PageSourceSearch

https://vrspacegame.com/sw.js

js vrspacegame.com collected 2026-10-02 00:59:43 UTC 5,664 bytes, 120 lines download raw bytes

1"use strict";
2
3const CACHE_NAME = 'vrspacegame.com-1578224240893';
4const SW_SUPPORTED_PROTOCOL_REGEX = /http(s?):/;
5const pageUrls = JSON.parse('["/","/privacy-policy"]');
6const staticAssets = JSON.parse('["//img1.wsimg.com/blobby/go/902a2ec9-dc2c-4c63-a5e3-8fbf832d0034/gpub/4ce1a7c86682e5e8/styles.css","//img1.wsimg.com/blobby/go/902a2ec9-dc2c-4c63-a5e3-8fbf832d0034/gpub/b1d859805808cce6/styles.css","//img1.wsimg.com/blobby/go/902a2ec9-dc2c-4c63-a5e3-8fbf832d0034/gpub/7831d45418813cea/styles.css","https://img1.wsimg.com/poly/v2/polyfill.min.js?unknown=polyfill&flags=gated&features=default%2Cfetch%2CArray.prototype.%40%40iterator%2CArray.prototype.find%2CArray.prototype.findIndex%2CFunction.name%2CNumber.isFinite%2CPromise%2CString.prototype.repeat%2CMath.sign%2CMath.trunc%2CArray.prototype.includes%2CObject.entries%2CObject.values%2CIntersectionObserver%2CIntl.~locale.en-GB","//img1.wsimg.com/blobby/go/gpub/e645c3e6fe995b50/script.js","//img1.wsimg.com/ceph-p3-01/website-builder-data-prod/static/widgets/UX.3.55.37.js","//img1.wsimg.com/blobby/go/gpub/38e4c49bc7ee31e0/script.js","//img1.wsimg.com/blobby/go/gpub/17d6eee626c9d02f/script.js","//img1.wsimg.com/blobby/go/gpub/70fa198bc69fb4f8/script.js","//fonts.googleapis.com/css?family=Playfair+Display:400,700,900","//fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,700,700i,800","//img1.wsimg.com/blobby/go/902a2ec9-dc2c-4c63-a5e3-8fbf832d0034/gpub/d32682e0d9c7ec7/styles.css","//img1.wsimg.com/blobby/go/902a2ec9-dc2c-4c63-a5e3-8fbf832d0034/gpub/fd5450f36e59fca9/styles.css"]');
7const networkOnlyUrls = JSON.parse('["https://api.ola.godaddy.com","https://902a2ec9-dc2c-4c63-a5e3-8fbf832d0034.onlinestore.godaddy.com","https://img.secureserver.net/t/1/tl/event","https://img.test-secureserver.net/t/1/tl/event","https://www.google-analytics.com/collect"]');
8const networkOnlyUrlsRegex = JSON.parse('["vrspacegame.com/m/api/.*"]').map(regexString => new RegExp(regexString));
9
10function preCacheResources() {
11  return caches.open(CACHE_NAME).then(function (cache) {
12    // Pre-Cache pages to improve subsequent navigation but don't making it blocking
13    // Avoid extremely large websites from using the end-users data in unexpected amount
14    cache.addAll(pageUrls); // Pre-cache all static assets by keeping them as installation dependency
15
16    return cache.addAll(staticAssets);
17  });
18}
19
20self.addEventListener('install', function (event) {
21  // Let the new worker take over as fast as possible
22  // For quirks refer: https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#skip_the_waiting_phase
23  self.skipWaiting();
24  event.waitUntil(preCacheResources().catch(function (installErr) {
25    console.log('sw: precaching failed with: ', installErr);
26  }));
27});
28
29function clearOldCache() {
30  return caches.keys().then(function (keys) {
31    return Promise.all(keys.filter(function (key) {
32      return key !== CACHE_NAME;
33    }).map(function (key) {
34      return caches.delete(key);
35    }));
36  });
37}
38
39self.addEventListener('activate', function (event) {
40  // Remember to keep this step as lean as possible
41  // Only sutiable for performing stuff that can't be done while the previous worker is running
42  event.waitUntil(clearOldCache().then(function () {
43    clients.claim(); // eslint-disable-line no-undef
44  }));
45});
46
47function isPageRequest(url) {
48  return url.origin === location.origin && pageUrls.includes(url.pathname);
49}
50
51function isNetworkOnlyRequest(url, requestMethod) {
52  // Browser extensions don't use the standard `http` and `https` protocols
53  // Refer: https://github.com/GoogleChromeLabs/sw-toolbox/issues/171
54  if (requestMethod !== 'GET' || !SW_SUPPORTED_PROTOCOL_REGEX.test(url.protocol)) {
55    return true;
56  }
57
58  const urlOrigin = url.origin;
59  const urlPathName = url.pathname;
60  const fullUrl = `${urlOrigin}${urlPathName}`;
61
62  if (networkOnlyUrls.includes(urlOrigin) || networkOnlyUrls.includes(fullUrl)) {
63    return true;
64  }
65
66  if (networkOnlyUrlsRegex.some(regex => regex.test(fullUrl))) {
67    return true;
68  }
69
70  return false;
71}
72
73function handleWithNetworkThenCache(event) {
74  return event.respondWith(fetch(event.request).then(function (networkResponse) {
75    return caches.open(CACHE_NAME).then(function (cache) {
76      cache.put(event.request, networkResponse.clone());
77      return networkResponse;
78    });
79  }).catch(function () {
80    // network failed, try to serve a cached response or offline page if there is one
81    return caches.match(event.request);
82  }));
83}
84
85function handleWithCacheThenNetwork(event) {
86  return event.respondWith(caches.open(CACHE_NAME).then(function (cache) {
87    return cache.match(event.request).then(function (response) {
88      return response || fetch(event.request).then(function (networkResponse) {
89        cache.put(event.request, networkResponse.clone());
90        return networkResponse;
91      });
92    });
93  }).catch(function (err) {
94    // TODO: respond with `offline.html` as the final fallback for page requests
95    // and use appropriate response for other cases
96    return err;
97  }));
98}
99
100function handleWithNetwork(event) {
101  return event.respondWith(fetch(event.request));
102}
103
104function handleRequests(event) {
105  const requestURL = new URL(event.request.url);
106
107  if (isNetworkOnlyRequest(requestURL, event.request.method)) {
108    return handleWithNetwork(event);
109  }
110
111  if (isPageRequest(requestURL)) {
112    // To avoid serving stale content after a publish
113    // always fetch the markup from origin and use cache only when the user is offline
114    return handleWithNetworkThenCache(event);
115  }
116
117  return handleWithCacheThenNetwork(event);
118}
119
120self.addEventListener('fetch', handleRequests);

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.