detectmobilebrowser.js
7 years ago
iris-script.js
6 years ago
mystickymenu-admin.js
6 years ago
mystickymenu.js
6 years ago
mystickymenu.min.js
6 years ago
select2.min.js
6 years ago
mystickymenu-admin.js
367 lines
| 1 | (function( $ ) { |
| 2 | "use strict"; |
| 3 | |
| 4 | jQuery(document).ready(function($){ |
| 5 | |
| 6 | $(document).on("click", ".updates-content-buttons button", function(){ |
| 7 | var updateStatus = 0; |
| 8 | if($(this).hasClass("yes")) { |
| 9 | updateStatus = 1; |
| 10 | } |
| 11 | $(".updates-content-buttons button").attr("disabled", true); |
| 12 | $.ajax({ |
| 13 | url: ajaxurl, |
| 14 | data: "action=sticky_menu_update_status&status="+updateStatus+"&nonce="+$("#myStickymenu_update_nonce").val()+"&email="+$("#myStickymenu_update_email").val(), |
| 15 | type: 'post', |
| 16 | cache: false, |
| 17 | success: function(){ |
| 18 | window.location.reload(); |
| 19 | } |
| 20 | }) |
| 21 | }); |
| 22 | |
| 23 | var handle = $( "#custom-handle" ); |
| 24 | $( "#slider" ).slider({ |
| 25 | create: function() { |
| 26 | handle.text( $( this ).slider( "value" ) ); |
| 27 | handle.text( $('#myfixed_opacity').val() ); |
| 28 | handle.css('left', $('#myfixed_opacity').val() + '%') |
| 29 | }, |
| 30 | slide: function( event, ui ) { |
| 31 | $('#myfixed_opacity').val(ui.value); |
| 32 | handle.text( ui.value ); |
| 33 | } |
| 34 | }); |
| 35 | jQuery( |
| 36 | '<div class="pt_number"><div class="pt_numberbutton pt_numberup">+</div><div class="pt_numberbutton pt_numberdown">-</div></div>' |
| 37 | ).insertAfter("input.mysticky-number1"); |
| 38 | |
| 39 | jQuery(".mystickynumber1").each(function() { |
| 40 | |
| 41 | var spinner = jQuery(this), |
| 42 | input = spinner.find('input[type="number"]'), |
| 43 | btnUp = spinner.find(".pt_numberup"), |
| 44 | btnDown = spinner.find(".pt_numberdown"), |
| 45 | min = input.attr("min"), |
| 46 | max = input.attr("max"), |
| 47 | valOfAmout = input.val(), |
| 48 | newVal = 0; |
| 49 | |
| 50 | btnUp.on("click", function() { |
| 51 | |
| 52 | var oldValue = parseFloat(input.val()); |
| 53 | |
| 54 | if (oldValue >= max) { |
| 55 | var newVal = oldValue; |
| 56 | } else { |
| 57 | var newVal = oldValue + 1; |
| 58 | } |
| 59 | spinner.find("input").val(newVal); |
| 60 | spinner.find("input").trigger("change"); |
| 61 | console.log(newVal); |
| 62 | }); |
| 63 | btnDown.on("click", function() { |
| 64 | var oldValue = parseFloat(input.val()); |
| 65 | if (oldValue <= min) { |
| 66 | var newVal = oldValue; |
| 67 | } else { |
| 68 | var newVal = oldValue - 1; |
| 69 | } |
| 70 | spinner.find("input").val(newVal); |
| 71 | spinner.find("input").trigger("change"); |
| 72 | }); |
| 73 | }); |
| 74 | |
| 75 | |
| 76 | $(".confirm").on( 'click', function() { |
| 77 | return window.confirm("Reset to default settings?"); |
| 78 | }); |
| 79 | |
| 80 | var flag = 0; |
| 81 | $( "#mystickymenu-select option" ).each(function( i ) { |
| 82 | |
| 83 | if ($('select#mystickymenu-select option:selected').val() !== '' ) { |
| 84 | flag = 1; |
| 85 | } |
| 86 | if( $('select#mystickymenu-select option:selected').val() == $(this).val() ){ |
| 87 | $('#mysticky_class_selector').show(); |
| 88 | }else { |
| 89 | $('#mysticky_class_selector').hide(); |
| 90 | } |
| 91 | }); |
| 92 | if ( flag === 0 ) { |
| 93 | $('#mysticky_class_selector').show(); |
| 94 | $("select#mystickymenu-select option[value=custom]").attr('selected', 'selected'); |
| 95 | } |
| 96 | |
| 97 | $("#mystickymenu-select").on( 'change', function() { |
| 98 | if ($(this).val() == 'custom' ) { |
| 99 | $('#mysticky_class_selector').show(); |
| 100 | }else { |
| 101 | $('#mysticky_class_selector').hide(); |
| 102 | } |
| 103 | |
| 104 | }); |
| 105 | /*02-08-2019 welcom bar js*/ |
| 106 | $( '.mysticky-welcomebar-action' ).on( 'change', function(){ |
| 107 | var mysticky_welcomebar_action = $( this ).val(); |
| 108 | if ( mysticky_welcomebar_action == 'redirect_to_url' ) { |
| 109 | $( '.mysticky-welcomebar-redirect' ).show(); |
| 110 | } else { |
| 111 | $( '.mysticky-welcomebar-redirect' ).hide(); |
| 112 | } |
| 113 | if ( $('.mysticky-welcomebar-action option:selected').attr('data-href') !== '' && mysticky_welcomebar_action == 'thankyou_screen' ) { |
| 114 | window.open( $( '.mysticky-welcomebar-action option:selected' ).attr('data-href') , '_blank'); |
| 115 | } |
| 116 | } ); |
| 117 | //$( '#mysticky_welcomebar_expirydate' ).datepicker( ); |
| 118 | //$( "#mysticky_welcomebar_expirydate" ).datepicker( "option", "dateFormat", 'mm/dd/yy' ); |
| 119 | |
| 120 | var page_option_content = ""; |
| 121 | page_option_content = $( '.mysticky-welcomebar-page-options-html' ).html(); |
| 122 | $( '.mysticky-welcomebar-page-options-html' ).remove(); |
| 123 | |
| 124 | $( '#create-rule' ).on( 'click', function(){ |
| 125 | var append_html = page_option_content.replace(/__count__/g, '1', page_option_content); |
| 126 | $( '.mysticky-welcomebar-page-options' ).append( append_html ); |
| 127 | $( '.mysticky-welcomebar-page-options' ).show(); |
| 128 | $( this ).parent().remove(); |
| 129 | }); |
| 130 | $( '.sticky-header-menu ul li a' ).on( 'click', function(){ |
| 131 | if ( $( "#sticky-header-welcome-bar" ).is( ":visible" ) ) { |
| 132 | check_for_preview_pos(); |
| 133 | } |
| 134 | } ); |
| 135 | jQuery(window).scroll(function(){ |
| 136 | if ( $( "#sticky-header-welcome-bar" ).is( ":visible" ) ) { |
| 137 | check_for_preview_pos(); |
| 138 | } |
| 139 | }); |
| 140 | /*Mysticky page target*/ |
| 141 | var mysticky_total_page_option = 0; |
| 142 | var mysticky_page_option_content = ""; |
| 143 | mysticky_total_page_option = $( '.mysticky-page-option' ).length; |
| 144 | mysticky_page_option_content = $( '.mysticky-page-options-html' ).html(); |
| 145 | $( '.mysticky-page-options-html' ).remove(); |
| 146 | |
| 147 | $( '#mysticky_create-rule' ).on( 'click', function(){ |
| 148 | |
| 149 | var append_html = mysticky_page_option_content.replace(/__count__/g, mysticky_total_page_option, mysticky_page_option_content); |
| 150 | mysticky_total_page_option++; |
| 151 | $( '.mysticky-page-options' ).append( append_html ); |
| 152 | $( '.mysticky-page-options .mysticky-page-option' ).removeClass( 'last' ); |
| 153 | $( '.mysticky-page-options .mysticky-page-option:last' ).addClass( 'last' ); |
| 154 | |
| 155 | if( $( '.mysticky-page-option .myStickymenu-upgrade' ).length > 0 ) { |
| 156 | $( this ).remove(); |
| 157 | } |
| 158 | }); |
| 159 | $( document ).on( 'click', '.mysticky-remove-rule', function() { |
| 160 | $( this ).closest( '.mysticky-page-option' ).remove(); |
| 161 | $( '.mysticky-page-options .mysticky-page-option' ).removeClass( 'last' ); |
| 162 | $( '.mysticky-page-options .mysticky-page-option:last' ).addClass( 'last' ); |
| 163 | }); |
| 164 | $( document ).on( 'change', '.mysticky-url-options', function() { |
| 165 | var current_val = jQuery( this ).val(); |
| 166 | var mysticky_welcomebar_siteURL = jQuery( '#mysticky_welcomebar_site_url' ).val(); |
| 167 | var mysticky_welcomebar_newURL = mysticky_welcomebar_siteURL; |
| 168 | if( current_val == 'page_has_url' ) { |
| 169 | mysticky_welcomebar_newURL = mysticky_welcomebar_siteURL; |
| 170 | } else if( current_val == 'page_contains' ) { |
| 171 | mysticky_welcomebar_newURL = mysticky_welcomebar_siteURL + '%s%'; |
| 172 | } else if( current_val == 'page_start_with' ) { |
| 173 | mysticky_welcomebar_newURL = mysticky_welcomebar_siteURL + 's%'; |
| 174 | } else if( current_val == 'page_end_with' ) { |
| 175 | mysticky_welcomebar_newURL = mysticky_welcomebar_siteURL + '%s'; |
| 176 | } |
| 177 | $( this ).closest( '.url-content' ).find( '.mysticky-welcomebar-url' ).text( mysticky_welcomebar_newURL ); |
| 178 | }); |
| 179 | /* welcome bar live preview */ |
| 180 | /* Apply Wp Color Picker */ |
| 181 | var myOptions = { |
| 182 | change: function(event, ui){ |
| 183 | var color_id = $(this).attr('id'); |
| 184 | var slug = $(this).data('slug'); |
| 185 | |
| 186 | var color_code = ui.color.toString(); |
| 187 | if ( color_id === 'mysticky_welcomebar_bgcolor'){ |
| 188 | $('.mysticky-welcomebar-fixed').css('background-color', color_code ); |
| 189 | } |
| 190 | if ( color_id === 'mysticky_welcomebar_bgtxtcolor'){ |
| 191 | $('.mysticky-welcomebar-fixed .mysticky-welcomebar-content p').css('color', color_code ); |
| 192 | } |
| 193 | if ( color_id === 'mysticky_welcomebar_btncolor'){ |
| 194 | $('.mysticky-welcomebar-btn a').css('background-color', color_code ); |
| 195 | } |
| 196 | if ( color_id === 'mysticky_welcomebar_btntxtcolor'){ |
| 197 | $('.mysticky-welcomebar-btn a').css('color', color_code ); |
| 198 | } |
| 199 | } |
| 200 | }; |
| 201 | $('.mysticky-welcomebar-setting-wrap .my-color-field').wpColorPicker(myOptions); |
| 202 | |
| 203 | $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_x_desktop]"]' ).on( 'change', function(){ |
| 204 | if( $( this ).prop( "checked" ) == true ) { |
| 205 | $( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-showx-desktop' ); |
| 206 | } else { |
| 207 | $( '.mysticky-welcomebar-fixed' ).removeClass( 'mysticky-welcomebar-showx-desktop' ); |
| 208 | } |
| 209 | } ); |
| 210 | $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_x_mobile]"]' ).on( 'change', function(){ |
| 211 | if( $( this ).prop( "checked" ) == true ) { |
| 212 | $( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-showx-mobile' ); |
| 213 | } else { |
| 214 | $( '.mysticky-welcomebar-fixed' ).removeClass( 'mysticky-welcomebar-showx-mobile' ); |
| 215 | } |
| 216 | } ); |
| 217 | |
| 218 | $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_btn_desktop]"]' ).on( 'change', function(){ |
| 219 | if( $( this ).prop( "checked" ) == true ) { |
| 220 | $( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-btn-desktop' ); |
| 221 | } else { |
| 222 | $( '.mysticky-welcomebar-fixed' ).removeClass( 'mysticky-welcomebar-btn-desktop' ); |
| 223 | } |
| 224 | |
| 225 | if( $( this ).prop( "checked" ) == false && $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_btn_mobile]"]' ).prop( "checked" ) == false ) { |
| 226 | $( ".mysticky_welcomebar_disable, .mysticky_welcomebar_btn_color button.wp-color-result" ).css({ |
| 227 | 'pointer-events': 'none', |
| 228 | 'opacity': '0.5' |
| 229 | }); |
| 230 | } else { |
| 231 | $( ".mysticky_welcomebar_disable, .mysticky_welcomebar_btn_color button.wp-color-result" ).css({ |
| 232 | 'pointer-events': '', |
| 233 | 'opacity': '' |
| 234 | }); |
| 235 | } |
| 236 | } ); |
| 237 | $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_btn_mobile]"]' ).on( 'change', function(){ |
| 238 | if( $( this ).prop( "checked" ) == true ) { |
| 239 | $( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-btn-mobile' ); |
| 240 | } else { |
| 241 | $( '.mysticky-welcomebar-fixed' ).removeClass( 'mysticky-welcomebar-btn-mobile' ); |
| 242 | } |
| 243 | |
| 244 | if( $( this ).prop( "checked" ) == false && $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_btn_desktop]"]' ).prop( "checked" ) == false ) { |
| 245 | $( ".mysticky_welcomebar_disable, .mysticky_welcomebar_btn_color button.wp-color-result" ).css({ |
| 246 | 'pointer-events': 'none', |
| 247 | 'opacity': '0.5' |
| 248 | }); |
| 249 | } else { |
| 250 | $( ".mysticky_welcomebar_disable, .mysticky_welcomebar_btn_color button.wp-color-result" ).css({ |
| 251 | 'pointer-events': '', |
| 252 | 'opacity': '' |
| 253 | }); |
| 254 | } |
| 255 | } ); |
| 256 | 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 ) { |
| 257 | $( ".mysticky_welcomebar_disable, .mysticky_welcomebar_btn_color button.wp-color-result" ).css({ |
| 258 | 'pointer-events': 'none', |
| 259 | 'opacity': '0.5' |
| 260 | }); |
| 261 | } else { |
| 262 | $( ".mysticky_welcomebar_disable, .mysticky_welcomebar_btn_color button.wp-color-result" ).css({ |
| 263 | 'pointer-events': '', |
| 264 | 'opacity': '' |
| 265 | }); |
| 266 | } |
| 267 | |
| 268 | $( 'select[name="mysticky_option_welcomebar[mysticky_welcomebar_font]"]' ).on( 'change', function(){ |
| 269 | var myfixed_font_val = $( this ).val(); |
| 270 | $( '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">' ); |
| 271 | $( '.mysticky-welcomebar-fixed' ).css( 'font-family', myfixed_font_val ); |
| 272 | } ); |
| 273 | |
| 274 | $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_fontsize]"]' ).on( 'keyup click', function(){ |
| 275 | var mysticky_welcomebar_fontsize_val = $( this ).val(); |
| 276 | $( '.mysticky-welcomebar-fixed p' ).css( 'font-size', mysticky_welcomebar_fontsize_val + 'px' ); |
| 277 | $( '.mysticky-welcomebar-btn a' ).css( 'font-size', mysticky_welcomebar_fontsize_val + 'px' ); |
| 278 | } ); |
| 279 | |
| 280 | $( '#wp-mysticky_bar_text-wrap .wp-editor-tabs button' ).on( 'click', function(){ |
| 281 | if ( $("#wp-mysticky_bar_text-wrap").hasClass("tmce-active") ){ |
| 282 | |
| 283 | } |
| 284 | } ); |
| 285 | |
| 286 | $( document ).on( 'click', '#qt_mysticky_bar_text_toolbar .ed_button', function(){ |
| 287 | $( 'textarea[name="mysticky_option_welcomebar[mysticky_welcomebar_bar_text]"]' ).trigger( 'change keyup click' ); |
| 288 | } ); |
| 289 | |
| 290 | $( 'textarea[name="mysticky_option_welcomebar[mysticky_welcomebar_bar_text]"]' ).on( 'change keyup click', function(e){ |
| 291 | var mysticky_bar_text_val = $( this ).val().replace(/(?:\r\n|\r|\n)/g, '<br />'); |
| 292 | $( '.mysticky-welcomebar-content' ).html( "<p>" + mysticky_bar_text_val + "</p>"); |
| 293 | } ); |
| 294 | |
| 295 | $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_btn_text]"]' ).on( 'keyup', function(){ |
| 296 | var mysticky_btn_text_val = $( this ).val(); |
| 297 | |
| 298 | $( '.mysticky-welcomebar-btn a' ).text( mysticky_btn_text_val ); |
| 299 | } ); |
| 300 | |
| 301 | /* DATE: 11-12-2019 start */ |
| 302 | $( 'select[name="mysticky_option_welcomebar[mysticky_welcomebar_attentionselect]"]' ).on( 'change', function(){ |
| 303 | $(".mysticky-welcomebar-fixed").removeClass (function (index, className) { |
| 304 | return (className.match (/(^|\s)mysticky-welcomebar-attention-\S+/g) || []).join(' '); |
| 305 | }); |
| 306 | $( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-attention-' + $(this).val() ); |
| 307 | |
| 308 | } ); |
| 309 | /* DATE: 11-12-2019 End */ |
| 310 | |
| 311 | $( '.mysticky-welcomebar-submit input#submit' ).on( 'click', function(e){ |
| 312 | if ( $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_enable]"]' ).prop( 'checked' ) == false && $( 'input#save_welcome_bar' ).val() == '' ) { |
| 313 | e.preventDefault(); |
| 314 | $( "#mysticky-welcomebar-save-confirm" ).dialog({ |
| 315 | resizable: false, |
| 316 | modal: true, |
| 317 | draggable: false, |
| 318 | height: 'auto', |
| 319 | width: 600, |
| 320 | buttons: { |
| 321 | "Yes, show it on my site": { |
| 322 | click:function () { |
| 323 | $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_enable]"]' ).prop( 'checked', true ); |
| 324 | $( '.mysticky-welcomebar-submit input#submit' ).trigger('click'); |
| 325 | $( this ).dialog('close'); |
| 326 | }, |
| 327 | text: 'Yes, show it on my site', |
| 328 | class: 'green-btn' |
| 329 | }, |
| 330 | "Just save and keep it off": function () { |
| 331 | $( 'input#save_welcome_bar' ).val('1'); |
| 332 | $( '.mysticky-welcomebar-submit input#submit' ).trigger('click'); |
| 333 | $( this ).dialog( 'close' ); |
| 334 | } |
| 335 | } |
| 336 | }); |
| 337 | } |
| 338 | //return false; |
| 339 | } ); |
| 340 | |
| 341 | }); |
| 342 | $( window ).load( function(){ |
| 343 | $( '.mysticky-welcomebar-url-options' ).each( function(){ |
| 344 | $( this ).trigger( 'change' ); |
| 345 | }); |
| 346 | }); |
| 347 | function check_for_preview_pos() { |
| 348 | var mysticky_welcomebar_form_pos = $( '#sticky-header-welcome-bar' ).offset().top; |
| 349 | if($(".show-on-apper").length && $(".mysticky-welcomebar-setting-right").length) { |
| 350 | var topPos = $(".show-on-apper").offset().top - $(window).scrollTop() - 700; |
| 351 | if (topPos < 0) { |
| 352 | topPos = Math.abs(topPos); |
| 353 | jQuery(".mysticky-welcomebar-setting-right").css("margin-top", ((-1)*topPos)+"px"); |
| 354 | } else { |
| 355 | jQuery(".mysticky-welcomebar-setting-right").css("margin-top", "0"); |
| 356 | } |
| 357 | } |
| 358 | if ( ( mysticky_welcomebar_form_pos + 32 ) < $(window).scrollTop() ) { |
| 359 | $( '.mysticky-welcomebar-setting-right' ).css( 'position', 'fixed' ); |
| 360 | $( '.mysticky-welcomebar-setting-right' ).css( 'right', '70px' ); |
| 361 | } else { |
| 362 | $( '.mysticky-welcomebar-setting-right' ).css( 'position', 'absolute' ); |
| 363 | $( '.mysticky-welcomebar-setting-right' ).css( 'right', '50px' ); |
| 364 | } |
| 365 | } |
| 366 | |
| 367 | })(jQuery); |