1"use strict"; 2 3const CACHE_NAME = 'themillerhouseky.com-1596035188123'; 4const SW_SUPPORTED_PROTOCOL_REGEX = /http(s?):/; 5const pageUrls = JSON.parse('["/","/about-us","/contact-us"]'); 6const staticAssets = JSON.parse('["//img1.wsimg.com/blobby/go/6d5ac9db-fc32-4a16-aac5-fc2c14ad8b52/gpub/4524c1974583bbdd/styles.css","//img1.wsimg.com/blobby/go/6d5ac9db-fc32-4a16-aac5-fc2c14ad8b52/gpub/6f47a3c72e2ddcfe/styles.css","//img1.wsimg.com/blobby/go/6d5ac9db-fc32-4a16-aac5-fc2c14ad8b52/gpub/ec8dbb0d371f1f36/styles.css","//img1.wsimg.com/blobby/go/6d5ac9db-fc32-4a16-aac5-fc2c14ad8b52/gpub/30f8faee8ab0fc22/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%2CObject.is%2CIntersectionObserver%2CIntl.~locale.en-US","//img1.wsimg.com/blobby/go/gpub/79fb68164481d54f/script.js","//img1.wsimg.com/blobby/go/gpub/e5b5b6b542f7c193/script.js","//img1.wsimg.com/ceph-p3-01/website-builder-data-prod/static/widgets/UX.3.64.0.js","//img1.wsimg.com/blobby/go/gpub/374fba81e9780843/script.js","//img1.wsimg.com/blobby/go/6d5ac9db-fc32-4a16-aac5-fc2c14ad8b52/gpub/cc45e622bce5e00a/script.js","//img1.wsimg.com/blobby/go/gpub/13750f786fd1d70c/script.js","//img1.wsimg.com/blobby/go/6d5ac9db-fc32-4a16-aac5-fc2c14ad8b52/gpub/57949af5280ddad5/script.js","//img1.wsimg.com/blobby/go/gpub/454286c5e2c349f6/script.js","//img1.wsimg.com/blobby/go/gpub/f8bd1c74586feff7/script.js","//img1.wsimg.com/blobby/go/6d5ac9db-fc32-4a16-aac5-fc2c14ad8b52/gpub/308a2ff900ff463/script.js","//img1.wsimg.com/blobby/go/6d5ac9db-fc32-4a16-aac5-fc2c14ad8b52/gpub/2b02dbf92601e916/script.js","//img1.wsimg.com/blobby/go/6d5ac9db-fc32-4a16-aac5-fc2c14ad8b52/gpub/883f4749d17c44a8/script.js","//img1.wsimg.com/blobby/go/6d5ac9db-fc32-4a16-aac5-fc2c14ad8b52/gpub/27c0265f99366c40/script.js","//fonts.googleapis.com/css?family=Oswald:700&display=swap","//fonts.googleapis.com/css?family=Quicksand:400,700&display=swap","//img1.wsimg.com/blobby/go/6d5ac9db-fc32-4a16-aac5-fc2c14ad8b52/gpub/8bafbcf79b46ba8d/styles.css","//img1.wsimg.com/blobby/go/6d5ac9db-fc32-4a16-aac5-fc2c14ad8b52/gpub/2c1180439ec89247/styles.css","//img1.wsimg.com/blobby/go/6d5ac9db-fc32-4a16-aac5-fc2c14ad8b52/gpub/9e77c56599ea00de/styles.css","//img1.wsimg.com/blobby/go/6d5ac9db-fc32-4a16-aac5-fc2c14ad8b52/gpub/75e791c816cd8eaa/script.js","//img1.wsimg.com/blobby/go/6d5ac9db-fc32-4a16-aac5-fc2c14ad8b52/gpub/b88d1247527c75af/script.js","//img1.wsimg.com/blobby/go/6d5ac9db-fc32-4a16-aac5-fc2c14ad8b52/gpub/4cff4e8ca72dada1/styles.css","//img1.wsimg.com/blobby/go/6d5ac9db-fc32-4a16-aac5-fc2c14ad8b52/gpub/736b45fec18e48b/styles.css","//img1.wsimg.com/blobby/go/6d5ac9db-fc32-4a16-aac5-fc2c14ad8b52/gpub/4ab91642f2482412/styles.css","//img1.wsimg.com/blobby/go/6d5ac9db-fc32-4a16-aac5-fc2c14ad8b52/gpub/1710d8ffe322ac4c/script.js","//img1.wsimg.com/blobby/go/6d5ac9db-fc32-4a16-aac5-fc2c14ad8b52/gpub/938553fc2c012e75/script.js"]'); 7const networkOnlyUrls = JSON.parse('["https://api.ola.godaddy.com","https://6d5ac9db-fc32-4a16-aac5-fc2c14ad8b52.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('["themillerhouseky.com/m/api/.*","themillerhouseky.com(?:/.*)?/ola/services/.*","themillerhouseky.com/ola/meetings/.*","securepay.godaddy.com/api/apps/ola/accounts/.*"]').map(regexString => new RegExp(regexString)); 9const networkThenCacheUrls = JSON.parse('["https://blog.apps.secureserver.net/v1/website/6d5ac9db-fc32-4a16-aac5-fc2c14ad8b52/feed/post/","https://blog.apps.secureserver.net/v1/website/6d5ac9db-fc32-4a16-aac5-fc2c14ad8b52/feed"]'); 10const networkThenCacheUrlsRegex = JSON.parse('["themillerhouseky.com(?:/.*)?/f/.*"]').map(regexString => new RegExp(regexString)); 11self.addEventListener('unhandledrejection', function (event) { 12 // eslint-disable-next-line no-console 13 console.warn('sw unhandledrejection error: ', event.reason); 14}); 15 16function preCacheResources() { 17 return caches.open(CACHE_NAME).then(function (cache) { 18 // Pre-Cache pages to improve subsequent navigation but don't making it blocking 19 // Avoid extremely large websites from using the end-users data in unexpected amount
20 cache.addAll(pageUrls); // Pre-cache all static assets by keeping them as installation dependency 21 22 return cache.addAll(staticAssets); 23 }); 24} 25 26self.addEventListener('install', function (event) { 27 // Let the new worker take over as fast as possible 28 // For quirks refer: https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#skip_the_waiting_phase 29 self.skipWaiting(); 30 event.waitUntil(preCacheResources()); 31}); 32 33function clearOldCache() { 34 return caches.keys().then(function (keys) { 35 return Promise.all(keys.filter(function (key) { 36 return key !== CACHE_NAME; 37 }).map(function (key) { 38 return caches.delete(key); 39 })); 40 }); 41} 42 43self.addEventListener('activate', function (event) { 44 // Remember to keep this step as lean as possible 45 // Only sutiable for performing stuff that can't be done while the previous worker is running 46 event.waitUntil(clearOldCache().then(function () { 47 clients.claim(); // eslint-disable-line no-undef 48 })); 49}); 50 51function isPageRequest(url) { 52 return url.origin === location.origin && pageUrls.includes(url.pathname); 53} 54 55function isNetworkOnlyRequest(url, requestMethod) { 56 // Browser extensions don't use the standard `http` and `https` protocols 57 // Refer: https://github.com/GoogleChromeLabs/sw-toolbox/issues/171 58 if (requestMethod !== 'GET' || !SW_SUPPORTED_PROTOCOL_REGEX.test(url.protocol)) { 59 return true; 60 } 61 62 const urlOrigin = url.origin; 63 const urlPathName = url.pathname; 64 const fullUrl = `${urlOrigin}${urlPathName}`; 65 66 if (networkOnlyUrls.includes(urlOrigin) || networkOnlyUrls.includes(fullUrl)) { 67 return true; 68 } 69 70 if (networkOnlyUrlsRegex.some(regex => regex.test(fullUrl))) { 71 return true; 72 } 73 74 return false; 75} 76 77function isNetworkThenCacheRequest(url, requestMethod) { 78 // Browser extensions don't use the standard `http` and `https` protocols 79 // Refer: https://github.com/GoogleChromeLabs/sw-toolbox/issues/171 80 if (requestMethod !== 'GET' || !SW_SUPPORTED_PROTOCOL_REGEX.test(url.protocol)) { 81 return true; 82 } 83 84 const urlOrigin = url.origin; 85 const urlPathName = url.pathname; 86 const fullUrl = `${urlOrigin}${urlPathName}`; 87 88 if (networkThenCacheUrls.includes(urlOrigin) || networkThenCacheUrls.includes(fullUrl)) { 89 return true; 90 } 91 92 if (networkThenCacheUrlsRegex.some(regex => regex.test(fullUrl))) { 93 return true; 94 } 95 96 return false; 97} 98 99function handleWithNetworkThenCache(event) { 100 return event.respondWith(fetch(event.request).then(function (networkResponse) { 101 if (!networkResponse.ok) { 102 return networkResponse; 103 } 104 105 return caches.open(CACHE_NAME).then(function (cache) { 106 cache.put(event.request, networkResponse.clone()); 107 return networkResponse; 108 }); 109 }).catch(function () { 110 // network failed, try to serve a cached response or offline page if there is one 111 return caches.match(event.request); 112 })); 113} 114 115function handleWithCacheThenNetwork(event) { 116 return event.respondWith(caches.open(CACHE_NAME).then(function (cache) { 117 return cache.match(event.request).then(function (response) { 118 return response || fetch(event.request).then(function (networkResponse) { 119 networkResponse.ok && cache.put(event.request, networkResponse.clone()); 120 return networkResponse; 121 }); 122 }); 123 }).catch(function (err) { 124 // TODO: respond with `offline.html` as the final fallback for page requests 125 // and use appropriate response for other cases 126 return err; 127 })); 128} 129 130function handleWithNetwork(event) { 131 return event.respondWith(fetch(event.request)); 132} 133 134function handleRequests(event) { 135 const requestURL = new URL(event.request.url); 136 137 if (isNetworkOnlyRequest(requestURL, event.request.method)) { 138 return handleWithNetwork(event); 139 } 140 141 if (isPageRequest(requestURL) || isNetworkThenCacheRequest(requestURL, event.request.method)) { 142 // To avoid serving stale content after a publish 143 // always fetch the markup from origin and use cache only when the user is offline 144 return handleWithNetworkThenCache(event); 145 } 146 147 return handleWithCacheThenNetwork(event); 148} 149 150self.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.