Cat Cleaner+++

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

当前为 2022-02-28 提交的版本,查看 最新版本

// ==UserScript==
// @name Cat Cleaner+++
// @namespace -
// @version 0.2
// @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://icons.iconarchive.com/icons/iconka/meow/256/cat-clean-icon.png');
}

function cleanLocalStorage() {
    localStorage.clear();
    GM.notification('Local storage for that website cleaned.', 'Cat Cleaner+++', 'https://icons.iconarchive.com/icons/iconka/meow/128/cat-walk-icon.png');
}

function cleanSessionStorage() {
    sessionStorage.clear();
    GM.notification('Session storage for that website cleaned.', 'Cat Cleaner+++', 'https://icons.iconarchive.com/icons/iconka/meow/128/cat-poo-icon.png');
}

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://icons.iconarchive.com/icons/iconka/meow-2/128/cat-paper-icon.png');
}

function cleanIndexedDB() {
    indexedDB.deleteDatabase(true)
    GM.notification('Indexed database for that website cleaned.', 'Cat Cleaner+++', 'https://icons.iconarchive.com/icons/iconka/meow-2/128/cat-paper-icon.png');
}

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();
    indexedDB.deleteDatabase(true)
    GM.notification('Cookies, local storage, session storage, cache storage, indexed db for that website cleaned.', 'Cat Cleaner+++', 'https://icons.iconarchive.com/icons/iconka/meow/128/cat-grumpy-icon.png');
}

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)
GM.registerMenuCommand('Clean indexed DB', cleanIndexedDB)


















QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址