PageSourceSearch

https://europava.com/service-worker.js

js europava.com collected 2026-10-07 23:07:10 UTC 3,432 bytes, 132 lines download raw bytes

1"use strict";
2
3importScripts('https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js');
4
5workbox.loadModule('workbox-strategies');
6
7RegExp.escape = function(string) {
8	return string.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&')
9};
10
11var storeId = 47955037;
12var cachePrefix = 'starter-site: ';
13var regExpRoutes = {
14	home_page:              '/\/(\?lang=.*\&from_admin)?$/',
15	network_first:          '/.*' + RegExp.escape('script.js?' + storeId) + '.*$/',
16	stale_while_revalidate: '/.*(?:' +
17		[
18			'd3cy3u1txmkqs3.cloudfront.net',
19			'd3cy3u1txmkqs3.cloudfront.net',
20			'd34ikvsdm2rlij.cloudfront.net',
21			'd201eyh6wia12q.cloudfront.net',
22			'categories.js?ownerid=' + storeId,
23			'data.js?ownerid=' + storeId,
24			'https://d20ubqycd8ynev.cloudfront.net/storefront-app.js',
25			'https://d1tqsoh7s4xjz9.cloudfront.net/v2/i.min.js',
26			'analytics.sitewit.com/ecwid.plugin.js',
27			'storage.googleapis.com/goostav-static-files/rh-easy-ecwid.js',
28			'd35z3p2poghz10.cloudfront.net/apps/ecwid-shop-at-app/shopatapp.css',
29			'd35z3p2poghz10.cloudfront.net/apps/ecwid-shop-at-app/bundle',
30			'd1howb1wwyap5o.cloudfront.net/ym/ecwid_ym.js',
31			'ya-metrika-ec.ecwid-labs.com/storefront/index.js'
32		].filter(Boolean).map(function(item) {
33			return RegExp.escape(item);
34		}).join('|') + ').*$/',
35	images_cache:     '/.*(?:png|gif|jpg|svg)$/',
36	fonts_cache:      '/.*(?:ttf|woff|woff2)$/'
37};
38
39var customFilter = {
40	requestWillFetch: async function requestWillFetch(event) {
41		var request = event.request;
42		if (request.cache === 'only-if-cached' && request.mode !== 'same-origin') {
43			return;
44		}
45		return request;
46	}
47};
48
49workbox.navigationPreload.enable();
50
51workbox.routing.registerRoute(
52	regExpRoutes.home_page,
53	new workbox.strategies.NetworkFirst({
54		cacheName: cachePrefix + 'home-page',
55		plugins: [
56			customFilter,
57			new workbox.expiration.Plugin({
58				maxAgeSeconds: 60 * 60 * 24 * 30
59			})
60		]
61	})
62);
63
64var customStrategy = new workbox.strategies.NetworkFirst({
65	plugins: [customFilter]
66});
67
68workbox.routing.registerRoute(/\/.+$/, customStrategy);
69
70workbox.routing.registerRoute(
71	regExpRoutes.network_first,
72	new workbox.strategies.NetworkFirst({
73		cacheName: cachePrefix + 'network_first',
74		plugins: [
75			new workbox.expiration.Plugin({
76				maxAgeSeconds: 60 * 60 * 24 * 30
77			})
78		]
79	})
80);
81
82workbox.routing.registerRoute(
83	regExpRoutes.stale_while_revalidate,
84	new workbox.strategies.StaleWhileRevalidate({
85		cacheName: cachePrefix + 'stale-while-revalidate',
86		plugins: [
87			new workbox.expiration.Plugin({
88				maxAgeSeconds: 60 * 60 * 24 * 30
89			})
90		]
91	})
92);
93
94workbox.routing.registerRoute(
95	regExpRoutes.images_cache,
96	new workbox.strategies.StaleWhileRevalidate({
97		cacheName: cachePrefix + 'images-cache',
98		plugins: [
99			new workbox.expiration.Plugin({
100				maxAgeSeconds: 60 * 60 * 24 * 30,
101				maxEntries: 100,
102				purgeOnQuotaError: true
103			})
104		]
105	})
106);
107
108workbox.routing.registerRoute(
109	regExpRoutes.fonts_cache,
110	new workbox.strategies.StaleWhileRevalidate({
111		cacheName: cachePrefix + 'fonts-cache',
112		plugins: [
113			new workbox.expiration.Plugin({
114				maxAgeSeconds: 60 * 60 * 24 * 365
115			})
116		]
117	})
118);
119
120self.addEventListener('fetch', function(event) {
121	if (event.request.method !== 'GET') {
122		return;
123	}
124	if (event.request.url.match('^.*(\/edit\/).*$')) {
125		return false;
126	}
127	event.respondWith(
128		caches.match(event.request).then(function(response) {
129			return response || fetch(event.request);
130		})
131	);
132});

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.