PageSourceSearch

https://jcdn.toastmasters.org/sw.js

js toastmasters.org collected 2026-10-01 07:18:46 UTC 4,616 bytes, 143 lines download raw bytes

1importScripts('https://storage.googleapis.com/workbox-cdn/releases/3.6.1/workbox-sw.js');
2
3if (workbox) {
4    const cacheVersion = 2;
5    // Cache names
6    const imageCache = "images-" + cacheVersion;
7    const fontCache = "fonts-" + cacheVersion;
8    const staticResourcesCache = "static-resources-" + cacheVersion;
9    const externalResourcesCache = "external-resources-" + cacheVersion;
10    const validResponse = new workbox.cacheableResponse.CacheableResponse({
11        statuses: [200]
12    });
13    const hourlyCacheDuration = 60 * 60;
14    const dailyCacheDuration = 24 * hourlyCacheDuration;
15    const weeklyCacheDuration = 7 * dailyCacheDuration;
16    const yearCacheDuration = 365 * dailyCacheDuration;
17
18    // Enable offline Google Analytics.
19    // TODO: Distinguish between offline and online requests.
20    workbox.googleAnalytics.initialize();
21
22    // Configure workbox pre and runtime cache names
23    workbox.core.setCacheNameDetails({
24        prefix: "TI.Website",
25        suffix: cacheVersion
26    });
27
28    // Cache bundled resourcs
29    workbox.routing.registerRoute(
30        new RegExp("\/cassette\.axd\/(script|stylesheet)\/.+"),
31        workbox.strategies.cacheFirst({
32            cacheName: staticResourcesCache,
33            plugins: [
34                new workbox.expiration.Plugin({
35                    maxEntries: 60,
36                    maxAgeSeconds: weeklyCacheDuration,
37                    purgeOnQuotaError: true
38                }),
39                validResponse
40            ]
41        })
42    );
43
44    // Cache fonts
45    workbox.routing.registerRoute(
46        /.*\.(?:eot|otf|woff2|woff|ttf)$/,
47        workbox.strategies.cacheFirst({
48            cacheName: fontCache,
49            plugins: [
50                new workbox.expiration.Plugin({
51                    maxEntries: 10,
52                    maxAgeSeconds: yearCacheDuration,
53                    purgeOnQuotaError: true
54                }),
55                validResponse
56            ]
57        })
58    );
59
60    workbox.routing.registerRoute(
61        /^https:\/\/fonts\.googleapis\.com/,
62        workbox.strategies.cacheFirst({
63            cacheName: fontCache,
64            plugins: [
65                new workbox.expiration.Plugin({
66                    maxEntries: 10,
67                    maxAgeSeconds: yearCacheDuration,
68                    purgeOnQuotaError: true
69                }),
70                validResponse
71            ]
72        })
73    );
74    
75    // Cache images
76    workbox.routing.registerRoute(
77        /.*\.(?:png|gif|jpg|jpeg|svg|webp|ico)$/,
78        workbox.strategies.cacheFirst({
79            cacheName: imageCache,
80            plugins: [
81                new workbox.expiration.Plugin({
82                    maxEntries: 60,
83                    maxAgeSeconds: dailyCacheDuration, 
84                    purgeOnQuotaError: true
85                }),
86                validResponse
87            ]
88        })
89    );
90
91    // Cache sitecore media
92    workbox.routing.registerRoute(
93        new RegExp('(-|~)\/media\/images\/.+', "i"),
94        workbox.strategies.cacheFirst({
95            cacheName: imageCache,
96            plugins: [
97                new workbox.expiration.Plugin({
98                    maxEntries: 60,
99                    maxAgeSeconds: dailyCacheDuration,
100                    purgeOnQuotaError: true
101                }),
102                validResponse
103            ]
104        })
105    );
106
107    // Cache CSS and JavaScript files
108    workbox.routing.registerRoute(
109        /\.(?:js|css)$/,
110        workbox.strategies.cacheFirst({
111            cacheName: staticResourcesCache,
112            plugins: [
113                new workbox.expiration.Plugin({
114                    maxEntries: 60,
115                    maxAgeSeconds: dailyCacheDuration,
116                    purgeOnQuotaError: true
117                }),
118                validResponse
119            ]
120        })
121    );
122
123    // Cache external sources by timeout
124    workbox.routing.registerRoute(
125        /.*(?:use.typekit|s7.addthis|googletagmanager)\.(?:com|net)/,
126        workbox.strategies.networkFirst({
127            networkTimeoutSeconds: 3,
128            cacheName: externalResourcesCache,
129            plugins: [
130                new workbox.expiration.Plugin({
131                    maxEntries: 60,
132                    maxAgeSeconds: 5 * 60, // 5 minutes
133                    purgeOnQuotaError: true
134                }),
135                validResponse
136            ]
137        })
138    );
139
140}
141else {
142    console.log(`Boo! Workbox didn't load 😬`);
143}

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.