优化 deepseek.com 界面

隐藏 deepseek.com 的水印,点击脚本菜单控制左侧边栏的显示与隐藏

  1. // ==UserScript==
  2. // @name Optimize the deepseek.com interface
  3. // @name:en Optimize the deepseek.com interface
  4. // @name:zh-CN 优化 deepseek.com 界面
  5. // @name:zh-TW 优化 deepseek.com 界面
  6. // @namespace deepseek.com
  7. // @version 0.2.2
  8. // @description Hide deepseek.com Watermark, click menu controls the display and hiding of the left sidebar
  9. // @description:en Hide deepseek.com Watermark, click menu controls the display and hiding of the left sidebar
  10. // @description:zh-CN 隐藏 deepseek.com 的水印,点击脚本菜单控制左侧边栏的显示与隐藏
  11. // @description:zh-TW 隐藏 deepseek.com 的水印,点击脚本菜单控制左侧边栏的显示与隐藏
  12. // @author xxnuo
  13. // @match https://chat.deepseek.com/*
  14. // @grant GM_registerMenuCommand
  15. // @grant GM_setValue
  16. // @grant GM_getValue
  17. // @license MIT
  18. // ==/UserScript==
  19.  
  20. (function() {
  21. 'use strict';
  22.  
  23. // 隐藏侧边栏函数
  24. function hideSidebar() {
  25. GM_setValue('isHideSidebar', '1');
  26. var sidebar = document.querySelector('#root > div:first-child > div:first-child');
  27. if (sidebar) {
  28. sidebar.style.display = 'none';
  29. }
  30. }
  31.  
  32. // 显示侧边栏函数
  33. function showSidebar() {
  34. GM_setValue('isHideSidebar', '0');
  35. var sidebar = document.querySelector('#root > div:first-child > div:first-child');
  36. if (sidebar) {
  37. sidebar.style.display = 'block';
  38. }
  39. }
  40.  
  41. // 注册隐藏侧边栏的菜单项
  42. GM_registerMenuCommand('Hide Sidebar', hideSidebar, 'H');
  43.  
  44. // 注册显示侧边栏的菜单项
  45. GM_registerMenuCommand('Show Sidebar', showSidebar, 'S');
  46.  
  47. // 等待DOM加载完成
  48. window.addEventListener('load', function() {
  49. if (GM_getValue('isHideSidebar') === '1') {
  50. hideSidebar();
  51. }
  52. // 获取所有具有指定类名的元素
  53. var elements = document.querySelectorAll('.ds-watermark.ds-watermark--fullscreen');
  54.  
  55. // 遍历元素并隐藏它们
  56. for (var i = 0; i < elements.length; i++) {
  57. elements[i].style.display = 'none';
  58. }
  59. });
  60. })();