I try to make a JavaScript replacing annoying fonts in a forum using Scriptish. The code itself works fine, but the execution also kills a text editor, which it shouldn't. The buttons and bars are still there, but the textbox is gone. The regex used doesn't have a match there.
document.body.innerHTML = document.body.innerHTML.replace(/font-family:georgia, serif/g, 'font-family:arial, tahoma');
I have tried document.body.innerHTML = document.body.innerHTML;
which does nothing, but replacing the body with itself. Even this causes the editor to mess up.
I also tried to change to the WYSIWYG editor, but even that one disappears.
I'm not admin of that website and the unwanted fonts are available to anyone (and some people use them in every post). I just don't want them to appear on my screen.
My guess is that Scriptish interferes with the website's scripting, but how can I verify this?
With the hint of Pete I found this solution pretty fast. This will override all user defined fonts with what you enter.
var css = document.createElement("style");
css.type = "text/css";
css.innerHTML = "span[style] { font-family:arial, tahoma !important }";
document.body.appendChild(css);
Thanks for your help.