Reddit Bypass Enhancer

Bypass the "open in app prompt" and unblur NSFW content on Reddit automatically.

目前为 2024-12-28 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Reddit Bypass Enhancer
  3. // @namespace https://greasyfork.org/en/users/1030895-universedev
  4. // @version 1.3
  5. // @description Bypass the "open in app prompt" and unblur NSFW content on Reddit automatically.
  6. // @author UniverseDev
  7. // @license GPL-3.0-or-later
  8. // @match https://www.reddit.com/*
  9. // @match https://sh.reddit.com/*
  10. // @grant none
  11. // @run-at document-end
  12. // @noframes
  13. // ==/UserScript==
  14. 'use strict';
  15.  
  16. (function () {
  17. const NSFW_MODAL_TAG = 'shreddit-async-loader';
  18. const NSFW_MODAL_ATTR = 'bundlename';
  19. const BLURRED_TAG = 'shreddit-blurred-container';
  20. const PROMPT_SELECTOR = 'xpromo-nsfw-blocking-container';
  21.  
  22. function removeNSFWBlock() {
  23. const nsfwModal = document.querySelector(`${NSFW_MODAL_TAG}[${NSFW_MODAL_ATTR}*="nsfw_blocking_modal"]`);
  24. if (nsfwModal) nsfwModal.remove();
  25.  
  26. const prompt = document.querySelector(`${PROMPT_SELECTOR} > *`)?.shadowRoot?.querySelector('.prompt');
  27. if (prompt) prompt.remove();
  28.  
  29. const blurredContainers = document.querySelectorAll(BLURRED_TAG);
  30. blurredContainers.forEach(container => {
  31. if (container.shadowRoot?.innerHTML) {
  32. container.firstElementChild.click();
  33. }
  34. });
  35. }
  36.  
  37. const observer = new MutationObserver(() => {
  38. removeNSFWBlock();
  39. });
  40.  
  41. observer.observe(document, {
  42. childList: true,
  43. subtree: true,
  44. attributes: false,
  45. });
  46.  
  47. removeNSFWBlock();
  48.  
  49. setTimeout(removeNSFWBlock, 100);
  50.  
  51. const shredditCheckInterval = setInterval(() => {
  52. if (!document.querySelector('shreddit-app')) {
  53. observer.disconnect();
  54. clearInterval(shredditCheckInterval);
  55. }
  56. }, 5000);
  57. })();
  58. 'use strict';
  59.  
  60. (function () {
  61. const NSFW_MODAL_TAG = 'shreddit-async-loader';
  62. const NSFW_MODAL_ATTR = 'bundlename';
  63. const BLURRED_TAG = 'shreddit-blurred-container';
  64. const PROMPT_SELECTOR = 'xpromo-nsfw-blocking-container';
  65.  
  66. function removeNSFWBlock() {
  67. const nsfwModal = document.querySelector(`${NSFW_MODAL_TAG}[${NSFW_MODAL_ATTR}*="nsfw_blocking_modal"]`);
  68. if (nsfwModal) nsfwModal.remove();
  69.  
  70. const prompt = document.querySelector(`${PROMPT_SELECTOR} > *`)?.shadowRoot?.querySelector('.prompt');
  71. if (prompt) prompt.remove();
  72.  
  73. const blurredContainers = document.querySelectorAll(BLURRED_TAG);
  74. blurredContainers.forEach(container => {
  75. if (container.shadowRoot?.innerHTML) {
  76. container.firstElementChild.click();
  77. }
  78. });
  79. }
  80.  
  81. const observer = new MutationObserver(() => {
  82. removeNSFWBlock();
  83. });
  84.  
  85. observer.observe(document, {
  86. childList: true,
  87. subtree: true,
  88. attributes: false,
  89. });
  90.  
  91. removeNSFWBlock();
  92.  
  93. const shredditCheckInterval = setInterval(() => {
  94. if (!document.querySelector('shreddit-app')) {
  95. observer.disconnect();
  96. clearInterval(shredditCheckInterval);
  97. }
  98. }, 5000);
  99. })();