PluginProbe ʕ •ᴥ•ʔ
My Sticky Bar – Floating Notification Bar & Sticky Header (formerly myStickymenu) / 2.2.4
My Sticky Bar – Floating Notification Bar & Sticky Header (formerly myStickymenu) v2.2.4
2.9.1 2.9.0 2.8.9 2.8.8 trunk 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.8.1 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9 1.9.1 2.0 2.0.1 2.0.3 2.0.4 2.0.5 2.0.6 2.1 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3 2.3.1 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.3.8 2.3.9 2.4 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.5 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.5.9 2.6 2.6.1 2.6.2 2.6.3 2.6.4 2.6.5 2.6.6 2.6.7 2.6.8 2.6.9 2.7 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7
mystickymenu / js / mystickymenu-admin.js
mystickymenu / js Last commit date
detectmobilebrowser.js 7 years ago iris-script.js 6 years ago mystickymenu-admin.js 6 years ago mystickymenu.js 6 years ago mystickymenu.min.js 6 years ago
mystickymenu-admin.js
260 lines
1 (function( $ ) {
2 "use strict";
3
4 jQuery(document).ready(function($){
5
6 $(document).on("click", ".updates-content-buttons button", function(){
7 var updateStatus = 0;
8 if($(this).hasClass("yes")) {
9 updateStatus = 1;
10 }
11 $(".updates-content-buttons button").attr("disabled", true);
12 $.ajax({
13 url: ajaxurl,
14 data: "action=sticky_menu_update_status&status="+updateStatus+"&nonce="+$("#myStickymenu_update_nonce").val()+"&email="+$("#myStickymenu_update_email").val(),
15 type: 'post',
16 cache: false,
17 success: function(){
18 window.location.reload();
19 }
20 })
21 });
22
23 var handle = $( "#custom-handle" );
24 $( "#slider" ).slider({
25 create: function() {
26 handle.text( $( this ).slider( "value" ) );
27 handle.text( $('#myfixed_opacity').val() );
28 handle.css('left', $('#myfixed_opacity').val() + '%')
29 },
30 slide: function( event, ui ) {
31 $('#myfixed_opacity').val(ui.value);
32 handle.text( ui.value );
33 }
34 });
35 jQuery(
36 '<div class="pt_number"><div class="pt_numberbutton pt_numberup">+</div><div class="pt_numberbutton pt_numberdown">-</div></div>'
37 ).insertAfter("input.mysticky-number1");
38
39 jQuery(".mystickynumber1").each(function() {
40
41 var spinner = jQuery(this),
42 input = spinner.find('input[type="number"]'),
43 btnUp = spinner.find(".pt_numberup"),
44 btnDown = spinner.find(".pt_numberdown"),
45 min = input.attr("min"),
46 max = input.attr("max"),
47 valOfAmout = input.val(),
48 newVal = 0;
49
50 btnUp.on("click", function() {
51
52 var oldValue = parseFloat(input.val());
53
54 if (oldValue >= max) {
55 var newVal = oldValue;
56 } else {
57 var newVal = oldValue + 1;
58 }
59 spinner.find("input").val(newVal);
60 spinner.find("input").trigger("change");
61 console.log(newVal);
62 });
63 btnDown.on("click", function() {
64 var oldValue = parseFloat(input.val());
65 if (oldValue <= min) {
66 var newVal = oldValue;
67 } else {
68 var newVal = oldValue - 1;
69 }
70 spinner.find("input").val(newVal);
71 spinner.find("input").trigger("change");
72 });
73 });
74
75
76 $(".confirm").on( 'click', function() {
77 return window.confirm("Reset to default settings?");
78 });
79
80 var flag = 0;
81 $( "#mystickymenu-select option" ).each(function( i ) {
82
83 if ($('select#mystickymenu-select option:selected').val() !== '' ) {
84 flag = 1;
85 }
86 if( $('select#mystickymenu-select option:selected').val() == $(this).val() ){
87 $('#mysticky_class_selector').show();
88 }else {
89 $('#mysticky_class_selector').hide();
90 }
91 });
92 if ( flag === 0 ) {
93 $('#mysticky_class_selector').show();
94 $("select#mystickymenu-select option[value=custom]").attr('selected', 'selected');
95 }
96
97 $("#mystickymenu-select").on( 'change', function() {
98 if ($(this).val() == 'custom' ) {
99 $('#mysticky_class_selector').show();
100 }else {
101 $('#mysticky_class_selector').hide();
102 }
103
104 });
105 /*02-08-2019 welcom bar js*/
106 $( '.mysticky-welcomebar-action' ).on( 'change', function(){
107 var mysticky_welcomebar_action = $( this ).val();
108 if ( mysticky_welcomebar_action == 'close_bar' ) {
109 $( '.mysticky-welcomebar-redirect' ).hide();
110 } else {
111 $( '.mysticky-welcomebar-redirect' ).show();
112 }
113 } );
114 //$( '#mysticky_welcomebar_expirydate' ).datepicker( );
115 //$( "#mysticky_welcomebar_expirydate" ).datepicker( "option", "dateFormat", 'mm/dd/yy' );
116
117 var page_option_content = "";
118 page_option_content = $( '.mysticky-welcomebar-page-options-html' ).html();
119 $( '.mysticky-welcomebar-page-options-html' ).remove();
120
121 $( '#create-rule' ).on( 'click', function(){
122 var append_html = page_option_content.replace(/__count__/g, '1', page_option_content);
123 $( '.mysticky-welcomebar-page-options' ).append( append_html );
124 $( this ).remove();
125 });
126 $( '.sticky-header-menu ul li a' ).on( 'click', function(){
127 if ( $( "#sticky-header-welcome-bar" ).is( ":visible" ) ) {
128 check_for_preview_pos();
129 }
130 } );
131 jQuery(window).scroll(function(){
132 if ( $( "#sticky-header-welcome-bar" ).is( ":visible" ) ) {
133 check_for_preview_pos();
134 }
135 });
136 /* welcome bar live preview */
137 /* Apply Wp Color Picker */
138 var myOptions = {
139 change: function(event, ui){
140 var color_id = $(this).attr('id');
141 var slug = $(this).data('slug');
142
143 var color_code = ui.color.toString();
144 if ( color_id === 'mysticky_welcomebar_bgcolor'){
145 $('.mysticky-welcomebar-fixed').css('background-color', color_code );
146 }
147 if ( color_id === 'mysticky_welcomebar_bgtxtcolor'){
148 $('.mysticky-welcomebar-fixed .mysticky-welcomebar-content p').css('color', color_code );
149 }
150 if ( color_id === 'mysticky_welcomebar_btncolor'){
151 $('.mysticky-welcomebar-btn a').css('background-color', color_code );
152 }
153 if ( color_id === 'mysticky_welcomebar_btntxtcolor'){
154 $('.mysticky-welcomebar-btn a').css('color', color_code );
155 }
156 }
157 };
158 $('.mysticky-welcomebar-setting-wrap .my-color-field').wpColorPicker(myOptions);
159
160 $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_x_desktop]"]' ).on( 'change', function(){
161 if( $( this ).prop( "checked" ) == true ) {
162 $( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-showx-desktop' );
163 } else {
164 $( '.mysticky-welcomebar-fixed' ).removeClass( 'mysticky-welcomebar-showx-desktop' );
165 }
166 } );
167 $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_x_mobile]"]' ).on( 'change', function(){
168 if( $( this ).prop( "checked" ) == true ) {
169 $( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-showx-mobile' );
170 } else {
171 $( '.mysticky-welcomebar-fixed' ).removeClass( 'mysticky-welcomebar-showx-mobile' );
172 }
173 } );
174
175 $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_btn_desktop]"]' ).on( 'change', function(){
176 if( $( this ).prop( "checked" ) == true ) {
177 $( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-btn-desktop' );
178 } else {
179 $( '.mysticky-welcomebar-fixed' ).removeClass( 'mysticky-welcomebar-btn-desktop' );
180 }
181 } );
182 $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_btn_mobile]"]' ).on( 'change', function(){
183 if( $( this ).prop( "checked" ) == true ) {
184 $( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-btn-mobile' );
185 } else {
186 $( '.mysticky-welcomebar-fixed' ).removeClass( 'mysticky-welcomebar-btn-mobile' );
187 }
188 } );
189
190 $( 'select[name="mysticky_option_welcomebar[mysticky_welcomebar_font]"]' ).on( 'change', function(){
191 var myfixed_font_val = $( this ).val();
192 $( 'head' ).append( '<link href="https://fonts.googleapis.com/css?family='+ myfixed_font_val +':400,600,700" rel="stylesheet" type="text/css" class="sfba-google-font">' );
193 $( '.mysticky-welcomebar-fixed' ).css( 'font-family', myfixed_font_val );
194 } );
195
196 $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_fontsize]"]' ).on( 'keyup click', function(){
197 var mysticky_welcomebar_fontsize_val = $( this ).val();
198 $( '.mysticky-welcomebar-fixed p' ).css( 'font-size', mysticky_welcomebar_fontsize_val + 'px' );
199 $( '.mysticky-welcomebar-btn a' ).css( 'font-size', mysticky_welcomebar_fontsize_val + 'px' );
200 } );
201
202 $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_bar_text]"]' ).on( 'keyup', function(){
203 var mysticky_bar_text_val = $( this ).val();
204 $( '.mysticky-welcomebar-content p' ).text( mysticky_bar_text_val );
205 } );
206
207 $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_btn_text]"]' ).on( 'keyup', function(){
208 var mysticky_btn_text_val = $( this ).val();
209 $( '.mysticky-welcomebar-btn a' ).text( mysticky_btn_text_val );
210 } );
211
212 $( '.mysticky-welcomebar-submit input#submit' ).on( 'click', function(e){
213 if ( $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_enable]"]' ).prop( 'checked' ) == false && $( 'input#save_welcome_bar' ).val() == '' ) {
214 e.preventDefault();
215 $( "#mysticky-welcomebar-save-confirm" ).dialog({
216 resizable: false,
217 modal: true,
218 draggable: false,
219 height: 'auto',
220 width: 600,
221 buttons: {
222 "Yes, show it on my site": {
223 click:function () {
224 $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_enable]"]' ).prop( 'checked', true );
225 $( '.mysticky-welcomebar-submit input#submit' ).trigger('click');
226 $( this ).dialog('close');
227 },
228 text: 'Yes, show it on my site',
229 class: 'green-btn'
230 },
231 "Just save and keep it off": function () {
232 $( 'input#save_welcome_bar' ).val('1');
233 $( '.mysticky-welcomebar-submit input#submit' ).trigger('click');
234 $( this ).dialog( 'close' );
235 }
236 }
237 });
238 }
239 //return false;
240 } );
241
242 });
243 $( window ).load( function(){
244 $( '.mysticky-welcomebar-url-options' ).each( function(){
245 $( this ).trigger( 'change' );
246 });
247 });
248 function check_for_preview_pos() {
249 if($(".show-on-apper").length && $(".mysticky-welcomebar-setting-right").length) {
250 var topPos = $(".show-on-apper").offset().top - $(window).scrollTop() - 650;
251 if (topPos < 0) {
252 topPos = Math.abs(topPos);
253 jQuery(".mysticky-welcomebar-setting-right").css("margin-top", ((-1)*topPos)+"px");
254 } else {
255 jQuery(".mysticky-welcomebar-setting-right").css("margin-top", "0");
256 }
257 }
258 }
259
260 })(jQuery);