PageSourceSearch

https://botaniki.pl/pwa_sw.js

js botaniki.pl collected 2026-10-08 06:45:40 UTC 2,093 bytes, 78 lines download raw bytes

1var filesToCache = [
2    '/data/include/pwa/pwa-out-of-internet.gif',
3    '/data/include/pwa/pwa-offline-pl.html',
4    '/data/include/pwa/pwa-offline-en.html'
5];
6
7var cacheName = 'iai-pwa-out-of-internet-3';
8
9self.addEventListener('install', function(event) {
10    self.skipWaiting();
11    event.waitUntil (
12        caches.open(cacheName)
13            .then(function (cache) {
14                return cache.addAll(filesToCache);
15            })
16    );
17});
18
19self.addEventListener('activate', function (event) {
20    var cacheWhitelist = [cacheName];
21
22    event.waitUntil(
23        caches.keys().then(function (cacheNames) {
24            return Promise.all(
25                cacheNames.map(function (cacheName) {
26                    if (cacheWhitelist.indexOf(cacheName) === -1) {
27                        return caches.delete(cacheName);
28                    }
29                })
30            );
31        })
32    );
33});
34
35self.addEventListener('fetch', function (event) {
36    if (event.request.method != 'GET') {
37        return;
38    }
39
40    // adres strony
41    var host = 'https://' + self.location.host;
42    var eventUrl = event.request.url;
43    if (event.request.url.startsWith(host) === false) {
44        // event, który jest fetchowany przez PWA nie należy do adresu strony sklepu, odrzucamy
45        return;
46    }
47
48    try {
49        var regexStr = '(' + event.currentTarget.origin + '\/(ajax|api|customer-api|edi|fulfillment-api|marketplace-api|panel|rma|data\/)\/)';
50    } catch (err) {
51        return;
52    }
53
54    if (event.request.url.match(regexStr) !== null) {
55        return;
56    }
57
58    try {
59        var regexStr = event.currentTarget.origin + '\/(\\w{2,3}\/)?order';
60    } catch (err) {
61        return;
62    }
63
64    if (event.request.url.match(regexStr) !== null) {
65        return;
66    }
67
68    event.respondWith(
69        caches.match(event.request).then(function(response) {
70            return fetch(event.request);
71        }).catch(function(error) {
72            if (!navigator.onLine) {
73                return caches.match('/pwa_offline.html');
74            }
75            return;
76        })
77    );
78});

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.