PageSourceSearch

https://restaurantguru.com.br/service-worker.js?13

js restaurantguru.com.br collected 2026-09-28 06:44:15 UTC 2,976 bytes, 88 lines download raw bytes

1(global => {
2    'use strict';
3    importScripts('/js/sw-toolbox.js');
4
5    function isValidRequest(request) {
6        const url = new URL(request.url);
7        const invalidProtocols = ['chrome-extension:', 'moz-extension:', 'safari-extension:'];
8
9        if (invalidProtocols.some(protocol => url.protocol === protocol)) {
10            return false;
11        }
12
13        const invalidPaths = ['/__webpack_hmr', '/sw.js', '/service-worker.js'];
14        if (invalidPaths.some(path => url.pathname.includes(path))) {
15            return false;
16        }
17
18        return true;
19    }
20
21    function isBlockedByExtension(error) {
22        if (error && error.message) {
23            const blockedMessages = [
24                'net::ERR_BLOCKED_BY_CLIENT',
25                'net::ERR_BLOCKED_BY_RESPONSE',
26                'NetworkError',
27                'Failed to fetch'
28            ];
29            return blockedMessages.some(msg => error.message.includes(msg));
30        }
31        return false;
32    }
33
34    function isHtmlRequest(request) {
35        return request.method === 'GET' &&
36            request.headers.get('accept') &&
37            request.headers.get('accept').includes('text/html');
38    }
39
40    function getOfflinePage(vals, opts) {
41        return global.toolbox.cacheOnly(new Request('/offline'), vals, opts)
42            .catch(() => {
43                console.warn('Cached offline page not found, creating fallback');
44                return new Response(
45                    '<!DOCTYPE html><html><head><title>Offline</title></head><body><h1>You are currently offline</h1><script>setTimeout(() => location.reload(), 10000);</script></body></html>',
46                    {
47                        status: 200,
48                        statusText: 'OK',
49                        headers: { 'Content-Type': 'text/html; charset=utf-8' }
50                    }
51                );
52            });
53    }
54
55
56    global.toolbox.router.get(/fonts\.googleapis\.com/, (request, values, options) => {
57        if (!isValidRequest(request)) {
58            return fetch(request);
59        }
60        return global.toolbox.cacheFirst(request, values, options);
61    });
62
63    global.toolbox.router.get(/fonts\.gstatic\.com/, (request, values, options) => {
64        if (!isValidRequest(request)) {
65            return fetch(request);
66        }
67        return global.toolbox.cacheFirst(request, values, options);
68    });
69
70    global.toolbox.router.get(/1014042311\.rsc\.cdn77\.org\/.+\.(woff|css|woff2|otf)/, (request, values, options) => {
71        if (!isValidRequest(request)) {
72            return fetch(request);
73        }
74        return global.toolbox.cacheFirst(request, values, options, {
75            cache: {
76                name: 'local-fonts'
77            }
78        });
79    });
80
81    global.addEventListener('install', event => {
82        event.waitUntil(global.skipWaiting());
83    });
84
85    global.addEventListener('activate', event => {
86        event.waitUntil(global.clients.claim());
87    });
88})(self);

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.