ChatGPT Scroll Fix 1

Fix scroll issues on ChatGPT for Safari iOS 15/16

目前为 2025-01-12 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name ChatGPT Scroll Fix 1
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.1
  5. // @description Fix scroll issues on ChatGPT for Safari iOS 15/16
  6. // @author 0xkuj
  7. // @match https://chatgpt.com/*
  8. // @match https://chat.openai.com/*
  9. // @license MIT
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. // Allow scrolling on all possible containers
  17. const elements = [
  18. document.documentElement,
  19. document.body,
  20. document.querySelector('main'),
  21. document.querySelector('.overflow-hidden'),
  22. document.querySelector('[role="presentation"]'),
  23. ...document.querySelectorAll('.overflow-hidden'),
  24. ...document.querySelectorAll('[style*="overflow: hidden"]'),
  25. ...document.querySelectorAll('[style*="position: fixed"]')
  26. ];
  27.  
  28. elements.forEach(el => {
  29. if (el) {
  30. el.style.cssText = `
  31. overflow: auto !important;
  32. position: relative !important;
  33. height: auto !important;
  34. max-height: none !important;
  35. overscroll-behavior: auto !important;
  36. -webkit-overflow-scrolling: touch !important;
  37. `;
  38. }
  39. });
  40.  
  41. // Force layout recalculation
  42. window.dispatchEvent(new Event('resize'));
  43.  
  44. // Remove any classes that might block scrolling
  45. document.querySelectorAll('*').forEach(el => {
  46. if (el.classList.contains('overflow-hidden')) {
  47. el.classList.remove('overflow-hidden');
  48. }
  49. });
  50. })();