PageSourceSearch

https://altitudeforestry.com/sw.js

js altitudeforestry.com collected 2026-10-05 09:49:14 UTC 8,155 bytes, 144 lines download raw bytes

1"use strict";
2
3const CACHE_NAME = 'altitudeforestry.com-1584534098229';
4const SW_SUPPORTED_PROTOCOL_REGEX = /http(s?):/;
5const pageUrls = JSON.parse('["/","/services","/about-us"]');
6const staticAssets = JSON.parse('["//img1.wsimg.com/blobby/go/750431ea-5ab7-4493-b0b0-3d89e6f68bfa/gpub/5c2b28b7ec7cfd8c/styles.css","//img1.wsimg.com/blobby/go/750431ea-5ab7-4493-b0b0-3d89e6f68bfa/gpub/a9fd7003a08b38b4/styles.css","//img1.wsimg.com/blobby/go/750431ea-5ab7-4493-b0b0-3d89e6f68bfa/gpub/2b1a5829f9c391a4/styles.css","//img1.wsimg.com/blobby/go/750431ea-5ab7-4493-b0b0-3d89e6f68bfa/gpub/264d5011842e0eba/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-US","//img1.wsimg.com/blobby/go/gpub/2a4f73fcd74c5421/script.js","//img1.wsimg.com/ceph-p3-01/website-builder-data-prod/static/widgets/UX.3.57.0.js","//img1.wsimg.com/blobby/go/gpub/f56b0d556cebe2b8/script.js","//img1.wsimg.com/blobby/go/gpub/1d60b452de0e239d/script.js","//img1.wsimg.com/blobby/go/750431ea-5ab7-4493-b0b0-3d89e6f68bfa/gpub/285aed73d43bf5
655/script.js","//img1.wsimg.com/blobby/go/gpub/60b25d5722ed2be1/script.js","//img1.wsimg.com/blobby/go/gpub/2af54f8ad0dd474a/script.js","//img1.wsimg.com/blobby/go/750431ea-5ab7-4493-b0b0-3d89e6f68bfa/gpub/80fdf252128dbcd6/script.js","//img1.wsimg.com/blobby/go/gpub/1b5a00162defe865/script.js","//img1.wsimg.com/blobby/go/gpub/1abb539582913de5/script.js","//img1.wsimg.com/blobby/go/gpub/50202c3598f99045/script.js","//fonts.googleapis.com/css?family=Cabin:700","//fonts.googleapis.com/css?family=Lato:100,300,400,400i,700,700i,900","//img1.wsimg.com/blobby/go/750431ea-5ab7-4493-b0b0-3d89e6f68bfa/gpub/5be433870f5895c5/styles.css","//img1.wsimg.com/blobby/go/750431ea-5ab7-4493-b0b0-3d89e6f68bfa/gpub/f8d61b6967361544/styles.css","//img1.wsimg.com/blobby/go/750431ea-5ab7-4493-b0b0-3d89e6f68bfa/gpub/46035a7f13d76653/styles.css","//img1.wsimg.com/blobby/go/750431ea-5ab7-4493-b0b0-3d89e6f68bfa/gpub/714cdc3647825ae0/script.js","//img1.wsimg.com/blobby/go/750431ea-5ab7-4493-b0b0-3d89e6f68bfa/gpub/1986390a8ea2816e/script.js","//img1.wsimg.com/blobby/go/750431ea-5ab7-4493-b0b0-3d89e6f68bfa/gpub/14749ff49894f70b/styles.css","//img1.wsimg.com/blobby/go/750431ea-5ab7-4493-b0b0-3d89e6f68bfa/gpub/4756ec69328bff1b/styles.css","//img1.wsimg.com/blobby/go/750431ea-5ab7-4493-b0b0-3d89e6f68bfa/gpub/16478f2c33f34193/styles.css","//img1.wsimg.com/blobby/go/750431ea-5ab7-4493-b0b0-3d89e6f68bfa/gpub/2b48191873835893/script.js","//img1.wsimg.com/blobby/go/750431ea-5ab7-4493-b0b0-3d89e6f68bfa/gpub/1c2bfd1179e49b94/script.js"]');
7const networkOnlyUrls = JSON.parse('["https://api.ola.godaddy.com","https://750431ea-5ab7-4493-b0b0-3d89e6f68bfa.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('["altitudeforestry.com/m/api/.*","altitudeforestry.com(?:/.*)?/ola/services/.*","securepay.godaddy.com/api/apps/ola/accounts/.*"]').map(regexString => new RegExp(regexString));
9const networkThenCacheUrls = JSON.parse('["https://blog.apps.secureserver.net/v1/website/750431ea-5ab7-4493-b0b0-3d89e6f68bfa/feed/post/","https://blog.apps.secureserver.net/v1/website/750431ea-5ab7-4493-b0b0-3d89e6f68bfa/feed"]');
10const networkThenCacheUrlsRegex = JSON.parse('["altitudeforestry.com(?:/.*)?/f/.*"]').map(regexString => new RegExp(regexString));
11
12function preCacheResources() {
13  return caches.open(CACHE_NAME).then(function (cache) {
14    // Pre-Cache pages to improve subsequent navigation but don't making it blocking
15    // Avoid extremely large websites from using the end-users data in unexpected amount
16    cache.addAll(pageUrls); // Pre-cache all static assets by keeping them as installation dependency
17
18    return cache.addAll(staticAssets);
19  });
20}
21
22self.addEventListener('install', function (event) {
23  // Let the new worker take over as fast as possible
24  // For quirks refer: https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#skip_the_waiting_phase
25  self.skipWaiting();
26  event.waitUntil(preCacheResources().catch(function (installErr) {
27    console.log('sw: precaching failed with: ', installErr);
28  }));
29});
30
31function clearOldCache() {
32  return caches.keys().then(function (keys) {
33    return Promise.all(keys.filter(function (key) {
34      return key !== CACHE_NAME;
35    }).map(function (key) {
36      return caches.delete(key);
37    }));
38  });
39}
40
41self.addEventListener('activate', function (event) {
42  // Remember to keep this step as lean as possible
43  // Only sutiable for performing stuff that can't be done while the previous worker is running
44  event.waitUntil(clearOldCache().then(function () {
45    clients.claim(); // eslint-disable-line no-undef
46  }));
47});
48
49function isPageRequest(url) {
50  return url.origin === location.origin && pageUrls.includes(url.pathname);
51}
52
53function isNetworkOnlyRequest(url, requestMethod) {
54  // Browser extensions don't use the standard `http` and `https` protocols
55  // Refer: https://github.com/GoogleChromeLabs/sw-toolbox/issues/171
56  if (requestMethod !== 'GET' || !SW_SUPPORTED_PROTOCOL_REGEX.test(url.protocol)) {
57    return true;
58  }
59
60  const urlOrigin = url.origin;
61  const urlPathName = url.pathname;
62  const fullUrl = `${urlOrigin}${urlPathName}`;
63
64  if (networkOnlyUrls.includes(urlOrigin) || networkOnlyUrls.includes(fullUrl)) {
65    return true;
66  }
67
68  if (networkOnlyUrlsRegex.some(regex => regex.test(fullUrl))) {
69    return true;
70  }
71
72  return false;
73}
74
75function isNetworkThenCacheRequest(url, requestMethod) {
76  // Browser extensions don't use the standard `http` and `https` protocols
77  // Refer: https://github.com/GoogleChromeLabs/sw-toolbox/issues/171
78  if (requestMethod !== 'GET' || !SW_SUPPORTED_PROTOCOL_REGEX.test(url.protocol)) {
79    return true;
80  }
81
82  const urlOrigin = url.origin;
83  const urlPathName = url.pathname;
84  const fullUrl = `${urlOrigin}${urlPathName}`;
85
86  if (networkThenCacheUrls.includes(urlOrigin) || networkThenCacheUrls.includes(fullUrl)) {
87    return true;
88  }
89
90  if (networkThenCacheUrlsRegex.some(regex => regex.test(fullUrl))) {
91    return true;
92  }
93
94  return false;
95}
96
97function handleWithNetworkThenCache(event) {
98  return event.respondWith(fetch(event.request).then(function (networkResponse) {
99    return caches.open(CACHE_NAME).then(function (cache) {
100      cache.put(event.request, networkResponse.clone());
101      return networkResponse;
102    });
103  }).catch(function () {
104    // network failed, try to serve a cached response or offline page if there is one
105    return caches.match(event.request);
106  }));
107}
108
109function handleWithCacheThenNetwork(event) {
110  return event.respondWith(caches.open(CACHE_NAME).then(function (cache) {
111    return cache.match(event.request).then(function (response) {
112      return response || fetch(event.request).then(function (networkResponse) {
113        cache.put(event.request, networkResponse.clone());
114        return networkResponse;
115      });
116    });
117  }).catch(function (err) {
118    // TODO: respond with `offline.html` as the final fallback for page requests
119    // and use appropriate response for other cases
120    return err;
121  }));
122}
123
124function handleWithNetwork(event) {
125  return event.respondWith(fetch(event.request));
126}
127
128function handleRequests(event) {
129  const requestURL = new URL(event.request.url);
130
131  if (isNetworkOnlyRequest(requestURL, event.request.method)) {
132    return handleWithNetwork(event);
133  }
134
135  if (isPageRequest(requestURL) || isNetworkThenCacheRequest(requestURL, event.request.method)) {
136    // To avoid serving stale content after a publish
137    // always fetch the markup from origin and use cache only when the user is offline
138    return handleWithNetworkThenCache(event);
139  }
140
141  return handleWithCacheThenNetwork(event);
142}
143
144self.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.