Reddit Bypass Enhancer

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

目前為 2025-01-17 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Reddit Bypass Enhancer
  3. // @namespace https://greasyfork.org/en/users/1030895-universedev
  4. // @version 1.6
  5. // @description Bypass the "open in app prompt", unblur NSFW content and thumbnails, remove the blur from community highlight cards, and remove image darkening 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. const THUMBNAIL_IMAGE_SELECTOR = 'a.block.w-100.h-100 > img.mb-0.h-full.w-full.object-cover';
  25. const THUMBNAIL_SHADOW_SELECTOR = '.thumbnail-shadow';
  26. const MEDIA_BACKGROUND_SELECTOR = '.bg-media-background';
  27.  
  28. function removeNSFWBlock() {
  29. const nsfwModal = document.querySelector(`${NSFW_MODAL_TAG}[${NSFW_MODAL_ATTR}*="nsfw_blocking_modal"]`);
  30. if (nsfwModal) nsfwModal.remove();
  31.  
  32. const prompt = document.querySelector(`${PROMPT_SELECTOR} > *`)?.shadowRoot?.querySelector('.prompt');
  33. if (prompt) prompt.remove();
  34.  
  35. const blurredContainers = document.querySelectorAll(BLURRED_TAG);
  36. blurredContainers.forEach(container => {
  37. if (container.shadowRoot?.innerHTML && !container.classList.contains(BLURRED_CLICKED_CLASS)) {
  38. container.firstElementChild.click();
  39. container.classList.add(BLURRED_CLICKED_CLASS);
  40. }
  41. });
  42.  
  43. const thumbnailBlurElements = document.querySelectorAll(THUMBNAIL_BLUR_SELECTOR);
  44. thumbnailBlurElements.forEach(el => {
  45. el.classList.remove('thumbnail-blur');
  46. });
  47.  
  48. const cards = document.querySelectorAll(COMMUNITY_HIGHLIGHT_CARD_SELECTOR);
  49. cards.forEach(card => {
  50. card.removeAttribute('blurred');
  51. });
  52.  
  53. const thumbnailImage = document.querySelector(THUMBNAIL_IMAGE_SELECTOR);
  54. if (thumbnailImage) {
  55. thumbnailImage.style.filter = '';
  56. }
  57.  
  58. const thumbnailShadow = document.querySelector(THUMBNAIL_SHADOW_SELECTOR);
  59. if (thumbnailShadow) {
  60. thumbnailShadow.remove();
  61. }
  62.  
  63. const mediaBackground = document.querySelector(MEDIA_BACKGROUND_SELECTOR);
  64. if (mediaBackground) {
  65. mediaBackground.style.backgroundColor = 'transparent';
  66. }
  67. }
  68.  
  69. const observer = new MutationObserver(() => {
  70. removeNSFWBlock();
  71. });
  72.  
  73. observer.observe(document, {
  74. childList: true,
  75. subtree: true,
  76. attributes: false,
  77. });
  78.  
  79. removeNSFWBlock();
  80.  
  81. setTimeout(removeNSFWBlock, 100);
  82.  
  83. const shredditCheckInterval = setInterval(() => {
  84. if (!document.querySelector('shreddit-app')) {
  85. observer.disconnect();
  86. clearInterval(shredditCheckInterval);
  87. }
  88. }, 5000);
  89. })();