您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
解决pc网页版豆瓣很多帖子点开直接跳转网站首页
// ==UserScript== // @name 防豆瓣跳转首页 // @version 0.1 // @description 解决pc网页版豆瓣很多帖子点开直接跳转网站首页 // @author 云在天(Harry) // @match https://*.douban.com/* // @icon https://www.google.com/s2/favicons?sz=64&domain=douban.com // @license GPL-3.0 License // @run-at document-start // @namespace https://greasyfork.org/users/662979 // ==/UserScript== (function () { console.log('加载拦截脚本'); /** * 重写open方法 * https://developer.mozilla.org/zh-CN/docs/Web/API/XMLHttpRequest/open */ XMLHttpRequest.prototype.myOpen = XMLHttpRequest.prototype.open; XMLHttpRequest.prototype.open = function (method, url, async, user, password) { // 用对象便于修改参数 if(url.indexOf('check')>-1) { if(url.indexOf('clean')>-1) { if(url.indexOf('content')>-1) { console.log('拦截'+url+'成功!'); return; } } } var options = { method: method, url: url, async: async, user: user, password: password }; if ('function' === typeof window.beforeXMLHttpRequestOpen) { window.beforeXMLHttpRequestOpen(this, options); } this.myOpen(options.method, options.url, options.async); }; })();