1"use strict"; 2 3const CACHE_NAME = 'tinalesteryourhome.com-1582135511493'; 4const SW_SUPPORTED_PROTOCOL_REGEX = /http(s?):/; 5const pageUrls = JSON.parse('["/","/before-%26-after","/who-is-this-chick%3F","/photo-gallery%2Fstaging","/contact"]'); 6const staticAssets = JSON.parse('["//img1.wsimg.com/blobby/go/575045a6-6a24-4f3f-9393-d491154f0036/gpub/4ce1a7c86682e5e8/styles.css","//img1.wsimg.com/blobby/go/575045a6-6a24-4f3f-9393-d491154f0036/gpub/e3331c2e1024d818/styles.css","//img1.wsimg.com/blobby/go/575045a6-6a24-4f3f-9393-d491154f0036/gpub/9e823c034ed9bc9d/styles.css","//img1.wsimg.com/blobby/go/575045a6-6a24-4f3f-9393-d491154f0036/gpub/9167fbada5aec63b/styles.css","//img1.wsimg.com/blobby/go/575045a6-6a24-4f3f-9393-d491154f0036/gpub/c1fdcb65382d50dc/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/e645c3e6fe995b50/script.js","//img1.wsimg.com/ceph-p3-01/website-builder-data-prod/static/widgets/UX.3.55.71.js","//img1.wsimg.com/blobby/go/gpub/709f0559ff4933e6/script.js","//img1.wsimg.com/blobby/go/gpub/60b25d5722ed2be1/script.js","//img1.wsimg.com/blobby/go/575045a6-6a24-4f3f-9393-d491154f0036/gpub/79cde0c955b231c2/script.js","//img1.wsimg.com/blobby/go/gpub/1aff2d600074f107/script.js","//img1.wsimg.com/blobby/go/575045a6-6a24-4f3f-9393-d491154f0036/gpub/3ba28aeb6437642c/script.js","//img1.wsimg.com/blobby/go/gpub/da109323ef2d31b7/script.js","//img1.wsimg.com/blobby/go/gpub/6935aacf3bae0a6c/script.js","//img1.wsimg.com/blobby/go/gpub/e374870201fcd502/script.js","//img1.wsimg.com/blobby/go/gpub/f09c859d00cd73c2/script.js","//img1.wsimg.com/blobby/go/575045a6-6a24-4f3f-9393-d491154f0036/gpub/618b15bcbf82eccb/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/575045a6-6a24-4f3f-9393-d491154f0036/gpub/b06b321691c00810/styles.css","//img1.wsimg.com/blobby/go/575045a6-6a24-4f3f-9393-d491154f0036/gpub/a8b08604795f7aa/styles.css","//img1.wsimg.com/blobby/go/575045a6-6a24-4f3f-9393-d491154f0036/gpub/46d5fc56460a93e8/script.js","//img1.wsimg.com/blobby/go/575045a6-6a24-4f3f-9393-d491154f0036/gpub/2359db64b1c50420/script.js","//img1.wsimg.com/blobby/go/575045a6-6a24-4f3f-9393-d491154f0036/gpub/dbd306ca877cddca/script.js","//img1.wsimg.com/blobby/go/575045a6-6a24-4f3f-9393-d491154f0036/gpub/4a7701621cfad539/styles.css","//img1.wsimg.com/blobby/go/575045a6-6a24-4f3f-9393-d491154f0036/gpub/529d09e925692b67/styles.css","//img1.wsimg.com/blobby/go/575045a6-6a24-4f3f-9393-d491154f0036/gpub/389ceb3bb67dc3ea/script.js","//img1.wsimg.com/blobby/go/575045a6-6a24-4f3f-9393-d491154f0036/gpub/d8728c674aac6582/script.js","//img1.wsimg.com/blobby/go/575045a6-6a24-4f3f-9393-d491154f0036/gpub/7e506727097de4c8/script.js","//img1.wsimg.com/blobby/go/575045a6-6a24-4f3f-9393-d491154f0036/gpub/eb5383288112179c/script.js","//img1.wsimg.com/blobby/go/575045a6-6a24-4f3f-9393-d491154f0036/gpub/a65de2642a14a982/script.js","//img1.wsimg.com/blobby/go/575045a6-6a24-4f3f-9393-d491154f0036/gpub/706ad774fbf63417/styles.css","//img1.wsimg.com/blobby/go/575045a6-6a24-4f3f-9393-d491154f0036/gpub/793db0109102bbfe/styles.css","//img1.wsimg.com/blobby/go/575045a6-6a24-4f3f-9393-d491154f0036/gpub/8f5e7fa9beda5621/styles.css","//img1.wsimg.com/blobby/go/575045a6-6a24-4f3f-9393-d491154f0036/gpub/fb757b3ae6680b3f/script.js","//img1.wsimg.com/blobby/go/575045a6-6a24-4f3f-9393-d491154f0036/gpub/dfe03813c8823229/script.js","//img1.wsimg.com/blobby/go/gpub/bead77564de17eea/script.js","//img1.wsimg.com/blobby/go/575045a6-6a24-4f3f-9393-d491154f0036/gpub/2304ba07b2c403d8/script.js"]'); 7const networkOnlyUrls = JSON.parse('["https://api.ola.godaddy.com","https://575045a6-6a24-4f3f-9393-d491154f0036.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('["tinalesteryourhome.com/m/api/.*","tinalesteryourhome.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/575045a6-6a24-4f3f-9393-d491154f0036/feed/post/","https://blog.apps.secureserver.net/v1/website/575045a6-6a24-4f3f-9393-d491154f0036/feed"]'); 10const networkThenCacheUrlsRegex = JSON.parse('["tinalesteryourhome.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.