PageSourceSearch

https://www.vizionplus.tv/sw.js

js vizionplus.tv collected 2026-10-02 06:32:05 UTC 2,179 bytes, 38 lines download raw bytes

1/*
2 * Vizion Plus service worker (DECISIONS #252). Deliberately small: a news and live-TV site must
3 * never show yesterday's page, so nothing here caches stories, the guide or the stream.
4 *   · page loads go to the network; only when there is no connection does the offline page answer
5 *   · the offline page and the three files it needs are kept on the device
6 * 39667cae44 and ["/offline/","/wp-content/themes/vizionplus/assets/css/tokens.css?ver=1789943147","/wp-content/themes/vizionplus/assets/css/offline.css?ver=1789931778","/wp-content/themes/vizionplus/assets/pwa/offline.js?ver=1789931778","/wp-content/themes/vizionplus/assets/app/icon.svg"] are filled in by inc/pwa.php when it serves this file at /sw.js.
7 */
8const CACHE = 'vp-offline-39667cae44';
9const OFFLINE = '/offline/';
10const PRECACHE = ["/offline/","/wp-content/themes/vizionplus/assets/css/tokens.css?ver=1789943147","/wp-content/themes/vizionplus/assets/css/offline.css?ver=1789931778","/wp-content/themes/vizionplus/assets/pwa/offline.js?ver=1789931778","/wp-content/themes/vizionplus/assets/app/icon.svg"];
11
12self.addEventListener('install', (event) => {
13  event.waitUntil(caches.open(CACHE).then((c) => c.addAll(PRECACHE)).then(() => self.skipWaiting()));
14});
15
16self.addEventListener('activate', (event) => {
17  event.waitUntil(
18    caches.keys()
19      .then((keys) => Promise.all(keys.filter((k) => k.startsWith('vp-offline-') && k !== CACHE).map((k) => caches.delete(k))))
20      .then(() => self.clients.claim())
21  );
22});
23
24self.addEventListener('fetch', (event) => {
25  const req = event.request;
26  if (req.method !== 'GET') return;
27  const url = new URL(req.url);
28  if (url.origin !== self.location.origin) return;
29  if (req.mode === 'navigate') {
30    if (url.pathname.startsWith('/wp-admin') || url.pathname.startsWith('/wp-login')) return;
31    event.respondWith(fetch(req).catch(() => caches.match(OFFLINE, { ignoreSearch: true })));
32    return;
33  }
34  // the offline page's own files, when the network is gone
35  if (PRECACHE.includes(url.pathname + url.search) || PRECACHE.includes(url.pathname)) {
36    event.respondWith(fetch(req).catch(() => caches.match(req, { ignoreSearch: true })));
37  }
38});

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.