您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Automatically rejects cookies and legitimate interest
当前为
// ==UserScript== // @name Reject cookie banners // @namespace http://tampermonkey.net/ // @version 1.0.2 // @description Automatically rejects cookies and legitimate interest // @author https://gf.qytechs.cn/en/users/85040-dan-wl-danwl // @license MIT // @match *://*/* // @run-at document-start // @grant none // ==/UserScript== // MIT License // Copyright(c) 2024 DanWL // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files(the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. (function() { const rejections = [ { // reject consent and reject legitimate interest banner: 'body > .fc-consent-root', btn: 'button[aria-label^="Manage"] > p', toggles: '.fc-preference-slider input[aria-label^="Consent"]:checked, .fc-preference-slider input[aria-label^="Legitimate interest"]:checked', confirm: 'button[aria-label^="Confirm"] p' }, { // only accept necessary cookies banner: 'body > #onetrust-consent-sdk', btn: '[aria-label="Cookie banner"] #onetrust-reject-all-handler' }, ]; function rejectAll() { for (let i = 0; i < rejections.length; i++) { const item = rejections[i]; const banners = document.querySelectorAll(item.banner); banners.forEach(function(banner) { const btn = banner.querySelector(item.btn); if (!btn) { return; } if (item.toggles) { btn.click(); banner.querySelectorAll(item.toggles).forEach(function(toggle) { toggle.click(); }); const confirmBtn = banner.querySelector(item.confirm); if (!confirmBtn) { return; } confirmBtn.click(); } else { // some pages would constantly reload because of automatically clearing and rejecting cookies // so check if cookies are stored before trying to reject them if (document.cookie) { // reject cookies btn.click(); } } // make sure there is no persistent banner // banner.outerHTML = ''; }); } // cookie banner may not have loaded yet, try again setTimeout(rejectAll, 200); } rejectAll(); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址