PageSourceSearch

https://molly.com/sw.js

js molly.com collected 2026-10-02 02:41:07 UTC 3,831 bytes, 121 lines download raw bytes

1const CACHE_NAME = 'mollyverse-v10-art-f0dc83da0ca7';
2
3const PRECACHE_ASSETS = [
4  '/recast.wasm',
5  '/favicon.svg',
6  '/logo.jpg',
7  '/sprites/player.webp?v=9',
8  '/sprites/player_crouch.webp?v=9',
9  '/sprites/npc_kid.webp?v=9',
10  '/sprites/npc_shopkeeper.webp?v=9',
11  '/sprites/npc_woman.webp?v=9',
12  '/sprites/npc_pho.webp?v=9',
13  '/sprites/npc_woman_sit.webp?v=9',
14  '/sprites/npc_shopkeeper_sit.webp?v=9',
15  '/sprites/npc_kid_sit.webp?v=9',
16  '/sprites/player_sit.webp?v=9',
17  '/hd2d/environment/backdrop_skyline_day.webp',
18  '/hd2d/environment/backdrop_treeline_day.webp',
19  '/hd2d/environment/ground_cobble.webp',
20  '/hd2d/environment/ground_grass.webp',
21];
22
23self.addEventListener('install', (event) => {
24  event.waitUntil(
25    caches.open(CACHE_NAME).then((cache) => cache.addAll(PRECACHE_ASSETS))
26  );
27});
28self.addEventListener('activate', (event) => {
29  // Do not immediately evict caches used by already-open tabs. The new worker
30  // activates naturally after those clients close/reload, at which point old
31  // hashed chunks are no longer needed.
32  event.waitUntil(caches.keys().then((keys) =>
33    Promise.all(keys.filter((k) => k !== CACHE_NAME).map((k) => caches.delete(k)))
34  ));
35});
36
37self.addEventListener('fetch', (event) => {
38  const url = new URL(event.request.url);
39
40  if (event.request.method !== 'GET') return;
41  if (url.protocol !== 'https:' && url.protocol !== 'http:') return;
42
43  if (url.pathname.startsWith('/api/')) return;
44  if (url.pathname === '/api/ws') return;
45
46  if (url.pathname.includes('/assets/') && /\.[a-f0-9]{8,}\.(js|css|wasm|png|jpg|svg|woff2?)$/i.test(url.pathname)) {
47    event.respondWith(
48      caches.match(event.request).then((cached) => {
49        if (cached) return cached;
50        return fetch(event.request).then((response) => {
51          if (response.ok) {
52            const clone = response.clone();
53            caches.open(CACHE_NAME).then((cache) => cache.put(event.request, clone));
54          }
55          return response;
56        });
57      })
58    );
59    return;
60  }
61
62  if (/\.(wasm|obj|mtl|glb|gltf|png|jpg|jpeg|svg|webp|ico|woff2?)$/i.test(url.pathname)) {
63    event.respondWith(
64      caches.match(event.request).then((cached) => {
65        if (cached) return cached;
66        return fetch(event.request).then((response) => {
67          if (response.ok) {
68            const clone = response.clone();
69            caches.open(CACHE_NAME).then((cache) => cache.put(event.request, clone));
70          }
71          return response;
72        });
73      })
74    );
75    return;
76  }
77
78  if (url.pathname.endsWith('.js') || url.pathname.endsWith('.css')) {
79    event.respondWith(
80      caches.match(event.request).then((cached) => {
81        if (cached) return cached;
82        return fetch(event.request).then((response) => {
83          if (response.ok) {
84            const clone = response.clone();
85            caches.open(CACHE_NAME).then((cache) => cache.put(event.request, clone));
86          }
87          return response;
88        });
89      })
90    );
91    return;
92  }
93
94  if (event.request.mode === 'navigate') {
95    event.respondWith(
96      fetch(event.request).then((response) => {
97        if (response.ok) {
98          const clone = response.clone();
99          caches.open(CACHE_NAME).then((cache) => cache.put(event.request, clone));
100        }
101        return response;
102      }).catch(() => caches.match(event.request))
103    );
104    return;
105  }
106
107  if (url.origin === self.location.origin) {
108    event.respondWith(
109      caches.match(event.request).then((cached) => {
110        if (cached) return cached;
111        return fetch(event.request).then((response) => {
112          if (response.ok) {
113            const clone = response.clone();
114            caches.open(CACHE_NAME).then((cache) => cache.put(event.request, clone));
115          }
116          return response;
117        });
118      })
119    );
120  }
121});

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.