// ==UserScript== // @name remove the jump link in BAIDU // @author burningall // @description 去除百度搜索跳转链接 // @version 2015.8.25 // @include *www.baidu.com* // @grant GM_setValue // @grant GM_getValue // @grant GM_registerMenuCommand // @grant GM_xmlhttpRequest // @run-at document-start // @compatible chrome 完美运行 // @compatible firefox 完美运行 // @license The MIT License (MIT); http://opensource.org/licenses/MIT // @supportURL http://www.burningall.com // @contributionURL troy450409405@gmail.com|alipay.com // @namespace https://greasyfork.org/zh-CN/users/3400-axetroy // @downloadURL none // ==/UserScript== //======说明======= /* 如果觉得卡顿 请尝试修改配置参数项 config.isAnimate:GM_getValue("isAnimate",false) 关闭CSS3动画(默认开启) config.mixRequireMod:false 关闭混合请求(默认开启) 以下内容: 不懂代码就不用管 混合请求说明:存在两种请求方式 1,把所有跳转链接请求个遍,类似于图片的延迟加载。页面滚动到哪里请求到哪里。 2,把当前页面的href的参数&fn=baiduhome_pg修改成&fn=baidulocal,得到一个全新的页面。也没的链接没有跳转,然后替换到当前页面的链接。 如果关闭混合请求,那么执行第一种,第二种不执行。 为什么关闭第二种方式:(不推荐关闭,理论上是好的) 存在缺陷,替换的链接不全。 请求的文件比第一种大,可能造成性能的问题。(chrome下和firefox下测试均没问题,当然,其他脚本\扩展也是用这种方法)。 请求方式的统一性。 */ (function(window,document) { //=====配置参数====== var config = { macthRules: 'a[href*="www.baidu.com/link?url"]:not([transcoding]):not([transcoded]):not([transcodedall]):not(.m)', //需要跳转的链接 reloadRules: 'a[transcoded*="false"]', //请求失败,需要再次请求的链接 isAnimate: GM_getValue("isAnimate",true), //是否需要请求动画,false为关闭动画,默认为true,开启 transcodingAll:false,//是否正在请求全部,不要修改 turn:false,//防止过多请求数,不要修改 mixRequireMod:true//混合请求,默认开启 }; //匹配正则 var regRules = { isJumpLink: /www.baidu.com\/link\?url=/ig, sliceResponse: { step1: /.*window\.location\.replace\(\"(.*)\"\).*$/img, step2: /^(.*)(