1importScripts("https://storage.googleapis.com/workbox-cdn/releases/5.1.2/workbox-sw.js"); 2function escapeRegExp(string) { 3 return string.replace(/[.*+?^=!:()|[\]\/\\]/g, '\\$&'); 4} 5function targetHostRegExp() { 6 return '(' + escapeRegExp(location.origin) + '|' + escapeRegExp('https://colorful.ismcdn.jp') + ')'; 7} 8function mwRegister() { 9 //console.log('register'); 10 var cacheId = 'mwcache'; 11 var mwResources = new RegExp('^' + targetHostRegExp() + '(?:/(common|resources)/.+)(?:\\?.*)?$'); 12 var mwImages = new RegExp('^' + targetHostRegExp() + '(?:/mwimgs/.+)(?:\\?.*)?$'); 13 workbox.core.setCacheNameDetails({prefix: cacheId}); 14 workbox.routing.registerRoute( 15 mwImages, 16 new workbox.strategies.CacheFirst({ 17 cacheName: cacheId + "-mwimages", 18 plugins: [ 19 new workbox.cacheableResponse.CacheableResponsePlugin({ 20 statuses: [0, 200] 21 }), 22 new workbox.expiration.ExpirationPlugin({ 23 maxEntries: 255, 24 maxAgeSeconds: 7 * 24 * 60 * 60, 25 purgeOnQuotaError: false 26 }) 27 ] 28 }),'GET' 29 ); 30 workbox.routing.registerRoute( 31 mwResources, 32 new workbox.strategies.StaleWhileRevalidate({ 33 cacheName: cacheId + "-resources" 34 }),'GET' 35 ); 36}; 37 38if (workbox) { 39 //console.log('workboxstart'); 40 workbox.setConfig({ debug: false }); 41 workbox.core.skipWaiting(); 42 workbox.core.clientsClaim(); 43 mwRegister(); 44} else { 45 //console.log('load error Workbox') 46} 47self.addEventListener('fetch', function(event) { 48 //console.log(event.request.url); 49});
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.