Assassinate Ad Block Blockers [BETA]

You know those annoying content blockers that popup demanding you remove your AdBlock so you can read the content? This script removes them by force. Please note, this is not UNIVERSAL like AdBlock Plus. It operates at a per-site basis.

当前为 2019-05-25 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Assassinate Ad Block Blockers [BETA]
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.6
  5. // @description You know those annoying content blockers that popup demanding you remove your AdBlock so you can read the content? This script removes them by force. Please note, this is not UNIVERSAL like AdBlock Plus. It operates at a per-site basis.
  6. // @author Kxmode
  7. // @run-at document-idle
  8. // @match *://www.vg247.com/*
  9. // @match *://www.eurogamer.net/*
  10. // @match *://www.makeuseof.com/*
  11. // @match *://www.gamesradar.com/*
  12. // @match *://www.usatoday.com/*
  13. // @match *://www.cnn.com/*
  14. // @match *://www.businessinsider.com/*
  15. // @match *://www.thedailybeast.com/*
  16. // ==/UserScript==
  17.  
  18. // Loads jQuery and triggers a callback function when jQuery has finished loading
  19. function addJQuery(callback) {
  20. var script = document.createElement("script");
  21. script.setAttribute("src", "//ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js");
  22. script.addEventListener('load', function() { callback(); }, false);
  23. document.body.appendChild(script);
  24. }
  25.  
  26. // The main script
  27. function main() {
  28.  
  29. const $ = (unsafeWindow || window).$;
  30.  
  31. // For domains that follow the standard way of blocking AdBlockers typically with a full-page block and overlay.
  32. var arrayStandardBlockerDomains = [ "www.vg247.com",
  33. "www.eurogamer.net",
  34. "www.gamesradar.com",
  35. "www.usatoday.com",
  36. "www.cnn.com"].map(String);
  37.  
  38. // For domains that follow a nonstandard way of blocking AdBlockers by typically blocking the content area only, or some other unique way.
  39. var arrayAbnormalBlockerDomains = [ "www.makeuseof.com",
  40. "www.businessinsider.com",
  41. "www.thedailybeast.com"].map(String);
  42.  
  43. // For domains that typically launch third-party modals for random stuff like sign-ups.
  44. var arrayAuxiliaryBlockerDomains = [ "www.gamesradar.com"].map(String);
  45.  
  46. function DOMStatusCheck() {
  47. if (arrayStandardBlockerDomains.indexOf(window.location.hostname) > -1)
  48. {
  49. var isHTMLBlocked = $("html").attr("style");
  50. var isBodyBlocked = $("body").attr("style");
  51. if (isHTMLBlocked !== undefined || isBodyBlocked !== undefined)
  52. {
  53. clearInterval(currentStatus1);
  54. // We're on a page that is blocked
  55.  
  56. $("html").removeAttr("style");
  57. $("body").removeAttr("style");
  58.  
  59. switch(window.location.hostname)
  60. {
  61. case arrayStandardBlockerDomains[0]: // vg247
  62. case arrayStandardBlockerDomains[1]: // eurogamer
  63. case arrayStandardBlockerDomains[2]: // gamesradar
  64. case arrayStandardBlockerDomains[3]: // usatoday
  65. case arrayStandardBlockerDomains[4]: // cnn
  66. $("[class*='sp_veil']").remove();
  67. $("[id*='sp_message_id']").remove();
  68. break;
  69. }
  70. }
  71.  
  72. console.clear();
  73. }
  74.  
  75. if (arrayAuxiliaryBlockerDomains.indexOf(window.location.hostname) > -1)
  76. {
  77. switch(window.location.hostname)
  78. {
  79. case arrayAuxiliaryBlockerDomains[0]: // gamesradar
  80. if ($(".raleigh-optin-visible").is(":visible"))
  81. {
  82. clearInterval(currentStatus2);
  83. $("[class*='raleigh-optin-']").remove();
  84. }
  85. break;
  86. }
  87. }
  88.  
  89. }
  90.  
  91. function DOMStatusCheckAbnormal() {
  92. if (arrayAbnormalBlockerDomains.indexOf(window.location.hostname) > -1)
  93. {
  94. switch(window.location.hostname)
  95. {
  96. case arrayAbnormalBlockerDomains[0]: // makeuseof
  97. $("[class*='unblockplease-overlay']").remove();
  98. $(".unblockplease").removeAttr("style");
  99. break;
  100. case arrayAbnormalBlockerDomains[1]: // businessinsider
  101. $(".tp-modal").remove();
  102. $(".tp-backdrop").remove();
  103. $("body").removeClass("tp-modal-open");
  104. break;
  105. case arrayAbnormalBlockerDomains[2]: // dailybeast - these guys *rolls eyes*
  106. $(".tp-modal").remove();
  107. $(".tp-backdrop").remove();
  108. $("body").removeClass("tp-modal-open");
  109. $("[id*='offer-0-']").remove();
  110. $("[displayname*='PianoTag']").remove();
  111. $("[src*='tinypass.min.js']").remove();
  112. $("#piano_bottom_ribbon_wrapper").remove();
  113. console.clear();
  114. console.log("blocker code removed");
  115. break;
  116. }
  117.  
  118. }
  119. }
  120.  
  121. DOMStatusCheckAbnormal();
  122.  
  123. function ClearAllIntervals()
  124. {
  125. for (var i = 1; i <= 6; i++)
  126. {
  127. var intervalName = "currentStatus" + i;
  128. clearInterval(intervalName);
  129. }
  130. clearInterval(ci);
  131. console.clear();
  132. console.log("all intervals cleared");
  133. }
  134.  
  135. // Sets up listeners to supercede any blocker shenanigans
  136. if (arrayStandardBlockerDomains.indexOf(window.location.hostname) > -1) { var currentStatus1 = setInterval(DOMStatusCheck, 50); }
  137. if (arrayAuxiliaryBlockerDomains.indexOf(window.location.hostname) > -1) { var currentStatus2 = setInterval(DOMStatusCheck, 50); }
  138.  
  139. // Second pass after 1.5 seconds
  140. if (arrayStandardBlockerDomains.indexOf(window.location.hostname) > -1) { var currentStatus3 = setTimeout(DOMStatusCheck, 1500); }
  141. if (arrayAbnormalBlockerDomains.indexOf(window.location.hostname) > -1) { var currentStatus4 = setTimeout(DOMStatusCheck, 1500); }
  142.  
  143. // Third pass after 2.5 seconds
  144. if (arrayStandardBlockerDomains.indexOf(window.location.hostname) > -1) { var currentStatus5 = setTimeout(DOMStatusCheck, 2500); }
  145. if (arrayAbnormalBlockerDomains.indexOf(window.location.hostname) > -1) { var currentStatus6 = setTimeout(DOMStatusCheck, 2500); }
  146.  
  147. // Last-pass guarantee after 7 seconds
  148. var ci = setTimeout(ClearAllIntervals, 7000);
  149.  
  150. // Perpetual check and removal every 2.5 seconds - The Peter Gabriel Sledgehammer Special
  151. if (arrayAbnormalBlockerDomains.indexOf(window.location.hostname) > -1) { var ABStatus = setInterval(DOMStatusCheckAbnormal, 2500); }
  152.  
  153.  
  154. console.clear();
  155. }
  156.  
  157. // Load jQuery and then execute the main function
  158. addJQuery(main);