Make ChatGPT scrollable with keyboard

This app makes it scrollable by setting tabindex to outer div making it focusable

目前為 2024-07-13 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Make ChatGPT scrollable with keyboard
  3. // @namespace http://tampermonkey.net/
  4. // @version 2024-07-01
  5. // @description This app makes it scrollable by setting tabindex to outer div making it focusable
  6. // @author Alexander Yaremchuk & ChatGPT
  7. // @match https://chatgpt.com/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. function onNavigation() {
  14. console.log("============helllo===============");
  15. var elem = document.querySelector("div.flex.flex-col.text-sm.md\\:pb-9");
  16. console.log("!!!", elem);
  17. console.log("===", document.documentElement.innerHTML);
  18. if (elem) {
  19. elem.setAttribute("tabindex", "1");
  20. }
  21. }
  22.  
  23. (function () {
  24. "use strict";
  25. if (
  26. typeof document !== "undefined" &&
  27. typeof MutationObserver !== "undefined"
  28. ) {
  29. const callback = function (mutationsList, observer) {
  30. for (let mutation of mutationsList) {
  31. if (mutation.type === "childList") {
  32. onNavigation();
  33. break;
  34. }
  35. }
  36. };
  37.  
  38. const observer = new MutationObserver(callback);
  39.  
  40. observer.observe(document.body, { childList: true, subtree: true });
  41. }
  42. })();
  43.  
  44. module.exports = { onNavigation };