AllenAI Prevent Autofocus

Blocks programmatic autofocus on playground.allenai.org

当前为 2025-05-20 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name AllenAI Prevent Autofocus
  3. // @description Blocks programmatic autofocus on playground.allenai.org
  4. // @match https://playground.allenai.org/*
  5. // @match https://chat.mistral.ai/*
  6. // @run-at document-start
  7. // @version 0.0.1.20250520204207
  8. // @namespace https://greasyfork.org/users/1435046
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. // Override focus on all textareas to no-op before the page runs scripts
  15. const originalDescriptor = Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'focus');
  16. HTMLElement.prototype.focus = function(...args) {
  17. if (this.tagName === 'TEXTAREA') return;
  18. return originalDescriptor.value.apply(this, args);
  19. };
  20. })();