PluginProbe ʕ •ᴥ•ʔ
My Sticky Bar – Floating Notification Bar & Sticky Header (formerly myStickymenu) / 2.6
My Sticky Bar – Floating Notification Bar & Sticky Header (formerly myStickymenu) v2.6
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
875 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
335 $(".button-input-error").remove();
336 if ( $("#mysticky_welcomebar_btn_text").val().length > 8 ) {
337 $("#mysticky_welcomebar_btn_text").css("border","1px solid #FF424D");
338 $("#mysticky_welcomebar_btn_text").val($("#mysticky_welcomebar_btn_text").val().substr(0, $("#mysticky_welcomebar_btn_text").val().length - 1))
339
340 $( '<p class="button-input-error">max character limit is 8</p>' ).insertAfter( $("#mysticky_welcomebar_btn_text") );
341 return false;
342 }else{
343 $("#mysticky_welcomebar_btn_text").css("border","1px solid #DCE2E2");
344 }
345 var mysticky_btn_text_val = $( this ).val();
346 $( '.mysticky-welcomebar-btn a' ).text( mysticky_btn_text_val );
347 } );
348
349 /* DATE: 11-12-2019 start */
350 $( 'select[name="mysticky_option_welcomebar[mysticky_welcomebar_attentionselect]"]' ).on( 'change', function(){
351 $(".mysticky-welcomebar-fixed").removeClass (function (index, className) {
352 return (className.match (/(^|\s)mysticky-welcomebar-attention-\S+/g) || []).join(' ');
353 });
354 $( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-attention-' + $(this).val() );
355
356 } );
357 /* DATE: 11-12-2019 End */
358 $("#myStickymenu-entry-effect").on( 'change', function() {
359 $(".mysticky-welcomebar-preview-screen .mysticky-welcomebar-fixed").removeClass('entry-effect');
360 $(".mysticky-welcomebar-fixed").removeClass (function (index, className) {
361 return (className.match (/(^|\s)mysticky-welcomebar-entry-effect-\S+/g) || []).join(' ');
362 });
363 $( '.mysticky-welcomebar-preview-screen .mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-entry-effect-' + $(this).val() );
364 setTimeout( function(){
365 $(".mysticky-welcomebar-preview-screen .mysticky-welcomebar-fixed").addClass('entry-effect');
366 }, 1000 );
367
368 });
369 $( '.mysticky-welcomebar-fixed' ).addClass( 'entry-effect' );
370
371 });
372 $( window ).on('load', function(){
373 $( '.mysticky-welcomebar-url-options' ).each( function(){
374 $( this ).trigger( 'change' );
375 });
376 });
377
378
379 /* Preview section part maintain sticky using "check_for_preview_pos" function */
380
381 function check_for_preview_pos() {
382
383 var $window = $(window);
384 var windowsize = $window.width();
385 console.log("windowsize == " + windowsize)
386
387
388 var mysticky_welcomebar_form_pos = $( '#sticky-header-welcome-bar' ).offset().top;
389 if($(".show-on-apper").length && $(".mysticky-welcomebar-setting-right").length) {
390 var topPos = $(".show-on-apper").offset().top - $(window).scrollTop() - 750;
391 if (topPos < 0) {
392 topPos = Math.abs(topPos);
393 jQuery(".mysticky-welcomebar-setting-right").css("margin-top", ((-1)*topPos)+"px");
394 } else {
395 jQuery(".mysticky-welcomebar-setting-right").css("margin-top", "0");
396 }
397 }
398 var position_screen = (isRtl == 1 ) ? 'left' : 'right';
399
400 if ( ( mysticky_welcomebar_form_pos + 32 ) < $(window).scrollTop() ) {
401 $( '.mysticky-welcomebar-setting-right' ).css( 'position', 'fixed' );
402 $( '.mysticky-welcomebar-setting-right' ).css( position_screen, '70px' );
403
404 if ( windowsize < 1181 && windowsize > 768 && position_screen == 'right' ) {
405
406 $( '.mysticky-welcomebar-setting-right' ).css( position_screen, '30px' );
407
408 }else if ( windowsize <= 768 && position_screen == 'right' ) {
409 $( '.mysticky-welcomebar-setting-right' ).css( position_screen, '25px' );
410 }
411
412 if ( windowsize < 1181 && windowsize > 768 && position_screen == 'left') {
413 $( '.mysticky-welcomebar-setting-right' ).css( position_screen, '30px' );
414 }else if ( windowsize <= 768 && position_screen == 'left') {
415 $( '.mysticky-welcomebar-setting-right' ).css( position_screen, '25px' );
416 }
417 } else {
418 $( '.mysticky-welcomebar-setting-right' ).css( 'position', 'absolute' );
419 $( '.mysticky-welcomebar-setting-right' ).css( position_screen, '50px' );
420
421 if ( windowsize < 1181 && position_screen == 'right') {
422 $( '.mysticky-welcomebar-setting-right' ).css( position_screen, '10px' );
423 }
424
425 if ( windowsize < 1181 && position_screen == 'left') {
426 $( '.mysticky-welcomebar-setting-right' ).css( position_screen, '10px' );
427 }
428 }
429
430
431 }
432
433 jQuery(document).on("click",".mystickymenu-delete-widget",function(e){
434 e.preventDefault();
435
436 var widget_id = jQuery(this).data("widget-id");
437 jQuery("#widget-delete-dialog-"+widget_id).show();
438 jQuery("#mystickymenu-delete-popup-overlay-"+widget_id).show();
439 });
440
441 /* Mystickymenu: Dashbaord table delete button click action */
442
443 jQuery(document).on("click",".btn-delete",function(e){
444 e.preventDefault();
445 var delWidId = jQuery(this).data("id");
446 jQuery.ajax({
447 url: ajaxurl,
448 type:'post',
449 data: 'action=stickymenu_widget_delete&widget_id=' + delWidId + '&widget_delete=1&wpnonce=' + mystickymenu.ajax_nonce,
450 success: function( data ){
451 $( '#stickymenu-widget-' + delWidId ).remove();
452 setTimeout('location.reload()', 500);
453 },
454 });
455 });
456
457
458 jQuery(document).on("click",".btn-delete-cancel",function(e){
459 e.preventDefault();
460 var id = jQuery(this).data("id");
461 jQuery("#widget-delete-dialog-"+id).hide();
462 jQuery("#mystickymenu-delete-popup-overlay-"+id).hide();
463 });
464
465 /* Mystickymenu: Dashbaord table welcombar widget status change action */
466
467 jQuery(document).on("click",".mystickymenu-widget-enabled",function(){
468 var widget_id = $(this).data('id');
469 if(jQuery(this).prop("checked") != true){
470 jQuery('#widget-status-dialog-' + widget_id).show();
471 jQuery('#mystickymenu-status-popup-overlay-' + widget_id).show();
472 }else{
473 var widget_status = 1;
474 set_widget_status( widget_id, widget_status );
475 }
476 });
477
478 jQuery(document).on("click",".btn-turnoff-status",function(e){
479 e.preventDefault();
480 var widget_id = $(this).data('id');
481
482 if ( typeof widget_id !== "undefined") {
483 var widget_status = 0;
484 set_widget_status( widget_id, widget_status );
485 }
486
487 });
488
489
490 jQuery(document).on("click",".btn-nevermind-status",function(e){
491 e.preventDefault();
492 var widget_id = $(this).data('id');
493 if ( typeof widget_id !== "undefined") {
494 var widget_status = 1;
495 set_widget_status( widget_id, widget_status );
496 jQuery("#mystickymenu-widget-enabled-"+widget_id).prop('checked', true)
497 }
498
499 });
500
501 jQuery(document).on("click",".mystickymenupopup-overlay",function(e){
502 e.preventDefault();
503
504 if(jQuery(this).data("fromoverlay") == 'welcombar_delete'){
505 jQuery(this).hide();
506 var delId = jQuery(this).data('id');
507 jQuery('#widget-delete-dialog-'+delId).hide();
508 }
509 });
510
511 jQuery(document).on("click",".mystickymenupopup-widget-status-overlay",function(e){
512 e.preventDefault();
513 var widget_id = $(this).data('id');
514 var widget_status = 1;
515 set_widget_status( widget_id, widget_status );
516 jQuery("#mystickymenu-widget-enabled-"+widget_id).prop('checked', true);
517
518 });
519
520 function set_widget_status( widget_id, widget_status ) {
521 jQuery.ajax({
522 url: ajaxurl,
523 type:'post',
524 data: 'action=mystickymenu_widget_status&widget_id='+widget_id+'&widget_status=' + widget_status +'&wpnonce=' + mystickymenu.ajax_nonce,
525 success: function( data ){
526 $('#widget-status-dialog-' + widget_id).hide();
527 $('#mystickymenu-status-popup-overlay-' + widget_id).hide();
528 },
529 });
530 }
531
532 jQuery(document).on("click","#close-first-popup",function(){
533 jQuery('.first-widget-popup').hide();
534 jQuery('.mystickymenupopup-overlay').hide();
535 });
536
537 jQuery(document).on("click","#first_widget_overlay",function(){
538 jQuery('.first-widget-popup').hide();
539 jQuery(this).hide();
540 });
541
542
543
544 jQuery(document).on("click","#btn-config-disable",function(e){
545 e.preventDefault();
546 jQuery("#stickymenu_status_popupbox").show();
547 jQuery("#stickymenuconfig-overlay-popup").show();
548 });
549
550 jQuery(document).on("click","#stickymenuconfig-overlay-popup",function(){
551 jQuery("#stickymenu_status_popupbox").hide();
552 jQuery(this).hide();
553 });
554
555 jQuery(document).on("click","#stickymenu_status_turnoff",function(e){
556 e.preventDefault();
557 var stickymenu_status = 0;
558 set_stickymenu_status( stickymenu_status );
559 });
560
561 jQuery(document).on("click","#stickymenu_status_nevermind",function(e){
562 e.preventDefault();
563 jQuery("#stickymenu_status_popupbox").hide();
564 jQuery("#stickymenuconfig-overlay-popup").hide();
565 });
566
567 function set_stickymenu_status( stickymenu_status ){
568 jQuery.ajax({
569 url: ajaxurl,
570 type:'post',
571 data: 'action=stickymenu_status_update&stickymenu_status=' + stickymenu_status +'&wpnonce=' + mystickymenu.ajax_nonce,
572 success: function( data ){
573 location.reload();
574 },
575 });
576 }
577
578 jQuery(document).on("click",".close-button",function(){
579 if(jQuery(this).data("from") == 'welcome-bar-status'){
580 var id = jQuery(this).data("id");
581 jQuery("#widget-status-dialog-"+id).hide();
582 jQuery("#mystickymenu-status-popup-overlay-"+id).hide();
583 var widget_status = 1;
584 set_widget_status( id, widget_status );
585 jQuery("#mystickymenu-widget-enabled-"+id).prop('checked', true)
586
587 }else if( jQuery(this).data("from") == "stickymenu-status"){
588 jQuery("#stickymenu_status_popupbox").hide();
589 jQuery("#stickymenuconfig-overlay-popup").hide();
590
591 }else if( jQuery(this).data("from") == "stickymenu-confirm" ){
592 jQuery("#mysticky-sticky-save-confirm").hide();
593 jQuery("#stickymenu-option-overlay-popup").hide();
594 }else if( jQuery(this).data("from") == "welcombar-confirm" ){
595 jQuery("#welcomebar-save-confirm").hide();
596 jQuery("#welcombar-sbmtvalidation-overlay-popup").hide();
597 }else{
598 var id = jQuery(this).data("id");
599 jQuery("#widget-delete-dialog-"+id).hide();
600 jQuery("#mystickymenu-delete-popup-overlay-"+id).hide();
601 }
602 });
603
604
605 jQuery(document).on("click","#stickymenu-option-overlay-popup",function(){
606 $("#mysticky-sticky-save-confirm").hide();
607 $(this).hide();
608 });
609
610
611 jQuery(document).on("click","#welcombar-sbmtvalidation-overlay-popup",function(){
612 $("#welcomebar-save-confirm").hide();
613 $(this).hide();
614 });
615
616
617 jQuery(document).on("change","#mysticky-welcomebar-countdown-enabled",function(){
618 var url = jQuery(this).data("url");
619 jQuery(this).prop('checked',false);
620 window.open(url, '_blank');
621 });
622
623 jQuery(document).on("click",".btn-save-stickymenu" , 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', 'save');
630 $('#stickymenu_status_dolater').attr('data-clickfrom', 'save');
631 }
632 });
633
634 jQuery(document).on("click",".save_view_dashboard" , function(event){
635 if ( $( '#mysticky-stickymenu-form-enabled' ).prop( 'checked' ) == false && $('#save_stickymenu').val() == "" ) {
636 event.preventDefault();
637 $("#mysticky-sticky-save-confirm").show();
638 $("#stickymenu-option-overlay-popup").show();
639
640 $('#stickymenu_status_ok').attr('data-clickfrom', 'dashboard');
641 $('#stickymenu_status_dolater').attr('data-clickfrom', 'dashboard');
642 }
643 });
644
645 jQuery(document).on("click","#stickymenu_status_ok",function(){
646 var clickFrom = $(this).data("clickfrom");
647 $('#save_stickymenu').val("1");
648 $( '#mysticky-stickymenu-form-enabled' ).prop( 'checked' , true )
649 $("#mysticky-sticky-save-confirm").hide();
650 $("#stickymenu-option-overlay-popup").hide();
651 if(clickFrom == 'dashboard'){
652 $('.save_view_dashboard').trigger("click");
653 }else{
654 $('.btn-save-stickymenu').trigger("click");
655 }
656 });
657
658 jQuery(document).on("click","#stickymenu_status_dolater",function(){
659 var clickFrom = $(this).data("clickfrom");
660 $('#save_stickymenu').val("1");
661 if(clickFrom == 'dashboard'){
662 $('.save_view_dashboard').trigger("click");
663 }else{
664 $('.btn-save-stickymenu').trigger("click");
665 }
666 });
667
668 jQuery(document).on( 'click','.welcombar_save', function(e){
669
670 if ( $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_enable]"]' ).prop( 'checked' ) == false && $( 'input#save_welcome_bar' ).val() == '' ) {
671 e.preventDefault();
672 $("#welcomebar-save-confirm").show();
673 $("#welcombar-sbmtvalidation-overlay-popup").show();
674 $("#welcombar_sbmtbtn_off").attr("data-clickfrom",'save_button');
675 $("#welcomebar_yes_sbmtbtn").attr("data-clickfrom",'save_button');
676 }
677 });
678
679
680 jQuery(document).on( 'click','.save_view_dashboard', function(e){
681
682 if ( $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_enable]"]' ).prop( 'checked' ) == false && $( 'input#save_welcome_bar' ).val() == '' ) {
683 e.preventDefault();
684 $("#welcomebar-save-confirm").show();
685 $("#welcombar-sbmtvalidation-overlay-popup").show();
686 $("#welcombar_sbmtbtn_off").attr("data-clickfrom",'save_dashboard_button');
687 $("#welcomebar_yes_sbmtbtn").attr("data-clickfrom",'save_dashboard_button');
688 }
689 });
690
691 jQuery(document).on("click","#welcomebar_yes_sbmtbtn",function(){
692
693 var clickFrom = $(this).data("clickfrom");
694
695 $("#welcomebar-save-confirm").hide();
696 $("#welcombar-sbmtvalidation-overlay-popup").hide();
697 $( 'input#welcome_save_anyway' ).val('1');
698 $( 'input#save_welcome_bar' ).val('1');
699 $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_enable]"]' ).prop( 'checked',true );
700 if(clickFrom == 'save_dashboard_button'){
701 $( '.mysticky-welcomebar-submit input.save_view_dashboard' ).trigger('click');
702 }else{
703 $( '.mysticky-welcomebar-submit input.welcombar_save' ).trigger('click');
704 }
705 });
706
707 jQuery(document).on("click","#welcombar_sbmtbtn_off",function(){
708 var clickFrom = $(this).data("clickfrom");
709
710 $("#welcomebar-save-confirm").hide();
711 $("#welcombar-sbmtvalidation-overlay-popup").hide();
712 $( 'input#welcome_save_anyway' ).val('1');
713 $( 'input#save_welcome_bar' ).val('1');
714
715 if(clickFrom == 'save_dashboard_button'){
716 $( '.mysticky-welcomebar-submit input.save_view_dashboard' ).trigger('click');
717 }else{
718 $( '.mysticky-welcomebar-submit input.welcombar_save' ).trigger('click');
719 }
720 });
721
722 jQuery(document).on("click","#mysticky-welcomebar-showcoupon-enabled",function(){
723 var url = jQuery(this).data("url");
724 jQuery(this).prop('checked',false);
725 window.open(url, '_blank');
726 });
727
728 jQuery(document).on("change","#mysticky-welcomebar-collectlead-enabled",function(){
729
730 var button_text = $(this).data("button-text");
731
732 if( $(this).prop("checked") == true ){
733
734 $(".timer-message").show();
735 $(".mysticky-collect-lead").show();
736 $(".welcomebar_height_content").hide();
737 $(".mysticky-welcomebar-preview-screen .mysticky-welcomebar-fixed .mysticky-welcomebar-content").css("width","90%");
738 $(".mysticky-welcomebar-lead-content").show();
739 $(".mysticky-welcomebar-btn a").text("Send me");
740 $("#mysticky_welcomebar_btn_text").val("Send me");
741 $(".mysticky-welcomebar-btn").addClass("collect-lead");
742 $(".height-setting").hide();
743 }else{
744
745 button_text = ( button_text == 'Send me' ) ? 'Got it!' : button_text;
746 $(".timer-message").hide();
747 $(".welcomebar_height_content").show();
748 $(".mysticky-collect-lead").hide();
749 $(".mysticky-welcomebar-preview-screen .mysticky-welcomebar-fixed .mysticky-welcomebar-content").css("width","65%");
750 $(".mysticky-welcomebar-lead-content").hide();
751 $(".mysticky-welcomebar-btn a").text(button_text);
752 $("#mysticky_welcomebar_btn_text").val(button_text);
753 $(".height-setting").show();
754 $(".mysticky-welcomebar-btn").removeClass("collect-lead");
755 }
756 });
757
758 jQuery(document).on("click","#send_lead_email_enable",function(){
759 var url = jQuery(this).data("url");
760 jQuery(this).prop('checked',false);
761 window.open(url, '_blank');
762 });
763
764
765 jQuery(document).on("keyup","#lead-name-placeholder,#lead-email-placeholder,#lead-phone-placeholder",function(e){
766 if( $(this).attr("id") == "lead-name-placeholder" ){
767 $(".preview-lead-name").attr("placeholder",$(this).val());
768 }else if( $(this).attr("id") == "lead-email-placeholder" ){
769 $(".preview-lead-email").attr("placeholder",$(this).val());
770 }else{
771 $(".preview-lead-phone").attr("placeholder",$(this).val());
772 }
773 });
774
775 jQuery(document).on("change","input[name='mysticky_option_welcomebar[mysticky_welcomebar_lead_input]']",function(){
776 if( $(this).val() == 'email_address' ){
777 $("#lead-email-content").show();
778 $("#lead-phone-content").hide();
779 $(".preview-lead-email").show();
780 $(".preview-lead-phone").hide();
781 }else{
782 $("#lead-email-content").hide();
783 $("#lead-phone-content").show();
784 $(".preview-lead-email").hide();
785 $(".preview-lead-phone").show();
786 }
787
788 });
789
790 /* Mystickymenu : Single delete contact lead data - Contact lead page */
791
792 jQuery(document).on("click",".mystickymenu-delete-entry",function(event){
793
794 var deleterowid = $( this ).attr( "data-delete" );
795 var confirm_delete = window.confirm("Are you sure you want to delete Record with ID# "+deleterowid);
796 if (confirm_delete == true) {
797 jQuery.ajax({
798 type: 'POST',
799 url: ajaxurl,
800 data: {"action": "mystickymenu_delete_contact_lead","ID": deleterowid, delete_nonce: jQuery("#delete_nonce").val(),"wpnonce": mystickymenu.ajax_nonce},
801 success: function(data){
802 location.href = window.location.href;
803 },
804 error: function(XMLHttpRequest, textStatus, errorThrown) {
805 alert("Status: " + textStatus); alert("Error: " + errorThrown);
806 }
807 });
808 }
809
810 });
811
812 /* Mystickymenu : Bulk delete all contact lead data - Contact lead page */
813
814 jQuery(document).on("click","#mystickymenu_delete_all_leads", function(){
815 var confirm_delete = window.confirm("Are you sure you want to delete all Record from the database?");
816 if (confirm_delete == true) {
817 jQuery.ajax({
818 type: 'POST',
819 url: ajaxurl,
820 data: {"action": "mystickymenu_delete_contact_lead", 'all_leads': 1 , delete_nonce: jQuery("#delete_nonce").val(),"wpnonce": mystickymenu.ajax_nonce},
821 success: function(data){
822 location.href = window.location.href;
823 },
824 error: function(XMLHttpRequest, textStatus, errorThrown) {
825 alert("Status: " + textStatus); alert("Error: " + errorThrown);
826 }
827 });
828 }
829 return false;
830 });
831
832 /* Mystickymenu : Bulk do action trigger in contact lead table */
833
834 jQuery(document).on('click','#doaction',function(e){
835 e.preventDefault();
836 var bulks = [];
837 jQuery( '.cb-select-blk' ).each( function(){
838 if (this.checked) {
839 bulks.push( jQuery(this).val() );
840 }
841 } );
842
843 jQuery.ajax({
844 type: 'POST',
845 url: ajaxurl,
846 data: {"action": "my_sticky_menu_bulks","bulks": bulks,"wpnonce": mystickymenu.ajax_nonce},
847 success: function(data){
848 location.href = window.location.href;
849 },
850 error: function(XMLHttpRequest, textStatus, errorThrown) {
851 alert("Status: " + textStatus); alert("Error: " + errorThrown);
852 }
853 });
854 } );
855
856 jQuery(document).on( 'change','#mysticky-welcomebar-close-automatically-enabled', function(){
857 $(this).prop("checked",false);
858 var url = $(this).data("url");
859 window.open(url, '_blank');
860 });
861
862 jQuery(document).on("click",".save_change",function(){
863 $( '.mysticky-welcomebar-submit input.welcombar_save' ).trigger('click');
864 });
865
866 jQuery(document).on( 'change','#mysticky_welcomebar_show_success_message', function(){
867 if( $( this ).prop( "checked" ) == true ) {
868 $('#mysticky-welcomebar-thankyou-wrap').show();
869 } else {
870 $('#mysticky-welcomebar-thankyou-wrap').hide();
871 }
872 });
873
874 })(jQuery);
875