ChatGPT Disable Autofocus

Completely block all programmatic autofocus on chatgpt.com

Versão de: 12/05/2025. Veja: a última versão.

// ==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://greasyforks.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);
  };
})();
长期地址
遇到问题?请前往 GitHub 提 Issues。