Advertisement
Guest User

Untitled

a guest
Jan 9th, 2018
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1.  
  2. // ==UserScript==
  3. // @name 4chan Block Fix
  4. // @namespace b4k
  5. // @version 1.0.0
  6. // @match *://boards.4chan.org/*
  7. // @match *://sys.4chan.org/*
  8. // @run-at document-start
  9. // @grant unsafeWindow
  10. // ==/UserScript==
  11.  
  12. (function () {
  13. var window;
  14. var process;
  15. var interval;
  16. var domloaded;
  17.  
  18. window =
  19. unsafeWindow;
  20.  
  21. domloaded = false;
  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.getAttribute("x-done")) {
  34. script.setAttribute("x-done", "");
  35.  
  36. if (script.innerHTML.match(/(style_group|fourcat|recaptcha|pass_enabled)/)) {
  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. process();
  64.  
  65. interval =
  66. setInterval(
  67. function () {
  68. process();
  69.  
  70. if (domloaded) {
  71. clearInterval(interval);
  72. }
  73. },
  74.  
  75. ( 3 )
  76. );
  77.  
  78. document.addEventListener(
  79. "DOMContentLoaded",
  80.  
  81. function (event) {
  82. domloaded = true;
  83. }
  84. );
  85. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement