Anti-AdBlocker & DeBlocker

Remove Anti-AdBlocker & DeBlocker

当前为 2020-02-29 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Anti-AdBlocker & DeBlocker
  3. // @version 1.06
  4. // @description Remove Anti-AdBlocker & DeBlocker
  5. // @author Elwyn
  6. // @license MIT
  7. // @namespace https://openuserjs.org/install/Elwyn/Anti-AdBlocker_DeBlocker.user.js
  8. // @include *
  9. // @run-at document-start
  10. // @grant unsafeWindow
  11. // ==/UserScript==
  12. (function() {
  13.  
  14. if ( window.location !== window.parent.location ) return;
  15.  
  16. var excludes = ['360.cn', 'adblockplus.org', 'agar.io', 'aliexpress.com', 'amazon.', 'apple.com', 'ask.com', 'baidu.com', 'bing.com', 'bufferapp.com', 'calm.com', 'chatango.com', 'chromeactions.com', 'dolldivine.com', 'easyinplay.net', 'ebay.com', 'exacttarget.com', 'facebook.com', 'flattr.com', 'flickr.com', 'fsf.org', 'greasyfork.org', 'ghacks.net', 'google.', 'imdb.com', 'imgbox.com', 'imgur.com', 'instagram.com', 'jsbin.com', 'jsfiddle.net', 'linkedin.com', 'live.com', 'mail.ru', 'microsoft.com', 'msn.com', 'openuserjs.org', 'pandoon.info', 'paypal.com', 'pinterest.com', 'plnkr.co', 'popmech.ru', 'preloaders.net', 'qq.com', 'reddit.com', 'stackoverflow.com', 'tampermonkey.net', 'twitter.com', 'vimeo.com', 'wikipedia.org', 'w3schools.com', 'xemvtv.net', 'yahoo.', 'yandex.ru', 'youtu.be', 'youtube.com', 'vod.pl'];
  17. if (new RegExp( excludes.join('|').replace(/\./g,'\.') ).test( location.host )) return;
  18.  
  19. function addStyle(str) {
  20. var node = document.createElement('style');
  21. node.innerHTML = str;
  22. document.body.appendChild(node);
  23. }
  24.  
  25. function randomInt( min, max )
  26. {
  27. // min and max included
  28. if ( max === undefined ) {
  29. max = min;
  30. min = 0;
  31. }
  32. return Math.floor(min + Math.random() * (max - min + 1));
  33. }
  34.  
  35. function getRandomName( size )
  36. {
  37. var chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
  38. var i;
  39. var name = '';
  40. for (i = 0; i < (size||randomInt(10,24)); i++)
  41. {
  42. name += chars.charAt( randomInt(0,chars.length) );
  43. }
  44. return name;
  45. }
  46.  
  47. function addRandomClass( el ) {
  48. var name = el.className;
  49. if ( typeof name != 'undefined' ) {
  50. if( /\s/.test( name ) ) {
  51. name = name.split(' ');
  52. name = name[0];
  53. }
  54. } else {
  55. name = getRandomName();
  56. el.classList.add( name );
  57. }
  58. return '.' + name + ',';
  59. }
  60.  
  61. function removeModal( el )
  62. {
  63. console.log( 'ANTI-DEBLOCKER: Anti-AdBlock Found!');
  64.  
  65. var classes = '';
  66.  
  67. for (;;) {
  68. if ( el.parentNode.tagName == 'BODY' ) break;
  69. classes += addRandomClass( el );
  70. el = el.parentNode;
  71. }
  72.  
  73. document.querySelectorAll( 'div' ).forEach( ( el ) => {
  74. let style = window.getComputedStyle( el );
  75. let height;
  76. if ( style.getPropertyValue( 'position' ) == 'fixed' )
  77. {
  78. height = style.getPropertyValue( 'height' );
  79. if ( height == '100%' )
  80. {
  81. classes += addRandomClass( el );
  82. }
  83. else if ( /px/i.test( height ) && parseInt( height ) > window.innerHeight - 100 )
  84. {
  85. classes += addRandomClass( el );
  86. }
  87. }
  88. });
  89.  
  90. if ( classes.length > 0 ) {
  91.  
  92. classes = classes.substring( 0, classes.length - 1 );
  93.  
  94. console.log( 'ANTI-DEBLOCKER Elements:' + classes );
  95.  
  96. let $_removeChild = unsafeWindow.Node.prototype.removeChild;
  97. unsafeWindow.Node.prototype.removeChild = ( node ) => {
  98. if ( node.tagName != 'HEAD' && node.tagName != 'BODY' ) {
  99. $_removeChild.apply( this, arguments );
  100. }
  101. }
  102.  
  103. addStyle( classes + '{ display: none !important; }' );
  104.  
  105. addStyle( '* { -webkit-filter: blur(0px) !important; filter: blur(0px) !important; }' );
  106. }
  107.  
  108. }
  109.  
  110. document.addEventListener('DOMContentLoaded', function() {
  111. // Mutation Observer
  112. var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
  113.  
  114. // Create an observer instance
  115. var observer = new MutationObserver( (mutations) => {
  116. mutations.forEach( (mutation) => {
  117. if ( mutation.addedNodes.length ) {
  118. Array.prototype.forEach.call( mutation.addedNodes, (addedNode) => {
  119. if ( typeof addedNode.innerText == 'undefined' ) return;
  120. if ( addedNode.innerText.length < 2 ) return;
  121. //console.log( 'ANTI-DEBLOCKER Text:' + addedNode.innerText );
  122. if( /A\s*d\s*-?B\s*l\s*o\s*c\s*k|bloqueur|bloqueador|Werbeblocker|&#1570;&#1583;&#1576;&#1604;&#1608;&#1603; &#1576;&#1604;&#1587;|блокировщиком/i.test( addedNode.innerText ) ){
  123. removeModal( addedNode );
  124. }
  125. });
  126. }
  127. });
  128. });
  129. // Observer
  130. observer.observe(document, {
  131. childList : true,
  132. subtree : true
  133. });
  134. }, false);
  135.  
  136.  
  137. })();