NYTimes - Prevent cookies

Prevents cookies from being set from NYTimes

目前为 2020-11-08 提交的版本。查看 最新版本

// ==UserScript==
// @name         NYTimes - Prevent cookies
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Prevents cookies from being set from NYTimes
// @author       You
// @match        https://*.nytimes.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    const clearCookies = () => {
        const cookies = document.cookie.split("; ");
        for (let c = 0; c < cookies.length; c++) {
            const d = window.location.hostname.split(".");
            while (d.length > 0) {
                const cookieBase = encodeURIComponent(cookies[c].split(";")[0].split("=")[0]) + '=; expires=Thu, 01-Jan-1970 00:00:01 GMT; domain=' + d.join('.') + ' ;path=';
                const p = location.pathname.split('/');
                document.cookie = cookieBase + '/';
                while (p.length > 0) {
                    document.cookie = cookieBase + p.join('/');
                    p.pop();
                };
                d.shift();
            }
        }
    }
    clearCookies();
    setInterval(() => {
        clearCookies();
    }, 1500);
    // Your code here...
})();

QingJ © 2025

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