<commit_before>{*
 * This file is part of Nepttune (https://www.peldax.com)
 *
 * Copyright (c) 2018 <NAME> (<EMAIL>)
 *
 * This software consists of voluntary contributions made by many individuals
 * and is licensed under the MIT license. For more information, see
 * <https://www.peldax.com>.
*}

{contentType application/javascript}

self.addEventListener('install', function(event) {
    event.waitUntil(self.skipWaiting());
});

self.addEventListener('activate', function(event) {
    event.waitUntil(self.clients.claim());
});

self.addEventListener('push', function(event) {
    const payload = event.data ? event.data.text() : 'no payload';
    event.waitUntil(
        self.registration.showNotification('peldax.com notification', { body: payload })
    );
});

self.addEventListener('notificationclick', function(event) {
    event.waitUntil(
        self.clients.matchAll().then(function(clientList) {
            if (clientList.length > 0) {
                return clientList[0].focus();
            }
            return self.clients.openWindow("{plink $dest['homepage']}");
        })
    );
});

self.addEventListener('fetch', function(event) {
    const CACHE_NAME = 'dependencies-cache';
    
    if (event.request.method !== 'GET' || 
    	event.request.url.startsWith({$baseUrl}) === false || 
    	event.request.headers.get('Accept').indexOf('text/html') !== -1 )
	{
        return;
    }

    event.respondWith(
        caches.match(event.request).then(function(response) {
            if (response) {
                return response;
            }

            var fetchRequest = event.request.clone();

            return fetch(fetchRequest).then(function(response) {
                if(!response || response.status !== 200 || response.type !== 'basic') {
                    return response;
                }
<commit_msg>Update worker.latte<commit_after>{*
 * This file is part of Nepttune (https://www.peldax.com)
 *
 * Copyright (c) 2018 <NAME> (<EMAIL>)
 *
 * This software consists of voluntary contributions made by many individuals
 * and is licensed under the MIT license. For more information, see
 * <https://www.peldax.com>.
*}

{contentType application/javascript}

self.addEventListener('install', function(event) {
    event.waitUntil(self.skipWaiting());
});

self.addEventListener('activate', function(event) {
    event.waitUntil(self.clients.claim());
});

self.addEventListener('push', function(event) {
    const payload = event.data ? event.data.text() : 'no payload';
    event.waitUntil(
        self.registration.showNotification('peldax.com notification', { body: payload })
    );
});

self.addEventListener('notificationclick', function(event) {
    event.waitUntil(
        self.clients.matchAll().then(function(clientList) {
            if (clientList.length > 0) {
                return clientList[0].focus();
            }
            return self.clients.openWindow("{plink $dest['homepage']}");
        })
    );
});

self.addEventListener('fetch', function(event) {
    const CACHE_NAME = 'dependencies-cache';
    
    // is not GET, is HTML, is not local, is AJAX
    if (event.request.method !== 'GET' || 
    	event.request.headers.get('Accept').indexOf('text/html') !== -1 ||
    	event.request.url.startsWith("https:\/\/www.realstream.cz") === false ||
    	event.request.url.includes('?do=') || event.request.url.includes('&do='))
    {
        return;
    }

    event.respondWith(
        caches.match(event.request).then(function(response) {
            if (response) {
                return response;
            }

            var fetchRequest = event.request.clone();

            return fetch(fetchRequest).then(function(response) {
                if(!response || response.status !== 200 || response.type !== 'basic') {
                    return response;
                }

{'fraction_non_alphanumeric': 0.15120810600155885, 'fraction_numerical': 0.005196154845414394, 'mean_word_length': 2.759765625, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 4, 'lorem ipsum': 0, 'www.': 5, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2207861', 'n_tokens_mistral': 1115, 'n_tokens_neox': 1072, 'n_words': 211}