PageSourceSearch

https://www.denley.pl/ajax/js/pwa_online_bar.js?v=1&r=6

js denley.pl collected 2026-09-26 04:21:57 UTC 5,662 bytes, 170 lines download raw bytes

1var PWAHandler = {
2    'cacheName' : 'iai-pwa-out-of-internet-1'
3};
4
5try {
6    PWAHandler.registerServiceWorker = function () {
7        return navigator.serviceWorker.register('/pwa_sw.js')
8            .then(function (registration) {
9                return registration;
10            })
11            .catch(function (err) {
12                console.log('Unable to register pwa service worker.', err);
13            });
14    };
15
16    PWAHandler.checkCompatibility = function () {
17        return _adblock == false && ('serviceWorker' in navigator);
18    };
19
20    PWAHandler.isIos = function() {
21        var userAgent = window.navigator.userAgent.toLowerCase();
22        return /iphone|ipad|ipod/.test(userAgent);
23    };
24
25    PWAHandler.isInStandaloneMode = function () {
26        return ('standalone' in window.navigator) && (window.navigator.standalone);
27    };
28
29    PWAHandler.regenerateCache = function () {
30        var lang = null;
31        if ('languages' in navigator) {
32            lang = navigator.languages[0].substring(0, 2);
33        } else {
34            if ('language' in navigator) {
35                lang = navigator.language.substring(0, 2);
36            } else {
37                if ('userLanguage' in navigator) {
38                    lang = navigator.userLanguage.substring(0, 2);
39                }
40            }
41        }
42
43        var offlinePage = (lang === 'pl' || lang === 'PL')
44            ? '/data/include/pwa/pwa-offline-pl.html'
45            : '/data/include/pwa/pwa-offline-en.html';
46
47        var filesToCache = [
48            '/data/include/pwa/pwa-out-of-internet.gif',
49            '/data/include/pwa/pwa-offline-pl.html',
50            '/data/include/pwa/pwa-offline-en.html'
51        ];
52
53        caches.open(PWAHandler.cacheName).then(function (cache) {
54            fetch(offlinePage).then(function(response) {
55                if (response.ok) {
56                    return cache.addAll(filesToCache) && cache.put('/pwa_offline.html', response);
57                }
58            });
59        });
60    }
61
62    PWAHandler.checkCache = function() {
63        caches.open(PWAHandler.cacheName).then(function (cache) {
64            cache.keys().then(function(keys) {
65                if (keys.length < 4) {
66                    PWAHandler.regenerateCache();
67                }
68            });
69        });
70    }
71
72    PWAHandler.init = function () {
73        if (!PWAHandler.checkCompatibility()) {
74            return;
75        }
76
77        PWAHandler.swRegistration = PWAHandler.registerServiceWorker();
78        PWAHandler.checkCache();
79    };
80
81    PWAHandler.init();
82
83    //iOS dodanie do ekranu domowego
84    if (PWAHandler.isIos() && !PWAHandler.isInStandaloneMode()) {
85        this.setState({showInstallMessage: true});
86    }
87
88} catch(e) {
89    console.log(e);
90}
91
92//Symulacja manifestu dla iOS'a
93(function() {
94    var startUrlEl = document.querySelector("meta[name=msapplication-starturl]");
95    if(!!startUrlEl === true && navigator.standalone === true) {
96        var lastUrl = localStorage["navigate"];
97        history.pushState({launched: (!!lastUrl == false && history.length === 1)}, undefined, lastUrl || startUrlEl.content);
98        localStorage.removeItem("navigate");
99
100        // Intercept all anchor clicks and keep fullscreen if in origin
101        document.addEventListener("click", function(e) {
102            var target = e.target;
103            if(target.tagName === 'A') {
104
105                var href = target.getAttribute("href");
106                var linkedUrl = new URL(target.href);
107                if(linkedUrl.origin === location.origin) {
108                    e.preventDefault();
109                    location.href = href;
110                }
111                else {
112                    // When we are navigating away store the state so we can resume.
113                    localStorage["navigate"] = location.href;
114                }
115            }
116        });
117    }
118})();
119
120document.addEventListener('DOMContentLoaded', function(){
121    window.addEventListener('beforeunload', function() {
122        if (window.matchMedia('(display-mode: standalone)').matches || window.matchMedia('(display-mode: fullscreen)').matches) {
123            document.getElementsByTagName("BODY")[0].classList.add("load-content");
124        }
125    });
126}, false);
127
128window.addEventListener('load', function() {
129    var stylePWA = {
130        bottom: 0,
131        background: '#eb5467',
132        left: 0,
133        position:'fixed',
134        right:0,
135        textAlign:'center',
136        zIndex: 99999,
137        display:'none',
138        fontFamily:'Arial,sans-serif'
139    };
140    var elePWA = document.createElement('div');
141    elePWA.setAttribute('id','offlineInfo');
142    document.querySelector('body').appendChild(elePWA);
143
144    var infoBlockPWA = document.querySelector('#offlineInfo');
145    infoBlockPWA.innerHTML ='<span id="offlineInfo_sub" style="color:#fff;padding:3px 10px;font-size:12px;display:block;"></span>';
146    var infoBlockPWASub = document.querySelector('#offlineInfo_sub');
147
148
149    var currStyle;
150    for (currStyle in stylePWA)
151        infoBlockPWA.style[currStyle] = stylePWA[currStyle];
152
153    function updateOnlineStatus(event) {
154        var condition = navigator.onLine ? 'online' : 'offline';
155
156        infoBlockPWASub.innerText = statusPWA[condition].txt;
157        infoBlockPWASub.style.background = statusPWA[condition].bg;
158        infoBlockPWA.style.display = 'block';
159
160        if(condition === 'online')
161            setTimeout(function () {
162                infoBlockPWA.style.display = 'none';
163            }, 1500);
164    }
165
166    setTimeout(function() {
167        window.addEventListener('online',  updateOnlineStatus);
168        window.addEventListener('offline', updateOnlineStatus);
169    }, 1000);
170});

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.