1try{ 2 3(function( $ ) { 4 'use strict'; 5 6 /** 7 * All of the code for your public-facing JavaScript source 8 * should reside in this file. 9 * 10 * Note: It has been assumed you will write jQuery code here, so the 11 * $ function reference has been prepared for usage within the scope 12 * of this function. 13 * 14 * This enables you to define handlers, for when the DOM is ready: 15 * 16 * $(function() { 17 * 18 * }); 19 * 20 * When the window is loaded: 21 * 22 * $( window ).load(function() { 23 * 24 * }); 25 * 26 * ...and/or other possibilities. 27 * 28 * Ideally, it is not considered best practise to attach more than a 29 * single DOM-ready or window-load handler for a particular page. 30 * Although scripts in the WordPress core, Plugins and Themes may be 31 * practising this, we should strive to set a better example in our own work. 32 */ 33 34 $(document).ready(function (){ 35 // Answer Sound Muter 36 $(document).on('click', '.ays_pb_music_sound', function() { 37 var $this = $(this); 38 var audioEl = $(document).find('.ays_pb_sound').get(0); 39 if($this.hasClass('ays_sound_active')){ 40 audioEl.volume = 0; 41 $this.find('.ays_pb_fa_volume').remove(); 42 $this.html(pbLocalizeObj.icons.volume_mute_icon); 43 $this.find('.ays_pb_fa_volume').addClass('ays_pb_fa_volume_off').removeClass('ays_pb_fa_volume'); 44 $this.removeClass('ays_sound_active'); 45 } else { 46 audioEl.volume = 1; 47 $this.find('.ays_pb_fa_volume_off').remove(); 48 $this.html(pbLocalizeObj.icons.volume_up_icon); 49 $this.find('.ays_pb_fa_volume_off').addClass('ays_pb_fa_volume').removeClass('ays_pb_fa_volume_off'); 50 $this.addClass('ays_sound_active'); 51 } 52 }); 53 54 $(document).on('click', '#ays_pb_dismiss_ad', function(){ 55 var expTime = $(this).parent().data('dismiss'); 56 var id = $(this).parent().data('id'); 57 58 if(expTime != ''){ 59 set_cookies('ays_pb_dismiss_ad_'+id, 'ays_pb_dismiss_ad_'+id, parseInt(expTime)); 60 }else{ 61 var expiryDate = new Date(); 62 expiryDate.setMonth(expiryDate.getMonth() + 1); 63 set_cookies('ays_pb_dismiss_ad_'+id, 'ays_pb_dismiss_ad_'+id, expiryDate); 64 } 65 $(document).find('.ays-pb-modal-close_'+id).trigger('click'); 66 }); 67 68 $(document).on('click', '.asypb-cta', function(){ 69 let popupContainer = $(this).closest('.ays-pb-modals'); 70 if (!popupContainer) return; 71 72 // Check if conversion already updated 73 if (typeof popupContainer.attr('data-updated-conversion') != 'undefined') return 74 75 var classValue = popupContainer.attr('class'); 76 var id = classValue.match(/av_pop_modals_(\d+)/)[1]; 77 updatePopupConversions(id); 78 79 popupContainer.attr('data-updated-conversion', true); 80 }); 81 82 function set_cookies( cname, cvalue, exdays ) { 83 var expires = 'expires=' + (new Date(Date.now() + exdays)).toUTCString(); 84 document.cookie = cname + '=' + cvalue + ';' + expires + ';path=/'; 85 } 86 87 var isMobileDevice = false; 88 if (window.innerWidth < 768) { 89 isMobileDevice = true; 90 } 91 92 $('div.ays-pb-modals').each(function() { 93 var classValue = $(this).attr('class'); 94 var id = classValue.match(/av_pop_modals_(\d+)/)[1]; 95 var popup = JSON.parse(atob(window.aysPopupOptions[id])).popupbox; 96 var popupOptions = JSON.parse(popup.options); 97 98 var actionType = popup.action_button_type; 99 var openDelay = popup.delay; 100 var scrollTop = popup.scroll_top; 101 102 var template = popup.view_type; 103 var height = popup.height; 104 var minHeight = popupOptions.pb_min_height; 105 var borderSize = (typeof popup.bordersize != 'undefined') ? popup.bordersize : 0; 106 var enableborderSizeMobile = (typeof popupOptions != 'undefined' && typeof popupOptions.enable_bordersize_mobile != 'undefined' && popupOptions.enable_bordersize_mobile == 'on') ? true : false; 107 if (typeof popupOptions != 'undefined' && typeof popupOptions.bordersize_mobile != 'undefined') { 108 var borderSizeMobile = popupOptions.bordersize_mobile; 109 } else { 110 var borderSizeMobile = borderSize; 111 } 112 113 if (!enableborderSizeMobile) { 114 borderSizeMobile = borderSize; 115 } 116 117 var enableFullScreen = popupOptions.enable_pb_fullscreen == 'on' ? true : false; 118 119 var closeButtonPosition = popupOptions.close_button_position; 120 var closeButtonText = popupOptions.close_button_text; 121 var closeButtonImage = popupOptions.close_button_image; 122 123 var enableOpenDelayMobile = popupOptions.enable_open_delay_mobile == 'on' ? true : false ; 124 var enableScrollTopMobile = popupOptions.enable_scroll_top_mobile == 'on' ? true : false ; 125 var enableCloseButtonPositionMobile = popupOptions.enable_close_button_position_mobile == 'on' ? true : false ; 126 var enableCloseButtonTextMobile = popupOptions.enable_close_button_text_mobile == 'on' ? true : false ; 127 128 $(document).find('.ays-pb-modal-close_'+id).on('click', function() { 129 $(document).find('input#ays-pb-modal-checkbox_' + id).trigger('change'); 130 }) 131 132 var formattedBorderSize = borderSize; 133 if (isMobileDevice) { 134 if (enableCloseButtonPositionMobile) { 135 closeButtonPosition = popupOptions.close_button_position_mobile; 136 } 137 if (enableCloseButtonTextMobile) { 138 closeButtonText = popupOptions.close_button_text_mobile; 139 } 140 if (enableOpenDelayMobile) { 141 openDelay = popupOptions.open_delay_mobile; 142 } 143 if (enableScrollTopMobile) { 144 scrollTop = popupOptions.scroll_top_mobile; 145 } 146 if (enableborderSizeMobile) { 147 formattedBorderSize = borderSizeMobile; 148 } 149 150 height = popupOptions.mobile_height ? popupOptions.mobile_height : popup.height; 151 enableFullScreen = false;
152 } 153 154 if (actionType == 'both' || actionType == 'pageLoaded') { 155 if (openDelay == 0 && scrollTop == 0) { 156 $(document).find('input#ays-pb-modal-checkbox_' + id).prop('checked', true); 157 } 158 } 159 160 if (enableFullScreen) { 161 height = window.innerHeight; 162 } 163 setCloseButtonPosition(template, id, height, minHeight, formattedBorderSize, enableFullScreen, closeButtonPosition, closeButtonImage); 164 setCloseButtonText(closeButtonText, closeButtonImage, id, template); 165 }); 166 167 function setCloseButtonPosition(template, id, height, minHeight, borderSize, enableFullScreen, closeButtonPosition, closeButtonImage) { 168 if (template !== 'default' && template !== 'lil' && template !== 'image' && template !== 'template' && template !== 'video' && template !== 'minimal' && template !== 'image_type_img_theme' && template !== 'facebook' && template !== 'notification') { 169 return false; 170 } 171 172 var heightForPosition = height; 173 if (minHeight > height) { 174 heightForPosition = minHeight; 175 } 176 177 var closeButtonPositionValue = {}; 178 179 if (template == 'default' || template == 'image_type_img_theme' || template == 'facebook') { 180 var aysConteiner = parseInt(heightForPosition); 181 var h2Height = $(document).find('.ays-pb-modal_' + id + ' h2').outerHeight(true); 182 var hrHeight = $(document).find('.ays-pb-modal_' + id + ' hr').outerHeight(true); 183 var descriptionHeight = $(document).find('.ays-pb-modal_' + id + ' .ays_pb_description').outerHeight(true); 184 var timerHeight = $(document).find('.ays-pb-modal_' + id + ' .ays_pb_timer_' + id).outerHeight(true); 185 var customHtml = $(document).find('.ays-pb-modal_' + id + ' .ays_content_box').outerHeight(true); 186 187 if(h2Height == undefined){ 188 h2Height = 0; 189 } 190 if(hrHeight == undefined){ 191 hrHeight = 0; 192 } 193 if(descriptionHeight == undefined){ 194 descriptionHeight = 0; 195 } 196 if(timerHeight == undefined){ 197 timerHeight = 0; 198 } 199 if(customHtml == undefined){ 200 customHtml = 0; 201 } 202 var aysConteinerHeight = (h2Height + descriptionHeight + timerHeight + customHtml + hrHeight); 203 if(aysConteinerHeight < aysConteiner){ 204 if(enableFullScreen){ 205 aysConteinerHeight = (aysConteiner - 75) + 'px'; 206 }else{ 207 aysConteinerHeight = (aysConteiner - 55) + 'px'; 208 } 209 } 210 switch(closeButtonPosition) { 211 case 'left-top': 212 closeButtonPositionValue = {top: '10px', left: '10px'}; 213 break; 214 case 'left-bottom': 215 closeButtonPositionValue = {top: aysConteinerHeight, left: '10px'}; 216 break; 217 case 'right-bottom': 218 closeButtonPositionValue = {top: aysConteinerHeight, right: '10px'}; 219 break; 220 default: 221 closeButtonPositionValue = {top: '10px', right: '4%'}; 222 break; 223 } 224 } else if (template == 'lil') { 225 var closeButtonTop; 226 if(enableFullScreen){ 227 closeButtonTop = heightForPosition - 43 + (2 * borderSize); 228 }else{ 229 closeButtonTop = heightForPosition - 43 - (2 * borderSize); 230 } 231 switch(closeButtonPosition) { 232 case 'left-top': 233 closeButtonPositionValue = { top: '10px', left: '10px' }; 234 break; 235 case 'left-bottom': 236 closeButtonPositionValue = { top: closeButtonTop + 'px', left: '10px' }; 237 break; 238 case 'right-bottom': 239 closeButtonPositionValue = { top: closeButtonTop + 'px', right: '40px', bottom: 'auto', left: 'auto' }; 240 break; 241 default: 242 closeButtonPositionValue = { top: '10px', right: '40px' }; 243 break; 244 } 245 } else if (template == 'template') { 246 var closeBttnImageExist = closeButtonImage != ''; 247 switch(closeButtonPosition) { 248 case 'left-top': 249 var sidePostion = closeBttnImageExist ? 30 + 'px' : 20 + 'px'; 250 closeButtonPositionValue = { top: '14px', left: sidePostion }; 251 break; 252 case 'left-bottom': 253 var sidePostion = closeBttnImageExist ? 30 + 'px' : 16 + 'px'; 254 closeButtonPositionValue = { bottom: '25px', left: sidePostion }; 255 break; 256 case 'right-bottom': 257 var sidePostion = closeBttnImageExist ? 30 + 'px' : 16 + 'px'; 258 closeButtonPositionValue = { bottom: '25px', right: sidePostion }; 259 break; 260 default: 261 var sidePostion = closeBttnImageExist ? 30 + 'px' : 20 + 'px'; 262 closeButtonPositionValue = { top: '14px', right: sidePostion }; 263 break; 264 } 265 } else if (template == 'image' || template == 'minimal' || template == 'video') { 266 switch(closeButtonPosition) { 267 case 'left-top': 268 if (enableFullScreen) { 269 closeButtonPositionValue = { right: '97%' }; 270 } else { 271 closeButtonPositionValue = { 272 top: (-25 - borderSize) + 'px', 273 left: (-borderSize) + 'px' 274 }; 275 } 276 break; 277 case 'left-bottom': 278 if (enableFullScreen) { 279 closeButtonPositionValue = { top: '97%', right: '95%' }; 280 } else { 281 var close_btn_pos = -15 - borderSize; 282 closeButtonPositionValue = { 283 bottom: close_btn_pos + 'px', 284 left: (-borderSize) + 'px' 285 }; 286 } 287 break; 288 case 'right-bottom': 289 if (enableFullScreen) { 290 closeButtonPositionValue = { top: '97%', left: '95%' }; 291 } else { 292 var close_btn_pos = -15 - borderSize; 293 closeButtonPositionValue = { 294 bottom: close_btn_pos + 'px', 295 right: (-borderSize) + 26 + 'px' 296 }; 297 } 298 break; 299 default: 300 if (template == 'image' || template == 'minimal') { 301 var top = (enableFullScreen) ? (6 - borderSize) + 'px' : (-29 - borderSize) + 'px'; 302 closeButtonPositionValue = { 303 top: top, 304 right: (-borderSize) + 26 + 'px' 305 }; 306 } 307 if (template == 'video') { 308 if (enableFullScreen) { 309 closeButtonPositionValue = { right: '15px' }; 310 } else { 311 closeButtonPositionValue = { 312 top: (-25 - borderSize) + 'px', 313 right: (-borderSize) + 15 + 'px' 314 }; 315 } 316 } 317 break; 318 } 319 } else if (template == 'notification') { 320 switch(closeButtonPosition) { 321 case 'left-top': 322 closeButtonPositionValue = {top: '0', left: '0'}; 323 break; 324 case 'left-bottom': 325 closeButtonPositionValue = {bottom: '0', left: '0'}; 326 break; 327 case 'right-bottom': 328 closeButtonPositionValue = {bottom: '0', right: '0'}; 329 break; 330 default: 331 closeButtonPositionValue = {top: '0', right: '0'}; 332 break; 333 } 334 } 335 closeButtonPositionValue.position = 'absolute'; 336 $(document).find('.ays-pb-modal_' + id + ' .ays-pb-modal-close_' + id).css(closeButtonPositionValue); 337 338 } 339 340 function setCloseButtonText(closeButtonText, closeButtonImage, id, template) { 341 var currentCloseBttnContainer = $(document).find('div.ays-pb-modal-close_' + id ); 342 var defaultCloseIcon = '<svg class="ays_pb_material_close_icon" xmlns="http://www.w3.org/2000/svg" height="36px" viewBox="0 0 24 24" width="36px" fill="#000000" alt="Pop-up Close"><path d="M0 0h24v24H0z" fill="none"/><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>'; 343 var text = ''; 344 var closeBttnContainerClass = ''; 345 346 switch(template) { 347 case 'default': 348 case 'image_type_img_theme': 349 case 'facebook':
350 case 'notification': 351 if(closeButtonImage != ""){ 352 text = "<img class='close_btn_img' src='" + closeButtonImage + "' width='30' height='30'>"; 353 }else{ 354 if(closeButtonText === 'â'){ 355 text = defaultCloseIcon; 356 }else{ 357 text = closeButtonText; 358 } 359 } 360 currentCloseBttnContainer.html(text); 361 break; 362 case 'win98': 363 text = closeButtonText; 364 currentCloseBttnContainer.find('span').html(text); 365 break; 366 case 'lil': 367 if(closeButtonImage != ""){ 368 text = "<img class='close_btn_img' src='" + closeButtonImage + "' width='50' height='50'>"; 369 }else{ 370 text = closeButtonText; 371 if(closeButtonText != 'â'){ 372 closeBttnContainerClass = 'close-lil-btn-text'; 373 } 374 } 375 currentCloseBttnContainer.find('a').addClass(closeBttnContainerClass); 376 currentCloseBttnContainer.find('a').html(text); 377 break; 378 case 'image': 379 case 'template': 380 case 'minimal': 381 case 'video': 382 if(closeButtonImage != ""){ 383 text = "<img class='close_btn_img' src='" + closeButtonImage + "' width='30' height='30'>"; 384 }else{ 385 text = closeButtonText; 386 } 387 currentCloseBttnContainer.find('div').html(text); 388 break 389 } 390 } 391 392 function updatePopupConversions(id) { 393 $.ajax({ 394 url: pbLocalizeObj.ajax, 395 method: 'POST', 396 dataType: 'text', 397 data: { 398 id: id, 399 action: 'ays_increment_pb_conversions', 400 }, 401 }); 402 } 403 }) 404 405})( jQuery ); 406 407window.onload = function(){ 408 var classList = document.body.classList; 409 document.ontouchmove = function(e){ 410 for( var i = 0; i < classList.length; i++ ){ 411 if( classList[i].startsWith('pb_disable_scroll_') ){ 412 if (navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { 413 e.preventDefault(); 414 } 415 break; 416 } 417 } 418 } 419 420 // Handle scrollbar visibility on window resize and initial load 421 function updateScrollbarVisibility() { 422 var popups = document.querySelectorAll('.ays-pb-modal, .ays_cmd_window, .ays-pb-modal-macos, .ays_ubuntu_window, .ays_winxp_window, .ays_lil_window, .ays_image_window .ays_image_main, .ays_minimal_window .ays_minimal_main, .ays_template_window, .ays_win98_window'); 423 var isMobile = window.innerWidth < 768; 424 425 popups.forEach(function(popup) { 426 if (isMobile) { 427 if (popup.classList.contains('ays-pb-show-scrollbar-mobile')) { 428 popup.classList.add('ays-pb-show-scrollbar'); 429 } else { 430 popup.classList.remove('ays-pb-show-scrollbar'); 431 } 432 } else { 433 if (popup.classList.contains('ays-pb-show-scrollbar-desktop')) { 434 popup.classList.add('ays-pb-show-scrollbar'); 435 } else { 436 popup.classList.remove('ays-pb-show-scrollbar'); 437 } 438 } 439 }); 440 } 441 442 // Update on page load 443 updateScrollbarVisibility(); 444 445 // Update on window resize with debounce 446 var resizeTimer; 447 window.addEventListener('resize', function() { 448 clearTimeout(resizeTimer); 449 resizeTimer = setTimeout(updateScrollbarVisibility, 250); 450 }); 451}; 452 453 454 455} 456catch(e){console.error("WP-Optimize Minify: An error has occurred in the minified code. \n\n- Original script: https://labadibeachhotelgh.com/wp-content/plugins/ays-popup-box/public/js/ays-pb-public.js\n- Error message: "+ e.message);}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.