PluginProbe ʕ •ᴥ•ʔ
My Sticky Bar – Floating Notification Bar & Sticky Header (formerly myStickymenu) / 2.6.1
My Sticky Bar – Floating Notification Bar & Sticky Header (formerly myStickymenu) v2.6.1
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 4 years ago iris-script.js 4 years ago mystickymenu-admin.js 3 years ago mystickymenu.js 3 years ago mystickymenu.min.js 5 years ago select2.min.js 4 years ago
mystickymenu-admin.js
864 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: {
15 action: "sticky_menu_update_status",
16 status: updateStatus,
17 nonce: $("#myStickymenu_update_nonce").val(),
18 email: $("#myStickymenu_update_email").val()
19 },
20 type: 'post',
21 cache: false,
22 success: function(){
23 window.location.reload();
24 }
25 })
26 });
27
28 $(document).on("click", ".skip-dolatter", function(){
29 var updateStatus = 0;
30 $(".updates-form button").attr("disabled", true);
31 $.ajax({
32 url: ajaxurl,
33 data: {
34 action: "sticky_menu_update_status",
35 status: updateStatus,
36 nonce: $("#myStickymenu_update_nonce").val(),
37 email: $("#myStickymenu_update_email").val()
38 },
39 type: 'post',
40 cache: false,
41 success: function(){
42 window.location.reload();
43 }
44 })
45 });
46
47 var handle = $( "#custom-handle" );
48 $( "#slider" ).slider({
49 create: function() {
50 handle.text( $( this ).slider( "value" ) );
51 handle.text( $('#myfixed_opacity').val() );
52 handle.css('left', $('#myfixed_opacity').val() + '%')
53 },
54 slide: function( event, ui ) {
55 $('#myfixed_opacity').val(ui.value);
56 handle.text( ui.value );
57 }
58 });
59 jQuery(
60 '<div class="pt_number"><div class="pt_numberbutton pt_numberup">+</div><div class="pt_numberbutton pt_numberdown">-</div></div>'
61 ).insertAfter("input.mysticky-number1");
62
63 jQuery(".mystickynumber1").each(function() {
64
65 var spinner = jQuery(this),
66 input = spinner.find('input[type="number"]'),
67 btnUp = spinner.find(".pt_numberup"),
68 btnDown = spinner.find(".pt_numberdown"),
69 min = input.attr("min"),
70 max = input.attr("max"),
71 valOfAmout = input.val(),
72 newVal = 0;
73
74 btnUp.on("click", function() {
75
76 var oldValue = parseFloat(input.val());
77
78 if (oldValue >= max) {
79 var newVal = oldValue;
80 } else {
81 var newVal = oldValue + 1;
82 }
83 spinner.find("input").val(newVal);
84 spinner.find("input").trigger("change");
85 });
86 btnDown.on("click", function() {
87 var oldValue = parseFloat(input.val());
88 if (oldValue <= min) {
89 var newVal = oldValue;
90 } else {
91 var newVal = oldValue - 1;
92 }
93 spinner.find("input").val(newVal);
94 spinner.find("input").trigger("change");
95 });
96 });
97
98
99 $(".confirm").on( 'click', function() {
100 return window.confirm("Reset to default settings?");
101 });
102
103 var flag = 0;
104 $( "#mystickymenu-select option" ).each(function( i ) {
105
106 if ($('select#mystickymenu-select option:selected').val() !== '' ) {
107 flag = 1;
108 }
109 if( $('select#mystickymenu-select option:selected').val() == $(this).val() ){
110 $('#mysticky_class_selector').show();
111 }else {
112 $('#mysticky_class_selector').hide();
113 }
114 });
115 if ( flag === 0 ) {
116 $('#mysticky_class_selector').show();
117 $("select#mystickymenu-select option[value=custom]").attr('selected', 'selected');
118 }
119
120 $("#mystickymenu-select").on( 'change', function() {
121 if ($(this).val() == 'custom' ) {
122 $('#mysticky_class_selector').show();
123 }else {
124 $('#mysticky_class_selector').hide();
125 }
126
127 });
128 /*02-08-2019 welcom bar js*/
129
130 $( '.mysticky-welcomebar-action' ).on( 'change', function(){
131 var mysticky_welcomebar_action = $( this ).val();
132 if ( mysticky_welcomebar_action == 'redirect_to_url' ) {
133 $( '.mysticky-welcomebar-redirect' ).show();
134 $( '.mysticky-welcomebar-redirect-container' ).show();
135 } else {
136 $( '.mysticky-welcomebar-redirect' ).hide();
137 $( '.mysticky-welcomebar-redirect-container' ).hide();
138 }
139 if ( mysticky_welcomebar_action == 'poptin_popup' ) {
140 $( '.mysticky-welcomebar-poptin-popup' ).show();
141 } else {
142 $( '.mysticky-welcomebar-poptin-popup' ).hide();
143 }
144 if ( $('.mysticky-welcomebar-action option:selected').attr('data-href') !== '' && mysticky_welcomebar_action == 'thankyou_screen' ) {
145 window.open( $( '.mysticky-welcomebar-action option:selected' ).attr('data-href') , '_blank');
146 }
147 } );
148
149 var page_option_content = "";
150 page_option_content = $( '.mysticky-welcomebar-page-options-html' ).html();
151 $( '.mysticky-welcomebar-page-options-html' ).remove();
152
153 $( '#create-rule' ).on( 'click', function(){
154 var append_html = page_option_content.replace(/__count__/g, '1', page_option_content);
155 $( '.mysticky-welcomebar-page-options' ).append( append_html );
156 $( '.mysticky-welcomebar-page-options' ).show();
157 $( this ).parent().remove();
158 });
159 $( '.sticky-header-menu ul li a' ).on( 'click', function(){
160 if ( $( "#sticky-header-welcome-bar" ).is( ":visible" ) ) {
161 check_for_preview_pos();
162 }
163 } );
164 jQuery(window).on('scroll', function(){
165 if ( $( "#sticky-header-welcome-bar" ).is( ":visible" ) ) {
166 check_for_preview_pos();
167 }
168 });
169 /*Mysticky page target*/
170 var mysticky_total_page_option = 0;
171 var mysticky_page_option_content = "";
172 mysticky_total_page_option = $( '.mysticky-page-option' ).length;
173 mysticky_page_option_content = $( '.mysticky-page-options-html' ).html();
174 $( '.mysticky-page-options-html' ).remove();
175
176 $( '#mysticky_create-rule' ).on( 'click', function(){
177
178 var append_html = mysticky_page_option_content.replace(/__count__/g, mysticky_total_page_option, mysticky_page_option_content);
179 mysticky_total_page_option++;
180 $( '.mysticky-page-options' ).append( append_html );
181 $( '.mysticky-page-options .mysticky-page-option' ).removeClass( 'last' );
182 $( '.mysticky-page-options .mysticky-page-option:last' ).addClass( 'last' );
183
184 if( $( '.mysticky-page-option .myStickymenu-upgrade' ).length > 0 ) {
185 $( this ).remove();
186 }
187 });
188 $( document ).on( 'click', '.mysticky-remove-rule', function() {
189 $( this ).closest( '.mysticky-page-option' ).remove();
190 $( '.mysticky-page-options .mysticky-page-option' ).removeClass( 'last' );
191 $( '.mysticky-page-options .mysticky-page-option:last' ).addClass( 'last' );
192 });
193 $( document ).on( 'change', '.mysticky-url-options', function() {
194 var current_val = jQuery( this ).val();
195 var mysticky_welcomebar_siteURL = jQuery( '#mysticky_welcomebar_site_url' ).val();
196 var mysticky_welcomebar_newURL = mysticky_welcomebar_siteURL;
197 if( current_val == 'page_has_url' ) {
198 mysticky_welcomebar_newURL = mysticky_welcomebar_siteURL;
199 } else if( current_val == 'page_contains' ) {
200 mysticky_welcomebar_newURL = mysticky_welcomebar_siteURL + '%s%';
201 } else if( current_val == 'page_start_with' ) {
202 mysticky_welcomebar_newURL = mysticky_welcomebar_siteURL + 's%';
203 } else if( current_val == 'page_end_with' ) {
204 mysticky_welcomebar_newURL = mysticky_welcomebar_siteURL + '%s';
205 }
206 $( this ).closest( '.url-content' ).find( '.mysticky-welcomebar-url' ).text( mysticky_welcomebar_newURL );
207 });
208 /* welcome bar live preview */
209 /* Apply Wp Color Picker */
210 var myOptions = {
211 change: function(event, ui){
212 var color_id = $(this).attr('id');
213 var slug = $(this).data('slug');
214
215 var color_code = ui.color.toString();
216 if ( color_id === 'mysticky_welcomebar_bgcolor'){
217 $('.mysticky-welcomebar-fixed').css('background-color', color_code );
218 }
219 if ( color_id === 'mysticky_welcomebar_bgtxtcolor'){
220 $('.mysticky-welcomebar-fixed .mysticky-welcomebar-content p').css('color', color_code );
221 }
222 if ( color_id === 'mysticky_welcomebar_btncolor'){
223 $('.mysticky-welcomebar-btn a').css('background-color', color_code );
224 }
225 if ( color_id === 'mysticky_welcomebar_btntxtcolor'){
226 $('.mysticky-welcomebar-btn a').css('color', color_code );
227 }
228 if( color_id === 'mysticky_welcomebar_xcolor' ){
229 $(".mysticky-welcomebar-close").css('color',color_code);
230 }
231 }
232 };
233 $('.mysticky-welcomebar-setting-wrap .my-color-field').wpColorPicker(myOptions);
234
235 $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_x_desktop]"]' ).on( 'change', function(){
236 if( $( this ).prop( "checked" ) == true ) {
237 $( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-showx-desktop' );
238 } else {
239 $( '.mysticky-welcomebar-fixed' ).removeClass( 'mysticky-welcomebar-showx-desktop' );
240 }
241 } );
242 $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_x_mobile]"]' ).on( 'change', function(){
243 if( $( this ).prop( "checked" ) == true ) {
244 $( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-showx-mobile' );
245 } else {
246 $( '.mysticky-welcomebar-fixed' ).removeClass( 'mysticky-welcomebar-showx-mobile' );
247 }
248 } );
249
250 $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_btn_desktop]"]' ).on( 'change', function(){
251 if( $( this ).prop( "checked" ) == true ) {
252 $( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-btn-desktop' );
253 } else {
254 $( '.mysticky-welcomebar-fixed' ).removeClass( 'mysticky-welcomebar-btn-desktop' );
255 }
256
257 if( $( this ).prop( "checked" ) == false && $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_btn_mobile]"]' ).prop( "checked" ) == false ) {
258 $( ".mysticky_welcomebar_disable, .mysticky_welcomebar_btn_color button.wp-color-result" ).css({
259 'pointer-events': 'none',
260 'opacity': '0.5'
261 });
262 } else {
263 $( ".mysticky_welcomebar_disable, .mysticky_welcomebar_btn_color button.wp-color-result" ).css({
264 'pointer-events': '',
265 'opacity': ''
266 });
267 }
268 } );
269
270 $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_btn_mobile]"]' ).on( 'change', function(){
271 if( $( this ).prop( "checked" ) == true ) {
272 $( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-btn-mobile' );
273 } else {
274 $( '.mysticky-welcomebar-fixed' ).removeClass( 'mysticky-welcomebar-btn-mobile' );
275 }
276
277 if( $( this ).prop( "checked" ) == false && $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_btn_desktop]"]' ).prop( "checked" ) == false ) {
278 $( ".mysticky_welcomebar_disable, .mysticky_welcomebar_btn_color button.wp-color-result" ).css({
279 'pointer-events': 'none',
280 'opacity': '0.5'
281 });
282 } else {
283 $( ".mysticky_welcomebar_disable, .mysticky_welcomebar_btn_color button.wp-color-result" ).css({
284 'pointer-events': '',
285 'opacity': ''
286 });
287 }
288 } );
289 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 ) {
290 $( ".mysticky_welcomebar_disable, .mysticky_welcomebar_btn_color button.wp-color-result" ).css({
291 'pointer-events': 'none',
292 'opacity': '0.5'
293 });
294 } else {
295 $( ".mysticky_welcomebar_disable, .mysticky_welcomebar_btn_color button.wp-color-result" ).css({
296 'pointer-events': '',
297 'opacity': ''
298 });
299 }
300
301 $( 'select[name="mysticky_option_welcomebar[mysticky_welcomebar_font]"]' ).on( 'change', function(){
302 var myfixed_font_val = $( this ).val();
303 if( myfixed_font_val == 'System Stack'){
304 myfixed_font_val = '-apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';
305 }
306 $( '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">' );
307 $( '.mysticky-welcomebar-fixed' ).css( 'font-family', myfixed_font_val );
308 } );
309
310 $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_fontsize]"]' ).on( 'keyup click', function(){
311 var mysticky_welcomebar_fontsize_val = $( this ).val();
312 $( '.mysticky-welcomebar-fixed p' ).css( 'font-size', mysticky_welcomebar_fontsize_val + 'px' );
313 $( '.mysticky-welcomebar-btn a' ).css( 'font-size', mysticky_welcomebar_fontsize_val + 'px' );
314 } );
315
316 $( '#wp-mysticky_bar_text-wrap .wp-editor-tabs button' ).on( 'click', function(){
317 if ( $("#wp-mysticky_bar_text-wrap").hasClass("tmce-active") ){
318
319 }
320 } );
321
322 $( document ).on( 'click', '#qt_mysticky_bar_text_toolbar .ed_button', function(){
323 $( 'textarea[name="mysticky_option_welcomebar[mysticky_welcomebar_bar_text]"]' ).trigger( 'change keyup click' );
324 } );
325
326 $( 'textarea[name="mysticky_option_welcomebar[mysticky_welcomebar_bar_text]"]' ).on( 'change keyup click', function(e){
327 var mysticky_bar_text_val = $( this ).val().replace(/(?:\r\n|\r|\n)/g, '<br />');
328 $( '.mysticky-welcomebar-content' ).html( "<p>" + mysticky_bar_text_val + "</p>");
329 $('.mysticky-welcomebar-fixed .mysticky-welcomebar-content p').css('color', $('#mysticky_welcomebar_bgtxtcolor').val() );
330 $( '.mysticky-welcomebar-fixed p' ).css( 'font-size', $('#mysticky_welcomebar_fontsize').val() + 'px' );
331 } );
332
333 $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_btn_text]"]' ).on( 'keyup', function(){
334 var mysticky_btn_text_val = $( this ).val();
335 $( '.mysticky-welcomebar-btn a' ).text( mysticky_btn_text_val );
336 } );
337
338 /* DATE: 11-12-2019 start */
339 $( 'select[name="mysticky_option_welcomebar[mysticky_welcomebar_attentionselect]"]' ).on( 'change', function(){
340 $(".mysticky-welcomebar-fixed").removeClass (function (index, className) {
341 return (className.match (/(^|\s)mysticky-welcomebar-attention-\S+/g) || []).join(' ');
342 });
343 $( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-attention-' + $(this).val() );
344
345 } );
346 /* DATE: 11-12-2019 End */
347 $("#myStickymenu-entry-effect").on( 'change', function() {
348 $(".mysticky-welcomebar-preview-screen .mysticky-welcomebar-fixed").removeClass('entry-effect');
349 $(".mysticky-welcomebar-fixed").removeClass (function (index, className) {
350 return (className.match (/(^|\s)mysticky-welcomebar-entry-effect-\S+/g) || []).join(' ');
351 });
352 $( '.mysticky-welcomebar-preview-screen .mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-entry-effect-' + $(this).val() );
353 setTimeout( function(){
354 $(".mysticky-welcomebar-preview-screen .mysticky-welcomebar-fixed").addClass('entry-effect');
355 }, 1000 );
356
357 });
358 $( '.mysticky-welcomebar-fixed' ).addClass( 'entry-effect' );
359
360 });
361 $( window ).on('load', function(){
362 $( '.mysticky-welcomebar-url-options' ).each( function(){
363 $( this ).trigger( 'change' );
364 });
365 });
366
367
368 /* Preview section part maintain sticky using "check_for_preview_pos" function */
369
370 function check_for_preview_pos() {
371
372 var $window = $(window);
373 var windowsize = $window.width();
374 console.log("windowsize == " + windowsize)
375
376
377 var mysticky_welcomebar_form_pos = $( '#sticky-header-welcome-bar' ).offset().top;
378 if($(".show-on-apper").length && $(".mysticky-welcomebar-setting-right").length) {
379 var topPos = $(".show-on-apper").offset().top - $(window).scrollTop() - 750;
380 if (topPos < 0) {
381 topPos = Math.abs(topPos);
382 jQuery(".mysticky-welcomebar-setting-right").css("margin-top", ((-1)*topPos)+"px");
383 } else {
384 jQuery(".mysticky-welcomebar-setting-right").css("margin-top", "0");
385 }
386 }
387 var position_screen = (isRtl == 1 ) ? 'left' : 'right';
388
389 if ( ( mysticky_welcomebar_form_pos + 32 ) < $(window).scrollTop() ) {
390 $( '.mysticky-welcomebar-setting-right' ).css( 'position', 'fixed' );
391 $( '.mysticky-welcomebar-setting-right' ).css( position_screen, '70px' );
392
393 if ( windowsize < 1181 && windowsize > 768 && position_screen == 'right' ) {
394
395 $( '.mysticky-welcomebar-setting-right' ).css( position_screen, '30px' );
396
397 }else if ( windowsize <= 768 && position_screen == 'right' ) {
398 $( '.mysticky-welcomebar-setting-right' ).css( position_screen, '25px' );
399 }
400
401 if ( windowsize < 1181 && windowsize > 768 && position_screen == 'left') {
402 $( '.mysticky-welcomebar-setting-right' ).css( position_screen, '30px' );
403 }else if ( windowsize <= 768 && position_screen == 'left') {
404 $( '.mysticky-welcomebar-setting-right' ).css( position_screen, '25px' );
405 }
406 } else {
407 $( '.mysticky-welcomebar-setting-right' ).css( 'position', 'absolute' );
408 $( '.mysticky-welcomebar-setting-right' ).css( position_screen, '50px' );
409
410 if ( windowsize < 1181 && position_screen == 'right') {
411 $( '.mysticky-welcomebar-setting-right' ).css( position_screen, '10px' );
412 }
413
414 if ( windowsize < 1181 && position_screen == 'left') {
415 $( '.mysticky-welcomebar-setting-right' ).css( position_screen, '10px' );
416 }
417 }
418
419
420 }
421
422 jQuery(document).on("click",".mystickymenu-delete-widget",function(e){
423 e.preventDefault();
424
425 var widget_id = jQuery(this).data("widget-id");
426 jQuery("#widget-delete-dialog-"+widget_id).show();
427 jQuery("#mystickymenu-delete-popup-overlay-"+widget_id).show();
428 });
429
430 /* Mystickymenu: Dashbaord table delete button click action */
431
432 jQuery(document).on("click",".btn-delete",function(e){
433 e.preventDefault();
434 var delWidId = jQuery(this).data("id");
435 jQuery.ajax({
436 url: ajaxurl,
437 type:'post',
438 data: 'action=stickymenu_widget_delete&widget_id=' + delWidId + '&widget_delete=1&wpnonce=' + mystickymenu.ajax_nonce,
439 success: function( data ){
440 $( '#stickymenu-widget-' + delWidId ).remove();
441 setTimeout('location.reload()', 500);
442 },
443 });
444 });
445
446
447 jQuery(document).on("click",".btn-delete-cancel",function(e){
448 e.preventDefault();
449 var id = jQuery(this).data("id");
450 jQuery("#widget-delete-dialog-"+id).hide();
451 jQuery("#mystickymenu-delete-popup-overlay-"+id).hide();
452 });
453
454 /* Mystickymenu: Dashbaord table welcombar widget status change action */
455
456 jQuery(document).on("click",".mystickymenu-widget-enabled",function(){
457 var widget_id = $(this).data('id');
458 if(jQuery(this).prop("checked") != true){
459 jQuery('#widget-status-dialog-' + widget_id).show();
460 jQuery('#mystickymenu-status-popup-overlay-' + widget_id).show();
461 }else{
462 var widget_status = 1;
463 set_widget_status( widget_id, widget_status );
464 }
465 });
466
467 jQuery(document).on("click",".btn-turnoff-status",function(e){
468 e.preventDefault();
469 var widget_id = $(this).data('id');
470
471 if ( typeof widget_id !== "undefined") {
472 var widget_status = 0;
473 set_widget_status( widget_id, widget_status );
474 }
475
476 });
477
478
479 jQuery(document).on("click",".btn-nevermind-status",function(e){
480 e.preventDefault();
481 var widget_id = $(this).data('id');
482 if ( typeof widget_id !== "undefined") {
483 var widget_status = 1;
484 set_widget_status( widget_id, widget_status );
485 jQuery("#mystickymenu-widget-enabled-"+widget_id).prop('checked', true)
486 }
487
488 });
489
490 jQuery(document).on("click",".mystickymenupopup-overlay",function(e){
491 e.preventDefault();
492
493 if(jQuery(this).data("fromoverlay") == 'welcombar_delete'){
494 jQuery(this).hide();
495 var delId = jQuery(this).data('id');
496 jQuery('#widget-delete-dialog-'+delId).hide();
497 }
498 });
499
500 jQuery(document).on("click",".mystickymenupopup-widget-status-overlay",function(e){
501 e.preventDefault();
502 var widget_id = $(this).data('id');
503 var widget_status = 1;
504 set_widget_status( widget_id, widget_status );
505 jQuery("#mystickymenu-widget-enabled-"+widget_id).prop('checked', true);
506
507 });
508
509 function set_widget_status( widget_id, widget_status ) {
510 jQuery.ajax({
511 url: ajaxurl,
512 type:'post',
513 data: 'action=mystickymenu_widget_status&widget_id='+widget_id+'&widget_status=' + widget_status +'&wpnonce=' + mystickymenu.ajax_nonce,
514 success: function( data ){
515 $('#widget-status-dialog-' + widget_id).hide();
516 $('#mystickymenu-status-popup-overlay-' + widget_id).hide();
517 },
518 });
519 }
520
521 jQuery(document).on("click","#close-first-popup",function(){
522 jQuery('.first-widget-popup').hide();
523 jQuery('.mystickymenupopup-overlay').hide();
524 });
525
526 jQuery(document).on("click","#first_widget_overlay",function(){
527 jQuery('.first-widget-popup').hide();
528 jQuery(this).hide();
529 });
530
531
532
533 jQuery(document).on("click","#btn-config-disable",function(e){
534 e.preventDefault();
535 jQuery("#stickymenu_status_popupbox").show();
536 jQuery("#stickymenuconfig-overlay-popup").show();
537 });
538
539 jQuery(document).on("click","#stickymenuconfig-overlay-popup",function(){
540 jQuery("#stickymenu_status_popupbox").hide();
541 jQuery(this).hide();
542 });
543
544 jQuery(document).on("click","#stickymenu_status_turnoff",function(e){
545 e.preventDefault();
546 var stickymenu_status = 0;
547 set_stickymenu_status( stickymenu_status );
548 });
549
550 jQuery(document).on("click","#stickymenu_status_nevermind",function(e){
551 e.preventDefault();
552 jQuery("#stickymenu_status_popupbox").hide();
553 jQuery("#stickymenuconfig-overlay-popup").hide();
554 });
555
556 function set_stickymenu_status( stickymenu_status ){
557 jQuery.ajax({
558 url: ajaxurl,
559 type:'post',
560 data: 'action=stickymenu_status_update&stickymenu_status=' + stickymenu_status +'&wpnonce=' + mystickymenu.ajax_nonce,
561 success: function( data ){
562 location.reload();
563 },
564 });
565 }
566
567 jQuery(document).on("click",".close-button",function(){
568 if(jQuery(this).data("from") == 'welcome-bar-status'){
569 var id = jQuery(this).data("id");
570 jQuery("#widget-status-dialog-"+id).hide();
571 jQuery("#mystickymenu-status-popup-overlay-"+id).hide();
572 var widget_status = 1;
573 set_widget_status( id, widget_status );
574 jQuery("#mystickymenu-widget-enabled-"+id).prop('checked', true)
575
576 }else if( jQuery(this).data("from") == "stickymenu-status"){
577 jQuery("#stickymenu_status_popupbox").hide();
578 jQuery("#stickymenuconfig-overlay-popup").hide();
579
580 }else if( jQuery(this).data("from") == "stickymenu-confirm" ){
581 jQuery("#mysticky-sticky-save-confirm").hide();
582 jQuery("#stickymenu-option-overlay-popup").hide();
583 }else if( jQuery(this).data("from") == "welcombar-confirm" ){
584 jQuery("#welcomebar-save-confirm").hide();
585 jQuery("#welcombar-sbmtvalidation-overlay-popup").hide();
586 }else{
587 var id = jQuery(this).data("id");
588 jQuery("#widget-delete-dialog-"+id).hide();
589 jQuery("#mystickymenu-delete-popup-overlay-"+id).hide();
590 }
591 });
592
593
594 jQuery(document).on("click","#stickymenu-option-overlay-popup",function(){
595 $("#mysticky-sticky-save-confirm").hide();
596 $(this).hide();
597 });
598
599
600 jQuery(document).on("click","#welcombar-sbmtvalidation-overlay-popup",function(){
601 $("#welcomebar-save-confirm").hide();
602 $(this).hide();
603 });
604
605
606 jQuery(document).on("change","#mysticky-welcomebar-countdown-enabled",function(){
607 var url = jQuery(this).data("url");
608 jQuery(this).prop('checked',false);
609 window.open(url, '_blank');
610 });
611
612 jQuery(document).on("click",".btn-save-stickymenu" , function(event){
613 if ( $( '#mysticky-stickymenu-form-enabled' ).prop( 'checked' ) == false && $('#save_stickymenu').val() == "" ) {
614 event.preventDefault();
615 $("#mysticky-sticky-save-confirm").show();
616 $("#stickymenu-option-overlay-popup").show();
617
618 $('#stickymenu_status_ok').attr('data-clickfrom', 'save');
619 $('#stickymenu_status_dolater').attr('data-clickfrom', 'save');
620 }
621 });
622
623 jQuery(document).on("click",".save_view_dashboard" , function(event){
624 if ( $( '#mysticky-stickymenu-form-enabled' ).prop( 'checked' ) == false && $('#save_stickymenu').val() == "" ) {
625 event.preventDefault();
626 $("#mysticky-sticky-save-confirm").show();
627 $("#stickymenu-option-overlay-popup").show();
628
629 $('#stickymenu_status_ok').attr('data-clickfrom', 'dashboard');
630 $('#stickymenu_status_dolater').attr('data-clickfrom', 'dashboard');
631 }
632 });
633
634 jQuery(document).on("click","#stickymenu_status_ok",function(){
635 var clickFrom = $(this).data("clickfrom");
636 $('#save_stickymenu').val("1");
637 $( '#mysticky-stickymenu-form-enabled' ).prop( 'checked' , true )
638 $("#mysticky-sticky-save-confirm").hide();
639 $("#stickymenu-option-overlay-popup").hide();
640 if(clickFrom == 'dashboard'){
641 $('.save_view_dashboard').trigger("click");
642 }else{
643 $('.btn-save-stickymenu').trigger("click");
644 }
645 });
646
647 jQuery(document).on("click","#stickymenu_status_dolater",function(){
648 var clickFrom = $(this).data("clickfrom");
649 $('#save_stickymenu').val("1");
650 if(clickFrom == 'dashboard'){
651 $('.save_view_dashboard').trigger("click");
652 }else{
653 $('.btn-save-stickymenu').trigger("click");
654 }
655 });
656
657 jQuery(document).on( 'click','.welcombar_save', function(e){
658
659 if ( $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_enable]"]' ).prop( 'checked' ) == false && $( 'input#save_welcome_bar' ).val() == '' ) {
660 e.preventDefault();
661 $("#welcomebar-save-confirm").show();
662 $("#welcombar-sbmtvalidation-overlay-popup").show();
663 $("#welcombar_sbmtbtn_off").attr("data-clickfrom",'save_button');
664 $("#welcomebar_yes_sbmtbtn").attr("data-clickfrom",'save_button');
665 }
666 });
667
668
669 jQuery(document).on( 'click','.save_view_dashboard', function(e){
670
671 if ( $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_enable]"]' ).prop( 'checked' ) == false && $( 'input#save_welcome_bar' ).val() == '' ) {
672 e.preventDefault();
673 $("#welcomebar-save-confirm").show();
674 $("#welcombar-sbmtvalidation-overlay-popup").show();
675 $("#welcombar_sbmtbtn_off").attr("data-clickfrom",'save_dashboard_button');
676 $("#welcomebar_yes_sbmtbtn").attr("data-clickfrom",'save_dashboard_button');
677 }
678 });
679
680 jQuery(document).on("click","#welcomebar_yes_sbmtbtn",function(){
681
682 var clickFrom = $(this).data("clickfrom");
683
684 $("#welcomebar-save-confirm").hide();
685 $("#welcombar-sbmtvalidation-overlay-popup").hide();
686 $( 'input#welcome_save_anyway' ).val('1');
687 $( 'input#save_welcome_bar' ).val('1');
688 $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_enable]"]' ).prop( 'checked',true );
689 if(clickFrom == 'save_dashboard_button'){
690 $( '.mysticky-welcomebar-submit input.save_view_dashboard' ).trigger('click');
691 }else{
692 $( '.mysticky-welcomebar-submit input.welcombar_save' ).trigger('click');
693 }
694 });
695
696 jQuery(document).on("click","#welcombar_sbmtbtn_off",function(){
697 var clickFrom = $(this).data("clickfrom");
698
699 $("#welcomebar-save-confirm").hide();
700 $("#welcombar-sbmtvalidation-overlay-popup").hide();
701 $( 'input#welcome_save_anyway' ).val('1');
702 $( 'input#save_welcome_bar' ).val('1');
703
704 if(clickFrom == 'save_dashboard_button'){
705 $( '.mysticky-welcomebar-submit input.save_view_dashboard' ).trigger('click');
706 }else{
707 $( '.mysticky-welcomebar-submit input.welcombar_save' ).trigger('click');
708 }
709 });
710
711 jQuery(document).on("click","#mysticky-welcomebar-showcoupon-enabled",function(){
712 var url = jQuery(this).data("url");
713 jQuery(this).prop('checked',false);
714 window.open(url, '_blank');
715 });
716
717 jQuery(document).on("change","#mysticky-welcomebar-collectlead-enabled",function(){
718
719 var button_text = $(this).data("button-text");
720
721 if( $(this).prop("checked") == true ){
722
723 $(".timer-message").show();
724 $(".mysticky-collect-lead").show();
725 $(".welcomebar_height_content").hide();
726 $(".mysticky-welcomebar-preview-screen .mysticky-welcomebar-fixed .mysticky-welcomebar-content").css("width","90%");
727 $(".mysticky-welcomebar-lead-content").show();
728 $(".mysticky-welcomebar-btn a").text("Send me");
729 $("#mysticky_welcomebar_btn_text").val("Send me");
730 $(".mysticky-welcomebar-btn").addClass("collect-lead");
731 $(".height-setting").hide();
732 }else{
733
734 button_text = ( button_text == 'Send me' ) ? 'Got it!' : button_text;
735 $(".timer-message").hide();
736 $(".welcomebar_height_content").show();
737 $(".mysticky-collect-lead").hide();
738 $(".mysticky-welcomebar-preview-screen .mysticky-welcomebar-fixed .mysticky-welcomebar-content").css("width","65%");
739 $(".mysticky-welcomebar-lead-content").hide();
740 $(".mysticky-welcomebar-btn a").text(button_text);
741 $("#mysticky_welcomebar_btn_text").val(button_text);
742 $(".height-setting").show();
743 $(".mysticky-welcomebar-btn").removeClass("collect-lead");
744 }
745 });
746
747 jQuery(document).on("click","#send_lead_email_enable",function(){
748 var url = jQuery(this).data("url");
749 jQuery(this).prop('checked',false);
750 window.open(url, '_blank');
751 });
752
753
754 jQuery(document).on("keyup","#lead-name-placeholder,#lead-email-placeholder,#lead-phone-placeholder",function(e){
755 if( $(this).attr("id") == "lead-name-placeholder" ){
756 $(".preview-lead-name").attr("placeholder",$(this).val());
757 }else if( $(this).attr("id") == "lead-email-placeholder" ){
758 $(".preview-lead-email").attr("placeholder",$(this).val());
759 }else{
760 $(".preview-lead-phone").attr("placeholder",$(this).val());
761 }
762 });
763
764 jQuery(document).on("change","input[name='mysticky_option_welcomebar[mysticky_welcomebar_lead_input]']",function(){
765 if( $(this).val() == 'email_address' ){
766 $("#lead-email-content").show();
767 $("#lead-phone-content").hide();
768 $(".preview-lead-email").show();
769 $(".preview-lead-phone").hide();
770 }else{
771 $("#lead-email-content").hide();
772 $("#lead-phone-content").show();
773 $(".preview-lead-email").hide();
774 $(".preview-lead-phone").show();
775 }
776
777 });
778
779 /* Mystickymenu : Single delete contact lead data - Contact lead page */
780
781 jQuery(document).on("click",".mystickymenu-delete-entry",function(event){
782
783 var deleterowid = $( this ).attr( "data-delete" );
784 var confirm_delete = window.confirm("Are you sure you want to delete Record with ID# "+deleterowid);
785 if (confirm_delete == true) {
786 jQuery.ajax({
787 type: 'POST',
788 url: ajaxurl,
789 data: {"action": "mystickymenu_delete_contact_lead","ID": deleterowid, delete_nonce: jQuery("#delete_nonce").val(),"wpnonce": mystickymenu.ajax_nonce},
790 success: function(data){
791 location.href = window.location.href;
792 },
793 error: function(XMLHttpRequest, textStatus, errorThrown) {
794 alert("Status: " + textStatus); alert("Error: " + errorThrown);
795 }
796 });
797 }
798
799 });
800
801 /* Mystickymenu : Bulk delete all contact lead data - Contact lead page */
802
803 jQuery(document).on("click","#mystickymenu_delete_all_leads", function(){
804 var confirm_delete = window.confirm("Are you sure you want to delete all Record from the database?");
805 if (confirm_delete == true) {
806 jQuery.ajax({
807 type: 'POST',
808 url: ajaxurl,
809 data: {"action": "mystickymenu_delete_contact_lead", 'all_leads': 1 , delete_nonce: jQuery("#delete_nonce").val(),"wpnonce": mystickymenu.ajax_nonce},
810 success: function(data){
811 location.href = window.location.href;
812 },
813 error: function(XMLHttpRequest, textStatus, errorThrown) {
814 alert("Status: " + textStatus); alert("Error: " + errorThrown);
815 }
816 });
817 }
818 return false;
819 });
820
821 /* Mystickymenu : Bulk do action trigger in contact lead table */
822
823 jQuery(document).on('click','#doaction',function(e){
824 e.preventDefault();
825 var bulks = [];
826 jQuery( '.cb-select-blk' ).each( function(){
827 if (this.checked) {
828 bulks.push( jQuery(this).val() );
829 }
830 } );
831
832 jQuery.ajax({
833 type: 'POST',
834 url: ajaxurl,
835 data: {"action": "my_sticky_menu_bulks","bulks": bulks,"wpnonce": mystickymenu.ajax_nonce},
836 success: function(data){
837 location.href = window.location.href;
838 },
839 error: function(XMLHttpRequest, textStatus, errorThrown) {
840 alert("Status: " + textStatus); alert("Error: " + errorThrown);
841 }
842 });
843 } );
844
845 jQuery(document).on( 'change','#mysticky-welcomebar-close-automatically-enabled', function(){
846 $(this).prop("checked",false);
847 var url = $(this).data("url");
848 window.open(url, '_blank');
849 });
850
851 jQuery(document).on("click",".save_change",function(){
852 $( '.mysticky-welcomebar-submit input.welcombar_save' ).trigger('click');
853 });
854
855 jQuery(document).on( 'change','#mysticky_welcomebar_show_success_message', function(){
856 if( $( this ).prop( "checked" ) == true ) {
857 $('#mysticky-welcomebar-thankyou-wrap').show();
858 } else {
859 $('#mysticky-welcomebar-thankyou-wrap').hide();
860 }
861 });
862
863 })(jQuery);
864