Hide ChatGPT Sidebar

Hide the sidebar of the ChatGPT website

  1. // ==UserScript==
  2. // @name Hide ChatGPT Sidebar
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.5
  5. // @description Hide the sidebar of the ChatGPT website
  6. // @author You
  7. // @match https://chat.openai.com/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=openai.com
  9. // @require https://code.jquery.com/jquery-3.6.0.min.js
  10. // @grant none
  11.  
  12. // ==/UserScript==
  13.  
  14.  
  15.  
  16. (function() {
  17. 'use strict';
  18.  
  19. const leftPadElement = '#__next > div.overflow-hidden.w-full.h-full.relative > div.flex.h-full';
  20. const leftMenu = '#__next > div.overflow-hidden.w-full.h-full.relative > div.dark';
  21.  
  22. let paddingLeft = $().css('padding-left');
  23.  
  24. function show(){
  25. $(leftMenu).show();
  26. $(leftPadElement).css('padding-left', paddingLeft);
  27. }
  28.  
  29. function hide(){
  30. $(leftMenu).hide();
  31. $(leftPadElement).css('padding-left', '0px');
  32. }
  33.  
  34. hide();
  35.  
  36. var $button = $("<button>").text("Toggle Sidebar").click(function(){
  37. if($(leftMenu).is(":visible")){
  38. hide();
  39. } else {
  40. show();
  41. }
  42. });
  43.  
  44. $button.css({
  45. position: "absolute",
  46. top: "6px",
  47. right: "20px",
  48. 'background-color': '#eeeee4',
  49. 'border': 'none',
  50. 'padding': '6px 12px',
  51. 'text-align': 'center',
  52. 'text-decoration': 'none',
  53. 'font-size': '16px',
  54. 'cursor': 'pointer',
  55. 'border-radius': '5px',
  56. 'box-shadow': '0 2px 5px rgba(0, 0, 0, 0.3)'
  57. });
  58.  
  59. // Append the button to the UI element
  60. $("body").append($button);
  61.  
  62. })();

QingJ © 2025

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