// ==UserScript==
// @name remove the jump link in BAIDU (ECMA6)
// @author axetroy
// @description 去除百度搜索跳转链接
// @version 2016.4.12
// @grant GM_xmlhttpRequest
// @grant GM_addStyle
// @include *www.baidu.com*
// @connect tags
// @connect *
// @compatible chrome 完美运行
// @compatible firefox 完美运行
// @supportURL http://www.burningall.com
// @run-at document-start
// @contributionURL [email protected]|alipay.com
// @namespace https://greasyfork.org/zh-CN/users/3400-axetroy
// @license The MIT License (MIT); http://opensource.org/licenses/MIT
// ==/UserScript==
// Github源码:https://github.com/axetroy/GMscript/tree/master/remove_baidu_redirect
/* jshint ignore:start */
!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){"use strict";!function(){var b=a("./libs/jqLite"),c=a("./src/init"),d=a("./src/observe"),e=a("./src/mouseover"),f=a("./src/scroll");b(function(){c(),d(),e(),f()}),console.info("去跳转启动...")}()},{"./libs/jqLite":4,"./src/init":6,"./src/mouseover":8,"./src/observe":9,"./src/scroll":10}],2:[function(a,b,c){"use strict";var d=a("./$q"),e=a("./jqLite"),f=function(){var a=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],b=d.defer(),c=function(c){4===c.readyState&&(c.requestUrl=a.url,/^(2|3)/.test(c.status)||c.finalUrl?b.resolve(c):b.reject(c))},f=function(c){c.requestUrl=a.url,c&&c.finalUrl?b.resolve(c):b.reject(c)},g=function(c){c.requestUrl=a.url,c&&c.finalUrl?b.resolve(c):b.reject(c)};return a=e.fn.merge({onreadystatechange:c,ontimeout:f,onerror:g},a),new RegExp("^"+window.location.protocol).test(a.url)||(a.url=a.url.replace(/^(http|https):/im,window.location.protocol)),GM_xmlhttpRequest(a),b.promise};["HEAD","GET","POST"].forEach(function(a){f[a.toLocaleLowerCase()]=function(b){var c=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],g=d.defer();return c=e.fn.merge(c,{url:b,method:a}),f(c).then(function(a){g.resolve(a)},function(a){g.reject(a)}),g.promise}}),f.jsonp=function(a){var b=d.defer(),c=document.createElement("script");return c.setAttribute("type","text/javascript"),c.src=a+"?callback=func",document.body.appendChild(c),b.promise},b.exports=f},{"./$q":3,"./jqLite":4}],3:[function(a,b,c){"use strict";var d=function(){var a=arguments.length<=0||void 0===arguments[0]?noop:arguments[0];return new Promise(a)};d.defer=function(){var a={};return a.promise=new Promise(function(b,c){a.resolve=function(a){b(a)},a.reject=function(a){c(a)}}),a},d.resolve=function(a){return d(function(b,c){b(a)})},d.reject=function(a){return d(function(b,c){c(a)})},b.exports=d},{}],4:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}var e=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),f=function(a){return a},g=function(){function a(){var b=this,c=arguments.length<=0||void 0===arguments[0]?"":arguments[0],e=arguments.length<=1||void 0===arguments[1]?document:arguments[1];switch(d(this,a),this.selectors=c,this.context=e,this.length=0,typeof c){case"undefined":break;case"string":Array.from(e.querySelectorAll(c),function(a,c){b[c]=a,b.length++},this);break;case"object":c.length?Array.from(c,function(a,c){b[c]=a,b.length++},this):(this[0]=c,this.length=1);break;case"function":this.ready(c)}}return a.prototype.each=function(){for(var a=arguments.length<=0||void 0===arguments[0]?f:arguments[0],b=0;b<this.length;b++)a.call(this,this[b],b);return this},a.prototype.bind=function(){var a=arguments.length<=0||void 0===arguments[0]?"":arguments[0],b=arguments.length<=1||void 0===arguments[1]?f:arguments[1];this.each(function(c){a.trim().split(/\s{1,}/).forEach(function(a){c.addEventListener(a,function(a){var c=a.target||a.srcElement;return b.call(c,a)===!1?(a.returnValue=!0,a.cancelBubble=!0,a.preventDefault&&a.preventDefault(),a.stopPropagation&&a.stopPropagation(),!1):void 0},!1)})})},a.prototype.ready=function(){var a=this,b=arguments.length<=0||void 0===arguments[0]?f:arguments[0];this.context.addEventListener("DOMContentLoaded",function(c){b.call(a)},!1)},a.prototype.observe=function(){var a=this,b=arguments.length<=0||void 0===arguments[0]?f:arguments[0],c=arguments.length<=1||void 0===arguments[1]?{childList:!0,subtree:!0}:arguments[1];return this.each(function(d){var e=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,f=new e(function(c){c.forEach(function(c){b.call(a,c.target,c.addedNodes,c.removedNodes)})});f.observe(d,c)}),this},a.prototype.attr=function(a,b){return 1!==arguments.length?2===arguments.length?(this.each(function(c){c.setAttribute(a,b)}),this):this:"string"==typeof a?this[0].getAttribute(a):"object"==typeof a?(this.each(function(c){for(var d in a)a.hasOwnProperty(d)&&c.setAttribute(d,b)}),b):void 0},a.prototype.removeAttr=function(a){return 1===arguments.length&&this.each(function(b){b.removeAttribute(a)}),this},e(a,[{key:"text",get:function(){var a=this[0];return a.innerText?a.innerText:a.textContent}}],[{key:"fn",get:function(){var a=function(a){var b=a.getBoundingClientRect(),c=void 0,d=void 0,e=void 0,f=document.documentElement,g=document.body;return f.getBoundingClientRect?(c=f.clientWidth||g.clientWidth,d=f.clientHeight||g.clientHeight,e=b.top>d||b.bottom<0||b.left>c||b.right<0,!e):void 0},b=function(a,b){var c=void 0;return function(){var d=this,e=arguments;window.clearTimeout(c),c=window.setTimeout(function(){a.apply(d,e)},b)}},c=function(){for(var a=arguments.length,b=Array(a),c=0;a>c;c++)b[c]=arguments[c];return Object.assign.apply(Object,[{}].concat(b))};return{visible:a,debounce:b,merge:c}}}]),a}(),h=function(){var a=arguments.length<=0||void 0===arguments[0]?"":arguments[0],b=arguments.length<=1||void 0===arguments[1]?document:arguments[1];return new g(a,b)};h.fn=g.fn,b.exports=h},{}],5:[function(a,b,c){"use strict";var d={rules:'\n a[href*="www.baidu.com/link?url"]\n :not(.m)\n :not([decoding])\n :not([decoded])\n '.trim().replace(/\n/gim,"").replace(/\s{1,}([^a-zA-Z])/g,"$1"),debug:!1,isDecodingAll:!1};d.debug&&GM_addStyle("\n a[decoded]{\n background-color:green !important;\n color:#303030 !important;\n };\n a[decoding]{\n background-color:yellow !important;\n color:#303030 !important;\n }\n "),b.exports=d},{}],6:[function(a,b,c){"use strict";var d=a("./main"),e=a("../libs/$q"),f=a("./config"),g=function(){new d(f.rules).all().then(function(){return e.resolve(!0)},function(){return e.resolve(!0)}).then(function(){new d(f.rules).oneByOne()})};b.exports=g},{"../libs/$q":3,"./config":5,"./main":7}],7:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}var e=a("./config"),f=a("./../libs/jqLite"),g=a("./../libs/$q"),h=a("./../libs/$http"),i=function(){function a(){var b=this,c=arguments.length<=0||void 0===arguments[0]?"":arguments[0];return d(this,a),c?(this.inViewPort=[],void f(c).each(function(a){return f.fn.visible(a)&&b.inViewPort.push(a)})):this}return a.prototype.all=function(){var a=g.defer(),b=window.top.location.href.replace(/(\&)(tn=\w+)(\&)/gim,"$1tn=baidulocal$3");return e.isDecodingAll=!0,h.get(b,{timeout:2e3}).then(function(b){if(e.isDecodingAll=!1,b){var c=b.responseText;c=c.replace(/(src=[^>]*|link=[^>])/g,"");var d=document.createElement("html");d.innerHTML=c,f(".t>a:not(.OP_LOG_LINK):not([decoded])").each(function(a){f(".f>a",d).each(function(b){f(a).text===f(b).text&&(a.href=b.href,f(a).attr("decoded",!0))})}),a.resolve(b)}},function(b){e.isDecodingAll=!1,a.reject(b)}),a.promise},a.prototype.one=function(a){var b=g.defer();return f(a).attr("decoding",!0),h.get(a.href,{timeout:2e3,anonymous:!0}).then(function(c){f(a).attr("href",c.finalUrl).attr("decoded",!0).removeAttr("decoding"),b.resolve(c)},function(c){f(a).removeAttr("decoding"),b.reject(c)}),b.promise},a.prototype.oneByOne=function(){var b=this;return f(this.inViewPort).each(function(c){a.match(c)&&b.one(c)}),this},a.match=function(a){return"A"===a.tagName&&a.href&&/www\.baidu\.com\/link\?url=/im.test(a.href)&&!f(a).attr("decoded")&&!f(a).attr("decoding")},a}();b.exports=i},{"./../libs/$http":2,"./../libs/$q":3,"./../libs/jqLite":4,"./config":5}],8:[function(a,b,c){"use strict";var d=a("../libs/jqLite"),e=a("./main"),f=d.fn.debounce(function(a){var b=a.target;"A"===b.tagName&&b.href&&/www\.baidu\.com\/link\?url=/im.test(b.href)&&!d(b).attr("decoded")&&(new e).one(b)},100),g=function(){return function(){d(document).bind("mouseover",function(a){f(a)})}};b.exports=g()},{"../libs/jqLite":4,"./main":7}],9:[function(a,b,c){"use strict";var d=a("../libs/jqLite"),e=a("./main"),f=a("./init"),g=a("./config"),h=function(){return function(){var a=d.fn.debounce(function(a){var b=arguments.length<=1||void 0===arguments[1]?[]:arguments[1];arguments.length<=2||void 0===arguments[2]?[]:arguments[2];b.length&&(g.isDecodingAll?new e(g.rules).oneByOne():f())},100);d(document).observe(function(b){var c=arguments.length<=1||void 0===arguments[1]?[]:arguments[1],d=arguments.length<=2||void 0===arguments[2]?[]:arguments[2];a(b,c,d)})}};b.exports=h()},{"../libs/jqLite":4,"./config":5,"./init":6,"./main":7}],10:[function(a,b,c){"use strict";var d=a("../libs/jqLite"),e=a("./main"),f=a("./config"),g=function(){return function(){var a=d.fn.debounce(function(){new e(f.rules).oneByOne()},100);d(window).bind("scroll",function(){a()})}};b.exports=g()},{"../libs/jqLite":4,"./config":5,"./main":7}]},{},[1]);
//# sourceMappingURL=index.map
/* jshint ignore:end */