PluginProbe ʕ •ᴥ•ʔ
My Sticky Bar – Floating Notification Bar & Sticky Header (formerly myStickymenu) / 2.6.6
My Sticky Bar – Floating Notification Bar & Sticky Header (formerly myStickymenu) v2.6.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
morphext 3 years ago detectmobilebrowser.js 3 years ago iris-script.js 3 years ago jquery.star-rating-svg.min.js 3 years ago mystickymenu-admin.js 2 years ago mystickymenu.js 3 years ago mystickymenu.min.js 5 years ago select2.min.js 3 years ago slick.min.js 3 years ago welcomebar-front.js 2 years ago
mystickymenu-admin.js
1045 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 var bar_action_previous;
131 $( '.mysticky-welcomebar-action' ).on('focus', function () {
132 // Store the current value on focus and on change
133 bar_action_previous = this.value;
134 }).change(function() {
135 var mysticky_welcomebar_action = $( this ).val();
136
137 if ( mysticky_welcomebar_action == 'redirect_to_url' ) {
138 $( '.mysticky-welcomebar-redirect' ).show();
139 $( '.mysticky-welcomebar-redirect-container' ).show();
140 } else {
141 $( '.mysticky-welcomebar-redirect' ).hide();
142 $( '.mysticky-welcomebar-redirect-container' ).hide();
143 }
144 if ( mysticky_welcomebar_action == 'poptin_popup' ) {
145 $( '.mysticky-welcomebar-poptin-popup' ).show();
146 } else {
147 $( '.mysticky-welcomebar-poptin-popup' ).hide();
148 }
149 if ( $('.mysticky-welcomebar-action option:selected').attr('data-href') !== '' && mysticky_welcomebar_action == 'thankyou_screen' ) {
150 window.open( $( '.mysticky-welcomebar-action option:selected' ).attr('data-href') , '_blank');
151 $('.mysticky-welcomebar-action').val( bar_action_previous ).change();
152 console.log(bar_action_previous);
153 }
154 bar_action_previous = this.value;
155
156 });
157
158 var page_option_content = "";
159 page_option_content = $( '.mysticky-welcomebar-page-options-html' ).html();
160 $( '.mysticky-welcomebar-page-options-html' ).remove();
161
162 $( '#create-rule' ).on( 'click', function(){
163 var append_html = page_option_content.replace(/__count__/g, '1', page_option_content);
164 $( '.mysticky-welcomebar-page-options' ).append( append_html );
165 $( '.mysticky-welcomebar-page-options' ).show();
166 $( this ).parent().remove();
167 });
168 $( '.sticky-header-menu ul li a' ).on( 'click', function(){
169 if ( $( "#sticky-header-welcome-bar" ).is( ":visible" ) ) {
170 check_for_preview_pos();
171 }
172 } );
173 jQuery(window).on('scroll', function(){
174 if ( $( "#sticky-header-welcome-bar" ).is( ":visible" ) ) {
175 check_for_preview_pos();
176 }
177 });
178 /*Mysticky page target*/
179 var mysticky_total_page_option = 0;
180 var mysticky_page_option_content = "";
181 mysticky_total_page_option = $( '.mysticky-page-option' ).length;
182 mysticky_page_option_content = $( '.mysticky-page-options-html' ).html();
183 $( '.mysticky-page-options-html' ).remove();
184
185 $( '#mysticky_create-rule' ).on( 'click', function(){
186
187 var append_html = mysticky_page_option_content.replace(/__count__/g, mysticky_total_page_option, mysticky_page_option_content);
188 mysticky_total_page_option++;
189 $( '.mysticky-page-options' ).append( append_html );
190 $( '.mysticky-page-options .mysticky-page-option' ).removeClass( 'last' );
191 $( '.mysticky-page-options .mysticky-page-option:last' ).addClass( 'last' );
192
193 if( $( '.mysticky-page-option .myStickymenu-upgrade' ).length > 0 ) {
194 $( this ).remove();
195 }
196 });
197 $( document ).on( 'click', '.mysticky-remove-rule', function() {
198 $( this ).closest( '.mysticky-page-option' ).remove();
199 $( '.mysticky-page-options .mysticky-page-option' ).removeClass( 'last' );
200 $( '.mysticky-page-options .mysticky-page-option:last' ).addClass( 'last' );
201 });
202 $( document ).on( 'change', '.mysticky-url-options', function() {
203 var current_val = jQuery( this ).val();
204 var mysticky_welcomebar_siteURL = jQuery( '#mysticky_welcomebar_site_url' ).val();
205 var mysticky_welcomebar_newURL = mysticky_welcomebar_siteURL;
206 if( current_val == 'page_has_url' ) {
207 mysticky_welcomebar_newURL = mysticky_welcomebar_siteURL;
208 } else if( current_val == 'page_contains' ) {
209 mysticky_welcomebar_newURL = mysticky_welcomebar_siteURL + '%s%';
210 } else if( current_val == 'page_start_with' ) {
211 mysticky_welcomebar_newURL = mysticky_welcomebar_siteURL + 's%';
212 } else if( current_val == 'page_end_with' ) {
213 mysticky_welcomebar_newURL = mysticky_welcomebar_siteURL + '%s';
214 }
215 $( this ).closest( '.url-content' ).find( '.mysticky-welcomebar-url' ).text( mysticky_welcomebar_newURL );
216 });
217 /* welcome bar live preview */
218 /* Apply Wp Color Picker */
219 var myOptions = {
220 change: function(event, ui){
221 var color_id = $(this).attr('id');
222 var slug = $(this).data('slug');
223
224 var color_code = ui.color.toString();
225 if ( color_id === 'mysticky_welcomebar_bgcolor'){
226 $('.mysticky-welcomebar-fixed').css('background-color', color_code );
227 }
228 if ( color_id === 'mysticky_welcomebar_bgtxtcolor'){
229 $('.mysticky-welcomebar-fixed .mysticky-welcomebar-content p').css('color', color_code );
230 }
231 if ( color_id === 'mysticky_welcomebar_btncolor'){
232 $('.mysticky-welcomebar-btn a').css('background-color', color_code );
233 }
234 if ( color_id === 'mysticky_welcomebar_btntxtcolor'){
235 $('.mysticky-welcomebar-btn a').css('color', color_code );
236 }
237 if( color_id === 'mysticky_welcomebar_xcolor' ){
238 $(".mysticky-welcomebar-close").css('color',color_code);
239 }
240 }
241 };
242 $('.mysticky-welcomebar-setting-wrap .my-color-field').wpColorPicker(myOptions);
243
244 $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_x_desktop]"]' ).on( 'change', function(){
245 if( $( this ).prop( "checked" ) == true ) {
246 $( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-showx-desktop' );
247 } else {
248 $( '.mysticky-welcomebar-fixed' ).removeClass( 'mysticky-welcomebar-showx-desktop' );
249 }
250 } );
251 $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_x_mobile]"]' ).on( 'change', function(){
252 if( $( this ).prop( "checked" ) == true ) {
253 $( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-showx-mobile' );
254 } else {
255 $( '.mysticky-welcomebar-fixed' ).removeClass( 'mysticky-welcomebar-showx-mobile' );
256 }
257 } );
258
259 $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_btn_desktop]"]' ).on( 'change', function(){
260 if( $( this ).prop( "checked" ) == true ) {
261 $( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-btn-desktop' );
262 } else {
263 $( '.mysticky-welcomebar-fixed' ).removeClass( 'mysticky-welcomebar-btn-desktop' );
264 }
265
266 if( $( this ).prop( "checked" ) == false && $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_btn_mobile]"]' ).prop( "checked" ) == false ) {
267 $( ".mysticky_welcomebar_disable, .mysticky_welcomebar_btn_color button.wp-color-result" ).css({
268 'pointer-events': 'none',
269 'opacity': '0.5'
270 });
271 } else {
272 $( ".mysticky_welcomebar_disable, .mysticky_welcomebar_btn_color button.wp-color-result" ).css({
273 'pointer-events': '',
274 'opacity': ''
275 });
276 }
277 } );
278
279 $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_btn_mobile]"]' ).on( 'change', function(){
280 if( $( this ).prop( "checked" ) == true ) {
281 $( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-btn-mobile' );
282 } else {
283 $( '.mysticky-welcomebar-fixed' ).removeClass( 'mysticky-welcomebar-btn-mobile' );
284 }
285
286 if( $( this ).prop( "checked" ) == false && $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_btn_desktop]"]' ).prop( "checked" ) == false ) {
287 $( ".mysticky_welcomebar_disable, .mysticky_welcomebar_btn_color button.wp-color-result" ).css({
288 'pointer-events': 'none',
289 'opacity': '0.5'
290 });
291 } else {
292 $( ".mysticky_welcomebar_disable, .mysticky_welcomebar_btn_color button.wp-color-result" ).css({
293 'pointer-events': '',
294 'opacity': ''
295 });
296 }
297 } );
298 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 ) {
299 $( ".mysticky_welcomebar_disable, .mysticky_welcomebar_btn_color button.wp-color-result" ).css({
300 'pointer-events': 'none',
301 'opacity': '0.5'
302 });
303 } else {
304 $( ".mysticky_welcomebar_disable, .mysticky_welcomebar_btn_color button.wp-color-result" ).css({
305 'pointer-events': '',
306 'opacity': ''
307 });
308 }
309
310 $( 'select[name="mysticky_option_welcomebar[mysticky_welcomebar_font]"]' ).on( 'change', function(){
311 var myfixed_font_val = $( this ).val();
312 if( myfixed_font_val == 'System Stack'){
313 myfixed_font_val = '-apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';
314 }
315 $( '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">' );
316 $( '.mysticky-welcomebar-fixed' ).css( 'font-family', myfixed_font_val );
317 } );
318
319 $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_fontsize]"]' ).on( 'keyup click', function(){
320 var mysticky_welcomebar_fontsize_val = $( this ).val();
321 $( '.mysticky-welcomebar-fixed p' ).css( 'font-size', mysticky_welcomebar_fontsize_val + 'px' );
322 $( '.mysticky-welcomebar-btn a' ).css( 'font-size', mysticky_welcomebar_fontsize_val + 'px' );
323 } );
324
325 $( '#wp-mysticky_bar_text-wrap .wp-editor-tabs button' ).on( 'click', function(){
326 if ( $("#wp-mysticky_bar_text-wrap").hasClass("tmce-active") ){
327
328 }
329 } );
330
331 $( document ).on( 'click', '#qt_mysticky_bar_text_toolbar .ed_button', function(){
332 $( 'textarea[name="mysticky_option_welcomebar[mysticky_welcomebar_bar_text]"]' ).trigger( 'change keyup click' );
333 } );
334
335 /* Static Text */
336 $( 'textarea[name="mysticky_option_welcomebar[mysticky_welcomebar_bar_text]"]' ).on( 'change keyup click', function(){
337 var mysticky_bar_text_val = $( this ).val().replace(/(?:\r\n|\r|\n)/g, '<br />');
338
339 $( '.mysticky-welcomebar-content p.mysticky-welcomebar-static_text' ).html( mysticky_bar_text_val );
340 $('.mysticky-welcomebar-fixed .mysticky-welcomebar-content p.mysticky-welcomebar-static_text').css('color', $('#mysticky_welcomebar_bgtxtcolor').val() );
341 $( '.mysticky-welcomebar-fixed p.mysticky-welcomebar-static_text' ).css( 'font-size', $('#mysticky_welcomebar_fontsize').val() + 'px' );
342 } );
343 /* Sliding Text */
344 $( document ).on( 'change keyup click', 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_slider_text][]"]' , function(){
345 var sliding_text = '';
346 $('input[name="mysticky_option_welcomebar[mysticky_welcomebar_slider_text][]"]').each(function(index) {
347 sliding_text += '"' + $(this).val() + '",';
348 });
349 var slider_transition = $( 'select[name="mysticky_option_welcomebar[mysticky_welcomebar_slider_transition]"]' ).val();
350 $('.mysticky-welcomebar-animation-transition').html('<span class="mysticky-welcomebar-animation-text" data-morphext-options=\'{"animation": "'+ slider_transition +'", "phrases": [' + sliding_text.slice(0, -1) + '], "speed":"3500"}\'></span>')
351 jQuery(".mysticky-welcomebar-animation-transition .mysticky-welcomebar-animation-text").morphext();
352 });
353
354 $( document ).on( 'change', 'select[name="mysticky_option_welcomebar[mysticky_welcomebar_slider_transition]"]' , function(){
355 var sliding_text = '';
356 $('input[name="mysticky_option_welcomebar[mysticky_welcomebar_slider_text][]"]').each(function(index) {
357 sliding_text += '"' + $(this).val() + '",';
358 });
359 var slider_transition = $( 'select[name="mysticky_option_welcomebar[mysticky_welcomebar_slider_transition]"]' ).val();
360 $('.mysticky-welcomebar-animation-transition').html('<span class="mysticky-welcomebar-animation-text" data-morphext-options=\'{"animation": "'+ slider_transition +'", "phrases": [' + sliding_text.slice(0, -1) + '], "speed":"3500"}\'></span>')
361 jQuery(".mysticky-welcomebar-animation-transition .mysticky-welcomebar-animation-text").morphext();
362 });
363
364 $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_btn_text]"]' ).on( 'keyup', function(){
365 var mysticky_btn_text_val = $( this ).val();
366 $( '.mysticky-welcomebar-btn a' ).text( mysticky_btn_text_val );
367 } );
368
369 /* DATE: 11-12-2019 start */
370 $( 'select[name="mysticky_option_welcomebar[mysticky_welcomebar_attentionselect]"]' ).on( 'change', function(){
371 $(".mysticky-welcomebar-fixed").removeClass (function (index, className) {
372 return (className.match (/(^|\s)mysticky-welcomebar-attention-\S+/g) || []).join(' ');
373 });
374 $( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-attention-' + $(this).val() );
375
376 } );
377 /* DATE: 11-12-2019 End */
378 $("#myStickymenu-entry-effect").on( 'change', function() {
379 $(".mysticky-welcomebar-preview-screen .mysticky-welcomebar-fixed").removeClass('entry-effect');
380 $(".mysticky-welcomebar-fixed").removeClass (function (index, className) {
381 return (className.match (/(^|\s)mysticky-welcomebar-entry-effect-\S+/g) || []).join(' ');
382 });
383 $( '.mysticky-welcomebar-preview-screen .mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-entry-effect-' + $(this).val() );
384 setTimeout( function(){
385 $(".mysticky-welcomebar-preview-screen .mysticky-welcomebar-fixed").addClass('entry-effect');
386 }, 1000 );
387
388 });
389 $( '.mysticky-welcomebar-fixed' ).addClass( 'entry-effect' );
390
391 jQuery(".mysticky-welcomebar-animation-transition .mysticky-welcomebar-animation-text").morphext();
392
393 });
394 $( window ).on('load', function(){
395 $( '.mysticky-welcomebar-url-options' ).each( function(){
396 $( this ).trigger( 'change' );
397 });
398 });
399
400
401 /* Preview section part maintain sticky using "check_for_preview_pos" function */
402
403 function check_for_preview_pos() {
404
405 var $window = $(window);
406 var windowsize = $window.width();
407
408 var mysticky_welcomebar_form_pos = $( '#sticky-header-welcome-bar' ).offset().top;
409 if($(".show-on-apper").length && $(".mysticky-welcomebar-setting-right").length) {
410 var topPos = $(".show-on-apper").offset().top - $(window).scrollTop() - 750;
411 if (topPos < 0) {
412 topPos = Math.abs(topPos);
413 jQuery(".mysticky-welcomebar-setting-right").css("margin-top", ((-1)*topPos)+"px");
414 } else {
415 jQuery(".mysticky-welcomebar-setting-right").css("margin-top", "0");
416 }
417 }
418
419 var position_screen = (isRtl == 1 ) ? 'left' : 'right';
420
421 if ( ( mysticky_welcomebar_form_pos + 32 ) < $(window).scrollTop() ) {
422 $( '.mysticky-welcomebar-setting-right' ).css( 'position', 'fixed' );
423 $( '.mysticky-welcomebar-setting-right' ).css( position_screen, '40px' );
424
425 if ( windowsize < 1181 && windowsize > 768 && position_screen == 'right' ) {
426 $( '.mysticky-welcomebar-setting-right' ).css( position_screen, '30px' );
427
428 }else if ( windowsize <= 768 && position_screen == 'right' ) {
429 $( '.mysticky-welcomebar-setting-right' ).css( position_screen, '25px' );
430 }
431
432 if ( windowsize < 1181 && windowsize > 768 && position_screen == 'left') {
433 $( '.mysticky-welcomebar-setting-right' ).css( position_screen, '30px' );
434 }else if ( windowsize <= 768 && position_screen == 'left') {
435 $( '.mysticky-welcomebar-setting-right' ).css( position_screen, '25px' );
436 }
437 } else {
438 $( '.mysticky-welcomebar-setting-right' ).css( 'position', 'absolute' );
439 $( '.mysticky-welcomebar-setting-right' ).css( position_screen, '20px' );
440
441 if ( windowsize < 1181 && position_screen == 'right') {
442 $( '.mysticky-welcomebar-setting-right' ).css( position_screen, '10px' );
443 }
444
445 if ( windowsize < 1181 && position_screen == 'left') {
446 $( '.mysticky-welcomebar-setting-right' ).css( position_screen, '10px' );
447 }
448 }
449
450
451 }
452
453 jQuery(document).on("click",".mystickymenu-delete-widget",function(e){
454 e.preventDefault();
455
456 var widget_id = jQuery(this).data("widget-id");
457 jQuery("#widget-delete-dialog-"+widget_id).show();
458 jQuery("#mystickymenu-delete-popup-overlay-"+widget_id).show();
459 });
460
461 /* Mystickymenu: Dashbaord table delete button click action */
462
463 jQuery(document).on("click",".btn-delete",function(e){
464 e.preventDefault();
465 var delWidId = jQuery(this).data("id");
466 jQuery.ajax({
467 url: ajaxurl,
468 type:'post',
469 data: 'action=stickymenu_widget_delete&widget_id=' + delWidId + '&widget_delete=1&wpnonce=' + mystickymenu.ajax_nonce,
470 success: function( data ){
471 $( '#stickymenu-widget-' + delWidId ).remove();
472 setTimeout('location.reload()', 500);
473 },
474 });
475 });
476
477
478 jQuery(document).on("click",".btn-delete-cancel",function(e){
479 e.preventDefault();
480 var id = jQuery(this).data("id");
481 jQuery("#widget-delete-dialog-"+id).hide();
482 jQuery("#mystickymenu-delete-popup-overlay-"+id).hide();
483 });
484
485 /* Mystickymenu: Dashbaord table welcombar widget status change action */
486
487 jQuery(document).on("click",".mystickymenu-widget-enabled",function(){
488 var widget_id = $(this).data('id');
489 if(jQuery(this).prop("checked") != true){
490 jQuery('#widget-status-dialog-' + widget_id).show();
491 jQuery('#mystickymenu-status-popup-overlay-' + widget_id).show();
492 }else{
493 var widget_status = 1;
494 set_widget_status( widget_id, widget_status );
495 }
496 });
497
498 jQuery(document).on("click",".btn-turnoff-status",function(e){
499 e.preventDefault();
500 var widget_id = $(this).data('id');
501
502 if ( typeof widget_id !== "undefined") {
503 var widget_status = 0;
504 set_widget_status( widget_id, widget_status );
505 }
506
507 });
508
509
510 jQuery(document).on("click",".btn-nevermind-status",function(e){
511 e.preventDefault();
512 var widget_id = $(this).data('id');
513 if ( typeof widget_id !== "undefined") {
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
521 jQuery(document).on("click",".mystickymenupopup-overlay",function(e){
522 e.preventDefault();
523
524 if(jQuery(this).data("fromoverlay") == 'welcombar_delete'){
525 jQuery(this).hide();
526 var delId = jQuery(this).data('id');
527 jQuery('#widget-delete-dialog-'+delId).hide();
528 }
529 });
530
531 jQuery(document).on("click",".mystickymenupopup-widget-status-overlay",function(e){
532 e.preventDefault();
533 var widget_id = $(this).data('id');
534 var widget_status = 1;
535 set_widget_status( widget_id, widget_status );
536 jQuery("#mystickymenu-widget-enabled-"+widget_id).prop('checked', true);
537
538 });
539
540 function set_widget_status( widget_id, widget_status ) {
541 jQuery.ajax({
542 url: ajaxurl,
543 type:'post',
544 data: 'action=mystickymenu_widget_status&widget_id='+widget_id+'&widget_status=' + widget_status +'&wpnonce=' + mystickymenu.ajax_nonce,
545 success: function( data ){
546 $('#widget-status-dialog-' + widget_id).hide();
547 $('#mystickymenu-status-popup-overlay-' + widget_id).hide();
548 },
549 });
550 }
551
552 jQuery(document).on("click","#close-first-popup, .btn-close-dashboard",function(e){
553 e.preventDefault();
554 jQuery('.first-widget-popup').hide();
555 jQuery('.mystickymenupopup-overlay').hide();
556 });
557
558 jQuery(document).on("click","#first_widget_overlay",function(){
559 jQuery('.first-widget-popup').hide();
560 jQuery(this).hide();
561 });
562
563
564
565 jQuery(document).on("click","#btn-config-disable",function(e){
566 e.preventDefault();
567 jQuery("#stickymenu_status_popupbox").show();
568 jQuery("#stickymenuconfig-overlay-popup").show();
569 });
570
571 jQuery(document).on("click","#stickymenuconfig-overlay-popup",function(){
572 jQuery("#stickymenu_status_popupbox").hide();
573 jQuery(this).hide();
574 });
575
576 jQuery(document).on("click","#stickymenu_status_turnoff",function(e){
577 e.preventDefault();
578 var stickymenu_status = 0;
579 set_stickymenu_status( stickymenu_status );
580 });
581
582 jQuery(document).on("click","#stickymenu_status_nevermind",function(e){
583 e.preventDefault();
584 jQuery("#stickymenu_status_popupbox").hide();
585 jQuery("#stickymenuconfig-overlay-popup").hide();
586 });
587
588 function set_stickymenu_status( stickymenu_status ){
589 jQuery.ajax({
590 url: ajaxurl,
591 type:'post',
592 data: 'action=stickymenu_status_update&stickymenu_status=' + stickymenu_status +'&wpnonce=' + mystickymenu.ajax_nonce,
593 success: function( data ){
594 location.reload();
595 },
596 });
597 }
598
599 jQuery(document).on("click",".close-button",function(){
600 if(jQuery(this).data("from") == 'welcome-bar-status'){
601 var id = jQuery(this).data("id");
602 jQuery("#widget-status-dialog-"+id).hide();
603 jQuery("#mystickymenu-status-popup-overlay-"+id).hide();
604 var widget_status = 1;
605 set_widget_status( id, widget_status );
606 jQuery("#mystickymenu-widget-enabled-"+id).prop('checked', true)
607
608 }else if( jQuery(this).data("from") == "stickymenu-status"){
609 jQuery("#stickymenu_status_popupbox").hide();
610 jQuery("#stickymenuconfig-overlay-popup").hide();
611
612 }else if( jQuery(this).data("from") == "stickymenu-confirm" ){
613 jQuery("#mysticky-sticky-save-confirm").hide();
614 jQuery("#stickymenu-option-overlay-popup").hide();
615 }else if( jQuery(this).data("from") == "welcombar-confirm" ){
616 jQuery("#welcomebar-save-confirm").hide();
617 jQuery("#welcombar-sbmtvalidation-overlay-popup").hide();
618 }else{
619 var id = jQuery(this).data("id");
620 jQuery("#widget-delete-dialog-"+id).hide();
621 jQuery("#mystickymenu-delete-popup-overlay-"+id).hide();
622 }
623 });
624
625
626 jQuery(document).on("click","#stickymenu-option-overlay-popup",function(){
627 $("#mysticky-sticky-save-confirm").hide();
628 $(this).hide();
629 });
630
631
632 jQuery(document).on("click","#welcombar-sbmtvalidation-overlay-popup",function(){
633 $("#welcomebar-save-confirm").hide();
634 $(this).hide();
635 });
636
637
638 jQuery(document).on("change","#mysticky-welcomebar-countdown-enabled",function(){
639 var url = jQuery(this).data("url");
640 jQuery(this).prop('checked',false);
641 window.open(url, '_blank');
642 });
643
644 jQuery(document).on("click",".btn-save-stickymenu" , function(event){
645 if ( $( '#mysticky-stickymenu-form-enabled' ).prop( 'checked' ) == false && $('#save_stickymenu').val() == "" ) {
646 event.preventDefault();
647 $("#mysticky-sticky-save-confirm").show();
648 $("#stickymenu-option-overlay-popup").show();
649
650 $('#stickymenu_status_ok').attr('data-clickfrom', 'save');
651 $('#stickymenu_status_dolater').attr('data-clickfrom', 'save');
652 }
653 });
654
655 jQuery(document).on("click",".save_view_dashboard" , function(event){
656 if ( $( '#mysticky-stickymenu-form-enabled' ).prop( 'checked' ) == false && $('#save_stickymenu').val() == "" ) {
657 event.preventDefault();
658 $("#mysticky-sticky-save-confirm").show();
659 $("#stickymenu-option-overlay-popup").show();
660
661 $('#stickymenu_status_ok').attr('data-clickfrom', 'dashboard');
662 $('#stickymenu_status_dolater').attr('data-clickfrom', 'dashboard');
663 }
664 });
665
666 jQuery(document).on("click","#stickymenu_status_ok",function(){
667 var clickFrom = $(this).data("clickfrom");
668 $('#save_stickymenu').val("1");
669 $( '#mysticky-stickymenu-form-enabled' ).prop( 'checked' , true )
670 $("#mysticky-sticky-save-confirm").hide();
671 $("#stickymenu-option-overlay-popup").hide();
672 if(clickFrom == 'dashboard'){
673 $('.save_view_dashboard').trigger("click");
674 }else{
675 $('.btn-save-stickymenu').trigger("click");
676 }
677 });
678
679 jQuery(document).on("click","#stickymenu_status_dolater",function(){
680 var clickFrom = $(this).data("clickfrom");
681 $('#save_stickymenu').val("1");
682 if(clickFrom == 'dashboard'){
683 $('.save_view_dashboard').trigger("click");
684 }else{
685 $('.btn-save-stickymenu').trigger("click");
686 }
687 });
688
689 jQuery(document).on( 'click','.welcombar_save', function(e){
690
691 if ( $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_enable]"]' ).prop( 'checked' ) == false && $( 'input#save_welcome_bar' ).val() == '' ) {
692 e.preventDefault();
693 $("#welcomebar-save-confirm").show();
694 $("#welcombar-sbmtvalidation-overlay-popup").show();
695 $("#welcombar_sbmtbtn_off").attr("data-clickfrom",'save_button');
696 $("#welcomebar_yes_sbmtbtn").attr("data-clickfrom",'save_button');
697 }
698 });
699
700
701 jQuery(document).on( 'click','.save_view_dashboard', function(e){
702
703 if ( $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_enable]"]' ).prop( 'checked' ) == false && $( 'input#save_welcome_bar' ).val() == '' ) {
704 e.preventDefault();
705 $("#welcomebar-save-confirm").show();
706 $("#welcombar-sbmtvalidation-overlay-popup").show();
707 $("#welcombar_sbmtbtn_off").attr("data-clickfrom",'save_dashboard_button');
708 $("#welcomebar_yes_sbmtbtn").attr("data-clickfrom",'save_dashboard_button');
709 }
710 });
711 $( document ).on( 'change', '#mysticky-welcomebar-contact-form-enabled', function(){
712 $("span.mystickybar-visible, span.mystickybar-hidden").hide();
713 if( $(this).prop('checked') == true ) {
714 $("span.mystickybar-visible").show();
715 } else {
716 $("span.mystickybar-hidden").show();
717 }
718 })
719
720 jQuery(document).on("click","#welcomebar_yes_sbmtbtn",function(){
721
722 var clickFrom = $(this).data("clickfrom");
723
724 $("#welcomebar-save-confirm").hide();
725 $("#welcombar-sbmtvalidation-overlay-popup").hide();
726 $( 'input#welcome_save_anyway' ).val('1');
727 $( 'input#save_welcome_bar' ).val('1');
728 $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_enable]"]' ).prop( 'checked',true );
729 if(clickFrom == 'save_dashboard_button'){
730 $( '.mysticky-welcomebar-submit input.save_view_dashboard' ).trigger('click');
731 }else{
732 $( '.mysticky-welcomebar-submit input.welcombar_save' ).trigger('click');
733 }
734 });
735
736 jQuery(document).on("click","#welcombar_sbmtbtn_off",function(){
737 var clickFrom = $(this).data("clickfrom");
738
739 $("#welcomebar-save-confirm").hide();
740 $("#welcombar-sbmtvalidation-overlay-popup").hide();
741 $( 'input#welcome_save_anyway' ).val('1');
742 $( 'input#save_welcome_bar' ).val('1');
743
744 if(clickFrom == 'save_dashboard_button'){
745 $( '.mysticky-welcomebar-submit input.save_view_dashboard' ).trigger('click');
746 }else{
747 $( '.mysticky-welcomebar-submit input.welcombar_save' ).trigger('click');
748 }
749 });
750
751 jQuery(document).on("click","#mysticky-welcomebar-showcoupon-enabled",function(){
752 var url = jQuery(this).data("url");
753 jQuery(this).prop('checked',false);
754 window.open(url, '_blank');
755 });
756
757 jQuery(document).on("change","#mysticky-welcomebar-collectlead-enabled",function(){
758
759 var button_text = $(this).data("button-text");
760
761 if( $(this).prop("checked") == true ){
762
763 $(".timer-message").show();
764 $(".mysticky-welcomebar-collect-lead").show();
765 $(".welcomebar_height_content").hide();
766 $(".mysticky-welcomebar-preview-screen .mysticky-welcomebar-fixed .mysticky-welcomebar-content").css("width","90%");
767 $(".mysticky-welcomebar-lead-content").show();
768 $(".mysticky-welcomebar-btn a").text("Send me");
769 $("#mysticky_welcomebar_btn_text").val("Send me");
770 $(".mysticky-welcomebar-btn").addClass("collect-lead");
771 $(".height-setting").hide();
772 }else{
773
774 button_text = ( button_text == 'Send me' ) ? 'Got it!' : button_text;
775 $(".timer-message").hide();
776 $(".welcomebar_height_content").show();
777 $(".mysticky-welcomebar-collect-lead").hide();
778 $(".mysticky-welcomebar-preview-screen .mysticky-welcomebar-fixed .mysticky-welcomebar-content").css("width","75%");
779 $(".mysticky-welcomebar-lead-content").hide();
780 $(".mysticky-welcomebar-btn a").text(button_text);
781 $("#mysticky_welcomebar_btn_text").val(button_text);
782 $(".height-setting").show();
783 $(".mysticky-welcomebar-btn").removeClass("collect-lead");
784 }
785 });
786
787 jQuery(document).on("click","#send_lead_email_enable",function(){
788 var url = jQuery(this).data("url");
789 jQuery(this).prop('checked',false);
790 window.open(url, '_blank');
791 });
792
793
794 jQuery(document).on("keyup","#lead-name-placeholder,#lead-email-placeholder,#lead-phone-placeholder",function(e){
795 if( $(this).attr("id") == "lead-name-placeholder" ){
796 $(".preview-lead-name").attr("placeholder",$(this).val());
797 }else if( $(this).attr("id") == "lead-email-placeholder" ){
798 $(".preview-lead-email").attr("placeholder",$(this).val());
799 }else{
800 $(".preview-lead-phone").attr("placeholder",$(this).val());
801 }
802 });
803 /* Welcomebar Text*/
804 jQuery(document).on("change","input[name='mysticky_option_welcomebar[mysticky_welcomebar_text_type]']",function(){
805 if( $(this).val() == 'static_text' ){
806 $("#mysticky_welcomebar_static_text_setting").show();
807 $("#mysticky_welcomebar_sliding_text_setting").hide();
808 $("#mysticky_welcomebar_sliding_text_transition_style,#mysticky_welcomebar_sliding_text_transition_speed").hide();
809 }else{
810 $("#mysticky_welcomebar_static_text_setting").hide();
811 $("#mysticky_welcomebar_sliding_text_setting").show();
812 $("#mysticky_welcomebar_sliding_text_transition_style,#mysticky_welcomebar_sliding_text_transition_speed").show();
813 }
814
815 });
816
817 jQuery(document).on("change","input[name='mysticky_option_welcomebar[mysticky_welcomebar_lead_input]']",function(){
818 if( $(this).val() == 'email_address' ){
819 $("#lead-email-content").show();
820 $("#lead-phone-content").hide();
821 $(".preview-lead-email").show();
822 $(".preview-lead-phone").hide();
823 }else{
824 $("#lead-email-content").hide();
825 $("#lead-phone-content").show();
826 $(".preview-lead-email").hide();
827 $(".preview-lead-phone").show();
828 }
829
830 });
831
832 /* Mystickymenu : Single delete contact lead data - Contact lead page */
833
834 jQuery(document).on("click",".mystickymenu-delete-entry",function(event){
835
836 var deleterowid = $( this ).attr( "data-delete" );
837 var confirm_delete = window.confirm("Are you sure you want to delete Record with ID# "+deleterowid);
838 if (confirm_delete == true) {
839 jQuery.ajax({
840 type: 'POST',
841 url: ajaxurl,
842 data: {"action": "mystickymenu_delete_contact_lead","ID": deleterowid, delete_nonce: jQuery("#delete_nonce").val(),"wpnonce": mystickymenu.ajax_nonce},
843 success: function(data){
844 location.href = window.location.href;
845 },
846 error: function(XMLHttpRequest, textStatus, errorThrown) {
847 alert("Status: " + textStatus); alert("Error: " + errorThrown);
848 }
849 });
850 }
851
852 });
853
854 /* Mystickymenu : Bulk delete all contact lead data - Contact lead page */
855
856 jQuery(document).on("click","#mystickymenu_delete_all_leads", function(){
857 var confirm_delete = window.confirm("Are you sure you want to delete all Record from the database?");
858 if (confirm_delete == true) {
859 jQuery.ajax({
860 type: 'POST',
861 url: ajaxurl,
862 data: {"action": "mystickymenu_delete_contact_lead", 'all_leads': 1 , delete_nonce: jQuery("#delete_nonce").val(),"wpnonce": mystickymenu.ajax_nonce},
863 success: function(data){
864 location.href = window.location.href;
865 },
866 error: function(XMLHttpRequest, textStatus, errorThrown) {
867 alert("Status: " + textStatus); alert("Error: " + errorThrown);
868 }
869 });
870 }
871 return false;
872 });
873
874 /* Mystickymenu : Bulk do action trigger in contact lead table */
875
876 jQuery(document).on('click','#doaction',function(e){
877 e.preventDefault();
878 var bulks = [];
879 jQuery( '.cb-select-blk' ).each( function(){
880 if (this.checked) {
881 bulks.push( jQuery(this).val() );
882 }
883 } );
884
885 jQuery.ajax({
886 type: 'POST',
887 url: ajaxurl,
888 data: {"action": "my_sticky_menu_bulks","bulks": bulks,"wpnonce": mystickymenu.ajax_nonce},
889 success: function(data){
890 location.href = window.location.href;
891 },
892 error: function(XMLHttpRequest, textStatus, errorThrown) {
893 alert("Status: " + textStatus); alert("Error: " + errorThrown);
894 }
895 });
896 } );
897
898 jQuery(document).on( 'change','#mysticky-welcomebar-close-automatically-enabled', function(){
899 $(this).prop("checked",false);
900 var url = $(this).data("url");
901 window.open(url, '_blank');
902 });
903
904 jQuery(document).on("click",".save_change",function(){
905 $( '.mysticky-welcomebar-submit input.welcombar_save' ).trigger('click');
906 });
907
908 jQuery(document).on( 'change','#mysticky_welcomebar_show_success_message', function(){
909 if( $( this ).prop( "checked" ) == true ) {
910 $('#mysticky-welcomebar-thankyou-wrap').show();
911 } else {
912 $('#mysticky-welcomebar-thankyou-wrap').hide();
913 }
914 });
915
916 //rating popup
917 $(document).on("keyup", "#upgrade-review-comment", function(){
918 var commentLength = 1000 - parseInt($.trim($(this).val()).length);
919 if(commentLength < 0) {
920 var userComment = $.trim($(this).val());
921 userComment = userComment.slice(0, 1000);
922 $(".upgrade-review-textarea label span").text(0);
923 $(this).val(userComment);
924 } else {
925 $(".upgrade-review-textarea label span").text(commentLength);
926 }
927 });
928
929 $(document).on("change", "#upgrade-review-comment", function(){
930 var commentLength = 1000 - parseInt($.trim($(this).val()).length);
931 if(commentLength < 0) {
932 var userComment = $.trim($(this).val());
933 userComment = userComment.slice(0, 1000);
934 $(".upgrade-review-textarea label span").text(0);
935 $(this).val(userComment);
936 } else {
937 $(".upgrade-review-textarea label span").text(commentLength);
938 }
939 });
940
941 $(document).ready(
942 function () {
943 if( $("#mystickymenu-rating").length != 0 ) {
944 $("#rating-modal-popup").show();
945 $("#mystickymenu-rating").starRating({
946 initialRating : 0,
947 useFullStars : true,
948 strokeColor : '#FDB10C',
949 ratedColor : '#FDB10C',
950 activeColor : '#FDB10C',
951 strokeWidth : 0,
952 minRating : 1,
953 starSize : 32,
954 useGradient : 0,
955 onHover: function(currentRate) {
956 $(".upgrade-user-rating span").text(currentRate+"/5");
957 $(".upgrade-user-rating" ).css('visibility', 'visible');
958 },
959 onLeave: function(currentRate) {
960 $(".upgrade-user-rating" ).css('visibility', 'hidden');
961 },
962 callback( currentRate ) {
963 console.log(currentRate);
964 if( currentRate !== 5 ) {
965 $(".rating-modal-steps").removeClass("active");
966 $(".rating-modal-steps#step-2").addClass("active");
967 $("#mystickymenu-rated-rating").html("");
968 for(let i=0 ; i< parseInt(currentRate); i++) {
969 var ratingStar = '<div class="jq-star"><svg shape-rendering="geometricPrecision" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="305px" height="305px" viewBox="60 -62 309 309" style="enable-background:new 64 -59 305 305; stroke-width:0px;" xml:space="preserve"> <polygon data-side="center" className="svg-empty-28" points="281.1,129.8 364,55.7 255.5,46.8 214,-59 172.5,46.8 64,55.4 146.8,129.7 121.1,241 212.9,181.1 213.9,181 306.5,241 " style="fill: transparent; stroke: #ffa83e;"></polygon> <polygon data-side="left" className="svg-empty-28" points="281.1,129.8 364,55.7 255.5,46.8 214,-59 172.5,46.8 64,55.4 146.8,129.7 121.1,241 213.9,181.1 213.9,181 306.5,241 " style="stroke-opacity: 0;"></polygon> <polygon data-side="right" className="svg-empty-28" points="364,55.7 255.5,46.8 214,-59 213.9,181 306.5,241 281.1,129.8 " style="stroke-opacity: 0;"></polygon> </svg></div>';
970 $("#mystickymenu-rated-rating").append(ratingStar);
971 }
972 } else {
973 window.open("https://wordpress.org/support/plugin/mystickymenu/reviews/#new-post", '_blank');
974 set_mystickymenu_review_reminder(-1);
975 }
976 }
977 })
978 }
979
980 $(document).on("click", ".close-popup-button a.hide-upgrade-modal", function(){
981 if($(".rating-modal-steps#step-3").hasClass("active")) {
982 set_mystickymenu_review_reminder(14);
983 } else {
984 $(".rating-modal-steps").removeClass("active");
985 $(".rating-modal-steps#step-3").addClass("active");
986 }
987 });
988
989 $(document).on("click", "#upgrade-review-button", function(){
990 $("#rating-modal-popup").hide();
991 var review_reminder = ($('.upgrade-review-reminder').length >= 1) ? $('.upgrade-review-reminder').val(): "-1";
992 jQuery.ajax({
993 type:'post',
994 url: mystickymenu.ajaxurl,
995 data: {
996 action: "mystickymenu_review_box_message",
997 rating: $("#mystickymenu-rated-rating .jq-star").length,
998 nonce: mystickymenu.ajax_nonce,
999 message: $.trim($("#upgrade-review-comment").val())
1000 },
1001 success: function() {
1002 set_mystickymenu_review_reminder(review_reminder);
1003 }
1004 });
1005 });
1006
1007
1008 function set_mystickymenu_review_reminder(noOfDays) {
1009 $.ajax({
1010 type: "post",
1011 url: mystickymenu.ajaxurl,
1012 data: {
1013 action: "mystickymenu_review_box",
1014 days: noOfDays,
1015 nonce: mystickymenu.ajax_nonce
1016 },
1017
1018 success: function() {
1019
1020 }
1021 });
1022 $("#rating-modal-popup").remove();
1023 }
1024
1025 $(document).on("click", ".mystickymenu-popup-form", function( e ){
1026 if ( $(e.target).attr('id') == 'rating-modal-popup' ) {
1027 let step_id = $( '#rating-modal-popup .rating-modal-steps.active' ).attr( 'id') ;
1028
1029 if ( step_id == 'step-1' ) {
1030 $(".rating-modal-steps").removeClass("active");
1031 $(".rating-modal-steps#step-3").addClass("active");
1032 }
1033
1034 if ( step_id == 'step-3' ) {
1035 $('#upgrade-review-reminder option[value="14"]').attr("selected", "selected");
1036 $( "#upgrade-review-button" ).trigger( 'click');
1037 }
1038 }
1039
1040 });
1041
1042 });
1043
1044 })(jQuery);
1045