Toggle White Overlay on Top of ChatGPT Page

在 https://chatgpt.com/ 页面顶部添加一个可切换的白色背景覆盖层,鼠标移入时显示,移开时隐藏

  1. // ==UserScript==
  2. // @name Toggle White Overlay on Top of ChatGPT Page
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description 在 https://chatgpt.com/ 页面顶部添加一个可切换的白色背景覆盖层,鼠标移入时显示,移开时隐藏
  6. // @match https://chatgpt.com/*
  7. // @grant none
  8. // ==/UserScript==
  9.  
  10. (function() {
  11. 'use strict';
  12.  
  13. // 创建一个覆盖层 div
  14. const overlay = document.createElement('div');
  15. overlay.style.position = 'fixed';
  16. overlay.style.top = '0';
  17. overlay.style.left = '0';
  18. overlay.style.width = '100%';
  19. overlay.style.height = '60px'; // 根据实际情况调整高度
  20. overlay.style.backgroundColor = 'white';
  21. overlay.style.zIndex = '1000'; // 确保覆盖在页面顶部
  22. overlay.style.opacity = '0'; // 初始状态为隐藏
  23. overlay.style.transition = 'opacity 0.3s'; // 添加淡入淡出效果
  24. overlay.style.pointerEvents = 'none'; // 不影响鼠标事件传递
  25.  
  26. // 添加鼠标移入和移出事件
  27. document.body.addEventListener('mousemove', (event) => {
  28. if (event.clientY <= 60) { // 当鼠标位于页面顶部60px区域内时显示覆盖层
  29. overlay.style.opacity = '1';
  30. } else {
  31. overlay.style.opacity = '0';
  32. }
  33. });
  34.  
  35. // 将覆盖层添加到页面上
  36. document.body.appendChild(overlay);
  37. })();

QingJ © 2025

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