去百度搜索置顶推广 (ECMA6)

去除插入在百度搜索结果头部、尾部的推广链接。

目前为 2016-04-12 提交的版本。查看 最新版本

// ==UserScript==
// @name              去百度搜索置顶推广 (ECMA6)
// @author            axetroy
// @contributor       axetroy
// @description       去除插入在百度搜索结果头部、尾部的推广链接。
// @version           2016.4.12
// @grant             none
// @include           *www.baidu.com*
// @include           *zhidao.baidu.com/search*
// @connect           *
// @supportURL        http://www.burningall.com
// @compatible        chrome  完美运行
// @compatible        firefox  完美运行
// @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_search_ads

/* 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";var d=a("./libs/jqLite"),e=a("./libs/$interval"),f=a("./src/main"),g=e(function(){(new f).filter().turn()},50);d(function(){(new f).filter().turn(),e.cancel(g),d(window.document).observe(function(){(new f).filter().turn()})}),console.info("去广告启动...")},{"./libs/$interval":2,"./libs/jqLite":3,"./src/main":5}],2:[function(a,b,c){"use strict";var d=function(a,b){var c=function e(){a.call(void 0),d=setTimeout(e,b)},d=setTimeout(c,b);return function(){window.clearTimeout(d)}};d.cancel=function(a){a()},b.exports=d},{}],3:[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},{}],4:[function(a,b,c){"use strict";var d={rules:'\n    #content_left>div\n    :not([class*=result])\n    :not([class*=container])\n    :not(.leftBlock)\n    :not(#rs_top_new)\n    :not([filtered])\n    ,\n    #content_left>table\n    :not(.result)\n    :not([filtered])\n    ,\n    #content_right>table td\n    div#ec_im_container\n    ,\n    div.s-news-list-wrapper>div\n    :not([data-relatewords*="1"])\n    ,\n    div.list-wraper dl[data-oad]\n    :not([data-fb])\n    :not([filtered])\n  '.trim().replace(/\n/gim,"").replace(/\s{1,}([^a-zA-Z])/g,"$1")};b.exports=d},{}],5:[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("../libs/jqLite"),f=a("./config"),g=function(){function a(){var b=arguments.length<=0||void 0===arguments[0]?f.rules:arguments[0];d(this,a),this.ads=e(b),this.length=this.ads.length}return a.prototype.filter=function(){return this.ads.each(function(a,b){a.style.cssText="\n          display:none !important;\n          visibility:hidden !important;\n          width:0 !important;\n          height:0 !important;\n          overflow:hidden !important;\n          // background-color:red !important;\n          // border:1px solid red;\n        ",a.setAttribute("filtered","")}),this},a.prototype.turn=function(){return e("#content_left input[type=checkbox]:not(filtered)").each(function(a){a.checked=!1,a.setAttribute("filtered","")}),this},a}();b.exports=g},{"../libs/jqLite":3,"./config":4}]},{},[1]);
//# sourceMappingURL=index.map

/* jshint ignore:end */