PageSourceSearch

http://meme-buttons.com/sw.js

js meme-buttons.com collected 2026-10-06 17:50:13 UTC 1,886 bytes, 73 lines download raw bytes

1/* meme-buttons PWA Service Worker — static shell only; never touch audio/media */
2const CACHE_NAME = "meme-buttons-v2";
3const STATIC_ASSETS = [
4  "/",
5  "/manifest.webmanifest",
6  "/favicon-32x32.png",
7  "/icons/icon-192x192.png",
8  "/icons/icon-512x512.png",
9];
10
11self.addEventListener("install", (event) => {
12  event.waitUntil(
13    caches.open(CACHE_NAME).then((cache) => {
14      return cache.addAll(STATIC_ASSETS).catch(() => {
15        // Ignore failed individual requests
16      });
17    })
18  );
19  self.skipWaiting();
20});
21
22self.addEventListener("activate", (event) => {
23  event.waitUntil(
24    caches.keys().then((keys) =>
25      Promise.all(
26        keys.filter((k) => k !== CACHE_NAME).map((k) => caches.delete(k))
27      )
28    )
29  );
30  self.clients.claim();
31});
32
33self.addEventListener("fetch", (event) => {
34  if (event.request.method !== "GET") return;
35
36  const dest = event.request.destination;
37  if (dest === "audio" || dest === "video" || dest === "track") return;
38
39  const url = event.request.url;
40  if (
41    url.includes("/media/") ||
42    url.includes("/sounds/download/") ||
43    url.includes("play-v1.soundboard.cloud")
44  ) {
45    return;
46  }
47
48  // Only cache explicit static shell navigations / assets (same-origin)
49  if (!url.startsWith(self.location.origin)) return;
50
51  const path = new URL(url).pathname;
52  const isStaticShell =
53    path === "/" ||
54    STATIC_ASSETS.includes(path) ||
55    path.startsWith("/icons/") ||
56    path.startsWith("/favicon");
57
58  if (!isStaticShell) return;
59
60  event.respondWith(
61    fetch(event.request)
62      .then((response) => {
63        if (response.ok) {
64          const clone = response.clone();
65          caches.open(CACHE_NAME).then((cache) => cache.put(event.request, clone));
66        }
67        return response;
68      })
69      .catch(() =>
70        caches.match(event.request).then((cached) => cached || caches.match("/"))
71      )
72  );
73});

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.