Javascript for replacing text on Wikia site

87 Views Asked by At

I want to use some JS Scripts to replace some bad words automatically on my Wikia site. Here my code:

$(function () {
    var str = document.getElementById("WikiaPage").innerHTML; 
    var res = str.replace(/badword1/gi, "beep").replace(/badword2/gi, "beep");
    document.getElementById("WikiaPage").innerHTML = res;
});

Then it works. But this code causes crash on Wikia Comments Section, Recent Wiki Section in WIkia Rail and some issues may I don't know yet.

How can i do now? Any help is appreciated. Thank everyone.

0

There are 0 best solutions below