PluginProbe ʕ •ᴥ•ʔ
My Sticky Bar – Floating Notification Bar & Sticky Header (formerly myStickymenu) / 2.5.4
My Sticky Bar – Floating Notification Bar & Sticky Header (formerly myStickymenu) v2.5.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 5 years ago iris-script.js 5 years ago mystickymenu-admin.js 4 years ago mystickymenu.js 5 years ago mystickymenu.min.js 5 years ago select2.min.js 5 years ago
mystickymenu-admin.js
421 lines
1 (function( $ ) {
2 "use strict";
3
4 jQuery(document).ready(function($){
5
6 $(document).on("click", ".updates-form button", function(){
7 var updateStatus = 0;
8 if($(this).hasClass("yes")) {
9 updateStatus = 1;
10 }
11 $(".updates-form 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 == 'redirect_to_url' ) {
109 $( '.mysticky-welcomebar-redirect' ).show();
110 $( '.mysticky-welcomebar-redirect-container' ).show();
111 } else {
112 $( '.mysticky-welcomebar-redirect' ).hide();
113 $( '.mysticky-welcomebar-redirect-container' ).hide();
114 }
115 if ( mysticky_welcomebar_action == 'poptin_popup' ) {
116 $( '.mysticky-welcomebar-poptin-popup' ).show();
117 } else {
118 $( '.mysticky-welcomebar-poptin-popup' ).hide();
119 }
120 if ( $('.mysticky-welcomebar-action option:selected').attr('data-href') !== '' && mysticky_welcomebar_action == 'thankyou_screen' ) {
121 window.open( $( '.mysticky-welcomebar-action option:selected' ).attr('data-href') , '_blank');
122 }
123 } );
124 //$( '#mysticky_welcomebar_expirydate' ).datepicker( );
125 //$( "#mysticky_welcomebar_expirydate" ).datepicker( "option", "dateFormat", 'mm/dd/yy' );
126
127 var page_option_content = "";
128 page_option_content = $( '.mysticky-welcomebar-page-options-html' ).html();
129 $( '.mysticky-welcomebar-page-options-html' ).remove();
130
131 $( '#create-rule' ).on( 'click', function(){
132 var append_html = page_option_content.replace(/__count__/g, '1', page_option_content);
133 $( '.mysticky-welcomebar-page-options' ).append( append_html );
134 $( '.mysticky-welcomebar-page-options' ).show();
135 $( this ).parent().remove();
136 });
137 $( '.sticky-header-menu ul li a' ).on( 'click', function(){
138 if ( $( "#sticky-header-welcome-bar" ).is( ":visible" ) ) {
139 check_for_preview_pos();
140 }
141 } );
142 jQuery(window).on('scroll', function(){
143 if ( $( "#sticky-header-welcome-bar" ).is( ":visible" ) ) {
144 check_for_preview_pos();
145 }
146 });
147 /*Mysticky page target*/
148 var mysticky_total_page_option = 0;
149 var mysticky_page_option_content = "";
150 mysticky_total_page_option = $( '.mysticky-page-option' ).length;
151 mysticky_page_option_content = $( '.mysticky-page-options-html' ).html();
152 $( '.mysticky-page-options-html' ).remove();
153
154 $( '#mysticky_create-rule' ).on( 'click', function(){
155
156 var append_html = mysticky_page_option_content.replace(/__count__/g, mysticky_total_page_option, mysticky_page_option_content);
157 mysticky_total_page_option++;
158 $( '.mysticky-page-options' ).append( append_html );
159 $( '.mysticky-page-options .mysticky-page-option' ).removeClass( 'last' );
160 $( '.mysticky-page-options .mysticky-page-option:last' ).addClass( 'last' );
161
162 if( $( '.mysticky-page-option .myStickymenu-upgrade' ).length > 0 ) {
163 $( this ).remove();
164 }
165 });
166 $( document ).on( 'click', '.mysticky-remove-rule', function() {
167 $( this ).closest( '.mysticky-page-option' ).remove();
168 $( '.mysticky-page-options .mysticky-page-option' ).removeClass( 'last' );
169 $( '.mysticky-page-options .mysticky-page-option:last' ).addClass( 'last' );
170 });
171 $( document ).on( 'change', '.mysticky-url-options', function() {
172 var current_val = jQuery( this ).val();
173 var mysticky_welcomebar_siteURL = jQuery( '#mysticky_welcomebar_site_url' ).val();
174 var mysticky_welcomebar_newURL = mysticky_welcomebar_siteURL;
175 if( current_val == 'page_has_url' ) {
176 mysticky_welcomebar_newURL = mysticky_welcomebar_siteURL;
177 } else if( current_val == 'page_contains' ) {
178 mysticky_welcomebar_newURL = mysticky_welcomebar_siteURL + '%s%';
179 } else if( current_val == 'page_start_with' ) {
180 mysticky_welcomebar_newURL = mysticky_welcomebar_siteURL + 's%';
181 } else if( current_val == 'page_end_with' ) {
182 mysticky_welcomebar_newURL = mysticky_welcomebar_siteURL + '%s';
183 }
184 $( this ).closest( '.url-content' ).find( '.mysticky-welcomebar-url' ).text( mysticky_welcomebar_newURL );
185 });
186 /* welcome bar live preview */
187 /* Apply Wp Color Picker */
188 var myOptions = {
189 change: function(event, ui){
190 var color_id = $(this).attr('id');
191 var slug = $(this).data('slug');
192
193 var color_code = ui.color.toString();
194 if ( color_id === 'mysticky_welcomebar_bgcolor'){
195 $('.mysticky-welcomebar-fixed').css('background-color', color_code );
196 }
197 if ( color_id === 'mysticky_welcomebar_bgtxtcolor'){
198 $('.mysticky-welcomebar-fixed .mysticky-welcomebar-content p').css('color', color_code );
199 }
200 if ( color_id === 'mysticky_welcomebar_btncolor'){
201 $('.mysticky-welcomebar-btn a').css('background-color', color_code );
202 }
203 if ( color_id === 'mysticky_welcomebar_btntxtcolor'){
204 $('.mysticky-welcomebar-btn a').css('color', color_code );
205 }
206 }
207 };
208 $('.mysticky-welcomebar-setting-wrap .my-color-field').wpColorPicker(myOptions);
209
210 $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_x_desktop]"]' ).on( 'change', function(){
211 if( $( this ).prop( "checked" ) == true ) {
212 $( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-showx-desktop' );
213 } else {
214 $( '.mysticky-welcomebar-fixed' ).removeClass( 'mysticky-welcomebar-showx-desktop' );
215 }
216 } );
217 $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_x_mobile]"]' ).on( 'change', function(){
218 if( $( this ).prop( "checked" ) == true ) {
219 $( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-showx-mobile' );
220 } else {
221 $( '.mysticky-welcomebar-fixed' ).removeClass( 'mysticky-welcomebar-showx-mobile' );
222 }
223 } );
224
225 $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_btn_desktop]"]' ).on( 'change', function(){
226 if( $( this ).prop( "checked" ) == true ) {
227 $( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-btn-desktop' );
228 } else {
229 $( '.mysticky-welcomebar-fixed' ).removeClass( 'mysticky-welcomebar-btn-desktop' );
230 }
231
232 if( $( this ).prop( "checked" ) == false && $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_btn_mobile]"]' ).prop( "checked" ) == false ) {
233 $( ".mysticky_welcomebar_disable, .mysticky_welcomebar_btn_color button.wp-color-result" ).css({
234 'pointer-events': 'none',
235 'opacity': '0.5'
236 });
237 } else {
238 $( ".mysticky_welcomebar_disable, .mysticky_welcomebar_btn_color button.wp-color-result" ).css({
239 'pointer-events': '',
240 'opacity': ''
241 });
242 }
243 } );
244 $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_btn_mobile]"]' ).on( 'change', function(){
245 if( $( this ).prop( "checked" ) == true ) {
246 $( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-btn-mobile' );
247 } else {
248 $( '.mysticky-welcomebar-fixed' ).removeClass( 'mysticky-welcomebar-btn-mobile' );
249 }
250
251 if( $( this ).prop( "checked" ) == false && $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_btn_desktop]"]' ).prop( "checked" ) == false ) {
252 $( ".mysticky_welcomebar_disable, .mysticky_welcomebar_btn_color button.wp-color-result" ).css({
253 'pointer-events': 'none',
254 'opacity': '0.5'
255 });
256 } else {
257 $( ".mysticky_welcomebar_disable, .mysticky_welcomebar_btn_color button.wp-color-result" ).css({
258 'pointer-events': '',
259 'opacity': ''
260 });
261 }
262 } );
263 if( $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_btn_desktop]"]' ).prop( "checked" ) == false && $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_btn_mobile]"]' ).prop( "checked" ) == false ) {
264 $( ".mysticky_welcomebar_disable, .mysticky_welcomebar_btn_color button.wp-color-result" ).css({
265 'pointer-events': 'none',
266 'opacity': '0.5'
267 });
268 } else {
269 $( ".mysticky_welcomebar_disable, .mysticky_welcomebar_btn_color button.wp-color-result" ).css({
270 'pointer-events': '',
271 'opacity': ''
272 });
273 }
274
275 $( 'select[name="mysticky_option_welcomebar[mysticky_welcomebar_font]"]' ).on( 'change', function(){
276 var myfixed_font_val = $( this ).val();
277 $( '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">' );
278 $( '.mysticky-welcomebar-fixed' ).css( 'font-family', myfixed_font_val );
279 } );
280
281 $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_fontsize]"]' ).on( 'keyup click', function(){
282 var mysticky_welcomebar_fontsize_val = $( this ).val();
283 $( '.mysticky-welcomebar-fixed p' ).css( 'font-size', mysticky_welcomebar_fontsize_val + 'px' );
284 $( '.mysticky-welcomebar-btn a' ).css( 'font-size', mysticky_welcomebar_fontsize_val + 'px' );
285 } );
286
287 $( '#wp-mysticky_bar_text-wrap .wp-editor-tabs button' ).on( 'click', function(){
288 if ( $("#wp-mysticky_bar_text-wrap").hasClass("tmce-active") ){
289
290 }
291 } );
292
293 $( document ).on( 'click', '#qt_mysticky_bar_text_toolbar .ed_button', function(){
294 $( 'textarea[name="mysticky_option_welcomebar[mysticky_welcomebar_bar_text]"]' ).trigger( 'change keyup click' );
295 } );
296
297 $( 'textarea[name="mysticky_option_welcomebar[mysticky_welcomebar_bar_text]"]' ).on( 'change keyup click', function(e){
298 var mysticky_bar_text_val = $( this ).val().replace(/(?:\r\n|\r|\n)/g, '<br />');
299 $( '.mysticky-welcomebar-content' ).html( "<p>" + mysticky_bar_text_val + "</p>");
300 } );
301
302 $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_btn_text]"]' ).on( 'keyup', function(){
303 var mysticky_btn_text_val = $( this ).val();
304
305 $( '.mysticky-welcomebar-btn a' ).text( mysticky_btn_text_val );
306 } );
307
308 /* DATE: 11-12-2019 start */
309 $( 'select[name="mysticky_option_welcomebar[mysticky_welcomebar_attentionselect]"]' ).on( 'change', function(){
310 $(".mysticky-welcomebar-fixed").removeClass (function (index, className) {
311 return (className.match (/(^|\s)mysticky-welcomebar-attention-\S+/g) || []).join(' ');
312 });
313 $( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-attention-' + $(this).val() );
314
315 } );
316 /* DATE: 11-12-2019 End */
317 $("#myStickymenu-entry-effect").on( 'change', function() {
318 $(".mysticky-welcomebar-preview-screen .mysticky-welcomebar-fixed").removeClass('entry-effect');
319 $(".mysticky-welcomebar-fixed").removeClass (function (index, className) {
320 return (className.match (/(^|\s)mysticky-welcomebar-entry-effect-\S+/g) || []).join(' ');
321 });
322 $( '.mysticky-welcomebar-preview-screen .mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-entry-effect-' + $(this).val() );
323 setTimeout( function(){
324 $(".mysticky-welcomebar-preview-screen .mysticky-welcomebar-fixed").addClass('entry-effect');
325 }, 1000 );
326
327 });
328 $( '.mysticky-welcomebar-fixed' ).addClass( 'entry-effect' );
329
330 $( '.mysticky-welcomebar-submit input#submit' ).on( 'click', function(e){
331 var welcomebar_action = $('.mysticky-welcomebar-action').find(":selected").val();
332 var poptin_popup_link = $('#mysticky_welcomebar_poptin_popup_link').val().toLowerCase();
333 var welcome_save_anyway = $('#welcome_save_anyway').val();
334 console.log(poptin_popup_link);
335 if ( welcomebar_action == 'poptin_popup' && welcome_save_anyway == '' && (poptin_popup_link == '' || poptin_popup_link.indexOf('popt.in') == '-1' ) ) {
336 e.preventDefault();
337 $( "#mysticky-welcomebar-poptin-popup-confirm" ).dialog({
338 resizable: false,
339 modal: true,
340 draggable: false,
341 height: 'auto',
342 width: 500,
343 buttons: {
344 "Keep editing": {
345 click:function () {
346 $( this ).dialog('close');
347 $("body,html").animate({
348 scrollTop: $("#mysticky_welcomebar_poptin_popup_link").offset().top - 200
349 }, 500)
350 $('#mysticky_welcomebar_poptin_popup_link').focus();
351 $('#mysticky_welcomebar_poptin_popup_link').css( 'border', '1px solid #FF0000' );
352 },
353 text: 'Keep editing',
354 class: 'green-btn'
355 },
356 "Save anyway": function () {
357 $( 'input#welcome_save_anyway' ).val('1');
358 $( '.mysticky-welcomebar-submit input#submit' ).trigger('click');
359 $( this ).dialog( 'close' );
360 }
361 }
362 });
363 return false;
364 }
365
366 if ( $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_enable]"]' ).prop( 'checked' ) == false && $( 'input#save_welcome_bar' ).val() == '' ) {
367 e.preventDefault();
368 $( "#mysticky-welcomebar-save-confirm" ).dialog({
369 resizable: false,
370 modal: true,
371 draggable: false,
372 height: 'auto',
373 width: 600,
374 buttons: {
375 "Yes, show it on my site": {
376 click:function () {
377 $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_enable]"]' ).prop( 'checked', true );
378 $( '.mysticky-welcomebar-submit input#submit' ).trigger('click');
379 $( this ).dialog('close');
380 },
381 text: 'Yes, show it on my site',
382 class: 'green-btn'
383 },
384 "Just save and keep it off": function () {
385 $( 'input#save_welcome_bar' ).val('1');
386 $( '.mysticky-welcomebar-submit input#submit' ).trigger('click');
387 $( this ).dialog( 'close' );
388 }
389 }
390 });
391 }
392 //return false;
393 } );
394
395 });
396 $( window ).on('load', function(){
397 $( '.mysticky-welcomebar-url-options' ).each( function(){
398 $( this ).trigger( 'change' );
399 });
400 });
401 function check_for_preview_pos() {
402 var mysticky_welcomebar_form_pos = $( '#sticky-header-welcome-bar' ).offset().top;
403 if($(".show-on-apper").length && $(".mysticky-welcomebar-setting-right").length) {
404 var topPos = $(".show-on-apper").offset().top - $(window).scrollTop() - 700;
405 if (topPos < 0) {
406 topPos = Math.abs(topPos);
407 jQuery(".mysticky-welcomebar-setting-right").css("margin-top", ((-1)*topPos)+"px");
408 } else {
409 jQuery(".mysticky-welcomebar-setting-right").css("margin-top", "0");
410 }
411 }
412 if ( ( mysticky_welcomebar_form_pos + 32 ) < $(window).scrollTop() ) {
413 $( '.mysticky-welcomebar-setting-right' ).css( 'position', 'fixed' );
414 $( '.mysticky-welcomebar-setting-right' ).css( 'right', '70px' );
415 } else {
416 $( '.mysticky-welcomebar-setting-right' ).css( 'position', 'absolute' );
417 $( '.mysticky-welcomebar-setting-right' ).css( 'right', '50px' );
418 }
419 }
420
421 })(jQuery);