🏠 Home 

Greasy Fork is available in English.

ONE漫画广告屏蔽

ONE漫画广告屏蔽插件


安装此脚本?
  1. // ==UserScript==
  2. // @name ONE漫画广告屏蔽
  3. // @namespace https://greasyfork.org/zh-CN/users/505018
  4. // @iconURL https://www.onemanhua.com/favicon.png
  5. // @version 1.1
  6. // @description ONE漫画广告屏蔽插件
  7. // @author DreamFly
  8. // @match http*://*.onemanhua.com/*
  9. // @match http*://*.ohmanhua.com/*
  10. // @match http*://*.cocomanhua.com/*
  11. // @match http*://*.cocomanhua.com/*
  12. // @match http*://*.todaymanhua.com/*
  13. // @match http*://*.cocomanga.com/*
  14. // @grant chrome
  15. // @grant chrome.webRequest
  16. // ==/UserScript==
  17. (function() {
  18. 'use strict';
  19. var search_id = function(id){
  20. if (id.search('^M536099ScriptRoot') >= 0 ||
  21. id.search('^M572680ScriptRoot') >= 0 ||
  22. id.search('^rn_ad_native') >= 0 ||
  23. id.search('^sticky-banner') >= 0 ||
  24. id.search('^bidadx_tag') >= 0 ||
  25. id.search('^185140.') >= 0 ||
  26. id.search('FL$') >= 0 ||
  27. id.search('^bg_') >= 0 ||
  28. id.search('^ad') >= 0 ||
  29. id.search('^_tr') >=0 ||
  30. id.search('^wrap-fixed') >=0 ||
  31. id.search('^_') >= 0){
  32. return true
  33. }
  34. return false
  35. };
  36. var search_class = function(className){
  37. if (className.search('^rn_ad_native') >= 0 ||
  38. className.search('^sticky-banner') >= 0 ||
  39. className.search('^exoWdgtExit') >= 0 ||
  40. className.search('^website-pc-read') >= 0 ||
  41. className.search('^_') >= 0){
  42. return true
  43. }
  44. return false
  45. };
  46. //今日漫画
  47. var todayHandler = function() {
  48. if (location.hostname === 'm.todaymanhua.com')
  49. {
  50. let bodyTag = document.getElementsByTagName('body')[0]
  51. if (bodyTag){
  52. bodyTag.style.width = '65%';
  53. bodyTag.style.margin = '0 auto';
  54. }
  55. }
  56. }
  57. //其它处理
  58. var otherHandler = function() {
  59. //处理
  60. let class_names = ['kkSFH_dK', 'exoWdgtExit widget-visible', 'tb68d72c', 'website-pc-read-common', 'eww', 'vcaacd0c']
  61. let div_classs = document.getElementsByTagName('div')
  62. if (div_classs){
  63. for (let i = 0; i < div_classs.length; i++){
  64. let element = div_classs[i]
  65. if (element.className){
  66. if (search_class(element.className)){
  67. class_names.push(element.className)
  68. }
  69. }
  70. }
  71. }
  72. for (let m in class_names) {
  73. let shades = document.getElementsByClassName(class_names[m]);
  74. if (shades) {
  75. for (let i = 0; i < shades.length; i++){
  76. let shade = shades[i]
  77. if (shade.style.display != 'none') {
  78. shade.style.display = 'none';
  79. }
  80. }
  81. }
  82. }
  83. //处理
  84. let element_ids = [ '_jmrzfdC1Fa', 'affMAfdw1Fa', 'wpnAskModalContainer', 'KRJXSPEA', 'NPEWFSFN',
  85. 'HMcoupletDivleft', 'HMcoupletDivright', 'HMRichBox', 'bg_3654164748_CqjpCvZ788',
  86. 'bg_content', 'ESkzQKic', 'YTYIWDJDFL', 'ZCYKACKXFL', 'fGjzhzne', 'nGCanwCN']
  87. let div_ids = document.getElementsByTagName('div')
  88. if (div_ids){
  89. for (let i = 0; i < div_ids.length; i++){
  90. let element = div_ids[i]
  91. if (element.id){
  92. if (search_id(element.id)){
  93. element_ids.push(element.id)
  94. }
  95. }
  96. }
  97. }
  98. for (let j in element_ids) {
  99. let shade = document.getElementById(element_ids[j]);
  100. if (shade && shade.style.display != 'none') {
  101. shade.style.display = 'none';
  102. }
  103. }
  104. let m_class_name = document.querySelector('div>a>img');
  105. if (m_class_name){
  106. if (m_class_name.style.display != 'none') {
  107. m_class_name.style.display = 'none';
  108. }
  109. // m_class_name = m_class_name.parentNode;
  110. // if (m_class_name && m_class_name.style.display != 'none') {
  111. // m_class_name.style.display = 'none';
  112. // }
  113. m_class_name = m_class_name.parentNode.parentNode;
  114. if (m_class_name && m_class_name.style.display != 'none') {
  115. m_class_name.style.display = 'none';
  116. }
  117. }
  118. //处理
  119. let tag_names = ['qq', 'lodq', 'edna', 'gynd', 'etnz', 'lhrq', 'yfhr', 'ins'];
  120. for (let n in tag_names) {
  121. let shades = document.getElementsByTagName(tag_names[n]);
  122. if (shades){
  123. for (let i = 0; i < shades.length; i++){
  124. let shade = shades[i]
  125. if (shade && shade.style.display != 'none') {
  126. shade.style.display = 'none';
  127. }
  128. }
  129. }
  130. }
  131. //删除
  132. let node_name = document.querySelector('#p_3472883');
  133. if (node_name){
  134. node_name.parentNode.innerHTML = "";
  135. }
  136. //保留本页
  137. var location_url = "";
  138. var location_host = ""
  139. if (location_url == "" || (location_host == location.hostname && location.href != location_url)){
  140. location_url = location.href;
  141. location_host = location.hostname;
  142. }
  143. if (location_host != location.hostname){
  144. location.href = location_url;
  145. }
  146. }
  147. var loop = function () {
  148. todayHandler();
  149. otherHandler();
  150. //开启滚动条
  151. if (document.body.style.overflow != 'unset'){
  152. document.body.style.overflow = 'unset';
  153. }
  154. };
  155. //定时执行
  156. setInterval(loop, 10);
  157. })();