// ==UserScript== // @name 屏蔽百度广告,csdn博客广告 // @namespace http://tampermonkey.net/ // @version v0.303 // @description try to take over the world! // @author Skity666 // @match https://*.baidu.com/* // @match http://*.baidu.com/* // @match https://*csdn.net* // @match https://www.zhihu.com/* // @include https://*.baidu.com/* // @include https://*csdn.net* // @include https://www.zhihu.com/* // @grant none // @require https://cdn.staticfile.org/jquery/2.1.4/jquery.min.js // @downloadURL none // ==/UserScript== //更新了百度首页广告去除,csdn博客广告去除,csdn论坛 ,知乎登录页面自动关闭 //v0.302 更新了博客首页的推荐位第一广告,更新了博客文章详情下方评论的广告 //v0.303 更新了博客右边栏的广告 jQuery.noConflict(); (function($) { '屏蔽百度广告,csdn全网广告'; filter() handle() $(document).ready(function() { filter() if(location.href.indexOf('www.zhihu.com')>0){ closeZhiHu(); } setInterval(function(){ filter() }, 1000); }); function filter(){ //csdn首页 if(location.href.indexOf('blog.csdn.net')>0){ //推荐位第一广告 $("[data-type='ad']") //左下角的广告 $("#footerRightAds").remove(); //博客评论上方的广告 $("#dmp_ad_58").remove() //博客评论下方的广告 $("#recommend-item-box-tow").remove(); $(".adsbygoogle").remove(); } //csdn论坛 if(location.href.indexOf('bbs.csdn.net')>0){ //本周牛人上方的广告 $(".ad_top.bbs_left_box").remove() //右下方的广告 $(".ad_1.bbs_left_box").remove(); //中部的广告 $(".bbs_left_box .ad_1").remove(); } //百度 if(location.href.indexOf('www.baidu.com')>0){ //右边栏的广告 $("#zsyx_im0").remove() $("#m3423525928_canvas").remove() $("#m3424514202_canvas").remove() $("div").each(function(){ if($(this).attr("id")!='undefined'& $(this).attr("id")>3000){ $(this).remove() } }) //百度右边栏 if(localStorage.getItem("right-setting")!=null){ //console.log(localStorage.getItem("right-setting")) $("#content_right").remove() } //$("#content_right").remove() //第一层广告去除掉后出现的广告 setTimeout(function(){ $("div.result.c-container").each(function(){ //console.log($("span:contains('广告')",this).length) if($("span:contains('广告')",this).length>0){ $(this).remove() } }) //$("div.result.c-container>.f13").parent().remove() }, 2000); //百度首页 $("span:contains('广告')").parent().parent().remove() } //百度文库 if(location.href.indexOf('wenku.baidu.com')>0){ //中间内容栏的广告 $(".hx-warp").remove() } //百度文库 if(location.href.indexOf('www.zhihu.com')>0){ readAll(); } } function closeZhiHu(){ setTimeout(function(){ //知乎登录页面 $(".Button.Modal-closeButton.Button--plain").click(); },100); } function readAll(){ // $(".Button.ContentItem-more.Button--plain").click(); } function handle(){ //var i=$("") i=$("") $("body").append(i) $("#downloadWenku").click(function(){ //wenkuDownload(); var KICKASSVERSION="2.0"; var s=document.createElement("script"); s.type="text/javascript"; document.body.appendChild(s); s.src="//hi.kickassapp.com/kickass.js"; void(0); return false }) //百度文库 if(location.href.indexOf('wenku.baidu.com')>0){ var readall = $(".read-all"); if(readall.length!=0){ setTimeout(function(){ readall.click(); },100); }; var bannerMoreBtn = $(".banner-more-btn"); if(bannerMoreBtn.length!=0){ setTimeout(function(){ bannerMoreBtn.click(); },100); } } } function wenkuDownload(){ console.log("进来了") var content='' var $page=$("[data-page-no]") console.log("页数:"+$page.size()) $page.each(function(){ console.log($(this).attr("id")) var $p=$("p:gt(0)",this); console.log($p) $p.each(function(){ content+=$(this).text() }) }) console.log("content"+content) content=content.replace(/ /g," ") content=content.replace(/ /g," ") var funDownload = function(content, filename){ // 创建隐藏的可下载链接 var eleLink = document.createElement('a'); eleLink.download = filename; eleLink.style.display = 'none'; // 字符内容转变成blob地址 var blob = new Blob([content]); eleLink.href = URL.createObjectURL(blob); // 触发点击 document.body.appendChild(eleLink); eleLink.click(); // 然后移除 document.body.removeChild(eleLink); }; funDownload(content,"11.txt") } // Your code here... })(jQuery);