Skip to content

Instantly share code, notes, and snippets.

@duplaja
Last active April 13, 2022 18:35
Show Gist options
  • Save duplaja/7f9e1304c5bfd346193ed1a07483e00b to your computer and use it in GitHub Desktop.
Save duplaja/7f9e1304c5bfd346193ed1a07483e00b to your computer and use it in GitHub Desktop.
Fix Discord Web Browser Spellcheck
window.addEventListener("load", fixStupidDiscordSpellcheck, false);
window.addEventListener('locationchange', fixStupidDiscordSpellcheck, false);
window.addEventListener('hashchange', fixStupidDiscordSpellcheck, false);
function fixStupidDiscordSpellcheck(event){
setTimeout(function() {
var textBoxes = document.querySelectorAll('div[role="textbox"]');
textBoxes.forEach(function(textBox) {
textBox.setAttribute("spellcheck",true);
});
},6000)
//Change 6000 as desired. Right now, it kicks in 6 seconds after loading the page / changing channels
}
(() => {
let oldPushState = history.pushState;
history.pushState = function pushState() {
let ret = oldPushState.apply(this, arguments);
window.dispatchEvent(new Event('pushstate'));
window.dispatchEvent(new Event('locationchange'));
return ret;
};
let oldReplaceState = history.replaceState;
history.replaceState = function replaceState() {
let ret = oldReplaceState.apply(this, arguments);
window.dispatchEvent(new Event('replacestate'));
window.dispatchEvent(new Event('locationchange'));
return ret;
};
window.addEventListener('popstate', () => {
window.dispatchEvent(new Event('locationchange'));
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment