PageSourceSearch

https://mooders.net/service-worker.js

js mooders.net collected 2026-10-04 12:38:24 UTC 1,060 bytes, 40 lines download raw bytes

1'use strict';
2
3var cacheVersion = 1;
4var currentCache = {
5  offline: 'offline-cache' + cacheVersion
6};
7
8// WP CLASSIC STRUCTURE
9const offlineUrl = './wp-content/themes/beaucoup/resources/views/offline.html';
10
11this.addEventListener('install', event => {
12  event.waitUntil(
13    caches.open(currentCache.offline).then(function(cache) {
14      return cache.addAll([offlineUrl]);
15    })
16  );
17});
18
19const doesRequestAcceptHtml = (request) => {
20  return request.headers.get('Accept').split(',').some(function (type) { return type === 'text/html'; });
21};
22
23this.addEventListener('fetch', event => {
24  // for DevTools Chrome bug
25  if (event.request.cache === 'only-if-cached' && event.request.mode !== 'same-origin') return;
26  var request = event.request;
27  if (doesRequestAcceptHtml(request)) {
28    event.respondWith(fetch(request)
29      .catch(function () {
30        return caches.match(offlineUrl);
31      })
32    );
33  } else {
34    event.respondWith(caches.match(request)
35      .then(function (response) {
36        return response || fetch(request);
37      })
38    );
39  }
40});

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.