Greasy Fork is available in English.

百度去搜索推广

enter something useful

Verzia zo dňa 2015-05-22 06:35:28 UTC. Pozri najnovšiu verziu.

// ==UserScript==
// @name        百度去搜索推广
// @namespace    http://your.homepage/
// @version      0.3
// @description  enter something useful
// @author       You
// @match        http://*/*
// @include     *baidu.com/*
// @grant        none
// ==/UserScript==

(function() {
    function $(id) {
        return document.getElementById(id);
    };
    function addEvent(obj, event, fn) {
	return obj.addEventListener ? obj.addEventListener(event, fn, false) : obj.attachEventListener('on' + event, fn);
	};
	function remove(){
    adlist = $('content_left').children;
    for (var i=0;i<adlist.length;i++) {
    	 if(adlist[i].getAttribute("id")>1000){
    	 	adlist[i].style.cssText="display: none !important;"
    	 };
    	 if(adlist[i].getAttribute("id")==null){
    	 	adlist[i].style.cssText="display: none !important;"
    	 };
    };
    console.log("广告已去除")
  };
  function clearTime(){
  	var timer=setInterval(function(){
		remove();
		setTimeout(function(){
		clearInterval(timer);
		},3000)
  },20);
  };
  	remove();
	addEvent($("su"),'click',function(){
		clearTime();
	})
	addEvent($("kw"),'keyup',function(){
		clearTime();
	})
})()