Block Service Workers

Blocks Service Worker's registration.

03.10.2023 itibariyledir. En son verisyonu görün.

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name        Block Service Workers
// @name:zh-CN  禁用Service Workers
// @namespace   Violentmonkey Scripts
// @match       *://*/*
// @unwrap
// @version     0.2
// @author      axototl
// @inject-into page
// @sandbox     JavaScript
// @license     AGPL-3.0-or-later
// @description Blocks Service Worker's registration.
// @description:zh-CN 阻止Service Worker,并移除现有的Service Worker,杜绝网上垃圾。
// @run-at      document-start
// ==/UserScript==

(() => {
    'use strict';
    if (!('serviceWorker' in navigator)) return;
    console.log("Removing Service Workers API, please wait...");
    navigator.serviceWorker.register = () => new Promise((res, rej) => rej("This method is not allowed!"));
    console.log("Deregistering Installed Service Workers, please wait...");
    (async () => {
        let arrs = await navigator.serviceWorker.getRegistrations();
        for (const it of arrs) it.unregister();
    })();
    console.log("All done!");
    // GM_registerMenuCommand("注销Service Workers", logout);
})();