Reddit - cleaner look

Removes unnecessary embellishments: avatars, awards, achievements, up/down-vote arrows, online count. Hides navigation bar after scrolling. Leaving overall a much cleaner look.

  1. // ==UserScript==
  2. // @name Reddit - cleaner look
  3. // @description Removes unnecessary embellishments: avatars, awards, achievements, up/down-vote arrows, online count. Hides navigation bar after scrolling. Leaving overall a much cleaner look.
  4. // @version 0.8
  5. // @namespace oltodosel
  6. // @license MIT
  7. // @include https://*.reddit.com/*
  8. // @grant none
  9. // @run-at document-start
  10. // ==/UserScript==
  11.  
  12. function GM_addStyle(css) {
  13. document.head.insertAdjacentHTML('beforeend', '<style>' + css + '</style>');
  14. }
  15.  
  16. function cleaning() {
  17.  
  18. //GM_addStyle("#nr-ext-frame { transform: scale(0.5);}");
  19.  
  20. // Downvotes/Upvotes arrows
  21. GM_addStyle("button[aria-label='upvote'] { display: none;}");
  22. GM_addStyle("button[aria-label='downvote'] { display: none;}");
  23.  
  24. // nav-bar's:
  25. // logo
  26. GM_addStyle("a[aria-label='Home'] { visibility: hidden;}");
  27. // avatar
  28. GM_addStyle("span._3KfbpxpA8Esu_3UHTmIvfw._2OFo5eaD2V6ZcJsYBuYned { display: none; }");
  29. // coins
  30. GM_addStyle("._1t5i5bNwZeJ7FuUXZ9rM-p._1dJtiWITrnvIbQdXgYgdym { display: none; }");
  31. GM_addStyle("#COIN_PURCHASE_DROPDOWN_ID { display: none; }");
  32. // ads
  33. GM_addStyle("._2zZ-KGHbWWqrwGlHWXR90y._2I12Htze2UzJmmfnrgYJOn { display: none; }");
  34. GM_addStyle("button._3hna43Sh0DTnoV7v2NNc2r { display: none; }");
  35.  
  36.  
  37. // join button
  38. GM_addStyle("._2iuoyPiKHN3kfOoeIQalDT._10BQ7pjWbeYP63SAPNS8Ts.UEPNkU0rd1-nvbkOcBatc { display: none; }");
  39.  
  40. // FOLLOW bar
  41. GM_addStyle("._10IcBRrmressbhblq2bqiU { display: none; }");
  42.  
  43. // annoying "New Posts" blue bubble-popup on subreddits
  44. GM_addStyle("._369llFshxbL10dgfLlIApJ { display: none !important;}");
  45. // $("div[class^='_369llFshxbL10dgfLlIApJ']").hide();
  46.  
  47. // annoying "N new comments" bubble-popup
  48. GM_addStyle("._3LO_LEpMLN8-uaedpg6nl4._3JKnqeBKw2wp7eHzFXNXSe { display: none !important;}");
  49.  
  50. // Awards for Posts and Comments
  51. GM_addStyle("._3XoW0oYd5806XiOr24gGdb { display: none !important;}");
  52.  
  53. // giving Awards
  54. GM_addStyle("button.YszYBnnIoNY8pZ6UwCivd._3yh2bniLq7bYr4BaiXowdO { display: none;}");
  55. // Share
  56. GM_addStyle("button.kU8ebCMnbXfjCWfqn0WPb { display: none;}");
  57. // ...
  58. GM_addStyle("button._2pFdCpgBihIaYh9DSMWBIu._1EbinKu2t3KjaT2gR156Qp.uMPgOFYlCc5uvpa2Lbteu { display: none;}");
  59.  
  60. // online count (N people here)
  61. GM_addStyle("._1uHz4YY7qiPGVa7nGIRrUX._nvbopN4sT4l-fhb9ev1 { display: none;}");
  62. GM_addStyle("._3wvjcIArtO7kKPJabZfZ9S._1c98ixuh4QUWO9ERiFID3p { display: none;}");
  63.  
  64. // buttons: share, report, save, etc; leaving only Reply
  65. GM_addStyle("._2hr3tRWszeMRQ0u_Whs7t8 { display: none !important;}");
  66. GM_addStyle("div[id$='comment-share-menu'] { display: none !important;}");
  67. // leaving only icon for Reply
  68. GM_addStyle("button._374Hkkigy4E4srsI2WktEd { font-size: 0;}");
  69. // ...
  70. GM_addStyle("i.icon-overflow_horizontal { display: none;}");
  71.  
  72. // achievements
  73. GM_addStyle("div._15G4fCS1bzGgGK9kBOtN2t._28x1bnTjOY6zWZfooCxkKQ { display: none;}");
  74. GM_addStyle("span._3NdKulBcLHFmpKDAy9Barm._2a_XgY10KOzM0PRvywwDuY { display: none;}");
  75.  
  76. // cakeday
  77. GM_addStyle("img[data-testid='cakeday-icon'] { display: none;}");
  78.  
  79. // avatars
  80. GM_addStyle("div._2mHuuvyV9doV3zwbZPtIPG.ZvAy-PJfJmB8pzQxpz1sS { visibility: hidden;}");
  81. // // avatars for removed users
  82. GM_addStyle("div[to='/user/[deleted]/'] { visibility: hidden;}");
  83.  
  84. // scaling back < > at posts with multiple images
  85. GM_addStyle("a._1fSFPkxZ9pToLETLQT2dmc { zoom: 50%;}");
  86.  
  87.  
  88. // reducing superfluous padding in posts
  89. // only in individual posts
  90. if (window.location.href.indexOf("/comments/") != -1) {
  91. GM_addStyle('[data-testid="post-container"] { padding: 0px !important; margin-left: 6px !important;}');
  92. }
  93. GM_addStyle('div._3xX726aBn29LDbsDtzr_6E { padding-right: 4px !important;}');
  94.  
  95. // reducing superfluous padding in comments of posts
  96. GM_addStyle('div._1YCqQVO-9r-Up6QPB9H6_4 { padding: 0px !important;}');
  97. GM_addStyle('div._2M2wOqmeoPVvcSsJ6Po9-V { padding-right: 6px !important; margin: 0px !important;}');
  98. }
  99.  
  100. var wait_for_head = setInterval(function () {
  101. if (document.head) {
  102. cleaning();
  103.  
  104. clearInterval(wait_for_head);
  105. }
  106. }, 1);
  107.  
  108.  
  109. //////////////////////////////////////////////////////
  110. //////////////////////////////////////////////////////
  111. //////////////////////////////////////////////////////
  112.  
  113.  
  114. // hiding navigation bar after scrolling
  115. var nav_bar_hide_scroll_px = 10;
  116. var nav_bar_hidden = false;
  117.  
  118. var script = document.createElement('script');
  119. script.src = 'https://code.jquery.com/jquery-3.6.0.slim.min.js';
  120. script.type = 'text/javascript';
  121.  
  122. var wait_for_head2 = setInterval(function () {
  123. if (document.head) {
  124. document.head.appendChild(script);
  125.  
  126. script.onload = function(){
  127. start();
  128. };
  129.  
  130. clearInterval(wait_for_head2);
  131. }
  132. }, 50);
  133.  
  134. function start() {
  135. $(window).on('scroll', function() {
  136. var y_scroll_pos = window.pageYOffset;
  137.  
  138. if(nav_bar_hidden === false && y_scroll_pos > nav_bar_hide_scroll_px) {
  139. nav_bar_hidden = true;
  140.  
  141. $("div[class^='SubredditVars']:lt(1)").hide();
  142. $('div[id="SHORTCUT_FOCUSABLE_DIV"] > div').first().hide();
  143. $("div[class^='_1mIZHouXowafuH_S8YMnxT']").hide();
  144. $("div[class^='MSTY2ZpsdupobywLEfx9u']").hide();
  145.  
  146. } else if (nav_bar_hidden === true && y_scroll_pos < nav_bar_hide_scroll_px) {
  147. nav_bar_hidden = false;
  148.  
  149. $("div[class^='SubredditVars']:lt(1)").show();
  150. $('div[id="SHORTCUT_FOCUSABLE_DIV"] > div').first().show();
  151. $("div[class^='_1mIZHouXowafuH_S8YMnxT']").show();
  152. $("div[class^='MSTY2ZpsdupobywLEfx9u']").show();
  153. }
  154. });
  155. }