PageSourceSearch

https://shademix.com/sw.js

js shademix.com collected 2026-10-02 00:33:16 UTC 3,038 bytes, 101 lines download raw bytes

1
2const CACHE = 'shademix-v189';
3const ASSETS = [
4  './',
5  './index.html',
6  './about.html',
7  './pro.html',
8  './privacy.html',
9  './support.html',
10  './sitemap.xml',
11  './googleLqlCoMr1bs7GuUYzpSc2LGJrghvgdFOy4gzwm3aTbIQ.html',
12  './google845a1f2fba8d64ed.html',
13  './robots.txt',
14  './styles.css',
15  './manifest.json',
16  './og.png',
17  './favicon.ico',
18  './apple-touch-icon.png',
19  './icons/icon-192.svg',
20  './icons/icon-512.svg',
21  './icons/icon-192.png',
22  './icons/icon-512.png',
23  './icons/maskable-192.png',
24  './icons/maskable-512.png',
25  './icons/apple-touch-icon.png',
26  './icons/favicon-16.png',
27  './icons/favicon-32.png',
28  './icons/favicon-48.png',
29  './icons/safari-pinned-tab.svg',
30  './icons/logo-mark.svg',
31  './js/color-math.js',
32  './js/db.js',
33  './js/eyedropper.js',
34  './js/realcolor-engine.js',
35  './js/realcolor-data.js',
36  './js/realcolor.js',
37  './js/pro-key.js',
38  './js/import.js',
39  './js/sync.js',
40  './js/store.js',
41  './js/export.js',
42  './js/native.js',
43  './js/platform-clean.js',
44  './js/pro.js',
45  './js/discount.js',
46  './js/pricing.js',
47  './js/free-mode.js',
48  './js/shell.js',
49  './js/i18n.js',
50  './js/app.js',
51  './js/print-check.js',
52  './i18n/en.json',
53  './404.html',
54  './data/palettes.json',
55  './data/moods.json'
56];
57
58self.addEventListener('install', e => {
59  e.waitUntil(caches.open(CACHE).then(c => c.addAll(ASSETS).catch(() => {})));
60  self.skipWaiting();
61});
62self.addEventListener('activate', e => {
63  e.waitUntil(caches.keys().then(keys => Promise.all(keys.filter(k => k !== CACHE).map(k => caches.delete(k)))));
64  self.clients.claim();
65});
66// Code (HTML navigations, JS, CSS) is served network-first so a fresh deploy
67// reaches every client - including the iOS/Android WebView, which keeps its own
68// service-worker cache - on the next launch, with no manual cache clear. Static
69// assets (images, icons, fonts, JSON data) stay cache-first for speed. Both fall
70// back to cache when offline, preserving full offline use.
71function isCodeRequest(request, url) {
72  if (request.mode === 'navigate') return true;
73  return /\.(?:js|css|html)$/i.test(url.pathname);
74}
75
76self.addEventListener('fetch', e => {
77  const url = new URL(e.request.url);
78  if (url.origin !== location.origin) return;
79  if (e.request.method !== 'GET') return;
80
81  if (isCodeRequest(e.request, url)) {
82    // Network-first: always try the freshest code, fall back to cache offline.
83    e.respondWith(
84      fetch(e.request).then(res => {
85        const copy = res.clone();
86        caches.open(CACHE).then(c => c.put(e.request, copy)).catch(() => {});
87        return res;
88      }).catch(() => caches.match(e.request).then(cached => cached || caches.match('./index.html')))
89    );
90    return;
91  }
92
93  // Cache-first for static assets.
94  e.respondWith(
95    caches.match(e.request).then(cached => cached || fetch(e.request).then(res => {
96      const copy = res.clone();
97      caches.open(CACHE).then(c => c.put(e.request, copy)).catch(() => {});
98      return res;
99    }).catch(() => caches.match('./index.html')))
100  );
101});

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.