Reddit sidebar toggle

fix that shit

  1. // ==UserScript==
  2. // @name Reddit sidebar toggle
  3. // @namespace http://tampermonkey.net/
  4. // @version 1
  5. // @description fix that shit
  6. // @author You
  7. // @match https://www.reddit.com/r/*/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. let e = document.querySelectorAll(".side")[0];
  15. let con = document.querySelectorAll("div.content")[0];
  16. const conRight = window.getComputedStyle(con).marginRight;
  17. function toggle_sidebar() {
  18. if(e.style.display == 'none') {
  19. e.style.display = 'block';
  20. con.style.marginRight = conRight;
  21. }
  22. else {
  23. e.style.display = 'none';
  24. con.style.marginRight = "8px";
  25. }
  26. }
  27. let buttonToggle = document.createElement("button");
  28. buttonToggle.innerHTML = "Sidebar";
  29. buttonToggle.style = "position: fixed; bottom: 3px; right: 10px; z-index:999;"
  30. buttonToggle.onclick = toggle_sidebar;
  31. document.body.appendChild(buttonToggle);
  32. })();

QingJ © 2025

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