百度翻译去广告

移除百度翻译中的广告

  1. // ==UserScript==
  2. // @name 百度翻译去广告
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0.2
  5. // @icon https://fanyi.baidu.com/favicon.ico
  6. // @description 移除百度翻译中的广告
  7. // @author WingKing
  8. // @homepageURL https://github.com/
  9. // @match *://*.baidu.com/*
  10. // @grant none
  11. // @grant GM_log
  12. // @grant GM_getValue
  13. // @grant GM_listValues
  14. // @require https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js
  15. // @license MIT
  16. // ==/UserScript==
  17.  
  18. // const dom = {};
  19. // dom.query = jQuery.noConflict(true);
  20. // dom.query(document).ready(function ($) {
  21. // 'use strict';
  22. // // 百度翻译
  23. // if (location.href.indexOf('fanyi.baidu.com') > 0) {
  24. // $("#sideAdContainer").remove();
  25. // $(".spread-wrap").remove();
  26. // $("#sideBannerContainer").remove();
  27. // $('.manual-trans-btn').remove();
  28. // $('.products-list').remove();
  29. // $('.simultaneous-interpretation').remove();
  30. // $('.trans-machine').remove();
  31. // $('.manual-trans-info').remove();
  32. // $('.download-guide').remove();
  33. // $('.extra-wrap').remove();
  34. // $('.footer').remove();
  35. // $("#app-read").remove();
  36. // }
  37.  
  38. // });
  39.  
  40. /*
  41. 请把下面的JSON添加到数据中
  42. {
  43. " .products-list": {},
  44. "#app-read": {},
  45. "#sideAdContainer": {},
  46. "#sideBannerContainer": {},
  47. ".app-side-link": {},
  48. ".download-guide": {},
  49. ".extra-wrap": {},
  50. ".footer": {},
  51. ".manual-trans-btn": {},
  52. ".manual-trans-info": {},
  53. ".simultaneous-interpretation": {},
  54. ".spread-wrap": {},
  55. ".trans-machine": {}
  56. }
  57. */
  58.  
  59. ;(function () {
  60. $ = jQuery.noConflict(true)
  61.  
  62. const keys = GM_listValues()
  63. const hideElements = []
  64. const elements = []
  65.  
  66. keys.forEach(key => {
  67. const properties = GM_getValue(key)
  68.  
  69. if (properties && Object.keys(properties).length > 0) {
  70. const temp = []
  71. for (const iterator in properties) {
  72. temp.push(`${iterator}:${properties[iterator]}!important`)
  73. }
  74.  
  75. elements.push(`${key}{${temp.join(';')}}`)
  76. } else {
  77. hideElements.push(key)
  78. }
  79. })
  80.  
  81. const css =
  82. hideElements.join(',') + `{display:none !important;}` + elements.join('')
  83.  
  84. loadStyle(css)
  85. function loadStyle(css) {
  86. var style = document.createElement('style')
  87. style.type = 'text/css'
  88. style.rel = 'stylesheet'
  89. style.appendChild(document.createTextNode(css))
  90. var head = document.getElementsByTagName('head')[0]
  91. head.appendChild(style)
  92. }
  93. })()
  94.  

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址