Guest User

Untitled

a guest
Sep 19th, 2018
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. // ==UserScript==
  2. // @name 4chan Block Fix
  3. // @namespace b4k
  4. // @version 1.0.0
  5. // @match *://boards.4chan.org/*
  6. // @match *://sys.4chan.org/*
  7. // @run-at document-start
  8. // @grant unsafeWindow
  9. // ==/UserScript==
  10.  
  11. (function () {
  12. var window;
  13. var process;
  14. var interval;
  15. var domloaded;
  16.  
  17. document.documentElement
  18. .classList.add("js-enabled");
  19.  
  20. window =
  21. unsafeWindow;
  22.  
  23. process = function () {
  24. var scripts;
  25. var domevent;
  26.  
  27. scripts =
  28. document.querySelectorAll("script");
  29.  
  30. scripts.forEach(
  31. function (script) {
  32. if (!script.src && script.innerHTML) {
  33. if (script.dataset.ran === undefined) {
  34. script.dataset.ran = "";
  35.  
  36. if (script.innerHTML.match(/(style_gr|fourcat|recaptc|pass_ena)/)) {
  37. window.eval(script.innerHTML);
  38. }
  39. }
  40. }
  41. }
  42. );
  43.  
  44. if (domloaded) {
  45. if (window.initStyleSheet) {
  46. if (!window.activeStyleSheet) {
  47. window.initStyleSheet();
  48. }
  49. }
  50.  
  51. if (window.Main) {
  52. if (window.Main.now && !window.Main.type) {
  53. window.Main.init();
  54. }
  55. }
  56.  
  57. domevent = document.createEvent("Event");
  58. domevent.initEvent("DOMContentLoaded", true, true);
  59. document.dispatchEvent(domevent);
  60. }
  61. };
  62.  
  63. domloaded = false;
  64.  
  65. process();
  66.  
  67. interval =
  68. setInterval(
  69. function () {
  70. process();
  71.  
  72. if (domloaded) {
  73. clearInterval(interval);
  74. }
  75. },
  76.  
  77. ( 3 )
  78. );
  79.  
  80. document.addEventListener(
  81. "DOMContentLoaded",
  82.  
  83. function (event) {
  84. domloaded = true;
  85. }
  86. );
  87. })();
Add Comment
Please, Sign In to add comment