Fuck FuckAdBlock

Acts like FuckAdBlock.js but always says that no adblock was detected.

  1. // ==UserScript==
  2. // @name Fuck FuckAdBlock
  3. // @author Mechazawa
  4. // @namespace Mechazawa
  5. // @description Acts like FuckAdBlock.js but always says that no adblock was detected.
  6. // @license WTFPl
  7. // @version 5
  8. // @include *
  9. // @run-at document-start
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13.  
  14. (function(window) {
  15. var debug = false;
  16.  
  17. var FuckAdBlock = function(options) {
  18. if(options !== undefined)
  19. this.setOption(options);
  20.  
  21. var self = this;
  22. window.addEventListener('load', function() {
  23. setTimeout(function() {
  24. if(self._options.checkOnLoad === true)
  25. self.check(false);
  26. }, 1);
  27. }, false);
  28.  
  29. // hotfix
  30. var self = this;
  31. this.debug = {
  32. set: function(x){ debug = !!x; return self;},
  33. get: function(){ return debug; }
  34. }
  35. }
  36.  
  37. FuckAdBlock.prototype = {
  38. setOption : function(options, value) {
  39. if(value !== undefined) {
  40. var key = options;
  41. options = {};
  42. options[key] = value;
  43. }
  44.  
  45. for(option in options)
  46. this._options[option] = options[option];
  47.  
  48. return this;
  49. },
  50.  
  51. _options : {
  52. checkOnLoad: true,
  53. resetOnEnd: true,
  54. },
  55.  
  56. _var : {
  57. triggers: []
  58. },
  59.  
  60. check : function(ignore) {
  61. this.emitEvent(false);
  62. return true;
  63. },
  64.  
  65. clearEvent : function() {
  66. this._var.triggers = [];
  67. },
  68.  
  69. emitEvent : function(detected) {
  70. if(detected === false) {
  71. var fns = this._var.triggers;
  72. for (var i = 0; i < fns.length; i += 1) {
  73. if (fns[i] instanceof Function) { fns[i](); }
  74. }
  75. if(this._options.resetOnEnd === true)
  76. this.clearEvent();
  77. }
  78. return this;
  79. },
  80.  
  81. on : function(detected, fn) {
  82. if(detected === false)
  83. this._var.triggers.push(fn);
  84. return this;
  85. },
  86.  
  87. onDetected : function(fn) {
  88. return this;
  89. },
  90.  
  91. onNotDetected : function(fn) {
  92. return this.on(false, fn);
  93. }
  94. };
  95.  
  96. var fuck = new FuckAdBlock();
  97. for (var field in fuck) {
  98. Object.defineProperty(fuck, field, {value: fuck[field], configurable: false});
  99. }
  100. Object.defineProperties(window, {fuckAdBlock : { value: fuck, enumerable: true, writable: false }});
  101. Object.defineProperties(window, {blockAdBlock : { value: fuck, enumerable: true, writable: false }});
  102. })(window);