百度文库去广告

去掉相关文档推荐和购买链接,免开会员使用VIP背景换肤

Versión del día 5/5/2022. Echa un vistazo a la versión más reciente.

  1. // ==UserScript==
  2. // @name 百度文库去广告
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.9.9.2
  5. // @description 去掉相关文档推荐和购买链接,免开会员使用VIP背景换肤
  6. // @author AN drew
  7. // @match https://wenku.baidu.com/*
  8. // @match https://eduai.baidu.com/*
  9. // @require https://lib.baomitu.com/jquery/3.5.0/jquery.min.js
  10. // @require https://cdn.bootcdn.net/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js
  11. // @grant GM_addStyle
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16.  
  17. GM_addStyle(`html.full-screen::-webkit-scrollbar { width: 0 !important }
  18. html.full-screen { -ms-overflow-style: none; }
  19. html.full-screen { overflow: -moz-scrollbars-none; }
  20. .theme-wrapper{ padding-top: 15px;}
  21. .left-wrapper.zoom-scale{padding:0px}
  22. #right-wrapper-id{display:none!important}
  23. .btn.saveskin {
  24. height: 36px;
  25. background: green;
  26. text-align: center;
  27. position: absolute;
  28. right: 60px;
  29. top: 15px;
  30. border-radius: 6px;
  31. font-family: PingFangSC-Medium,sans-serif;
  32. font-size: 16px;
  33. color: #fff;
  34. display: inline-block;
  35. line-height: 36px;
  36. vertical-align: middle;
  37. min-width: 100px;
  38. cursor: pointer;
  39. }
  40. .btn.saveskin:hover {
  41. background: #00a900;
  42. }
  43. .btn.close {
  44. height: 32px;
  45. width: 32px;
  46. background: #ff0000ab;
  47. text-align: center;
  48. position: absolute;
  49. right: 18px;
  50. top: 18px;
  51. font-family: PingFangSC-Medium,sans-serif;
  52. font-size: 16px;
  53. color: #fff;
  54. display: inline-block;
  55. line-height: 36px;
  56. vertical-align: middle;
  57. cursor: pointer;
  58. border-radius: 32px;
  59. }
  60. .btn.close:hover {
  61. background: red;
  62. }
  63. `);
  64.  
  65. if(window.location.href.indexOf("wenku.baidu.com/ndcore/browse/sub") > -1)
  66. {
  67. /*
  68. if(document.querySelector(".red-text.bold-text"))
  69. document.querySelector(".red-text.bold-text").style.display="none";
  70. if(document.querySelector(".pay-vip-btn-wrap"))
  71. document.querySelector(".pay-vip-btn-wrap").style.display="none";
  72. if(document.querySelector(".sub-right"))
  73. document.querySelector(".sub-right").style.display="none";
  74. if(document.querySelector(".sub-main"))
  75. {
  76. document.querySelector(".sub-main").style.cssText="display: flex; justify-content: center;";
  77.  
  78. document.querySelector(".sub-main").style.display="flex";
  79. document.querySelector(".sub-main").style.justifyContent="center";
  80. }
  81. */
  82. GM_addStyle(`.red-text.bold-text{display:none!important}
  83. .pay-vip-btn-wrap{display:none!important}
  84. .sub-right{display:none!important}
  85. .sub-main{display: flex; justify-content: center;}`);
  86. }
  87. else if(window.location.href.indexOf("wenku.baidu.com/view") > -1)
  88. {
  89. if($('.xueshu-logo').length>0)
  90. {
  91. GM_addStyle(`.stream-img{display:none!important}`);
  92. }
  93. else
  94. {
  95. GM_addStyle(`.content-wrapper{display: flex; justify-content: center;}`);
  96. }
  97. }
  98.  
  99. if (typeof $ != 'undefined')
  100. {
  101. if(window.location.href.indexOf('/view/') > -1)
  102. {
  103. //清除原默认值
  104. if($.cookie('mytheme')=='theme-1')
  105. {
  106. $.cookie('mytheme', 'classic', { expires: 365, path: "/", domain: "wenku.baidu.com" });
  107. }
  108.  
  109. //设置皮肤
  110. if($.cookie('mytheme')==undefined)
  111. {
  112. $.cookie('mytheme', 'classic', { expires: 365, path: "/", domain: "wenku.baidu.com" });
  113. }
  114. else
  115. {
  116. $('#app').attr('class',$.cookie('mytheme'));
  117. $('#app').attr('style',$.cookie('mystyle'));
  118. }
  119. }
  120.  
  121. //点击换肤按钮后,选择并移动至当前皮肤预览图
  122. var timer1 = setInterval(()=>{
  123. if($('.theme-enter-wrap').length>0)
  124. {
  125. $('.theme-enter-wrap').click(function(){
  126. $('.bottom-theme-select-wrap').show();
  127. let myindex = parseInt($.cookie('myindex'));
  128. setTimeout(()=>{
  129. if(!$('.theme-item .bg-img').eq(myindex).hasClass('selected'))
  130. {
  131. $('.theme-item .bg-img').removeClass('selected');
  132. $('.theme-item .bg-img').eq(myindex).addClass('selected');
  133. }
  134. if(!$('.slide-wrapper').hasClass('slid'))
  135. {
  136. if(myindex >= 7)
  137. {
  138. $('.slide-wrapper').attr('style','margin-left: '+(-186*(myindex-7+1))+'px; transition: all 0.3s ease-out 0.1s;')
  139. }
  140. $('.slide-wrapper').addClass('slid');
  141. }
  142. },500);
  143. });
  144. clearInterval(timer1);
  145. }
  146. },1);
  147.  
  148. //选择皮肤预览图时
  149. var timer2 = setInterval(()=>{
  150. if($('.theme-list').length>0)
  151. {
  152. $('.theme-item .bg-img').click(function(){
  153. $('.theme-item .bg-img').removeClass('selected');
  154. $(this).addClass('selected');
  155. let tempindex=$('.theme-item .bg-img').index(this);
  156.  
  157. if(pageData.viewBiz.visitUserInfo.skinInfo.skinList != undefined)
  158. $('#app').attr('class',pageData.viewBiz.visitUserInfo.skinInfo.skinList[tempindex].skinId);
  159.  
  160. $.cookie('tempindex', tempindex, { expires: 365, path: "/", domain: "wenku.baidu.com" });
  161. });
  162. clearInterval(timer2);
  163. }
  164. },1);
  165.  
  166. //保存皮肤
  167. var $save = $('<div data-v-416af63d="" class="btn saveskin">保存皮肤</div>');
  168.  
  169. $save.click(function(){
  170. if($('#app').attr('class')!=undefined)
  171. {
  172. $.cookie('mytheme', $('#app').attr('class'), { expires: 365, path: "/", domain: "wenku.baidu.com" });
  173. $.cookie('mystyle', $('#app').attr('style'), { expires: 365, path: "/", domain: "wenku.baidu.com" });
  174. }
  175. $.cookie('myindex', $.cookie('tempindex'), { expires: 365, path: "/", domain: "wenku.baidu.com" });
  176. //window.location.reload();
  177. $('.bottom-theme-select-wrap').hide();
  178. });
  179.  
  180. var $close = $('<div data-v-416af63d="" class="btn close"><svg t="1651740904030" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2484" width="30" height="30"><path d="M558.933333 529.066667l285.866667 285.866666-29.866667 29.866667-285.866666-285.866667-285.866667 285.866667-29.866667-29.866667 285.866667-285.866666L213.333333 243.2l29.866667-29.866667 285.866667 285.866667L814.933333 213.333333l29.866667 29.866667-285.866667 285.866667z" fill="#ffffff" p-id="2485"></path></svg></div>');
  181.  
  182. $close.click(function(){
  183. $('.bottom-theme-select-wrap').hide();
  184. });
  185.  
  186.  
  187. setInterval(()=>{
  188. if($('.btn.saveskin').length==0)
  189. {
  190. $('.theme-list .title-wrap').append($save);
  191. }
  192. if($('.btn.close').length==0)
  193. {
  194. $('.theme-list .title-wrap').append($close);
  195. }
  196.  
  197. $('.theme-list .btn.join-vip').remove();
  198. $('.bottom-theme-select-wrap > .btn-close').remove();
  199. $('div.theme-list div.info').remove();
  200. },1);
  201.  
  202.  
  203. setInterval(()=>{
  204. $('body').removeAttr('style');
  205. },1);
  206.  
  207. setTimeout(function(){
  208. $(".moreBtn.goBtn").click();
  209. //$(".read-all").click();
  210. $(".more-coment").click();
  211. if($(".moreBtn.goBtn").length>0)
  212. {
  213. setTimeout(function(){
  214. $(window).scrollTop(0);
  215. },500);
  216. }
  217. },1500);
  218.  
  219. setInterval(function(){
  220.  
  221. $('.ppt-page-item').removeClass('hide');
  222. $('.relative-doc-newwrapper.sider-edge').hide();
  223. $('#side-fixed-box').hide();
  224.  
  225. $('.woniu-guide-card').hide();
  226. $('.woniu-tag').hide();
  227. $('.recommend-aside').hide();
  228. $('#pc-common-dialog-wrap').hide();
  229. $('.pc-common-sidebar').hide();
  230.  
  231. $('.search-topic-block').height(180);
  232. $('.specialDisplay-container').height(180);
  233. $('.specialDisplay-inner').height(180);
  234.  
  235. $('.tHiZXQ').hide();
  236. $('.vip-entrance-bottom').hide();
  237. $('#top-recommend-dsp-ad').hide();
  238. $('.search-topic-block').hide();
  239. $('.tiger-lossUser-dialog-vip').hide();
  240. $('#go-to-buy-vip-dialog').hide();
  241. $('.vip-guide-mask').hide();
  242. $('.new-recommend').hide();
  243. $('.try-end-fold-page').hide();
  244. $('.hx-recom-wrapper').hide();
  245. $('#fengchaoad').hide();
  246. $('.shop-goods-wrapper').hide();
  247. $('.opening-season-dialog').hide();
  248. $('.hx-warp').hide();
  249. $('.hx-bottom-wrapper').hide();
  250. $('.bz-doc-tool-dialog-fix').hide();
  251. $('.fixed-activity-bar').hide();
  252. $('.dialog-wraper').hide();
  253. $('.new-skin-wrap').hide();
  254. $('.pure-guide-dialog').hide();
  255.  
  256. $('.vip-activity-wrap-new').hide();
  257. $('.doc-price-voucher-wrap').hide();
  258. $('.btn-pay.2').hide();
  259. $('.btn-pay-vip').hide();
  260. $('.btn-vip').hide();
  261.  
  262. $('.pager-container').hide();
  263. $('.treasure-main').hide();
  264. $('.fufei-activity-bar').hide();
  265.  
  266. $(".slide-left").hide();
  267. $(".slide-right").hide();
  268. $(".bg-items-wrapper").empty();
  269. $(".bg-items-wrapper").attr("style","width: 700%; margin-left: -100%; background: linear-gradient(rgb(65, 210, 93), rgb(32, 181, 122));")
  270. $(".slide-circle-wrapper").hide();
  271. $(".promotion-wrapper").hide();
  272. $(".doc-pack-wrapper").hide();
  273. $("#book-rec-wrapper").hide();
  274. $("#app > div.header-wrapper > div.search-wrapper > div.hot-words-wrapper > div.hot-words-items > div:nth-child(2)").hide();
  275.  
  276. $(".aside-rknow-con").hide();
  277. $(".zsj-topbar.mini").hide();
  278. $(".search-nav").removeClass("zsj-act");
  279. $(".bd-wrap").removeClass("zsj-act");
  280. $(".search-aside-adWrap").hide();
  281. $(".yuedu-recommend-wrap").hide();
  282. $(".header-box-recommend.clearfix.inline").hide();
  283. $(".search-wrapper-box-recommend.clearfix").hide();
  284. $(".footer-box-recommend.clearfix").hide();
  285. $(".summary-recommend.clearfix.has-content").hide();
  286. $(".open-vip-button ").hide();
  287.  
  288. $('.confirm-change').hide();
  289. $('.btn.super-vip').hide();
  290. $('.slogan+.btn').hide();
  291. $('.specific-user-dialog-wrap').hide();
  292. $('.experience-card-old-dialog-wrap').hide();
  293. $("table tr:first").hide();
  294. $("#banurl").hide();
  295. $(".mn-lk-w.member-icon").next().hide();
  296. $("#hd > div > div.nav-wrap.mb10 > div > div > ul.main-nav.side-nav.clearfix > li:nth-child(1)").hide();
  297. $(".top-ads-banner-wrap").hide();
  298. $(".zsj-toppos").hide();
  299. $(".ui-bz-hot-ic").hide();
  300. $(".qua-box").hide();
  301. $("#__elm_view-like-recom__qk_1").hide();
  302. $("#__elm_view-like-recom__qk_2").hide();
  303. $("#__elm_view-like-recom__qk_3").hide();
  304. $(".ft").hide();
  305. $("#next_doc_box").hide();
  306. $(".convert-tip").hide();
  307. $(".toolbar-core-btns-wrap").find(".btn-pay-vip").hide();
  308. $("#relative-doc-item").hide();
  309. $(".welfare-pop-tip").hide();
  310. $(".wangpan-tip").hide();
  311. $(".lastcell-dialog").hide();
  312. $(".service-entry").hide();
  313. $(".ad-area").hide();
  314. $(".banner-ad.banner-wrap.ad-onff").hide();
  315. $(".wkfc-wrap.ad-onff").hide();
  316. $(".banner-ad").hide();
  317.  
  318. $(".edit-subscription-dialog-wrapper.mod").hide()
  319. $(".hot-option-word-wrapper").hide()
  320. $(".tangram-suggestion-main").hide();
  321.  
  322. $(".CASH_PACK-CASH.summary").hide();
  323. $(".CASH_PACK-CASH.searchBox").hide();
  324. $(".CASH_PACK-CASH.topBar").hide();
  325.  
  326. $(".CASH_DISCOUNT-CASH.summary").hide();
  327. $(".CASH_DISCOUNT-CASH.searchBox").hide();
  328. $(".CASH_DISCOUNT-CASH.topBar").hide();
  329.  
  330. $(".CASH_DISCOUNT-VIP_RIGHT.summary").hide();
  331. $(".CASH_DISCOUNT-VIP_RIGHT.searchBox").hide();
  332. $(".CASH_DISCOUNT-VIP_RIGHT.topBar").hide();
  333.  
  334. $(".-VIP_RIGHT.summary").hide();
  335. $(".-VIP_RIGHT.searchBox").hide();
  336. $(".-VIP_RIGHT.topBar").hide();
  337.  
  338. $('.slogan').hide();
  339. $(".red-text").hide();
  340. $(".operate-wrapper").hide();
  341. $(".bottom-pop-wrap").hide();
  342. $(".pay-layer1509-wrapper").hide();
  343. $(".pay-vip-btn-wrap").hide();
  344. $(".relative-search-wrap").hide();
  345. $(".relative-recommend-wrapper").hide();
  346. $(".operation-wrapper").hide();
  347. $(".relative-doc-wrapper").hide();
  348. $(".relative-course-wrapper").hide();
  349. $(".hot-search-wrapper").hide();
  350. $(".hx-right-wrapper").hide();
  351. $(".doc-voucher-wrap").hide();
  352. $(".core-btn-wrapper.CASH_DISCOUNT-CASH.CASH_DISCOUNT.summary.t1272-0.nafe-1509").hide();
  353. $(".core-btn-wrapper.CASH_DISCOUNT-CASH.CASH_DISCOUNT.searchBox.t1272-0.nafe-1509").hide();
  354.  
  355. $(".voucher-center-wrap").hide();
  356. $("#add-price-buy-wrap").hide();
  357. $(".recommend-wrap.clearfix.notjigou").hide();
  358. $(".searchMode01").parent().parent().parent().hide();
  359.  
  360. $(".right-channel-wrap").hide();
  361. $(".ex-wrapper").hide();
  362. $(".query-sug").hide();
  363.  
  364. $('.experience-card-dialog-wrap, .experience-card-bar-wrap').hide();
  365. },1);
  366. }
  367.  
  368. GM_addStyle(`.viewpage .view-body .view-right .right-wrapper{display:none!important}
  369. .header_bg{background:rgb(24,145,226)!important; cursor:auto!important;}
  370. .energy-power{display:none!important}`);
  371.  
  372. setInterval(function(){
  373. $('.header_bg').off();
  374. $('.num').remove();
  375. },100);
  376.  
  377. })();