ProBoards hide adblock message

Hides anti-adblock message

  1. // ==UserScript==
  2. // @name ProBoards hide adblock message
  3. // @namespace proboards
  4. // @description Hides anti-adblock message
  5. // @match https://*.proboards.com/*
  6. // @version 1.2
  7. // @grant none
  8. // @run-at document-start
  9. // @inject-into content
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function () {
  14. "use strict";
  15.  
  16. const defineVar = (null, function (context = window, exporter = (f) => f) {
  17. Reflect.defineProperty(context, "runAntiAdBlock", {
  18. configurable: false,
  19. enumerable: true,
  20. get: exporter(() => 0),
  21. set: exporter(() => {})
  22. });
  23. });
  24.  
  25. if ("wrappedJSObject" in window) {
  26. // Bypass Firefox sandbox and define directly
  27. const context = window.wrappedJSObject;
  28. defineVar(context, (f) => exportFunction(f, context));
  29. } else {
  30. // Inject into page (only works in Chrome if CSP blocks us)
  31. const script = document.createElement("script");
  32. script.text = `"use strict";(${defineVar})();`;
  33. (document.head ?? document.documentElement).prepend(script);
  34. script.remove();
  35. }
  36. })();