Toggle ChatGPT Sidebar with Ctrl+S

Toggle the sidebar in ChatGPT using Ctrl + S

当前为 2025-03-12 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Toggle ChatGPT Sidebar with Ctrl+S
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @description Toggle the sidebar in ChatGPT using Ctrl + S
  6. // @author Drewby123
  7. // @match https://chatgpt.com/*
  8. // @grant none
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12. (function () {
  13. 'use strict';
  14.  
  15. // Listen for Ctrl + S
  16. document.addEventListener('keydown', function (e) {
  17. if (e.ctrlKey && e.key.toLowerCase() === 's') {
  18. e.preventDefault();
  19.  
  20. // Try to find the sidebar toggle button
  21. const button = document.querySelector('button[aria-label="Open sidebar"], button[aria-label="Close sidebar"]');
  22. if (button) {
  23. button.click();
  24. } else {
  25. console.warn('Sidebar toggle button not found');
  26. }
  27. }
  28. });
  29. })();