LibReddit Dark Theme & LibReddit Settings Changer

Change the default Libreddit theme to Black, and set other preferences more convenient than on Reddit

  1. // ==UserScript==
  2. // @name LibReddit Dark Theme & LibReddit Settings Changer
  3. // @namespace https://violentmonkey.github.io/
  4. // @version 1.9
  5. // @description Change the default Libreddit theme to Black, and set other preferences more convenient than on Reddit
  6. // @author Streampunk
  7. // @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALQAAAC0CAMAAAAKE/YAAAAA5FBMVEUfHx////8B//8jHSM7Ozvp6ekiIiIALzAfHyEaGhohHiFhYWGcnJwMpKUd9fUL//4fIB0V9/Q41M0ATEQFKCN0dHQTJSUlmZukpKQcIR8f1dUCSEkWIiIHJyUfIBsAUlAyv78j7vUALDInlp4fICccIx8AMiwmHCEf1NcDR0sYICQjHxkhIRUpHBcfIxtCQkIAIS8yMjInaWkzfIgMOkYZLTI56+od6/VLys0QqqQA9/4Nppki9ekJ//YW4OVBuLQNSVIKJTIkJC8ASVQogX88ur9Kn5sQIx8APDwAQUELHyTLy8tHGpacAAADIUlEQVR4nO3cf1PaMBzH8Qw0pJmWgFqptHUixVJ/zjmnbk4252Ts+T+fJVh3gEJpNbT1Pu9/vOtx+rrvRdpyDYQghBBCCCGEEEIIIYTQXDFZ1obE5QItRLLX54Cs0I5jzV0YhgswGfTZ5PFHtG21WpWWrCKLfkyrdXISEkZsW6uZko8rjedaaWw8mIV1uru5+9jm7HY/nX22GddKVujj5XfP13gwk9bq+c6XnShzducXTdfhZa6XPQe6clkrXalK8Zn17fVQorWaJXppGnpl+ALb73z9dl2dAxyh3bDNdK9pGoP27xX6OhlaK3ketDOc9MioqzOqSTRjfG8vW7SdDL217RoKrXVVx6EZ8TuXtbElHTtpwsplneZYtHzzqqya8/4flszhpDNGc/nnE6MJKRi6XkR0kA80S45mms+JQAMN9NtFc60Xeq+NlmdEoU7+hUPbRPNdoga04RcMra6n1X1lrtGTN7tmfc1lwtN9N54aXa2a378HQbA1WnDTHHDh5XbS8tbqtNfrNkfrdnuDNhdRuUQHvR8/Q2e0MAzb8rySX3TJvLiVaHs8om4rhedpJL9o0mZwOyg/TjXK8zz1W/f384tuupM27+BAHTk81Eh+2fLY2l73JtAi7+hafW39ySLQuix0oRcS0EADDTTQQAMNNNBAAw000EADDTTQQAMNNNBAAw000EADDXRyNAca6CloUkg0LyKacLXh7OnOsqsr8zyvaOF5xP11d3f3YSJ55OZ35z6vaGF1+v2zPxN1z/r9/r2/kGdSEqKHT1JRyxoMrIE7ltqaKs16nwpLix6qKTVYKBt9kI1zQQQxcjjp4fo48o6OPNZut9lIttq2zDPabR2LFpIsU+j/akrVNkn1PHo26tjlIUft+77NImLEpI4jD+jeAJweLYRaxRMzjdDZvHnMQjeMNBGDjO0/XzD670aa6Pju+UWjU7W8lO2k06GPSREnTYEG+o2htTCBBhpooIEGGmiggQY6BVrPNfQYevoXoqVDHxv60Ybx+h8h6I/S968aXQSa0FSffs34VAwhhBBCCCGEEEIIIYQQKkT/AMjqwT28TZzjAAAAAElFTkSuQmCC
  8. // @match https://redlib.freedit.eu/*
  9. // @match https://discuss.whatever.social/*
  10. // @match https://l.opnxng.com/*
  11. // @match https://libreddit.bus-hit.me/*
  12. // @match https://libreddit.kylrth.com/*
  13. // @match https://libreddit.lunar.icu/*
  14. // @match https://libreddit.northboot.xyz/*
  15. // @match https://libreddit.oxymagnesium.com/*
  16. // @match https://libreddit.privacydev.net/*
  17. // @match https://libreddit.projectsegfau.lt/*
  18. // @match https://libreddit.pussthecat.org/*
  19. // @match https://libreddit.strongthany.cc/*
  20. // @match https://libreddit.tux.pizza/*
  21. // @match https://libreddit.miaoute.net/*
  22. // @match https://lr.artemislena.eu/*
  23. // @match https://lr.n8pjl.ca/*
  24. // @match https://lr.ggtyler.dev/*
  25. // @match https://reddit.invak.id/*
  26. // @match https://reddit.simo.sh/*
  27. // @match https://reddit.owo.si/*
  28. // @match https://reddit.nerdvpn.de/*
  29. // @match https://reddit.idevicehacked.com/*
  30. // @match https://safereddit.com/*
  31. // @match https://snoo.habedieeh.re/*
  32. // @match https://redlib.catsarch.com/*
  33. // @match https://redlib.ducks.party/*
  34. // @match https://redlib.seasi.dev/*
  35. // @match https://redlib.tux.pizza/*
  36. // @match https://redlib.vimmer.dev/*
  37. // @match https://redlib.xn--hackerhhle-kcb.org/*
  38. // @match https://redlib.privacyredirect.com/*
  39. // @match https://redlib.kittywi.re/*
  40. // @match https://redlib.baczek.me/*
  41. // @match https://redlib.frontendfriendly.xyz/*
  42. // @match https://redlib.incogniweb.net/*
  43. // @match https://redlib.nirn.quest/*
  44. // @match https://redlib.nohost.network/*
  45. // @match https://redlib.privacy.com.de/*
  46. // @match https://redlib.private.coffee/*
  47. // @match https://red.artemislena.eu/*
  48. // @match https://red.ngn.tf/*
  49. // @match https://red.arancia.click/*
  50. // @match https://rl.bloat.cat/*
  51. // @match https://rl.rootdo.com/*
  52. // @match https://r.darrennathanael.com/*
  53. // @match https://redlib.nadeko.net/*
  54. // @match https://redlib.pussthecat.org/*
  55. // @match https://i.opnxng.com/*
  56. // @match https://td.vern.cc/*
  57. // @match https://teddit.laserdisc.tokyo/*
  58. // @match https://teddit.projectsegfau.lt/*
  59. // @match https://teddit.pussthecat.org/*
  60. // @run-at document-start
  61. // @grant none
  62. // @license MIT
  63. // ==/UserScript==
  64.  
  65. // Set a preference of your choice among the available options. Settings will be saved in browser cookies.
  66. // Theme: black, dark, doomone, dracula, gold, gruvboxdark, gruvboxlight, laserwave, light, nord, rosebox, tokyoNight, violet
  67. var theme = 'black';
  68.  
  69. // Remove default feeds: on, off
  70. var remove_default_feeds = 'off';
  71.  
  72. // Front page: default, popular, all
  73. var front_page = 'default';
  74.  
  75. // Layout: card, clean, compact
  76. var layout = 'card';
  77.  
  78. // Wide UI: on, off
  79. var wide = 'off';
  80.  
  81. // Video quality: best, medium, worst
  82. var video_quality = 'best';
  83.  
  84. // Default subreddit post sort: hot, new, top, rising, controversial
  85. var post_sort = 'hot';
  86.  
  87. // Default comment sort: confidence, top, new, controversial, old
  88. var comment_sort = 'confidence';
  89.  
  90. // Blur spoiler previews: on, off
  91. var blur_spoiler = 'off';
  92.  
  93. // Show NSFW posts: on, off
  94. var show_nsfw = 'on';
  95.  
  96. // Blur NSFW previews: on, off
  97. var blur_nsfw = 'off';
  98.  
  99. // Autoplay videos: on, off
  100. var autoplay_videos = 'off';
  101.  
  102. // Use HLS for videos: on, off
  103. // Reddit videos require JavaScript (via HLS.js) to be enabled to be played with audio. Therefore, this toggle lets you either use Libreddit JS-free or utilize this feature.
  104. var use_hls = 'on';
  105.  
  106. // Hide notification about possible HLS usage: on, off
  107. var hide_hls_notification = 'on';
  108.  
  109. // Hide awards: on, off
  110. var hide_awards = 'on';
  111.  
  112. // Keep navbar fixed: on, off
  113. var fixed_navbar = 'off';
  114.  
  115. // Hide the summary and sidebar: on, off
  116. var hide_sidebar_and_summary = 'off';
  117.  
  118. // Hide score: on, off
  119. var hide_score = 'off';
  120.  
  121. // Do not confirm before visiting content on Reddit: on, off
  122. var disable_visit_reddit_confirmation = 'on';
  123.  
  124. // Subscriptions: ?
  125. var subscriptions = '';
  126.  
  127. // Filters: ?
  128. var filters = '';
  129.  
  130. // Set the value of custom settings as activated, so that the script works properly
  131. var user_settings = 'activated';
  132.  
  133. // A Function to Set a Cookie
  134. function setCookie(cName, cValue) {
  135. const domain = "domain=" + window.location.hostname;
  136. document.cookie = cName + "=" + cValue + ";" + domain + ";";
  137. }
  138.  
  139. // A Function to Get a Cookie
  140. function getCookie(cName) {
  141. let Name = cName + "=";
  142. let ca = document.cookie.split(';');
  143. for(let i = 0; i < ca.length; i++) {
  144. let c = ca[i];
  145. while (c.charAt(0) == ' ') {
  146. c = c.substring(1);
  147. }
  148. if (c.indexOf(Name) == 0) {
  149. return c.substring(Name.length, c.length);
  150. }
  151. }
  152. return "";
  153. }
  154.  
  155. // A Function that Checks if a Cookie is set
  156. function checkCookie() {
  157. let user = getCookie("user_settings");
  158. if (user != "") {
  159. // Remember to open the console (Press F12)
  160. console.error("Сookies with custom user settings are set!");
  161. } else {
  162. // Apply setCookie
  163. setCookie('theme', theme);
  164. setCookie('remove_default_feeds', remove_default_feeds);
  165. setCookie('theme', theme);
  166. setCookie('front_page', front_page);
  167. setCookie('layout', layout);
  168. setCookie('wide', wide);
  169. setCookie('video_quality', video_quality);
  170. setCookie('post_sort', post_sort);
  171. setCookie('comment_sort', comment_sort);
  172. setCookie('blur_spoiler', blur_spoiler);
  173. setCookie('show_nsfw', show_nsfw);
  174. setCookie('blur_nsfw', blur_nsfw);
  175. setCookie('autoplay_videos', autoplay_videos);
  176. setCookie('use_hls', use_hls);
  177. setCookie('hide_hls_notification', hide_hls_notification);
  178. setCookie('hide_awards', hide_awards);
  179. setCookie('fixed_navbar', fixed_navbar);
  180. setCookie('hide_sidebar_and_summary', hide_sidebar_and_summary);
  181. setCookie('hide_score', hide_score);
  182. setCookie('disable_visit_reddit_confirmation', disable_visit_reddit_confirmation);
  183. setCookie('subscriptions', subscriptions);
  184. setCookie('filters', filters);
  185. setCookie('user_settings', user_settings);
  186. location.reload();
  187. }
  188. }
  189.  
  190. // Check if Сookies are set and if not, set a Сookie with custom user settings
  191. checkCookie();