PageSourceSearch

https://visualpurple.net/vp_service-worker.js

js visualpurple.net collected 2026-10-04 12:28:24 UTC 2,418 bytes, 76 lines download raw bytes

1importScripts('/js/idb.js');
2importScripts('/js/utility.js');
3var CACHE_STATIC_NAME = 'static-v1';
4var CACHE_DYNAMIC_NAME = 'dynamic-v0';
5var STATIC_FILES = [
6  '/',
7  '/index.html',
8  '/offline.html',
9  '/js/main.js',
10  '/js/idb.js',
11  '/js/promise.js',
12  '/js/fetch.js',
13  '/css/main.css',
14  '/assets/images/vplogo_white_on_black564x332.png',
15  '/css/mobirise-icons.css',
16  '/offline/index.html',
17  '/assets/images/vectorstock-17089319-530x340.png'
18];
19
20self.addEventListener('install', function(event) {
21  console.log('[Service Worker] Installing Service Worker ...', event);
22  event.waitUntil(
23    caches.open(CACHE_STATIC_NAME).then(function(cache) {
24      console.log('[Service Worker] Precaching App Shell');
25      cache.addAll(STATIC_FILES);
26    })
27  );
28});
29
30self.addEventListener('activate', function(event) {
31  console.log('[Service Worker] Activating Service Worker ....', event);
32  event.waitUntil(
33    caches.keys().then(function(keyList) {
34      return Promise.all(
35        keyList.map(function(key) {
36          if (key !== CACHE_STATIC_NAME && key !== CACHE_DYNAMIC_NAME) {
37            console.log('[Service Worker] Removing old cache.', key);
38            return caches.delete(key);
39          }
40        })
41      );
42    })
43  );
44  return self.clients.claim();
45});
46
47// // is image URL?
48// let iExt = ['png', 'jpg', 'jpeg', 'gif', 'webp', 'bmp'].map(f => '.' + f);
49// function isImage(url) {
50//   return iExt.reduce((ret, ext) => ret || url.endsWith(ext), false);
51// }
52
53// return offline asset
54// function offlineAsset(url) {
55//   if (isImage(url)) {
56//     // return image
57//     return new Response(
58//       '<svg role="img" viewBox="0 0 400 300" xmlns="http://www.w3.org/2000/svg"><title>offline</title><path d="M0 0h400v300H0z" fill="#eee" /><text x="200" y="150" text-anchor="middle" dominant-baseline="middle" font-family="sans-serif" font-size="50" fill="#ccc">offline</text></svg>',
59//       {
60//         headers: {
61//           'Content-Type': 'image/svg+xml',
62//           'Cache-Control': 'no-store'
63//         }
64//       }
65//     );
66//   } else {
67//     // return page
68//     return caches.match(offlineURL);
69//   }
70// }
71
72// application fetch network data
73self.addEventListener('fetch', function(event) {
74  // console.log('[service worker] Fetching something...', event);
75  event.respondWith(fetch(event.request));
76});

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.