Cat Cleaner+++

gives user possibility to clean website data, directly from page user uses.

目前為 2022-02-26 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name Cat Cleaner+++
// @namespace -
// @version 0.1
// @description gives user possibility to clean website data, directly from page user uses.
// @author NotYou
// @include *
// @run-at document-body
// @license GPL-3.0-or-later
// @grant GM.registerMenuCommand
// @grant GM.notification
// ==/UserScript==

/*

ICONS LICENSED UNDER "Linkware" LICENSE

BACKLINK: http://www.iconka.com

README FILE: https://iconarchive.com/icons/iconka/meow/meow-me.txt

*/

function cleanCookie() {
    let cookieLength = document.cookie.split(';').length;
    for(let i = 0;i < cookieLength;i++) {
        let cookie = document.cookie;
        document.cookie = cookie + ";max-age=0";
    }
    GM.notification('Cookies for that website cleaned.', 'Cat Cleaner+++', 'https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Faux.iconspalace.com%2Fuploads%2Fcat-clean-icon-256.png&f=1&nofb=1');
}

function cleanLocalStorage() {
    localStorage.clear();
    GM.notification('Local storage for that website cleaned.', 'Cat Cleaner+++', 'https://external-content.duckduckgo.com/iu/?u=http%3A%2F%2Ficons.iconarchive.com%2Ficons%2Ficonka%2Fmeow%2F96%2Fcat-walk-icon.png&f=1&nofb=1');
}

function cleanSessionStorage() {
    sessionStorage.clear();
    GM.notification('Session storage for that website cleaned.', 'Cat Cleaner+++', 'https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Faux.iconspalace.com%2Fuploads%2Fcat-poo-icon-256.png&f=1&nofb=1');
}

function cleanCache() {
    caches.keys().then((keyList) => Promise.all(keyList.map((key) => caches.delete(key))));
    caches.delete();
    GM.notification('Chache storage for that website cleaned.', 'Cat Cleaner+++', 'https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Ficons.iconarchive.com%2Ficons%2Ficonka%2Fmeow-2%2F256%2Fcat-paper-icon.png&f=1&nofb=1');
}

function cleanEverything() {
    let cookieLength = document.cookie.split(';').length;
    for(let i = 0;i < cookieLength;i++) {
        let cookie = document.cookie;
        document.cookie = cookie + ";max-age=0";
    }
    localStorage.clear();
    sessionStorage.clear();
    caches.keys().then((keyList) => Promise.all(keyList.map((key) => caches.delete(key))));
    caches.delete();
    GM.notification('Cookies, local storage, session storage, cache storage for that website cleaned.', 'Cat Cleaner+++', 'https://external-content.duckduckgo.com/iu/?u=http%3A%2F%2Faux.iconspalace.com%2Fuploads%2Fcat-grumpy-icon-256.png&f=1&nofb=1');
}

GM.registerMenuCommand('Clean everything', cleanEverything)
GM.registerMenuCommand('Clean cookies', cleanCookie)
GM.registerMenuCommand('Clean local storage', cleanLocalStorage)
GM.registerMenuCommand('Clean session storage', cleanSessionStorage)
GM.registerMenuCommand('Clean cache storage', cleanCache)