PageSourceSearch

https://www.hatanakh.com/sw.js

js hatanakh.com collected 2026-10-02 10:25:42 UTC 1,956 bytes, 74 lines download raw bytes

1var CACHE_NAME = 'hatanakh-v1';
2var STATIC_ASSETS = [
3  '/sites/all/themes/herzog/images/icon-192.png',
4  '/sites/all/themes/herzog/images/icon-512.png'
5];
6
7self.addEventListener('install', function (event) {
8  event.waitUntil(
9    caches.open(CACHE_NAME).then(function (cache) {
10      return cache.addAll(STATIC_ASSETS);
11    })
12  );
13  self.skipWaiting();
14});
15
16self.addEventListener('activate', function (event) {
17  event.waitUntil(
18    caches.keys().then(function (cacheNames) {
19      return Promise.all(
20        cacheNames.filter(function (name) {
21          return name !== CACHE_NAME;
22        }).map(function (name) {
23          return caches.delete(name);
24        })
25      );
26    })
27  );
28  self.clients.claim();
29});
30
31self.addEventListener('fetch', function (event) {
32  var request = event.request;
33  var url = new URL(request.url);
34
35  if (request.method !== 'GET') return;
36
37  if (url.origin !== location.origin) return;
38
39  if (request.destination === 'style' ||
40      request.destination === 'script' ||
41      request.destination === 'image' ||
42      request.destination === 'font' ||
43      url.pathname.match(/\.(css|js|png|jpg|jpeg|gif|svg|woff|woff2|ttf|eot)$/)) {
44    event.respondWith(
45      caches.match(request).then(function (cached) {
46        if (cached) return cached;
47        return fetch(request).then(function (response) {
48          if (response.ok) {
49            var clone = response.clone();
50            caches.open(CACHE_NAME).then(function (cache) {
51              cache.put(request, clone);
52            });
53          }
54          return response;
55        });
56      })
57    );
58    return;
59  }
60
61  event.respondWith(
62    fetch(request).then(function (response) {
63      if (response.ok) {
64        var clone = response.clone();
65        caches.open(CACHE_NAME).then(function (cache) {
66          cache.put(request, clone);
67        });
68      }
69      return response;
70    }).catch(function () {
71      return caches.match(request);
72    })
73  );
74});

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.