您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
清除网站的禁止复制,百度搜索链接直达,不再经过百度中转,自动清除网站历史记录缓存的localStorage和cookie 2022/5/23 11:42
当前为
// ==UserScript== // @name 去除知乎登陆和跳转拦截,去除百度广告,清除除csdn搜索结果 // @license MIT // @namespace Xianclearad // @match *://*.zhihu.com/* // @include *://*.baidu.com/* // @grant none // @version 1.1 // @author Xian // @description 清除网站的禁止复制,百度搜索链接直达,不再经过百度中转,自动清除网站历史记录缓存的localStorage和cookie 2022/5/23 11:42 // ==/UserScript== window.addEventListener('touchstart', function (e) { window.localStorage.clear(); // 清除cookie let keys = document.cookie.match(/[^ =;]+(?=\=)/g); if (keys) { for (let i = keys.length; i--;) { document.cookie = keys[i] + '=0;expires=' + new Date(0).toUTCString() } } }); window.addEventListener('load', function (e) { document.querySelector('html').style.overflow = 'auto'; let style = document.createElement('style') style.innerHTML = /* css */` html,body{ overflow: auto!important; } .Modal-wrapper,.Modal-enter-done,.OpenInAppButton,.pt10,.clearfix{ display: none!important; } ` document.body.appendChild(style) // 去除知乎跳转拦截 document.querySelectorAll('.LinkCard').forEach(function (item) { let href = item.href; // 获取链接参数 let params = href.split('?')[1]; let paramsArr = params.split('&'); let paramsObj = {}; paramsArr.forEach(function (item) { let arr = item.split('='); paramsObj[arr[0]] = arr[1]; }) item.href = decodeURIComponent(paramsObj['target']) }) const MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; const observeMutationSupport = !!MutationObserver; baidu() if (observeMutationSupport) { let observer = new MutationObserver(function (records) { setTimeout(function () { baidu() }, 1000) }); let body = document.querySelector('body') observer.observe(body, { 'childList': true, 'subtree': true }) } // 监听url变化 window.addEventListener('popstate', function (e) { window.localStorage.clear(); // 清除cookie let keys = document.cookie.match(/[^ =;]+(?=\=)/g); if (keys) { for (let i = keys.length; i--;) { document.cookie = keys[i] + '=0;expires=' + new Date(0).toUTCString() } } baidu() }) function clickLink(url) { let a = document.createElement('a') a.href = url a.target = '_blank' a.click(); a.remove() } function baidu() { // 去除csdn结果 document.querySelectorAll('.result').forEach(function (item) { let mu = item.getAttribute('mu'); if (mu) { item.addEventListener('click', function (e) { e.preventDefault(); e.stopPropagation(); clickLink(mu) }) } else { item.style.display = 'none'; } if (mu && mu.indexOf('.csdn.') > -1) { item.style.display = 'none'; } }) // 去除百度广告 let baiduReslut = document.querySelector('#content_left') && document.querySelector('#content_left').children; if (baiduReslut) { for (let i = baiduReslut.length - 1; i >= 0; i--) { let className = baiduReslut[i].className; if (className.indexOf('result') < 0) { baiduReslut[i].style.display = 'none'; // baiduReslut[i].remove() } } } } // 去除禁止复制代码 document.querySelectorAll('pre').forEach(function (item) { item.style.userSelect = 'auto!important'; }) document.querySelectorAll('code').forEach(function (item) { item.style.userSelect = 'auto!important'; }) })