1//<--------- Start Payment -------//> 2(function($) { 3 "use strict"; 4 5 const divInstall = document.getElementById('installContainer'); 6 const butInstall = document.getElementById('butInstall'); 7 8 if (divInstall && butInstall) { 9 window.addEventListener('beforeinstallprompt', (event) => { 10 // Prevent the mini-infobar from appearing on mobile. 11 event.preventDefault(); 12 console.log('Ok', 'beforeinstallprompt', event); 13 // Stash the event so it can be triggered later. 14 window.deferredPrompt = event; 15 // Remove the 'display-none' class from the install button container. 16 divInstall.classList.toggle('display-none', false); 17 }); 18 19 butInstall.addEventListener('click', async () => { 20 console.log('Ok', 'butInstall-clicked'); 21 const promptEvent = window.deferredPrompt; 22 if (!promptEvent) { 23 // The deferred prompt isn't available. 24 return; 25 } 26 // Show the install prompt. 27 promptEvent.prompt(); 28 // Log the result 29 const result = await promptEvent.userChoice; 30 console.log('Ok', 'userChoice', result); 31 // Reset the deferred prompt variable, since 32 // prompt() can only be called once. 33 window.deferredPrompt = null; 34 // Hide the install button. 35 divInstall.classList.toggle('display-none', true); 36 }); 37 38 window.addEventListener('appinstalled', (event) => { 39 console.log('Ok', 'appinstalled', event); 40 // Clear the deferredPrompt so it can be garbage collected 41 window.deferredPrompt = null; 42 }); 43 } 44 45})(jQuery);
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.