Reddit Bypass Enhancer

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

当前为 2024-12-13 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Reddit Bypass Enhancer
  3. // @namespace https://greasyfork.org/en/users/1030895-universedev
  4. // @version 1.1
  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. function processElements() {
  18. const nsfwModal = [...document.getElementsByTagName('shreddit-async-loader')].find(e =>
  19. e.getAttribute('bundlename')?.includes('nsfw_blocking_modal')
  20. );
  21. if (nsfwModal) nsfwModal.remove();
  22.  
  23. const prompt = document.querySelector('xpromo-nsfw-blocking-container')?.shadowRoot?.querySelector('.prompt');
  24. if (prompt) prompt.remove();
  25.  
  26. const blurreds = [...document.getElementsByTagName('shreddit-blurred-container')].filter(e =>
  27. e.shadowRoot?.innerHTML
  28. );
  29. blurreds.forEach(blurred => {
  30. blurred.firstElementChild.click();
  31. });
  32. }
  33.  
  34. function mutationCallback() {
  35. processElements();
  36. }
  37.  
  38. const observer = new MutationObserver(mutationCallback);
  39. observer.observe(document, {
  40. childList: true,
  41. subtree: true,
  42. attributes: true,
  43. });
  44.  
  45. processElements();
  46.  
  47. setTimeout(() => {
  48. const isShreddit = document.querySelector('shreddit-app');
  49. if (!isShreddit) observer.disconnect();
  50. }, 10000);
  51. })();