Mint: A Fresh Look at your Site Minted
  1. 1 jQuery(function(){'use strict';var daftplugPublic=jQuery('.daftplugPublic[data-daftplug-plugin="daftplug_instantify"]');var optionName=daftplugPublic.attr('data-daftplug-plugin');var objectName=window[optionName+'_public_js_vars'];var client=new ClientJS();var pushButton=daftplugPublic.find('.daftplugPublicPushButton');var pushPrompt=daftplugPublic.find('.daftplugPublicPushPrompt');var navigationTabBar=daftplugPublic.find('.daftplugPublicNavigationTabBar');var isMobilePad=client.isMobile()||client.isIpad();var isAndroidChrome=client.isMobileAndroid()&&client.isChrome();var isAndroidFirefox=client.isMobileAndroid()&&client.isFirefox();var isIosSafari=client.isMobileIOS()&&client.isSafari();var isAndroidPwa=client.isMobileAndroid()&&isPwa();var isIosPwa=client.isMobileIOS()&&isPwa();var isFullscreenOverlayShown=getCookie('fullscreenOverlay');var isHeaderOverlayShown=getCookie('headerOverlay');var isMenuOverlayShown=getCookie('menuOverlay');var isCheckoutOverlayShown=getCookie('checkoutOverlay');var isPostOverlayShown=getCookie('postOverlay');var isPushPromptShown=getCookie('pushPrompt');var fullscreenOverlay=daftplugPublic.find('.daftplugPublicFullscreenOverlay');var chromeFullscreenOverlay=fullscreenOverlay.filter('.-chrome');var chrome2FullscreenOverlay=fullscreenOverlay.filter('.-chrome2');var firefoxFullscreenOverlay=fullscreenOverlay.filter('.-firefox');var safariFullscreenOverlay=fullscreenOverlay.filter('.-safari');var headerOverlay=daftplugPublic.find('.daftplugPublicHeaderOverlay');var menuOverlay=daftplugPublic.find('.daftplugPublicMenuOverlay');var checkoutOverlay=daftplugPublic.find('.daftplugPublicCheckoutOverlay');var postOverlay=daftplugPublic.find('.daftplugPublicPostOverlay');var installButton=daftplugPublic.find('.daftplugPublicInstallButton');var rotateNotice=daftplugPublic.find('.daftplugPublicRotateNotice');function isPwa(){return['fullscreen','standalone','minimal-ui'].some((displayMode)=>window.matchMedia('(display-mode: '+displayMode+')').matches)}
  2. 2 function setCookie(name,value,days){var expires='';if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));expires='; expires='+date.toUTCString()}
  3. 3 document.cookie=name+'='+(value||'')+expires+'; path=/'}
  4. 4 function getCookie(name){var nameEQ=name+'=';var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length)}
  5. 5 return null}
  6. 6 function changePushButtonState(state){switch(state){case 'enabled':pushButton.removeClass('-loading').removeClass('-on').addClass('-off');break;case 'disabled':pushButton.removeClass('-loading').removeClass('-off').addClass('-on');break;case 'computing':pushButton.removeClass('-on').removeClass('-off').addClass('-loading');break;case 'incompatible':pushButton.removeClass('-loading').removeClass('-off').addClass('-on').addClass('-disabled');break;case 'hidden':pushButton.removeClass('-loading').removeClass('-off').removeClass('-on').addClass('-hidden');break;default:console.error('Unhandled push button state',state);break}}
  7. 7 function urlBase64ToUint8Array(base64String){const padding='='.repeat((4-(base64String.length%4))%4);const base64=(base64String+padding).replace(/\-/g,'+').replace(/_/g,'/');const rawData=window.atob(base64);const outputArray=new Uint8Array(rawData.length);for(let i=0;i<rawData.length;++i){outputArray[i]=rawData.charCodeAt(i)}
  8. 8 return outputArray}
  9. 9 function checkNotificationPermission(){return new Promise((resolve,reject)=>{if(Notification.permission==='denied'){return reject(new Error('Push messages are blocked.'))}
  10. 10 if(Notification.permission==='granted'){return resolve()}
  11. 11 if(Notification.permission==='default'){return Notification.requestPermission().then(result=>{if(result!=='granted'){reject(new Error('Bad permission result'))}
  12. 12 resolve()})}})}
  13. 13 function registerPushDevice(){changePushButtonState('computing');return checkNotificationPermission().then(()=>navigator.serviceWorker.ready).then(serviceWorkerRegistration=>serviceWorkerRegistration.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:urlBase64ToUint8Array(objectName.pwaPublicKey),})).then(subscription=>{jQuery.toast({title:objectName.pwaSubscribeOnMsg,duration:2500,position:'bottom',});return handleSubscription(subscription,'add')}).then(subscription=>subscription&&changePushButtonState('enabled')).catch(e=>{if(Notification.permission==='denied'){console.warn('Notifications are denied by the user.');changePushButtonState('incompatible')}else{console.error('Impossible to subscribe to push notifications',e);changePushButtonState('disabled')}})}
  14. 14 function updatePushDevice(){navigator.serviceWorker.ready.then(serviceWorkerRegistration=>serviceWorkerRegistration.pushManager.getSubscription()).then(subscription=>{changePushButtonState('disabled');if(!subscription){return}
  15. 15 return handleSubscription(subscription,'update')}).then(subscription=>subscription&&changePushButtonState('enabled')).catch(e=>{console.error('Error when updating the subscription',e)})}
  16. 16 function deregisterPushDevice(){changePushButtonState('computing');navigator.serviceWorker.ready.then(serviceWorkerRegistration=>serviceWorkerRegistration.pushManager.getSubscription()).then(subscription=>{if(!subscription){changePushButtonState('disabled');return}
  17. 17 jQuery.toast({title:objectName.pwaSubscribeOffMsg,duration:2500,position:'bottom',});return handleSubscription(subscription,'remove')}).then(subscription=>subscription.unsubscribe()).then(()=>changePushButtonState('disabled')).catch(e=>{console.error('Error when unsubscribing the user',e);changePushButtonState('disabled')})}
  18. 18 function handleSubscription(subscription,method){const action=optionName+'_handle_subscription';const endpoint=subscription.endpoint;const userKey=subscription.getKey('p256dh');const userAuth=subscription.getKey('auth');const deviceInfo=client.getBrowser()+' '+client.getBrowserMajorVersion()+' on '+client.getOS()+' '+client.getOSVersion();const contentEncoding=(PushManager.supportedContentEncodings||['aesgcm'])[0];return jQuery.ajax({url:objectName.ajaxUrl,type:'POST',data:{method:method,action:action,endpoint:endpoint,userKey:userKey?btoa(String.fromCharCode.apply(null,new Uint8Array(userKey))):null,userAuth:userAuth?btoa(String.fromCharCode.apply(null,new Uint8Array(userAuth))):null,deviceInfo:deviceInfo,contentEncoding,},beforeSend:function(){},success:function(response,textStatus,jqXhr){},complete:function(){},error:function(jqXhr,textStatus,errorThrown){}}).then(()=>subscription)}
  19. 19 if('serviceWorker' in navigator&&'PushManager' in window&&!jQuery('meta[name="onesignal"]').length){navigator.serviceWorker.ready.then(function(registration){registration.pushManager.getSubscription().then(function(subscription){updatePushDevice();if(objectName.settings.pwaPushPrompt=='on'){if(!subscription&&Notification.permission!=='denied'&&isPushPromptShown==null&&pushPrompt.length){setTimeout(function(){pushPrompt.addClass('-show').on('click','.daftplugPublicPushPrompt_allow',function(e){pushPrompt.addClass('-hide').one("animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd",function(){pushPrompt.remove()});registerPushDevice()}).on('click','.daftplugPublicPushPrompt_dismiss',function(e){pushPrompt.addClass('-hide').one("animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd",function(){pushPrompt.remove()});setCookie('pushPrompt','shown',1)})},2000)}}
  20. 20 if(objectName.settings.pwaPushButton=='on'){if(subscription){if(objectName.settings.pwaPushButtonBehavior=='shown'){changePushButtonState('enabled');pushButton.css('display','flex').on('click',function(e){deregisterPushDevice()})}}else{changePushButtonState('disabled');pushButton.css('display','flex').on('click',function(e){if(objectName.settings.pwaPushButtonBehavior=='hidden'){registerPushDevice().then(()=>changePushButtonState('hidden'))}else{registerPushDevice()}})}}})})}
  21. 21 if(objectName.settings.pwaOfflineForms=='on'){Array.from(document.querySelectorAll('form')).forEach(form=>{new OfflineForm(form)})};if(objectName.settings.pwaAjaxify=='on'){if(objectName.settings.pwaAjaxifySelectors==''){var additionalSelectors='a:not(.no-ajaxy)'}else{var additionalSelectors='a:not(.no-ajaxy),'+objectName.settings.pwaAjaxifySelectors}
  22. 22 if(objectName.settings.pwaAjaxifyForms=='on'){var formsSelector='form:not(.no-ajaxy)'}else{var formsSelector=!1}
  23. 23 jQuery('body').ajaxify({selector:additionalSelectors,forms:formsSelector,refresh:!0,deltas:!1,alwayshints:'daftplug-instantify',})}
  24. 24 if(objectName.settings.pwaPreloader=='on'){if(objectName.settings.pwaPreloaderStyle=='percent'){var perfData=window.performance.timing,EstimatedTime=-(perfData.loadEventEnd-perfData.navigationStart),time=parseInt((EstimatedTime/1000)%60)*100,progBar=jQuery('.daftplugPublicPreloader_fill'),start=0,end=70,duration=time,counter=jQuery('.daftplugPublicPreloader_counter');animateValue(progBar,start,end,duration);function animateValue(element,start,end,duration){var range=end-start,current=start,increment=end>start?1:-1,stepTime=Math.abs(Math.floor(duration/range)),obj=element;var timer=setInterval(function(){if(current<end){current+=increment}
  25. 25 if(obj!==null){obj.css({'transition-duration':'0.001s','width':current+'%',})}
  26. 26 counter.text(current+'%');if((current==end&&perfData.loadEventEnd>0)||perfData.loadEventEnd>0){var endLoading=setInterval(function(){current+=increment;if(obj!==null){obj.css('width',current+'%')}
  27. 27 counter.text(current+'%');if(current==100){setTimeout(function(){jQuery('.daftplugPublicPreloader').fadeOut('slow')},300);clearInterval(endLoading)}},1)
  28. 28 clearInterval(timer)}},stepTime)}}else{jQuery(window).on('beforeunload pronto.request',function(e){e.returnValue='';jQuery('.daftplugPublicPreloader').css('display','flex').hide().fadeIn(200)}).on('load pronto.render',function(e){jQuery('.daftplugPublicPreloader').fadeOut('slow')})}}
  29. 29 if(isMobilePad){if(objectName.settings.pwaNavigationTabBar=='on'){if(navigationTabBar.find('li').length==0){navigationTabBar.hide()}
  30. 30 if(navigationTabBar.is(':visible')&&pushButton.length){setInterval(function(e){jQuery('#daftplugPublicToastMessage').css('bottom','85px')},10);if(objectName.settings.pwaPushButton=='on'&&objectName.settings.pwaPushButtonPosition.indexOf('bottom')>=0){pushButton.css('bottom','75px')}}
  31. 31 var directSearchItem=navigationTabBar.find('.daftplugPublicNavigationTabBar_item.-directSearch');var directSearchLink=directSearchItem.find('.daftplugPublicNavigationTabBar_link');directSearchLink.click(function(e){e.preventDefault();var self=jQuery(this);var searchContainer=self.prev();var searchForm=searchContainer.find('.daftplugPublicNavigationTabBar_searchForm');var searchField=searchForm.find('.daftplugPublicNavigationTabBar_searchField');searchContainer.fadeIn('fast',function(e){searchField.focus().blur(function(e){searchForm[0].reset();searchContainer.fadeOut('fast')})})})}
  32. 32 if(objectName.settings.pwaPullDownNavigation=='on'){PullToNavigate();jQuery('#daftplugPublicPullDownNavigation').css('background',objectName.settings.pwaPullDownNavigationBgColor)}
  33. 33 if(objectName.settings.pwaSwipeNavigation=='on'){jQuery('body').attr('data-xthreshold','111').swipeleft(function(){window.history.back();jQuery.toast({title:objectName.settings.pwaSwipeBackMsg,duration:3000,position:'bottom',})}).swiperight(function(){window.history.forward();jQuery.toast({title:objectName.settings.pwaSwipeForwardMsg,duration:3000,position:'bottom',})})}
  34. 34 if(objectName.settings.pwaShakeToRefresh=='on'){var shakeEvent=new Shake({threshold:15});shakeEvent.start();window.addEventListener('shake',function(){location.reload()},!1)}
  35. 35 if(objectName.settings.pwaVibration=='on'){jQuery('body').vibrate()}
  36. 36 if(objectName.settings.pwaOverlays=='on'){if(objectName.settings.pwaOverlaysTypes.includes('fullscreen')&&isAndroidPwa==!1&&isIosPwa==!1&&isFullscreenOverlayShown==null&&fullscreenOverlay.length){if(objectName.settings.pwaOverlaysBrowsers.includes('chrome')&&isAndroidChrome&&chromeFullscreenOverlay.length&&chrome2FullscreenOverlay.length){var isFullBeforeinstallprompt=!1;var isFullscreenOverlayFired=!1;var installPromptEvent=void 0;window.addEventListener('beforeinstallprompt',function(event){event.preventDefault();isFullBeforeinstallprompt=!0;installPromptEvent=event;if(!isFullscreenOverlayFired){setTimeout(function(){chromeFullscreenOverlay.fadeIn('fast',function(e){isFullscreenOverlayFired=!0;chromeFullscreenOverlay.on('click','.daftplugPublicFullscreenOverlay_button',function(e){chromeFullscreenOverlay.fadeOut('fast',function(e){setCookie('fullscreenOverlay','shown',objectName.settings.pwaOverlaysShowAgain);installPromptEvent.prompt();installPromptEvent=null})})})},5000)}});setTimeout(function(){if(isFullBeforeinstallprompt==!1){chrome2FullscreenOverlay.fadeIn('fast')}},5000)}else if(objectName.settings.pwaOverlaysBrowsers.includes('firefox')&&isAndroidFirefox&&firefoxFullscreenOverlay.length){setTimeout(function(){firefoxFullscreenOverlay.fadeIn('fast')},5000)}else if(objectName.settings.pwaOverlaysBrowsers.includes('safari')&&isIosSafari&&safariFullscreenOverlay.length){setTimeout(function(){safariFullscreenOverlay.fadeIn('fast')},5000)}
  37. 37 fullscreenOverlay.on('click','.daftplugPublicFullscreenOverlay_close',function(e){fullscreenOverlay.fadeOut('fast',function(e){setCookie('fullscreenOverlay','shown',objectName.settings.pwaOverlaysShowAgain)})})}
  38. 38 if(objectName.settings.pwaOverlaysTypes.includes('header')&&isAndroidPwa==!1&&isIosPwa==!1&&isHeaderOverlayShown==null&&headerOverlay.length){if(objectName.settings.pwaOverlaysBrowsers.includes('chrome')&&isAndroidChrome&&chrome2FullscreenOverlay.length){var isHeaderBeforeinstallprompt=!1;var isHeaderOverlayFired=!1;var installPromptEvent=void 0;window.addEventListener('beforeinstallprompt',function(event){event.preventDefault();isHeaderBeforeinstallprompt=!0;installPromptEvent=event;if(!isHeaderOverlayFired){setTimeout(function(){headerOverlay.css('display','flex').hide().fadeIn('fast',function(e){isHeaderOverlayFired=!0;headerOverlay.on('click','.daftplugPublicHeaderOverlay_button',function(e){headerOverlay.fadeOut('fast',function(e){setCookie('headerOverlay','shown',objectName.settings.pwaOverlaysShowAgain);installPromptEvent.prompt();installPromptEvent=null})})})},5000)}});setTimeout(function(){if(isHeaderBeforeinstallprompt==!1){headerOverlay.css('display','flex').hide().fadeIn('fast').on('click','.daftplugPublicHeaderOverlay_button',function(e){headerOverlay.fadeOut('fast',function(e){setCookie('headerOverlay','shown',objectName.settings.pwaOverlaysShowAgain);chrome2FullscreenOverlay.fadeIn('fast').on('click','.daftplugPublicFullscreenOverlay_close',function(e){chrome2FullscreenOverlay.fadeOut('fast')})})})}},5000)}else if(objectName.settings.pwaOverlaysBrowsers.includes('firefox')&&isAndroidFirefox&&firefoxFullscreenOverlay.length){setTimeout(function(){headerOverlay.css('display','flex').hide().fadeIn('fast').on('click','.daftplugPublicHeaderOverlay_button',function(e){headerOverlay.fadeOut('fast',function(e){setCookie('headerOverlay','shown',objectName.settings.pwaOverlaysShowAgain);firefoxFullscreenOverlay.fadeIn('fast').on('click','.daftplugPublicFullscreenOverlay_close',function(e){firefoxFullscreenOverlay.fadeOut('fast')})})})},5000)}else if(objectName.settings.pwaOverlaysBrowsers.includes('safari')&&isIosSafari&&safariFullscreenOverlay.length){setTimeout(function(){headerOverlay.css('display','flex').hide().fadeIn('fast').on('click','.daftplugPublicHeaderOverlay_button',function(e){headerOverlay.fadeOut('fast',function(e){setCookie('headerOverlay','shown',objectName.settings.pwaOverlaysShowAgain);safariFullscreenOverlay.fadeIn('fast').on('click','.daftplugPublicFullscreenOverlay_close',function(e){safariFullscreenOverlay.fadeOut('fast')})})})},5000)}
  39. 39 headerOverlay.on('click','.daftplugPublicHeaderOverlay_dismiss',function(e){headerOverlay.fadeOut('fast',function(e){setCookie('headerOverlay','shown',objectName.settings.pwaOverlaysShowAgain)})})}
  40. 40 if(objectName.settings.pwaOverlaysTypes.includes('menu')&&isAndroidPwa==!1&&isIosPwa==!1&&isMenuOverlayShown==null&&menuOverlay.length){if(objectName.settings.pwaOverlaysBrowsers.includes('chrome')&&isAndroidChrome&&chrome2FullscreenOverlay.length){var isMenuBeforeinstallprompt=!1;var installPromptEvent=void 0;var isMenuOverlayFired=!1;window.addEventListener('beforeinstallprompt',function(event){event.preventDefault();isMenuBeforeinstallprompt=!0;installPromptEvent=event;setTimeout(function(){if(!isMenuOverlayFired){menuOverlay.css('display','flex').hide().fadeIn('fast',function(e){isMenuOverlayFired=!0;menuOverlay.on('click','.daftplugPublicMenuOverlay_install',function(e){menuOverlay.fadeOut('fast',function(e){setCookie('menuOverlay','shown',objectName.settings.pwaOverlaysShowAgain);installPromptEvent.prompt();installPromptEvent=null})})})}},3000)});setTimeout(function(){if(isMenuBeforeinstallprompt==!1){menuOverlay.css('display','flex').hide().fadeIn('fast').on('click','.daftplugPublicMenuOverlay_install',function(e){menuOverlay.fadeOut('fast',function(e){setCookie('menuOverlay','shown',objectName.settings.pwaOverlaysShowAgain);chrome2FullscreenOverlay.fadeIn('fast').on('click','.daftplugPublicFullscreenOverlay_close',function(e){chrome2FullscreenOverlay.fadeOut('fast')})})})}},3000)}else if(objectName.settings.pwaOverlaysBrowsers.includes('firefox')&&isAndroidFirefox&&firefoxFullscreenOverlay.length){setTimeout(function(){menuOverlay.css('display','flex').hide().fadeIn('fast').on('click','.daftplugPublicMenuOverlay_install',function(e){menuOverlay.fadeOut('fast',function(e){setCookie('menuOverlay','shown',objectName.settings.pwaOverlaysShowAgain);firefoxFullscreenOverlay.fadeIn('fast').on('click','.daftplugPublicFullscreenOverlay_close',function(e){firefoxFullscreenOverlay.fadeOut('fast')})})})},3000)}else if(objectName.settings.pwaOverlaysBrowsers.includes('safari')&&isIosSafari&&safariFullscreenOverlay.length){setTimeout(function(){menuOverlay.css('display','flex').hide().fadeIn('fast').on('click','.daftplugPublicMenuOverlay_install',function(e){menuOverlay.fadeOut('fast',function(e){setCookie('menuOverlay','shown',objectName.settings.pwaOverlaysShowAgain);safariFullscreenOverlay.fadeIn('fast').on('click','.daftplugPublicFullscreenOverlay_close',function(e){safariFullscreenOverlay.fadeOut('fast')})})})},3000)}
  41. 41 menuOverlay.on('click','.daftplugPublicMenuOverlay_dismiss',function(e){menuOverlay.fadeOut('fast',function(e){setCookie('menuOverlay','shown',objectName.settings.pwaOverlaysShowAgain)})})}
  42. 42 if(objectName.settings.pwaOverlaysTypes.includes('checkout')&&isAndroidPwa==!1&&isIosPwa==!1&&isCheckoutOverlayShown==null&&checkoutOverlay.length){if(objectName.settings.pwaOverlaysBrowsers.includes('chrome')&&isAndroidChrome&&chrome2FullscreenOverlay.length){var isCheckoutBeforeinstallprompt=!1;var installPromptEvent=void 0;var isCheckoutOverlayFired=!1;window.addEventListener('beforeinstallprompt',function(event){event.preventDefault();isCheckoutBeforeinstallprompt=!0;installPromptEvent=event;setTimeout(function(){if(!isCheckoutOverlayFired){checkoutOverlay.css('display','flex').hide().fadeIn('fast',function(e){isCheckoutOverlayFired=!0;checkoutOverlay.on('click','.daftplugPublicCheckoutOverlay_install',function(e){checkoutOverlay.fadeOut('fast',function(e){setCookie('checkoutOverlay','shown',objectName.settings.pwaOverlaysShowAgain);installPromptEvent.prompt();installPromptEvent=null})})})}},3000)});setTimeout(function(){if(isCheckoutBeforeinstallprompt==!1){checkoutOverlay.css('display','flex').hide().fadeIn('fast').on('click','.daftplugPublicCheckoutOverlay_install',function(e){checkoutOverlay.fadeOut('fast',function(e){setCookie('checkoutOverlay','shown',objectName.settings.pwaOverlaysShowAgain);chrome2FullscreenOverlay.fadeIn('fast').on('click','.daftplugPublicFullscreenOverlay_close',function(e){chrome2FullscreenOverlay.fadeOut('fast')})})})}},3000)}else if(objectName.settings.pwaOverlaysBrowsers.includes('firefox')&&isAndroidFirefox&&firefoxFullscreenOverlay.length){setTimeout(function(){checkoutOverlay.css('display','flex').hide().fadeIn('fast').on('click','.daftplugPublicCheckoutOverlay_install',function(e){checkoutOverlay.fadeOut('fast',function(e){setCookie('checkoutOverlay','shown',objectName.settings.pwaOverlaysShowAgain);firefoxFullscreenOverlay.fadeIn('fast').on('click','.daftplugPublicFullscreenOverlay_close',function(e){firefoxFullscreenOverlay.fadeOut('fast')})})})},3000)}else if(objectName.settings.pwaOverlaysBrowsers.includes('safari')&&isIosSafari&&safariFullscreenOverlay.length){setTimeout(function(){checkoutOverlay.css('display','flex').hide().fadeIn('fast').on('click','.daftplugPublicCheckoutOverlay_install',function(e){checkoutOverlay.fadeOut('fast',function(e){setCookie('checkoutOverlay','shown',objectName.settings.pwaOverlaysShowAgain);safariFullscreenOverlay.fadeIn('fast').on('click','.daftplugPublicFullscreenOverlay_close',function(e){safariFullscreenOverlay.fadeOut('fast')})})})},3000)}
  43. 43 checkoutOverlay.on('click','.daftplugPublicCheckoutOverlay_dismiss',function(e){checkoutOverlay.fadeOut('fast',function(e){setCookie('checkoutOverlay','shown',objectName.settings.pwaOverlaysShowAgain)})})}
  44. 44 if(objectName.settings.pwaOverlaysTypes.includes('post')&&isAndroidPwa==!1&&isIosPwa==!1&&isPostOverlayShown==null&&postOverlay.length){if(objectName.settings.pwaOverlaysBrowsers.includes('chrome')&&isAndroidChrome&&chrome2FullscreenOverlay.length){var isPostBeforeinstallprompt=!1;var installPromptEvent=void 0;var isPostOverlayFired=!1;window.addEventListener('beforeinstallprompt',function(event){event.preventDefault();isPostBeforeinstallprompt=!0;installPromptEvent=event;setTimeout(function(){if(!isPostOverlayFired){postOverlay.fadeIn('fast',function(e){isPostOverlayFired=!0;postOverlay.on('click','.daftplugPublicPostOverlayAction_button.-install',function(e){postOverlay.fadeOut('fast',function(e){setCookie('postOverlay','shown',objectName.settings.pwaOverlaysShowAgain);installPromptEvent.prompt();installPromptEvent=null})})})}},5000)});setTimeout(function(){if(isPostBeforeinstallprompt==!1){postOverlay.fadeIn('fast').on('click','.daftplugPublicPostOverlayAction_button.-install',function(e){postOverlay.fadeOut('fast',function(e){setCookie('postOverlay','shown',objectName.settings.pwaOverlaysShowAgain);chrome2FullscreenOverlay.fadeIn('fast').on('click','.daftplugPublicFullscreenOverlay_close',function(e){chrome2FullscreenOverlay.fadeOut('fast')})})})}},5000)}else if(objectName.settings.pwaOverlaysBrowsers.includes('firefox')&&isAndroidFirefox&&firefoxFullscreenOverlay.length){setTimeout(function(){postOverlay.fadeIn('fast').on('click','.daftplugPublicPostOverlayAction_button.-install',function(e){postOverlay.fadeOut('fast',function(e){setCookie('postOverlay','shown',objectName.settings.pwaOverlaysShowAgain);firefoxFullscreenOverlay.fadeIn('fast').on('click','.daftplugPublicFullscreenOverlay_close',function(e){firefoxFullscreenOverlay.fadeOut('fast')})})})},5000)}else if(objectName.settings.pwaOverlaysBrowsers.includes('safari')&&isIosSafari&&safariFullscreenOverlay.length){setTimeout(function(){postOverlay.fadeIn('fast').on('click','.daftplugPublicPostOverlayAction_button.-install',function(e){postOverlay.fadeOut('fast',function(e){setCookie('postOverlay','shown',objectName.settings.pwaOverlaysShowAgain);safariFullscreenOverlay.fadeIn('fast').on('click','.daftplugPublicFullscreenOverlay_close',function(e){safariFullscreenOverlay.fadeOut('fast')})})})},5000)}
  45. 45 postOverlay.on('click','.daftplugPublicPostOverlayAction_button.-dismiss',function(e){postOverlay.fadeOut('fast',function(e){setCookie('postOverlay','shown',objectName.settings.pwaOverlaysShowAgain)})})}}
  46. 46 if(objectName.settings.pwaInstallButton=='on'){if(isAndroidPwa==!1&&isIosPwa==!1&&installButton.length){if(objectName.settings.pwaInstallButtonBrowsers.includes('chrome')&&isAndroidChrome&&chrome2FullscreenOverlay.length){var isButtonBeforeinstallprompt=!1;var installPromptEvent=void 0;window.addEventListener('beforeinstallprompt',function(event){isButtonBeforeinstallprompt=!0;event.preventDefault();installPromptEvent=event;setTimeout(function(){installButton.css('display','inline-block').on('click',function(e){installPromptEvent.prompt();installPromptEvent=null})},1000)});setTimeout(function(){if(isMenuBeforeinstallprompt==!1){installButton.css('display','inline-block').on('click',function(e){chrome2FullscreenOverlay.fadeIn('fast').on('click','.daftplugPublicFullscreenOverlay_close',function(e){chrome2FullscreenOverlay.fadeOut('fast')})})}},1000)}else if(objectName.settings.pwaInstallButtonBrowsers.includes('firefox')&&isAndroidFirefox&&firefoxFullscreenOverlay.length){setTimeout(function(){installButton.css('display','inline-block').on('click',function(e){firefoxFullscreenOverlay.fadeIn('fast').on('click','.daftplugPublicFullscreenOverlay_close',function(e){firefoxFullscreenOverlay.fadeOut('fast')})})},1000)}else if(objectName.settings.pwaInstallButtonBrowsers.includes('safari')&&isIosSafari&&safariFullscreenOverlay.length){setTimeout(function(){installButton.css('display','inline-block').on('click',function(e){safariFullscreenOverlay.fadeIn('fast').on('click','.daftplugPublicFullscreenOverlay_close',function(e){safariFullscreenOverlay.fadeOut('fast')})})},1000)}}}
  47. 47 if(isIosPwa){var noddy,remotes=!1;document.addEventListener('click',function(event){noddy=event.target;if(noddy.tagName.toLowerCase()!=='a'||noddy.hostname!==window.location.hostname||noddy.pathname!==window.location.pathname||!/#/.test(noddy.href))return;while(noddy.nodeName!=='A'&&noddy.nodeName!=='HTML'){noddy=noddy.parentNode}
  48. 48 if('href' in noddy&&noddy.href.indexOf('http')!==-1&&(noddy.href.indexOf(document.location.host)!==-1||remotes)){event.preventDefault();document.location.href=noddy.href}},!1);setInterval(function(){if((objectName.settings.pwaOrientation=='portrait'&&window.matchMedia('(orientation: landscape)').matches)||(objectName.settings.pwaOrientation=='landscape'&&window.matchMedia('(orientation: portrait)').matches)){rotateNotice.css('display','flex');window.onorientationchange=function(e){rotateNotice.hide()}}},100)}
  49. 49 if(isPwa()){if(jQuery('form').length){jQuery('form').attr('data-persist','garlic')}}}
  50. 50 window.onappinstalled=function(e){jQuery.ajax({url:objectName.ajaxUrl,dataType:'text',type:'POST',data:{action:optionName+'_save_installation_analytics',},beforeSend:function(){console.log('saving')},success:function(response,textStatus,jqXhr){console.log('saved')},complete:function(){},error:function(jqXhr,textStatus,errorThrown){console.log(jqXhr)}})}})
Bookmark: javascript:location='http://shauninman.com/vs/?url='+escape(location)