Force Spell Check in AI Dungeon

Automatically enables spell check on AI Dungeon input fields

  1. // ==UserScript==
  2. // @name Force Spell Check in AI Dungeon
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Automatically enables spell check on AI Dungeon input fields
  6. // @author JerTheDudeBear
  7. // @match https://play.aidungeon.com/*
  8. // @grant none
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. // Function to enable spell check on text inputs
  16. function enableSpellCheck() {
  17. const elements = document.querySelectorAll('textarea, [contenteditable]');
  18. elements.forEach(el => {
  19. el.spellcheck = true;
  20. el.setAttribute('spellcheck', 'true'); // Ensure attribute is set
  21. });
  22. }
  23.  
  24. // Run immediately on page load
  25. enableSpellCheck();
  26.  
  27. // Use a MutationObserver to catch dynamically loaded input fields
  28. const observer = new MutationObserver((mutations) => {
  29. enableSpellCheck();
  30. });
  31.  
  32. // Observe changes to the DOM (e.g., when new input fields appear)
  33. observer.observe(document.body, {
  34. childList: true,
  35. subtree: true
  36. });
  37.  
  38. // Optional: Re-run on focus or click events for extra reliability
  39. document.addEventListener('focusin', enableSpellCheck);
  40. document.addEventListener('click', enableSpellCheck);
  41. })();