Reddit Bypass Enhancer

Bypass the "open in app prompt", unblur NSFW content and thumbnails, and remove the blur from community highlight cards on Reddit automatically.

当前为 2025-01-09 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Reddit Bypass Enhancer
  3. // @namespace https://greasyfork.org/en/users/1030895-universedev
  4. // @version 1.5
  5. // @description Bypass the "open in app prompt", unblur NSFW content and thumbnails, and remove the blur from community highlight cards 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-start
  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. const THUMBNAIL_BLUR_SELECTOR = '.thumbnail-blur';
  22. const BLURRED_CLICKED_CLASS = 'rbe-unblurred';
  23. const COMMUNITY_HIGHLIGHT_CARD_SELECTOR = 'community-highlight-card';
  24.  
  25. function removeNSFWBlock() {
  26. const nsfwModal = document.querySelector(`${NSFW_MODAL_TAG}[${NSFW_MODAL_ATTR}*="nsfw_blocking_modal"]`);
  27. if (nsfwModal) nsfwModal.remove();
  28.  
  29. const prompt = document.querySelector(`${PROMPT_SELECTOR} > *`)?.shadowRoot?.querySelector('.prompt');
  30. if (prompt) prompt.remove();
  31.  
  32. const blurredContainers = document.querySelectorAll(BLURRED_TAG);
  33. blurredContainers.forEach(container => {
  34. if (container.shadowRoot?.innerHTML && !container.classList.contains(BLURRED_CLICKED_CLASS)) {
  35. container.firstElementChild.click();
  36. container.classList.add(BLURRED_CLICKED_CLASS);
  37. }
  38. });
  39.  
  40. const thumbnailBlurElements = document.querySelectorAll(THUMBNAIL_BLUR_SELECTOR);
  41. thumbnailBlurElements.forEach(el => {
  42. el.classList.remove('thumbnail-blur');
  43. });
  44.  
  45. // Remove blur from community highlight cards
  46. const cards = document.querySelectorAll(COMMUNITY_HIGHLIGHT_CARD_SELECTOR);
  47. cards.forEach(card => {
  48. card.removeAttribute('blurred');
  49. });
  50. }
  51.  
  52. const observer = new MutationObserver(() => {
  53. removeNSFWBlock();
  54. });
  55.  
  56. observer.observe(document, {
  57. childList: true,
  58. subtree: true,
  59. attributes: false,
  60. });
  61.  
  62. removeNSFWBlock();
  63.  
  64. setTimeout(removeNSFWBlock, 100);
  65.  
  66. const shredditCheckInterval = setInterval(() => {
  67. if (!document.querySelector('shreddit-app')) {
  68. observer.disconnect();
  69. clearInterval(shredditCheckInterval);
  70. }
  71. }, 5000);
  72. })();