PageSourceSearch

https://www.mannings.com.hk/venia-static-assets/installv1.0.0.js

js mannings.com.hk collected 2026-09-24 10:48:53 UTC 2,676 bytes, 83 lines download raw bytes

1/* eslint-disable no-console */
2/* eslint-disable radix */
3/* eslint-disable no-unused-vars */
4let deferredPrompt;
5
6function showInstallPromotion() {
7    const date = new Date();
8    const hide = localStorage.getItem('hideInstallPopup');
9    const expired = localStorage.getItem('expiredHideInstallPopup');
10    if (window.innerWidth < 768) {
11        const el = document.getElementById('popup-mobile__install');
12        // hidden popup
13        if (
14            el &&
15            (hide !== 'true' ||
16                (hide === 'true' && date.getDate() >= parseInt(expired)))
17        ) {
18            localStorage.removeItem('hideInstallPopup');
19            localStorage.removeItem('expiredHideInstallPopup');
20            el.style.display = 'flex';
21        }
22    } else {
23        const elDesktop = document.getElementById('popup-desktop__install');
24        if (
25            elDesktop &&
26            (hide !== 'true' ||
27                (hide === 'true' && date.getDate() >= parseInt(expired)))
28        ) {
29            elDesktop.style.display = 'block';
30        }
31    }
32
33    // run instalation
34    const buttonInstall =
35        window.innerWidth <= 768
36            ? document.getElementById('btn-install__mobile')
37            : document.getElementById('btn-install');
38    if (buttonInstall) {
39        buttonInstall.addEventListener('click', e => {
40            deferredPrompt.prompt();
41        });
42    }
43}
44
45function hideInstallPromotion() {
46    if (window.innerWidth <= 768) {
47        const el = document.getElementById('popup-mobile__install');
48        // hidden popup
49        if (el) {
50            el.style.display = 'none';
51        }
52
53        const date = new Date();
54        // add a day
55        date.setDate(date.getDate() + 1);
56        localStorage.removeItem('hideInstallPopup', true);
57        localStorage.removeItem('expiredHideInstallPopup', date.getDate());
58    } else {
59        const elDesktop = document.getElementById('popup-desktop__install');
60        if (elDesktop) {
61            elDesktop.style.display = 'none';
62        }
63        const date = new Date();
64        // add a day
65        date.setDate(date.getDate() + 1);
66        localStorage.removeItem('hideInstallPopup', true);
67        localStorage.removeItem('expiredHideInstallPopup', date.getDate());
68    }
69}
70
71window.addEventListener('beforeinstallprompt', e => {
72    // Prevent the mini-infobar from appearing on mobile
73    e.preventDefault();
74    // Stash the event so it can be triggered later.
75    deferredPrompt = e;
76    console.log(e);
77    // Update UI notify the user they can install the PWA
78    showInstallPromotion();
79});
80
81window.addEventListener('appinstalled', evt => {
82    hideInstallPromotion();
83});

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.