ChatGPT Scroll Fix 1

Fix scroll issues on ChatGPT for Safari iOS 15/16

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         ChatGPT Scroll Fix 1
// @namespace    http://tampermonkey.net/
// @version      1.2
// @description  Fix scroll issues on ChatGPT for Safari iOS 15/16
// @author       0xkuj
// @match        https://chatgpt.com/*
// @match        https://chat.openai.com/*
// @license MIT
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Allow scrolling on all possible containers
    const elements = [
        document.documentElement,
        document.body,
        document.querySelector('main'),
        document.querySelector('.overflow-hidden'),
        document.querySelector('[role="presentation"]'),
        ...document.querySelectorAll('.overflow-hidden'),
        ...document.querySelectorAll('[style*="overflow: hidden"]'),
        ...document.querySelectorAll('[style*="position: fixed"]')
    ];

    elements.forEach(el => {
        if (el) {
            el.style.cssText = `
                overflow: auto !important;
                position: relative !important;
                height: auto !important;
                max-height: none !important;
                overscroll-behavior: auto !important;
                -webkit-overflow-scrolling: touch !important;
            `;
        }
    });

    // Force layout recalculation
    window.dispatchEvent(new Event('resize'));

    // Remove any classes that might block scrolling
    document.querySelectorAll('*').forEach(el => {
        if (el.classList.contains('overflow-hidden')) {
            el.classList.remove('overflow-hidden');
        }
    });
})();