Board Thread:Support Requests - Designing Your Wiki/@comment-37490998-20190111224523/@comment-37490998-20190113202545

RickGT wrote: To answer your original question. It is not possible with just CSS. With a bit of JS work though, anything is possible. For example... var oldString = 'mythic', newString = ' mythic ', newText = $('p').text.replace(RegExp(oldString,"gi"),newString);

$('p').html(newText);

... could be paired with the CSS...

span{ color: blue; } ...to search and replace every instance of the word "mythic" with a blue-colored version. It would be up to staff to review this JS though, I wrote this in my personal sandbox in a few minutes

The easiest way, however, would be to use the template method above Thank you. I figured out how(and where) to write javascript, and it works but with a weird issue, I think that since common js is for all pages the $('p') part gets the paragraphs from all the content on the wiki! so as a result there is weird results that looks like pasting all the content from the wiki everywhere, so the issue is $('p') is for all the paragraphs on the wiki, how can I make it the all the paragraphs from the current page, instead of all the paragraphs on the whole wiki, I can't explain this very well, I hope you can understand. Thank you, the current code I have is: /* Any JavaScript here will be loaded for all users on every page load. */ //apply to only certain pages //colorizing certain texts: switch (mw.config.get('wgPageName')) { case 'page name': // JS here will be applied to "page name" break; case 'some other page': // JS here will be applied to "some other page" break; } function change(char1, char2){ var oldString = char1, newString = char2, newText = $('p').text.replace(RegExp(oldString,"gi"),newString); $('p').html(newText); } window.onload = function { //change mythic to purple: change(' mythic ', ' Mythic       '); }