Reddit Fix

Hide subreddits, remove promoted links, see full image actually shows the full image, html5 video player, remove background effects, copy video adress

  1. // ==UserScript==
  2. // @name Reddit Fix
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.9.8
  5. // @description Hide subreddits, remove promoted links, see full image actually shows the full image, html5 video player, remove background effects, copy video adress
  6. // @author Bum
  7. // @require http://code.jquery.com/jquery-3.4.1.min.js
  8. // @match https://www.reddit.com/*
  9. // @match https://new.reddit.com/*
  10. // @grant GM_addStyle
  11. // ==/UserScript==
  12.  
  13. var holdTopicsInMemory = "false";
  14. var commentEffects = "false";
  15. var originalBehavior = "false";
  16. var topicLimitInDom = 70;
  17. var lastScrollTop = 0;
  18. var scrollTopWhenREmoved = -1;
  19. var menuButtonWasAdded = false;
  20. var subsToHide = "";
  21. var removeBorderRadius = false;
  22. var hideRecentSection = false;
  23. var customFeedState = "open";
  24. var hidePromotedlinks = true;
  25.  
  26. var lastTopicRemovedTime = new Date().getTime();
  27.  
  28. if (localStorage.getItem("removeBorderRadius") != null) {
  29. removeBorderRadius = localStorage.getItem("removeBorderRadius");
  30. }
  31. if (localStorage.getItem("holdTopicsInMemory") != null) {
  32. holdTopicsInMemory = localStorage.getItem("holdTopicsInMemory");
  33. }
  34.  
  35. if (localStorage.getItem("commentEffects") != null) {
  36. commentEffects = localStorage.getItem("commentEffects");
  37. }
  38.  
  39. if (localStorage.getItem("originalBehavior") != null) {
  40. originalBehavior = localStorage.getItem("originalBehavior");
  41. }
  42. if (localStorage.getItem("subsToHide") != null) {
  43. subsToHide = localStorage.getItem("subsToHide");
  44. }
  45. if (localStorage.getItem("hidePromotedlinks") != null) {
  46. hidePromotedlinks = localStorage.getItem("hidePromotedlinks");
  47. }
  48.  
  49. if (localStorage.getItem("hideRecentSection") != null){
  50. hideRecentSection = localStorage.getItem("hideRecentSection");
  51. }
  52. if (localStorage.getItem("customFeedState") != null){
  53. customFeedState = localStorage.getItem("customFeedState");
  54. }
  55.  
  56.  
  57. var topicsInMemory = [];
  58. var isAPop = false;
  59. var maxOffset = 0;
  60.  
  61. (function() {
  62. 'use strict';
  63. function GM_addStyle(css) {
  64. const style = document.getElementById("GM_addStyle") || (function() {
  65. const style = document.createElement('style');
  66. style.type = 'text/css';
  67. style.id = "GM_addStyle";
  68. document.head.appendChild(style);
  69. return style;
  70. })();
  71. const sheet = style.sheet;
  72. sheet.insertRule(css, (sheet.rules || sheet.cssRules || []).length);
  73. }
  74.  
  75. function RemoveCssRule(css) {
  76. const style = document.getElementById("GM_addStyle") || (function() {
  77. const style = document.createElement('style');
  78. style.type = 'text/css';
  79. style.id = "GM_addStyle";
  80. document.head.appendChild(style);
  81. return style;
  82. })();
  83. const sheet = style.sheet;
  84. for (var i=0; i<sheet.cssRules.length; i++) {
  85. if (sheet.cssRules[i].selectorText == css) {
  86. sheet.deleteRule (i);
  87. }
  88. }
  89. }
  90. fRemoveBorderRadius(removeBorderRadius);
  91. fHideRecentSection(hideRecentSection);
  92.  
  93. fRemovePromoted(hidePromotedlinks);
  94.  
  95. HideAllSubs();
  96. if (commentEffects == "false")
  97. {
  98. GM_addStyle ( 'img[src*="flame"]{display:none;}' );
  99. GM_addStyle ( 'div[aria-role="presentation"]{box-shadow:none !important;background : transparent !important;}' );
  100. }
  101. GM_addStyle ( '.wwHbgRV0ZXGp5CHHlpo5u{display:block !important;}' );
  102. GM_addStyle ( '._1Q2mF3u7v9hBVu_4bkC7R4{display:block !important;}' );
  103. GM_addStyle ( '._3hUbl08LBz2mbXjy0iYhOS,._3b8u2OJXaSDdBWoRB7zUoK {height: 50px !important;width: 100% !important; bottom: 0 !important;}' );
  104.  
  105.  
  106. GM_addStyle ( '._3UEq__yL-82zX4EyuluREz,.gUpEQXQu8G8UvISmBIPsj,._1RZSSlyqzokrcxh0ESwE2e{display:none !important;}' );
  107. GM_addStyle ( '.vLH0XV-l8Y4mNGUvw4HHy{display:none !important;}' );
  108. GM_addStyle ( '.eI6Ep6BNFA5DZjPWNVb4,._2XQ3ZY6qCbEm9_WtvLLFru{display:none !important;}' );
  109.  
  110. //POPUP
  111. GM_addStyle('.fixmodal {position:fixed;background-color:rgba(0, 0, 0, 0.5);height:100%;width:100%;top:0;left:0;display:none; z-index: 1000;}');
  112. GM_addStyle('#fixPopup {padding:5px;text-align:center;}');
  113. GM_addStyle('.fixmodalWrap {margin: 50px auto; position:relative;width: fit-content;} ');
  114. var maxWidthPop = window.screen.height - 200;
  115. GM_addStyle('#fixPopup img {max-height:'+maxWidthPop+'px;}');
  116. GM_addStyle('._2f5uYHvlfzs2DngQsiCdvB {height: 50px !important;width: 100% !important; position: relative !important; bottom: 50px !important;}');
  117. GM_addStyle('.videoFixIcon {margin: 50px auto; background: url("https://www.pngall.com/white-play-png")} ');
  118. GM_addStyle('.expandDivCaption {padding: 5px!important; white-space: pre-wrap !important;max-height: max-content !important; display: inline-block !important; overflow-wrap: break-word !important;} ');
  119. GM_addStyle('.expandSpanCaption{height: auto !important; position: absolute !important; bottom: 0;} ');
  120. GM_addStyle('.expandDisableClick{pointer-events: none; } ');
  121. GM_addStyle('.expandEnableClick{pointer-events: auto; !important; } ');
  122. GM_addStyle('.expandGarbageRedditCaptions{position:relative !important; } ');
  123.  
  124.  
  125. window.addEventListener('scroll', throttle(callback, 300));
  126.  
  127. function throttle(fn, wait) {
  128. var time = Date.now();
  129. return function() {
  130. if ((time + wait - Date.now()) < 0) {
  131. fn();
  132. time = Date.now();
  133. }
  134. }
  135. }
  136.  
  137. function getMenuItem(id, display)
  138. {
  139. return '<a class="M2Hk_S2yvXpsNPfZMBMur customRedditFixMenu" id = "'+id+'" ><div class="_1lwNBHmCQJObvqs1fXKSYR" style="margin-right: 0px;">'+display+'</div></a>';
  140. }
  141.  
  142. function getCheckBoxItem(checked, id, display){
  143.  
  144. if (checked == 'true' || checked == true)
  145. return ' <span style="width: 100%;"><input type="checkbox" checked id="'+ id +'" name="'+display+'" /> ' + display + '</span>';
  146. else
  147. return '<span style="width: 100%;"><input type="checkbox" id="'+ id +'" name="'+display+'" /> ' + display + '</span>';
  148. }
  149.  
  150. function RemoveMenu(){
  151. $("#redditFixReloadAll").remove();
  152. $("#redditFixReload25").remove();
  153. }
  154. function AddMenu(){
  155. var menu = $("._2pUO1Sfe7WlIHvq6goN3Pz");
  156. if (menu.find(".customRedditFixMenu").length > 0 )
  157. return;
  158. menu.append(getMenuItem('redditFixReloadAll', 'Reload All'));
  159. $("#redditFixReloadAll").click(function(){
  160. for (var i = topicsInMemory.length - 1; i >= 0; --i) {
  161. var el = topicsInMemory.pop(i);
  162. $(".rpBJOHq2PR60pnwJlUyP0").prepend(el);
  163. }
  164. maxOffset = $(document).height();
  165. });
  166. menu.append(getMenuItem('redditFixReload25', 'Reload 25'));
  167. $("#redditFixReload25").click(function(){
  168. var reloadTill = topicsInMemory.length;
  169. if (reloadTill > 25)
  170. reloadTill = 25;
  171. for (var i = 0; i < 25; ++i) {
  172. var el = topicsInMemory.pop(i);
  173. $(".rpBJOHq2PR60pnwJlUyP0").prepend(el);
  174. }
  175. maxOffset = $(document).height();
  176. });
  177. }
  178.  
  179. function attachCustomFeed(){
  180. let isReady = $('[aria-controls="multireddits_section"]').length > 0;
  181. if (!isReady) {
  182. setTimeout(attachCustomFeed, 300);
  183. return;
  184. }
  185.  
  186. let customFeed = $('[aria-controls="multireddits_section"]').closest("faceplate-expandable-section-helper");
  187. customFeed.bind("click",function(){
  188. if ($(this).is("[open]"))
  189. {
  190. customFeedState = "open";
  191. localStorage.setItem("customFeedState", "open");
  192. }
  193. else{
  194. localStorage.setItem("customFeedState", "");
  195. customFeedState = "";
  196. }
  197. });
  198. if (customFeedState == "")
  199. customFeed.removeAttr("open");
  200. }
  201.  
  202. function attachObserver(){
  203. let isReady = $(".subgrid-container").length > 0;
  204. if (!isReady || $(".observerIsAttached").length == 1 ) {
  205. setTimeout(attachObserver, 300);
  206. return;
  207. }
  208. HideAllSubs();
  209. $(".subgrid-container").addClass("observerIsAttached");
  210. var config = { attributes: false, childList: true, subtree: true };
  211. var targetNodeRoot = $(".subgrid-container").first().get(0);
  212. var configRoot = { attributes: false, childList: true, subtree: true };
  213.  
  214. var callbackRoot = function(mutationsList, observer) {
  215. for(var mutation of mutationsList) {
  216. mutation.addedNodes.forEach(function(node) {
  217.  
  218. if ($(node).find("article.w-full")){
  219. HideAllSubs();
  220. }
  221. // Not needed anymore, it's not virtualized by reddit so dom fixed
  222.  
  223. // var currentTime = new Date().getTime();
  224. // var time = currentTime - lastTopicRemovedTime;
  225. // if ($(node).find("article.w-full")){
  226. // if ($("article.w-full").length > topicLimitInDom){
  227. // let newHeight = $(window).scrollTop();
  228. // $("article.w-full").slice(0,49).each(function(){
  229. // var currElHeight = 0;
  230. // if ($(this).attr("style") != ""){
  231. // var el = $(this);
  232. // if (holdTopicsInMemory)
  233. // topicsInMemory.push(el);
  234. // currElHeight = el.height();
  235.  
  236. // if(el.find(".promotedlink")){
  237. // }
  238. // else{
  239. // if (currElHeight == 0){
  240. // currElHeight = currElHeight + 500;
  241. // }
  242. // }
  243. // console.log("removed:" + el);
  244. // el.remove();
  245. // newHeight = newHeight - currElHeight;
  246. // currElHeight = 0;
  247. // }
  248. // lastTopicRemovedTime = new Date().getTime();
  249. // scrollTopWhenREmoved = lastScrollTop+10000;
  250. // });
  251. // $(window).scrollTop(newHeight);
  252. // }
  253. // }
  254. });
  255. }
  256. };
  257.  
  258.  
  259. var observerroot = new MutationObserver(callbackRoot);
  260. observerroot.observe(targetNodeRoot, config);
  261. }
  262.  
  263. function fadeOutThePicture(){
  264. $(".fixmodal").fadeOut("fast");
  265. document.removeEventListener("click", fadeOutThePicture);
  266. }
  267.  
  268. function doSomething() {
  269. attachObserver();
  270. }
  271.  
  272. let currentUrl = location.href;
  273.  
  274. setInterval(() => {
  275. if (location.href !== currentUrl) {
  276. currentUrl = location.href;
  277. doSomething();
  278. }
  279. }, 500);
  280.  
  281. $(document).on("mousedown", "._15nNdGlBIgryHV04IfAfpA", function(e) {
  282.  
  283. $(this).parent().toggleClass( "expandSpanCaption" );
  284. $(this).toggleClass( "expandDivCaption" );
  285.  
  286. if ($(".DraftEditor-root").length > 0){
  287. $(this).parent().toggleClass("expandGarbageRedditCaptions");
  288. }
  289.  
  290. //If anyone ever find how to stop this fucking propagation send me a dm like fuck none of this shit work on this element...
  291. e.stopPropagation();
  292. e.preventDefault();
  293. e.cancelBubble = true;
  294. e.stopImmediatePropagation();
  295. return false
  296. });
  297. var control = false;
  298. $("img").on('keyup keydown', function(e) {
  299. control = e.ctrlKey;
  300. });
  301.  
  302. $('img').on('click', function() {
  303. if (control) {
  304. e.stopPropagation();
  305. e.preventDefault();
  306. e.cancelBubble = true;
  307. e.stopImmediatePropagation();
  308. return false
  309. }
  310. });
  311.  
  312.  
  313.  
  314. $(document).on("mousedown", "._3b8u2OJXaSDdBWoRB7zUoK,._3hUbl08LBz2mbXjy0iYhOS,._2f5uYHvlfzs2DngQsiCdvB", function(e) {
  315.  
  316. $(".fixmodal").fadeIn("fast");
  317. $("#fixPopup img").remove();
  318. $("#fixPopup iframe").remove();
  319. var closestIframe = $(this).parent().find("iframe");
  320. if (closestIframe.length > 0){
  321. var clonedIframe = closestIframe.clone()
  322. clonedIframe.appendTo("#fixPopup");
  323. clonedIframe.css({'width': '800px', 'max-height':maxWidthPop + 'px'});
  324. }
  325. else{
  326. var imgSrc = $(this).parent().find("img").attr("src");
  327. $('<img src="'+imgSrc+'" alt="image3" />').appendTo("#fixPopup");
  328. }
  329.  
  330. setTimeout(() => {document.addEventListener("click", fadeOutThePicture);}, 100);
  331. e.stopPropagation();
  332. e.preventDefault();
  333. e.cancelBubble = true;
  334. e.stopImmediatePropagation();
  335. return false
  336. });
  337. attachObserver();
  338. attachCustomFeed();
  339.  
  340. function callback() {
  341. if (originalBehavior == "true")
  342. return;
  343. if (holdTopicsInMemory == "true")
  344. AddMenu();
  345. var st = $(document).scrollTop();
  346. if (st > maxOffset)
  347. {
  348. lastScrollTop = st;
  349. maxOffset = 0;
  350. }
  351. }
  352. $("body").append('<div class="fixmodal"> <div class="fixmodalWrap"><div id="fixPopup"></div> </div></div>');
  353.  
  354. //#####Custom menu for unbluring
  355. GM_addStyle(`
  356. .container__menu {
  357. /* Absolute position */
  358. position: absolute;
  359.  
  360. /* Reset */
  361. list-style: none;
  362. margin: 0;
  363. padding: 0;
  364. display: none;
  365.  
  366. /* Misc */
  367. border: 1px solid #cbd5e0;
  368. border-radius: 0.25rem;
  369. background-color: #f7fafc;
  370. }
  371. `);
  372.  
  373.  
  374. GM_addStyle(`
  375. .open {
  376. display: block;
  377. z-index: 9999;
  378. }
  379. `);
  380.  
  381. GM_addStyle(`
  382. .container__item {
  383. padding: 0.5rem 1rem;
  384. white-space: nowrap;
  385. cursor: pointer;
  386. color: black;
  387. }
  388. `);
  389.  
  390. GM_addStyle(`
  391. .container__item:hover {
  392. background-color: #bee3f8;
  393. }
  394. `);
  395.  
  396. GM_addStyle(`
  397. .container__divider {
  398. border-bottom: 1px solid #cbd5e0;
  399. height: 1px;
  400. }
  401. `);
  402. $("body").append(`
  403. <ul id="redditfixShowImage" class="container__menu">
  404. <li class="container__item">Show Image</li>
  405. </ul>
  406. `);
  407.  
  408. var cntxtMn = $("#redditfixShowImage");
  409. var mouseX;
  410. var mouseY;
  411. var currentTarget = null;
  412.  
  413. $(document).mousemove(function(e) {
  414. mouseX = e.pageX;
  415. mouseY = e.pageY;
  416. });
  417. $(document).on("mousedown", function(e){
  418. if ($(event.target).is('img')){
  419.  
  420. $(this).on('contextmenu', displayContextMenu)
  421. function displayContextMenu(e) {
  422. (cntxtMn.hasClass("open")) ? cntxtMn.removeClass("open") : false;
  423.  
  424. if ($(e.target).attr("src").toUpperCase().indexOf("BLUR=") >=0)
  425. {
  426. cntxtMn.css({'top':mouseY,'left':mouseX}).addClass("open");
  427. e.preventDefault();
  428. currentTarget = e.target;
  429. return;
  430. }
  431.  
  432. }
  433. cntxtMn.click(function(e) {
  434. e.stopPropagation();
  435. });
  436.  
  437. $(document).click(function() {
  438. (cntxtMn.hasClass("open")) ? cntxtMn.removeClass("open") : false;
  439. });
  440.  
  441. $(".container__item").click(function(){
  442. var src = $(currentTarget).attr('src');
  443. var myRegexp = /^.*\/(.*)\.?(.*)?\?/g;
  444. var match = myRegexp.exec(src);
  445. if (src.toUpperCase().indexOf("EXTERNAL") >= 0){
  446.  
  447. var closestOutBound = $(currentTarget).parents(".STit0dLageRsa2yR4te_b").parent().find(".styled-outbound-link");
  448. $(currentTarget).attr("src",closestOutBound.attr("href"));
  449. }
  450. else{
  451. $(currentTarget).attr("src","https://i.redd.it/" + match[1]);
  452. }
  453. $(currentTarget).attr("style","filter:none; width: auto; height: 100%;");
  454. cntxtMn.removeClass("open");
  455. });
  456. }
  457. });
  458.  
  459.  
  460.  
  461.  
  462.  
  463. function AddTheMenu(){
  464. var menuButton = `
  465. <div class="Layout-sc-nxg1ff-0 jA-dUUY"><div class="Layout-sc-nxg1ff-0 dDnLci">
  466. <div class="Layout-sc-nxg1ff-0 bYXYej">
  467. <div class="InjectLayout-sc-588ddc-0 iETGeJ">
  468. <button class="ScCoreButton-sc-1qn4ixc-0 enhanceButton jGqsfG ScButtonIcon-sc-o7ndmn-0 fNzXyu" style="
  469. background: url(https://i.imgur.com/kWu713g.png);
  470. background-size: 22px;
  471. z-index:999;
  472. background-repeat: no-repeat;
  473. background-position: center; width: 25px;
  474. height: 25px; top: 60px; right: 60px; position:fixed;" ></button>
  475. </div>
  476. </div>
  477. <div aria-label="Whispers" role="button" data-click-out-id="threads-box" data-a-target="threads-box-closed" class="Layout-sc-nxg1ff-0 emWtQg InjectLayout-sc-588ddc-0 kgrtoC whispers-threads-box__container"></div></div></div>
  478.  
  479. `;
  480.  
  481. var enhanceSettings = `
  482. <div class="enhancecontainer" style="display:none;">
  483.  
  484. </div>
  485. `;
  486.  
  487.  
  488.  
  489.  
  490. $("body").append(enhanceSettings);
  491. $(".enhancecontainer").append('<div class="tw-border-t tw-mg-t-1 tw-mg-x-05 tw-pd-b-1 customEnhanceMenu"" ></div><div class="tw-mg-y-05 tw-pd-x-05" style="width: 100%;"><p class="tw-c-text-alt-2 tw-font-size-6 tw-strong tw-upcase" style="color: var(--color-text-alt-2)!important; font-size: var(--font-size-6)!important; font-weight: 600!important; text-transform: uppercase!important;">Reddit enhance</p></div>');
  492.  
  493.  
  494. $(".enhancecontainer").append(getCheckBoxItem(commentEffects, "redditFixCheckBoxBackground", "Remove comment effects"));
  495. $("#redditFixCheckBoxBackground").click(function(){
  496. var btnBackgroundsChecked = $(this);
  497. if (btnBackgroundsChecked.prop('checked')){
  498. btnBackgroundsChecked.removeClass("_1L5kUnhRYhUJ4TkMbOTKkI");
  499. localStorage.setItem("commentEffects", false);
  500. commentEffects = "false";
  501. }
  502. else{
  503. btnBackgroundsChecked.addClass("_1L5kUnhRYhUJ4TkMbOTKkI");
  504. localStorage.setItem("commentEffects", true);
  505. commentEffects = "true";
  506. }
  507. });
  508.  
  509. $(".enhancecontainer").append(getCheckBoxItem(holdTopicsInMemory, "fixRedditKeepTopicsInMemory", "Save topics in ram"));
  510. $("#fixRedditKeepTopicsInMemory").click(function(){
  511. var btnTopicsChecked = $(this);
  512. if (btnTopicsChecked.prop('checked')){
  513. localStorage.setItem("holdTopicsInMemory", true);
  514. holdTopicsInMemory = "true";
  515. AddMenu();
  516. }
  517. else{
  518. localStorage.setItem("holdTopicsInMemory", false);
  519. holdTopicsInMemory = "false";
  520. RemoveMenu();
  521. }
  522. });
  523. $(".enhancecontainer").append(getCheckBoxItem(originalBehavior, "fixRedditoriginalBehavior", "Original behavior"));
  524. $("#fixRedditoriginalBehavior").click(function(){
  525. var btnTopicsChecked = $(this);
  526. if (btnTopicsChecked.prop('checked')){
  527. localStorage.setItem("originalBehavior", true);
  528. originalBehavior = "true";
  529. }
  530. else{
  531. btnTopicsChecked.addClass("_1L5kUnhRYhUJ4TkMbOTKkI");
  532. localStorage.setItem("originalBehavior", false);
  533. originalBehavior = "false";
  534. }
  535. });
  536.  
  537. $(".enhancecontainer").append(getCheckBoxItem(hidePromotedlinks, "fixhidePromotedlinks", "Hide promoted links"));
  538. $("#fixhidePromotedlinks").click(function(){
  539. var btnTopicsChecked = $(this);
  540. if (btnTopicsChecked.prop('checked')){
  541. localStorage.setItem("hidePromotedlinks", true);
  542. fRemovePromoted(true);
  543. hidePromotedlinks = "true";
  544. }
  545. else{
  546. btnTopicsChecked.addClass("_1L5kUnhRYhUJ4TkMbOTKkI");
  547. localStorage.setItem("hidePromotedlinks", false);
  548. fRemovePromoted(false);
  549. hidePromotedlinks = "false";
  550. }
  551. });
  552.  
  553. $(".enhancecontainer").append(getCheckBoxItem(removeBorderRadius, "fixremoveBorderRadius", "Remove border radius"));
  554. $("#fixremoveBorderRadius").click(function(){
  555. var btnTopicsChecked = $(this);
  556. if (btnTopicsChecked.prop('checked')){
  557. localStorage.setItem("removeBorderRadius", true);
  558. fRemoveBorderRadius(true);
  559. removeBorderRadius = "true";
  560. }
  561. else{
  562. btnTopicsChecked.addClass("_1L5kUnhRYhUJ4TkMbOTKkI");
  563. localStorage.setItem("removeBorderRadius", false);
  564. fRemoveBorderRadius(false);
  565. removeBorderRadius = "false";
  566. }
  567. });
  568.  
  569.  
  570. $(".enhancecontainer").append(getCheckBoxItem(hideRecentSection, "fixHideRecentSection", "Hide recent section"));
  571. $("#fixHideRecentSection").click(function(){
  572. var btnTopicsChecked = $(this);
  573. if (btnTopicsChecked.prop('checked')){
  574. localStorage.setItem("hideRecentSection", true);
  575. fHideRecentSection(true);
  576. }
  577. else{
  578. localStorage.setItem("hideRecentSection", false);
  579. fHideRecentSection(false);
  580. }
  581. });
  582.  
  583.  
  584. $(".enhancecontainer").append('<span style="margin-top: 10px;">Hide subreddit from appearing in feed. If you remove subs you have to restart. If you add just click save, no need to restart.</span>');
  585. $(".enhancecontainer").append(`
  586. <textarea id="fixHideSubreddits" name="fixHideSubreddits" rows="3" cols="40" style = "flex:1">`+subsToHide+`</textarea>
  587. `);
  588.  
  589. $(".enhancecontainer").append(" <button type='button' id='fixSaveSubredditsHidden' style = 'background:darkgreen; flex: 2'>Save</button> ");
  590.  
  591. $(".enhancecontainer").append(`<div class="tw-border-t tw-mg-t-1 tw-mg-x-05 tw-pd-b-1 customEnhanceMenu"" ></div><div class="tw-mg-y-05 tw-pd-x-05" style="width: 100%;"><p class="tw-c-text-alt-2 tw-font-size-6 tw-strong tw-upcase"
  592.  
  593. style="color: var(--color-text-alt-2)!important;
  594. font-size: smaller;line-height: 1.4;
  595. margin-top: 6px;">Any subreddit containing this word will be hidden from your feed. This is Case Sensitive. Write the exact subreddit name if you only target that subreddit. Use ; to separate keywords. Example: funny;tiktok;celebrity</p></div>`);
  596.  
  597. $("body").append(menuButton);
  598.  
  599. $(".enhanceButton").click(function(){
  600. $(".enhancecontainer").toggle();
  601. });
  602.  
  603. $("#fixSaveSubredditsHidden").click(function(){
  604. subsToHide = $("#fixHideSubreddits").val();
  605. localStorage.setItem("subsToHide", subsToHide);
  606. HideAllSubs();
  607. });
  608. //rgba(25, 25, 25, 0.75);
  609.  
  610.  
  611.  
  612.  
  613. }
  614.  
  615. function fRemovePromoted(hide){
  616. if (hide == "true" || hide == true)
  617. GM_addStyle('.promotedlink{display: none !important;}');
  618. else
  619. RemoveCssRule('.promotedlink');
  620. }
  621.  
  622. function fHideRecentSection(hide){
  623. if (hide == "true" || hide == true)
  624. GM_addStyle('reddit-recent-pages{display: none !important;}');
  625. else
  626. RemoveCssRule('reddit-recent-pages');
  627. }
  628.  
  629. function fRemoveBorderRadius(remove){
  630. if (remove == "true" || remove == true)
  631. GM_addStyle('*:not(.shreddit-subreddit-icon__icon){border-radius: 0 !important;}');
  632. else
  633. RemoveCssRule(':not(.shreddit-subreddit-icon__icon)');
  634. }
  635. function HideAllSubs(){
  636.  
  637. var subsToHideArray = subsToHide.split(";");
  638. let i = 0;
  639. while (i < subsToHideArray.length) {
  640. let tobeRemoved = $("a[href*='"+ subsToHideArray[i] + "']").closest("article");
  641. $(tobeRemoved).closest("hr").remove();
  642. $(tobeRemoved).remove();
  643. i++;
  644. }
  645. // alert( );
  646. }
  647.  
  648. AddTheMenu();
  649. GM_addStyle('.enhanceButton:hover{ background-color:var(--color-background-button-text-hover) !important;}');
  650. GM_addStyle(`
  651. .enhancecontainer {
  652. display: flex;
  653. flex-wrap: wrap;
  654. justify-content: center;
  655. background: #393939;
  656. padding: 10px;
  657. width: 200px;
  658. position: fixed;
  659. right: 100px;
  660. z-index: 100;
  661. margin-top: 66px;
  662. width: 500px;
  663. height: auto;
  664. top: 0;
  665. }
  666. `);
  667.  
  668. GM_addStyle(`
  669. input.enhancCheck[type=checkbox] + label {
  670. display: block;
  671. cursor: pointer;
  672. height: fit-content;
  673. flex: 1 0 35%;
  674. margin-top: 5px;
  675. }
  676. `);
  677. GM_addStyle(`
  678. input.enhancCheck[type=checkbox] {
  679. display: none;
  680. }`);
  681. GM_addStyle(`
  682. ._1L5kUnhRYhUJ4TkMbOTKkI{
  683. background: green !important;
  684. }
  685.  
  686. `)
  687.  
  688. GM_addStyle(`
  689. #redditFixCheckBoxBackground,#fixRedditKeepTopicsInMemory,#fixRedditoriginalBehavior{
  690. background: red;
  691. }
  692.  
  693. `)
  694. GM_addStyle(` input.enhancCheck[type=checkbox] + label:before {
  695. content: "\\2714";
  696. border: 0.1em solid #fff;
  697. border-radius: 0.2em;
  698. display: inline-block;
  699. width: 1em;
  700. height: 1em;
  701. padding-left: 0.2em;
  702. padding-bottom: 0.3em;
  703. margin-right: 0.2em;
  704. vertical-align: bottom;
  705. color: transparent;
  706. }`);
  707. GM_addStyle(`input.enhancCheck[type=checkbox]:checked + label:before {
  708. background-color: #ED820A;
  709. border-color:white;
  710. color: #fff;
  711. }`);
  712. })();
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址