1const installButton = document.getElementById('install-app'); 2let beforeInstallPromptEvent 3window.addEventListener('beforeinstallprompt', function(e) { 4 e.preventDefault(); 5 beforeInstallPromptEvent = e 6 installButton.style.display = 'block' 7 installButton.addEventListener('click', function() { 8 e.prompt(); 9 }); 10 installButton.hidden = false; 11 12 (function($) { 13 "use strict"; 14 var data = $('#kanews-install-app'), 15 delay = data.data('delay'), 16 expired = data.data('expired'), 17 cookie = 'kan_install_app' 18 19 if ( typeof CookieBox !== 'undefined' && CookieBox.isFirstVisit() ) { 20 return; 21 } 22 23 if( ! Cookies.get(cookie) ) { 24 Cookies.set(cookie, 'active') 25 } 26 27 if( Cookies.get(cookie) == 'active' ) { 28 var openInstall = function() { 29 if (data.length && !data.parent().is('body')) { 30 data.appendTo('body'); 31 } 32 data.removeAttr('hidden').attr('aria-hidden', 'false').addClass('is-active'); 33 $('body').addClass('kan-modal-open'); 34 }; 35 setTimeout(function() { 36 if (typeof window.requestIdleCallback === 'function') { 37 window.requestIdleCallback(openInstall, { timeout: 4000 }); 38 } else { 39 openInstall(); 40 } 41 }, delay); 42 data.find('.kanews-modal-close-btn').on('click', function(){ 43 Cookies.set(cookie, 'disable', {expires:expired}); 44 }); 45 } 46 })(jQuery); 47}); 48installButton.addEventListener('click', function() { 49 beforeInstallPromptEvent.prompt(); 50});
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.