morphext
2 years ago
detectmobilebrowser.js
2 years ago
iris-script.js
2 years ago
jquery.star-rating-svg.min.js
3 years ago
mystickymenu-admin.js
2 years ago
mystickymenu.js
2 years ago
mystickymenu.min.js
5 years ago
select2.min.js
2 years ago
slick.min.js
2 years ago
welcomebar-front.js
2 years ago
mystickymenu-admin.js
1048 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 | var mysticky_bar_text_val = $( 'textarea[name="mysticky_option_welcomebar[mysticky_welcomebar_bar_text]"]' ).val().replace(/(?:\r\n|\r|\n)/g, '<br />'); |
| 337 | mysticky_bar_text_val = mysticky_bar_text_val.replace(/(?:onchange|onclick|onmouseover|onmouseout|onkeydown|onload\onerror|alert)/g, ''); |
| 338 | $( '.mysticky-welcomebar-content p.mysticky-welcomebar-static_text' ).html( mysticky_bar_text_val ); |
| 339 | $( 'textarea[name="mysticky_option_welcomebar[mysticky_welcomebar_bar_text]"]' ).on( 'change keyup click', function(){ |
| 340 | var mysticky_bar_text_val = $( this ).val().replace(/(?:\r\n|\r|\n)/g, '<br />'); |
| 341 | mysticky_bar_text_val = mysticky_bar_text_val.replace(/(?:onchange|onclick|onmouseover|onmouseout|onkeydown|onload\onerror|alert)/g, ''); |
| 342 | $( '.mysticky-welcomebar-content p.mysticky-welcomebar-static_text' ).html( mysticky_bar_text_val ); |
| 343 | $('.mysticky-welcomebar-fixed .mysticky-welcomebar-content p.mysticky-welcomebar-static_text').css('color', $('#mysticky_welcomebar_bgtxtcolor').val() ); |
| 344 | $( '.mysticky-welcomebar-fixed p.mysticky-welcomebar-static_text' ).css( 'font-size', $('#mysticky_welcomebar_fontsize').val() + 'px' ); |
| 345 | } ); |
| 346 | /* Sliding Text */ |
| 347 | $( document ).on( 'change keyup click', 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_slider_text][]"]' , function(){ |
| 348 | var sliding_text = ''; |
| 349 | $('input[name="mysticky_option_welcomebar[mysticky_welcomebar_slider_text][]"]').each(function(index) { |
| 350 | sliding_text += '"' + $(this).val() + '",'; |
| 351 | }); |
| 352 | var slider_transition = $( 'select[name="mysticky_option_welcomebar[mysticky_welcomebar_slider_transition]"]' ).val(); |
| 353 | $('.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>') |
| 354 | jQuery(".mysticky-welcomebar-animation-transition .mysticky-welcomebar-animation-text").morphext(); |
| 355 | }); |
| 356 | |
| 357 | $( document ).on( 'change', 'select[name="mysticky_option_welcomebar[mysticky_welcomebar_slider_transition]"]' , function(){ |
| 358 | var sliding_text = ''; |
| 359 | $('input[name="mysticky_option_welcomebar[mysticky_welcomebar_slider_text][]"]').each(function(index) { |
| 360 | sliding_text += '"' + $(this).val() + '",'; |
| 361 | }); |
| 362 | var slider_transition = $( 'select[name="mysticky_option_welcomebar[mysticky_welcomebar_slider_transition]"]' ).val(); |
| 363 | $('.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>') |
| 364 | jQuery(".mysticky-welcomebar-animation-transition .mysticky-welcomebar-animation-text").morphext(); |
| 365 | }); |
| 366 | |
| 367 | $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_btn_text]"]' ).on( 'keyup', function(){ |
| 368 | var mysticky_btn_text_val = $( this ).val(); |
| 369 | $( '.mysticky-welcomebar-btn a' ).text( mysticky_btn_text_val ); |
| 370 | } ); |
| 371 | |
| 372 | /* DATE: 11-12-2019 start */ |
| 373 | $( 'select[name="mysticky_option_welcomebar[mysticky_welcomebar_attentionselect]"]' ).on( 'change', function(){ |
| 374 | $(".mysticky-welcomebar-fixed").removeClass (function (index, className) { |
| 375 | return (className.match (/(^|\s)mysticky-welcomebar-attention-\S+/g) || []).join(' '); |
| 376 | }); |
| 377 | $( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-attention-' + $(this).val() ); |
| 378 | |
| 379 | } ); |
| 380 | /* DATE: 11-12-2019 End */ |
| 381 | $("#myStickymenu-entry-effect").on( 'change', function() { |
| 382 | $(".mysticky-welcomebar-preview-screen .mysticky-welcomebar-fixed").removeClass('entry-effect'); |
| 383 | $(".mysticky-welcomebar-fixed").removeClass (function (index, className) { |
| 384 | return (className.match (/(^|\s)mysticky-welcomebar-entry-effect-\S+/g) || []).join(' '); |
| 385 | }); |
| 386 | $( '.mysticky-welcomebar-preview-screen .mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-entry-effect-' + $(this).val() ); |
| 387 | setTimeout( function(){ |
| 388 | $(".mysticky-welcomebar-preview-screen .mysticky-welcomebar-fixed").addClass('entry-effect'); |
| 389 | }, 1000 ); |
| 390 | |
| 391 | }); |
| 392 | $( '.mysticky-welcomebar-fixed' ).addClass( 'entry-effect' ); |
| 393 | |
| 394 | jQuery(".mysticky-welcomebar-animation-transition .mysticky-welcomebar-animation-text").morphext(); |
| 395 | |
| 396 | }); |
| 397 | $( window ).on('load', function(){ |
| 398 | $( '.mysticky-welcomebar-url-options' ).each( function(){ |
| 399 | $( this ).trigger( 'change' ); |
| 400 | }); |
| 401 | }); |
| 402 | |
| 403 | |
| 404 | /* Preview section part maintain sticky using "check_for_preview_pos" function */ |
| 405 | |
| 406 | function check_for_preview_pos() { |
| 407 | |
| 408 | var $window = $(window); |
| 409 | var windowsize = $window.width(); |
| 410 | |
| 411 | var mysticky_welcomebar_form_pos = $( '#sticky-header-welcome-bar' ).offset().top; |
| 412 | if($(".show-on-apper").length && $(".mysticky-welcomebar-setting-right").length) { |
| 413 | var topPos = $(".show-on-apper").offset().top - $(window).scrollTop() - 750; |
| 414 | if (topPos < 0) { |
| 415 | topPos = Math.abs(topPos); |
| 416 | jQuery(".mysticky-welcomebar-setting-right").css("margin-top", ((-1)*topPos)+"px"); |
| 417 | } else { |
| 418 | jQuery(".mysticky-welcomebar-setting-right").css("margin-top", "0"); |
| 419 | } |
| 420 | } |
| 421 | |
| 422 | var position_screen = (isRtl == 1 ) ? 'left' : 'right'; |
| 423 | |
| 424 | if ( ( mysticky_welcomebar_form_pos + 32 ) < $(window).scrollTop() ) { |
| 425 | $( '.mysticky-welcomebar-setting-right' ).css( 'position', 'fixed' ); |
| 426 | $( '.mysticky-welcomebar-setting-right' ).css( position_screen, '40px' ); |
| 427 | |
| 428 | if ( windowsize < 1181 && windowsize > 768 && position_screen == 'right' ) { |
| 429 | $( '.mysticky-welcomebar-setting-right' ).css( position_screen, '30px' ); |
| 430 | |
| 431 | }else if ( windowsize <= 768 && position_screen == 'right' ) { |
| 432 | $( '.mysticky-welcomebar-setting-right' ).css( position_screen, '25px' ); |
| 433 | } |
| 434 | |
| 435 | if ( windowsize < 1181 && windowsize > 768 && position_screen == 'left') { |
| 436 | $( '.mysticky-welcomebar-setting-right' ).css( position_screen, '30px' ); |
| 437 | }else if ( windowsize <= 768 && position_screen == 'left') { |
| 438 | $( '.mysticky-welcomebar-setting-right' ).css( position_screen, '25px' ); |
| 439 | } |
| 440 | } else { |
| 441 | $( '.mysticky-welcomebar-setting-right' ).css( 'position', 'absolute' ); |
| 442 | $( '.mysticky-welcomebar-setting-right' ).css( position_screen, '20px' ); |
| 443 | |
| 444 | if ( windowsize < 1181 && position_screen == 'right') { |
| 445 | $( '.mysticky-welcomebar-setting-right' ).css( position_screen, '10px' ); |
| 446 | } |
| 447 | |
| 448 | if ( windowsize < 1181 && position_screen == 'left') { |
| 449 | $( '.mysticky-welcomebar-setting-right' ).css( position_screen, '10px' ); |
| 450 | } |
| 451 | } |
| 452 | |
| 453 | |
| 454 | } |
| 455 | |
| 456 | jQuery(document).on("click",".mystickymenu-delete-widget",function(e){ |
| 457 | e.preventDefault(); |
| 458 | |
| 459 | var widget_id = jQuery(this).data("widget-id"); |
| 460 | jQuery("#widget-delete-dialog-"+widget_id).show(); |
| 461 | jQuery("#mystickymenu-delete-popup-overlay-"+widget_id).show(); |
| 462 | }); |
| 463 | |
| 464 | /* Mystickymenu: Dashbaord table delete button click action */ |
| 465 | |
| 466 | jQuery(document).on("click",".btn-delete",function(e){ |
| 467 | e.preventDefault(); |
| 468 | var delWidId = jQuery(this).data("id"); |
| 469 | jQuery.ajax({ |
| 470 | url: ajaxurl, |
| 471 | type:'post', |
| 472 | data: 'action=stickymenu_widget_delete&widget_id=' + delWidId + '&widget_delete=1&wpnonce=' + mystickymenu.ajax_nonce, |
| 473 | success: function( data ){ |
| 474 | $( '#stickymenu-widget-' + delWidId ).remove(); |
| 475 | setTimeout('location.reload()', 500); |
| 476 | }, |
| 477 | }); |
| 478 | }); |
| 479 | |
| 480 | |
| 481 | jQuery(document).on("click",".btn-delete-cancel",function(e){ |
| 482 | e.preventDefault(); |
| 483 | var id = jQuery(this).data("id"); |
| 484 | jQuery("#widget-delete-dialog-"+id).hide(); |
| 485 | jQuery("#mystickymenu-delete-popup-overlay-"+id).hide(); |
| 486 | }); |
| 487 | |
| 488 | /* Mystickymenu: Dashbaord table welcombar widget status change action */ |
| 489 | |
| 490 | jQuery(document).on("click",".mystickymenu-widget-enabled",function(){ |
| 491 | var widget_id = $(this).data('id'); |
| 492 | if(jQuery(this).prop("checked") != true){ |
| 493 | jQuery('#widget-status-dialog-' + widget_id).show(); |
| 494 | jQuery('#mystickymenu-status-popup-overlay-' + widget_id).show(); |
| 495 | }else{ |
| 496 | var widget_status = 1; |
| 497 | set_widget_status( widget_id, widget_status ); |
| 498 | } |
| 499 | }); |
| 500 | |
| 501 | jQuery(document).on("click",".btn-turnoff-status",function(e){ |
| 502 | e.preventDefault(); |
| 503 | var widget_id = $(this).data('id'); |
| 504 | |
| 505 | if ( typeof widget_id !== "undefined") { |
| 506 | var widget_status = 0; |
| 507 | set_widget_status( widget_id, widget_status ); |
| 508 | } |
| 509 | |
| 510 | }); |
| 511 | |
| 512 | |
| 513 | jQuery(document).on("click",".btn-nevermind-status",function(e){ |
| 514 | e.preventDefault(); |
| 515 | var widget_id = $(this).data('id'); |
| 516 | if ( typeof widget_id !== "undefined") { |
| 517 | var widget_status = 1; |
| 518 | set_widget_status( widget_id, widget_status ); |
| 519 | jQuery("#mystickymenu-widget-enabled-"+widget_id).prop('checked', true) |
| 520 | } |
| 521 | |
| 522 | }); |
| 523 | |
| 524 | jQuery(document).on("click",".mystickymenupopup-overlay",function(e){ |
| 525 | e.preventDefault(); |
| 526 | |
| 527 | if(jQuery(this).data("fromoverlay") == 'welcombar_delete'){ |
| 528 | jQuery(this).hide(); |
| 529 | var delId = jQuery(this).data('id'); |
| 530 | jQuery('#widget-delete-dialog-'+delId).hide(); |
| 531 | } |
| 532 | }); |
| 533 | |
| 534 | jQuery(document).on("click",".mystickymenupopup-widget-status-overlay",function(e){ |
| 535 | e.preventDefault(); |
| 536 | var widget_id = $(this).data('id'); |
| 537 | var widget_status = 1; |
| 538 | set_widget_status( widget_id, widget_status ); |
| 539 | jQuery("#mystickymenu-widget-enabled-"+widget_id).prop('checked', true); |
| 540 | |
| 541 | }); |
| 542 | |
| 543 | function set_widget_status( widget_id, widget_status ) { |
| 544 | jQuery.ajax({ |
| 545 | url: ajaxurl, |
| 546 | type:'post', |
| 547 | data: 'action=mystickymenu_widget_status&widget_id='+widget_id+'&widget_status=' + widget_status +'&wpnonce=' + mystickymenu.ajax_nonce, |
| 548 | success: function( data ){ |
| 549 | $('#widget-status-dialog-' + widget_id).hide(); |
| 550 | $('#mystickymenu-status-popup-overlay-' + widget_id).hide(); |
| 551 | }, |
| 552 | }); |
| 553 | } |
| 554 | |
| 555 | jQuery(document).on("click","#close-first-popup, .btn-close-dashboard",function(e){ |
| 556 | e.preventDefault(); |
| 557 | jQuery('.first-widget-popup').hide(); |
| 558 | jQuery('.mystickymenupopup-overlay').hide(); |
| 559 | }); |
| 560 | |
| 561 | jQuery(document).on("click","#first_widget_overlay",function(){ |
| 562 | jQuery('.first-widget-popup').hide(); |
| 563 | jQuery(this).hide(); |
| 564 | }); |
| 565 | |
| 566 | |
| 567 | |
| 568 | jQuery(document).on("click","#btn-config-disable",function(e){ |
| 569 | e.preventDefault(); |
| 570 | jQuery("#stickymenu_status_popupbox").show(); |
| 571 | jQuery("#stickymenuconfig-overlay-popup").show(); |
| 572 | }); |
| 573 | |
| 574 | jQuery(document).on("click","#stickymenuconfig-overlay-popup",function(){ |
| 575 | jQuery("#stickymenu_status_popupbox").hide(); |
| 576 | jQuery(this).hide(); |
| 577 | }); |
| 578 | |
| 579 | jQuery(document).on("click","#stickymenu_status_turnoff",function(e){ |
| 580 | e.preventDefault(); |
| 581 | var stickymenu_status = 0; |
| 582 | set_stickymenu_status( stickymenu_status ); |
| 583 | }); |
| 584 | |
| 585 | jQuery(document).on("click","#stickymenu_status_nevermind",function(e){ |
| 586 | e.preventDefault(); |
| 587 | jQuery("#stickymenu_status_popupbox").hide(); |
| 588 | jQuery("#stickymenuconfig-overlay-popup").hide(); |
| 589 | }); |
| 590 | |
| 591 | function set_stickymenu_status( stickymenu_status ){ |
| 592 | jQuery.ajax({ |
| 593 | url: ajaxurl, |
| 594 | type:'post', |
| 595 | data: 'action=stickymenu_status_update&stickymenu_status=' + stickymenu_status +'&wpnonce=' + mystickymenu.ajax_nonce, |
| 596 | success: function( data ){ |
| 597 | location.reload(); |
| 598 | }, |
| 599 | }); |
| 600 | } |
| 601 | |
| 602 | jQuery(document).on("click",".close-button",function(){ |
| 603 | if(jQuery(this).data("from") == 'welcome-bar-status'){ |
| 604 | var id = jQuery(this).data("id"); |
| 605 | jQuery("#widget-status-dialog-"+id).hide(); |
| 606 | jQuery("#mystickymenu-status-popup-overlay-"+id).hide(); |
| 607 | var widget_status = 1; |
| 608 | set_widget_status( id, widget_status ); |
| 609 | jQuery("#mystickymenu-widget-enabled-"+id).prop('checked', true) |
| 610 | |
| 611 | }else if( jQuery(this).data("from") == "stickymenu-status"){ |
| 612 | jQuery("#stickymenu_status_popupbox").hide(); |
| 613 | jQuery("#stickymenuconfig-overlay-popup").hide(); |
| 614 | |
| 615 | }else if( jQuery(this).data("from") == "stickymenu-confirm" ){ |
| 616 | jQuery("#mysticky-sticky-save-confirm").hide(); |
| 617 | jQuery("#stickymenu-option-overlay-popup").hide(); |
| 618 | }else if( jQuery(this).data("from") == "welcombar-confirm" ){ |
| 619 | jQuery("#welcomebar-save-confirm").hide(); |
| 620 | jQuery("#welcombar-sbmtvalidation-overlay-popup").hide(); |
| 621 | }else{ |
| 622 | var id = jQuery(this).data("id"); |
| 623 | jQuery("#widget-delete-dialog-"+id).hide(); |
| 624 | jQuery("#mystickymenu-delete-popup-overlay-"+id).hide(); |
| 625 | } |
| 626 | }); |
| 627 | |
| 628 | |
| 629 | jQuery(document).on("click","#stickymenu-option-overlay-popup",function(){ |
| 630 | $("#mysticky-sticky-save-confirm").hide(); |
| 631 | $(this).hide(); |
| 632 | }); |
| 633 | |
| 634 | |
| 635 | jQuery(document).on("click","#welcombar-sbmtvalidation-overlay-popup",function(){ |
| 636 | $("#welcomebar-save-confirm").hide(); |
| 637 | $(this).hide(); |
| 638 | }); |
| 639 | |
| 640 | |
| 641 | jQuery(document).on("change","#mysticky-welcomebar-countdown-enabled",function(){ |
| 642 | var url = jQuery(this).data("url"); |
| 643 | jQuery(this).prop('checked',false); |
| 644 | window.open(url, '_blank'); |
| 645 | }); |
| 646 | |
| 647 | jQuery(document).on("click",".btn-save-stickymenu" , function(event){ |
| 648 | if ( $( '#mysticky-stickymenu-form-enabled' ).prop( 'checked' ) == false && $('#save_stickymenu').val() == "" ) { |
| 649 | event.preventDefault(); |
| 650 | $("#mysticky-sticky-save-confirm").show(); |
| 651 | $("#stickymenu-option-overlay-popup").show(); |
| 652 | |
| 653 | $('#stickymenu_status_ok').attr('data-clickfrom', 'save'); |
| 654 | $('#stickymenu_status_dolater').attr('data-clickfrom', 'save'); |
| 655 | } |
| 656 | }); |
| 657 | |
| 658 | jQuery(document).on("click",".save_view_dashboard" , function(event){ |
| 659 | if ( $( '#mysticky-stickymenu-form-enabled' ).prop( 'checked' ) == false && $('#save_stickymenu').val() == "" ) { |
| 660 | event.preventDefault(); |
| 661 | $("#mysticky-sticky-save-confirm").show(); |
| 662 | $("#stickymenu-option-overlay-popup").show(); |
| 663 | |
| 664 | $('#stickymenu_status_ok').attr('data-clickfrom', 'dashboard'); |
| 665 | $('#stickymenu_status_dolater').attr('data-clickfrom', 'dashboard'); |
| 666 | } |
| 667 | }); |
| 668 | |
| 669 | jQuery(document).on("click","#stickymenu_status_ok",function(){ |
| 670 | var clickFrom = $(this).data("clickfrom"); |
| 671 | $('#save_stickymenu').val("1"); |
| 672 | $( '#mysticky-stickymenu-form-enabled' ).prop( 'checked' , true ) |
| 673 | $("#mysticky-sticky-save-confirm").hide(); |
| 674 | $("#stickymenu-option-overlay-popup").hide(); |
| 675 | if(clickFrom == 'dashboard'){ |
| 676 | $('.save_view_dashboard').trigger("click"); |
| 677 | }else{ |
| 678 | $('.btn-save-stickymenu').trigger("click"); |
| 679 | } |
| 680 | }); |
| 681 | |
| 682 | jQuery(document).on("click","#stickymenu_status_dolater",function(){ |
| 683 | var clickFrom = $(this).data("clickfrom"); |
| 684 | $('#save_stickymenu').val("1"); |
| 685 | if(clickFrom == 'dashboard'){ |
| 686 | $('.save_view_dashboard').trigger("click"); |
| 687 | }else{ |
| 688 | $('.btn-save-stickymenu').trigger("click"); |
| 689 | } |
| 690 | }); |
| 691 | |
| 692 | jQuery(document).on( 'click','.welcombar_save', function(e){ |
| 693 | |
| 694 | if ( $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_enable]"]' ).prop( 'checked' ) == false && $( 'input#save_welcome_bar' ).val() == '' ) { |
| 695 | e.preventDefault(); |
| 696 | $("#welcomebar-save-confirm").show(); |
| 697 | $("#welcombar-sbmtvalidation-overlay-popup").show(); |
| 698 | $("#welcombar_sbmtbtn_off").attr("data-clickfrom",'save_button'); |
| 699 | $("#welcomebar_yes_sbmtbtn").attr("data-clickfrom",'save_button'); |
| 700 | } |
| 701 | }); |
| 702 | |
| 703 | |
| 704 | jQuery(document).on( 'click','.save_view_dashboard', function(e){ |
| 705 | |
| 706 | if ( $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_enable]"]' ).prop( 'checked' ) == false && $( 'input#save_welcome_bar' ).val() == '' ) { |
| 707 | e.preventDefault(); |
| 708 | $("#welcomebar-save-confirm").show(); |
| 709 | $("#welcombar-sbmtvalidation-overlay-popup").show(); |
| 710 | $("#welcombar_sbmtbtn_off").attr("data-clickfrom",'save_dashboard_button'); |
| 711 | $("#welcomebar_yes_sbmtbtn").attr("data-clickfrom",'save_dashboard_button'); |
| 712 | } |
| 713 | }); |
| 714 | $( document ).on( 'change', '#mysticky-welcomebar-contact-form-enabled', function(){ |
| 715 | $("span.mystickybar-visible, span.mystickybar-hidden").hide(); |
| 716 | if( $(this).prop('checked') == true ) { |
| 717 | $("span.mystickybar-visible").show(); |
| 718 | } else { |
| 719 | $("span.mystickybar-hidden").show(); |
| 720 | } |
| 721 | }) |
| 722 | |
| 723 | jQuery(document).on("click","#welcomebar_yes_sbmtbtn",function(){ |
| 724 | |
| 725 | var clickFrom = $(this).data("clickfrom"); |
| 726 | |
| 727 | $("#welcomebar-save-confirm").hide(); |
| 728 | $("#welcombar-sbmtvalidation-overlay-popup").hide(); |
| 729 | $( 'input#welcome_save_anyway' ).val('1'); |
| 730 | $( 'input#save_welcome_bar' ).val('1'); |
| 731 | $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_enable]"]' ).prop( 'checked',true ); |
| 732 | if(clickFrom == 'save_dashboard_button'){ |
| 733 | $( '.mysticky-welcomebar-submit input.save_view_dashboard' ).trigger('click'); |
| 734 | }else{ |
| 735 | $( '.mysticky-welcomebar-submit input.welcombar_save' ).trigger('click'); |
| 736 | } |
| 737 | }); |
| 738 | |
| 739 | jQuery(document).on("click","#welcombar_sbmtbtn_off",function(){ |
| 740 | var clickFrom = $(this).data("clickfrom"); |
| 741 | |
| 742 | $("#welcomebar-save-confirm").hide(); |
| 743 | $("#welcombar-sbmtvalidation-overlay-popup").hide(); |
| 744 | $( 'input#welcome_save_anyway' ).val('1'); |
| 745 | $( 'input#save_welcome_bar' ).val('1'); |
| 746 | |
| 747 | if(clickFrom == 'save_dashboard_button'){ |
| 748 | $( '.mysticky-welcomebar-submit input.save_view_dashboard' ).trigger('click'); |
| 749 | }else{ |
| 750 | $( '.mysticky-welcomebar-submit input.welcombar_save' ).trigger('click'); |
| 751 | } |
| 752 | }); |
| 753 | |
| 754 | jQuery(document).on("click","#mysticky-welcomebar-showcoupon-enabled",function(){ |
| 755 | var url = jQuery(this).data("url"); |
| 756 | jQuery(this).prop('checked',false); |
| 757 | window.open(url, '_blank'); |
| 758 | }); |
| 759 | |
| 760 | jQuery(document).on("change","#mysticky-welcomebar-collectlead-enabled",function(){ |
| 761 | |
| 762 | var button_text = $(this).data("button-text"); |
| 763 | |
| 764 | if( $(this).prop("checked") == true ){ |
| 765 | |
| 766 | $(".timer-message").show(); |
| 767 | $(".mysticky-welcomebar-collect-lead").show(); |
| 768 | $(".welcomebar_height_content").hide(); |
| 769 | $(".mysticky-welcomebar-preview-screen .mysticky-welcomebar-fixed .mysticky-welcomebar-content").css("width","90%"); |
| 770 | $(".mysticky-welcomebar-lead-content").show(); |
| 771 | $(".mysticky-welcomebar-btn a").text("Send me"); |
| 772 | $("#mysticky_welcomebar_btn_text").val("Send me"); |
| 773 | $(".mysticky-welcomebar-btn").addClass("collect-lead"); |
| 774 | $(".height-setting").hide(); |
| 775 | }else{ |
| 776 | |
| 777 | button_text = ( button_text == 'Send me' ) ? 'Got it!' : button_text; |
| 778 | $(".timer-message").hide(); |
| 779 | $(".welcomebar_height_content").show(); |
| 780 | $(".mysticky-welcomebar-collect-lead").hide(); |
| 781 | $(".mysticky-welcomebar-preview-screen .mysticky-welcomebar-fixed .mysticky-welcomebar-content").css("width","75%"); |
| 782 | $(".mysticky-welcomebar-lead-content").hide(); |
| 783 | $(".mysticky-welcomebar-btn a").text(button_text); |
| 784 | $("#mysticky_welcomebar_btn_text").val(button_text); |
| 785 | $(".height-setting").show(); |
| 786 | $(".mysticky-welcomebar-btn").removeClass("collect-lead"); |
| 787 | } |
| 788 | }); |
| 789 | |
| 790 | jQuery(document).on("click","#send_lead_email_enable",function(){ |
| 791 | var url = jQuery(this).data("url"); |
| 792 | jQuery(this).prop('checked',false); |
| 793 | window.open(url, '_blank'); |
| 794 | }); |
| 795 | |
| 796 | |
| 797 | jQuery(document).on("keyup","#lead-name-placeholder,#lead-email-placeholder,#lead-phone-placeholder",function(e){ |
| 798 | if( $(this).attr("id") == "lead-name-placeholder" ){ |
| 799 | $(".preview-lead-name").attr("placeholder",$(this).val()); |
| 800 | }else if( $(this).attr("id") == "lead-email-placeholder" ){ |
| 801 | $(".preview-lead-email").attr("placeholder",$(this).val()); |
| 802 | }else{ |
| 803 | $(".preview-lead-phone").attr("placeholder",$(this).val()); |
| 804 | } |
| 805 | }); |
| 806 | /* Welcomebar Text*/ |
| 807 | jQuery(document).on("change","input[name='mysticky_option_welcomebar[mysticky_welcomebar_text_type]']",function(){ |
| 808 | if( $(this).val() == 'static_text' ){ |
| 809 | $("#mysticky_welcomebar_static_text_setting").show(); |
| 810 | $("#mysticky_welcomebar_sliding_text_setting").hide(); |
| 811 | $("#mysticky_welcomebar_sliding_text_transition_style,#mysticky_welcomebar_sliding_text_transition_speed").hide(); |
| 812 | }else{ |
| 813 | $("#mysticky_welcomebar_static_text_setting").hide(); |
| 814 | $("#mysticky_welcomebar_sliding_text_setting").show(); |
| 815 | $("#mysticky_welcomebar_sliding_text_transition_style,#mysticky_welcomebar_sliding_text_transition_speed").show(); |
| 816 | } |
| 817 | |
| 818 | }); |
| 819 | |
| 820 | jQuery(document).on("change","input[name='mysticky_option_welcomebar[mysticky_welcomebar_lead_input]']",function(){ |
| 821 | if( $(this).val() == 'email_address' ){ |
| 822 | $("#lead-email-content").show(); |
| 823 | $("#lead-phone-content").hide(); |
| 824 | $(".preview-lead-email").show(); |
| 825 | $(".preview-lead-phone").hide(); |
| 826 | }else{ |
| 827 | $("#lead-email-content").hide(); |
| 828 | $("#lead-phone-content").show(); |
| 829 | $(".preview-lead-email").hide(); |
| 830 | $(".preview-lead-phone").show(); |
| 831 | } |
| 832 | |
| 833 | }); |
| 834 | |
| 835 | /* Mystickymenu : Single delete contact lead data - Contact lead page */ |
| 836 | |
| 837 | jQuery(document).on("click",".mystickymenu-delete-entry",function(event){ |
| 838 | |
| 839 | var deleterowid = $( this ).attr( "data-delete" ); |
| 840 | var confirm_delete = window.confirm("Are you sure you want to delete Record with ID# "+deleterowid); |
| 841 | if (confirm_delete == true) { |
| 842 | jQuery.ajax({ |
| 843 | type: 'POST', |
| 844 | url: ajaxurl, |
| 845 | data: {"action": "mystickymenu_delete_contact_lead","ID": deleterowid, delete_nonce: jQuery("#delete_nonce").val(),"wpnonce": mystickymenu.ajax_nonce}, |
| 846 | success: function(data){ |
| 847 | location.href = window.location.href; |
| 848 | }, |
| 849 | error: function(XMLHttpRequest, textStatus, errorThrown) { |
| 850 | alert("Status: " + textStatus); alert("Error: " + errorThrown); |
| 851 | } |
| 852 | }); |
| 853 | } |
| 854 | |
| 855 | }); |
| 856 | |
| 857 | /* Mystickymenu : Bulk delete all contact lead data - Contact lead page */ |
| 858 | |
| 859 | jQuery(document).on("click","#mystickymenu_delete_all_leads", function(){ |
| 860 | var confirm_delete = window.confirm("Are you sure you want to delete all Record from the database?"); |
| 861 | if (confirm_delete == true) { |
| 862 | jQuery.ajax({ |
| 863 | type: 'POST', |
| 864 | url: ajaxurl, |
| 865 | data: {"action": "mystickymenu_delete_contact_lead", 'all_leads': 1 , delete_nonce: jQuery("#delete_nonce").val(),"wpnonce": mystickymenu.ajax_nonce}, |
| 866 | success: function(data){ |
| 867 | location.href = window.location.href; |
| 868 | }, |
| 869 | error: function(XMLHttpRequest, textStatus, errorThrown) { |
| 870 | alert("Status: " + textStatus); alert("Error: " + errorThrown); |
| 871 | } |
| 872 | }); |
| 873 | } |
| 874 | return false; |
| 875 | }); |
| 876 | |
| 877 | /* Mystickymenu : Bulk do action trigger in contact lead table */ |
| 878 | |
| 879 | jQuery(document).on('click','#doaction',function(e){ |
| 880 | e.preventDefault(); |
| 881 | var bulks = []; |
| 882 | jQuery( '.cb-select-blk' ).each( function(){ |
| 883 | if (this.checked) { |
| 884 | bulks.push( jQuery(this).val() ); |
| 885 | } |
| 886 | } ); |
| 887 | |
| 888 | jQuery.ajax({ |
| 889 | type: 'POST', |
| 890 | url: ajaxurl, |
| 891 | data: {"action": "my_sticky_menu_bulks","bulks": bulks,"wpnonce": mystickymenu.ajax_nonce}, |
| 892 | success: function(data){ |
| 893 | location.href = window.location.href; |
| 894 | }, |
| 895 | error: function(XMLHttpRequest, textStatus, errorThrown) { |
| 896 | alert("Status: " + textStatus); alert("Error: " + errorThrown); |
| 897 | } |
| 898 | }); |
| 899 | } ); |
| 900 | |
| 901 | jQuery(document).on( 'change','#mysticky-welcomebar-close-automatically-enabled', function(){ |
| 902 | $(this).prop("checked",false); |
| 903 | var url = $(this).data("url"); |
| 904 | window.open(url, '_blank'); |
| 905 | }); |
| 906 | |
| 907 | jQuery(document).on("click",".save_change",function(){ |
| 908 | $( '.mysticky-welcomebar-submit input.welcombar_save' ).trigger('click'); |
| 909 | }); |
| 910 | |
| 911 | jQuery(document).on( 'change','#mysticky_welcomebar_show_success_message', function(){ |
| 912 | if( $( this ).prop( "checked" ) == true ) { |
| 913 | $('#mysticky-welcomebar-thankyou-wrap').show(); |
| 914 | } else { |
| 915 | $('#mysticky-welcomebar-thankyou-wrap').hide(); |
| 916 | } |
| 917 | }); |
| 918 | |
| 919 | //rating popup |
| 920 | $(document).on("keyup", "#upgrade-review-comment", function(){ |
| 921 | var commentLength = 1000 - parseInt($.trim($(this).val()).length); |
| 922 | if(commentLength < 0) { |
| 923 | var userComment = $.trim($(this).val()); |
| 924 | userComment = userComment.slice(0, 1000); |
| 925 | $(".upgrade-review-textarea label span").text(0); |
| 926 | $(this).val(userComment); |
| 927 | } else { |
| 928 | $(".upgrade-review-textarea label span").text(commentLength); |
| 929 | } |
| 930 | }); |
| 931 | |
| 932 | $(document).on("change", "#upgrade-review-comment", function(){ |
| 933 | var commentLength = 1000 - parseInt($.trim($(this).val()).length); |
| 934 | if(commentLength < 0) { |
| 935 | var userComment = $.trim($(this).val()); |
| 936 | userComment = userComment.slice(0, 1000); |
| 937 | $(".upgrade-review-textarea label span").text(0); |
| 938 | $(this).val(userComment); |
| 939 | } else { |
| 940 | $(".upgrade-review-textarea label span").text(commentLength); |
| 941 | } |
| 942 | }); |
| 943 | |
| 944 | $(document).ready( |
| 945 | function () { |
| 946 | if( $("#mystickymenu-rating").length != 0 ) { |
| 947 | $("#rating-modal-popup").show(); |
| 948 | $("#mystickymenu-rating").starRating({ |
| 949 | initialRating : 0, |
| 950 | useFullStars : true, |
| 951 | strokeColor : '#FDB10C', |
| 952 | ratedColor : '#FDB10C', |
| 953 | activeColor : '#FDB10C', |
| 954 | strokeWidth : 0, |
| 955 | minRating : 1, |
| 956 | starSize : 32, |
| 957 | useGradient : 0, |
| 958 | onHover: function(currentRate) { |
| 959 | $(".upgrade-user-rating span").text(currentRate+"/5"); |
| 960 | $(".upgrade-user-rating" ).css('visibility', 'visible'); |
| 961 | }, |
| 962 | onLeave: function(currentRate) { |
| 963 | $(".upgrade-user-rating" ).css('visibility', 'hidden'); |
| 964 | }, |
| 965 | callback( currentRate ) { |
| 966 | console.log(currentRate); |
| 967 | if( currentRate !== 5 ) { |
| 968 | $(".rating-modal-steps").removeClass("active"); |
| 969 | $(".rating-modal-steps#step-2").addClass("active"); |
| 970 | $("#mystickymenu-rated-rating").html(""); |
| 971 | for(let i=0 ; i< parseInt(currentRate); i++) { |
| 972 | 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>'; |
| 973 | $("#mystickymenu-rated-rating").append(ratingStar); |
| 974 | } |
| 975 | } else { |
| 976 | window.open("https://wordpress.org/support/plugin/mystickymenu/reviews/#new-post", '_blank'); |
| 977 | set_mystickymenu_review_reminder(-1); |
| 978 | } |
| 979 | } |
| 980 | }) |
| 981 | } |
| 982 | |
| 983 | $(document).on("click", ".close-popup-button a.hide-upgrade-modal", function(){ |
| 984 | if($(".rating-modal-steps#step-3").hasClass("active")) { |
| 985 | set_mystickymenu_review_reminder(14); |
| 986 | } else { |
| 987 | $(".rating-modal-steps").removeClass("active"); |
| 988 | $(".rating-modal-steps#step-3").addClass("active"); |
| 989 | } |
| 990 | }); |
| 991 | |
| 992 | $(document).on("click", "#upgrade-review-button", function(){ |
| 993 | $("#rating-modal-popup").hide(); |
| 994 | var review_reminder = ($('.upgrade-review-reminder').length >= 1) ? $('.upgrade-review-reminder').val(): "-1"; |
| 995 | jQuery.ajax({ |
| 996 | type:'post', |
| 997 | url: mystickymenu.ajaxurl, |
| 998 | data: { |
| 999 | action: "mystickymenu_review_box_message", |
| 1000 | rating: $("#mystickymenu-rated-rating .jq-star").length, |
| 1001 | nonce: mystickymenu.ajax_nonce, |
| 1002 | message: $.trim($("#upgrade-review-comment").val()) |
| 1003 | }, |
| 1004 | success: function() { |
| 1005 | set_mystickymenu_review_reminder(review_reminder); |
| 1006 | } |
| 1007 | }); |
| 1008 | }); |
| 1009 | |
| 1010 | |
| 1011 | function set_mystickymenu_review_reminder(noOfDays) { |
| 1012 | $.ajax({ |
| 1013 | type: "post", |
| 1014 | url: mystickymenu.ajaxurl, |
| 1015 | data: { |
| 1016 | action: "mystickymenu_review_box", |
| 1017 | days: noOfDays, |
| 1018 | nonce: mystickymenu.ajax_nonce |
| 1019 | }, |
| 1020 | |
| 1021 | success: function() { |
| 1022 | |
| 1023 | } |
| 1024 | }); |
| 1025 | $("#rating-modal-popup").remove(); |
| 1026 | } |
| 1027 | |
| 1028 | $(document).on("click", ".mystickymenu-popup-form", function( e ){ |
| 1029 | if ( $(e.target).attr('id') == 'rating-modal-popup' ) { |
| 1030 | let step_id = $( '#rating-modal-popup .rating-modal-steps.active' ).attr( 'id') ; |
| 1031 | |
| 1032 | if ( step_id == 'step-1' ) { |
| 1033 | $(".rating-modal-steps").removeClass("active"); |
| 1034 | $(".rating-modal-steps#step-3").addClass("active"); |
| 1035 | } |
| 1036 | |
| 1037 | if ( step_id == 'step-3' ) { |
| 1038 | $('#upgrade-review-reminder option[value="14"]').attr("selected", "selected"); |
| 1039 | $( "#upgrade-review-button" ).trigger( 'click'); |
| 1040 | } |
| 1041 | } |
| 1042 | |
| 1043 | }); |
| 1044 | |
| 1045 | }); |
| 1046 | |
| 1047 | })(jQuery); |
| 1048 |