Completely block all programmatic autofocus on chatgpt.com
目前為
// ==UserScript==
// @name ChatGPT Disable Autofocus
// @description Completely block all programmatic autofocus on chatgpt.com
// @match https://chatgpt.com/*
// @run-at document-start
// @version 0.0.1.20250512171827
// @namespace https://greasyfork.org/users/1435046
// ==/UserScript==
(function() {
'use strict';
// Save the real focus
const realFocus = HTMLElement.prototype.focus;
// Override to always prevent scroll
HTMLElement.prototype.focus = function(options) {
// If caller explicitly wants scrolling, respect that; otherwise prevent it
const focusOptions = (options && options.preventScroll === false)
? options
: { ...(typeof options === 'object' ? options : {}), preventScroll: true };
return realFocus.call(this, focusOptions);
};
})();