Greasy Fork is available in English.

Diskuse » Creation Requests

highlight keywords in a chatbox, how to add different styles to several keywords?

§
Posted: 22. 04. 2014
Edited: 22. 04. 2014

highlight keywords in a chatbox, how to add different styles to several keywords?

I'm editing a userscript that has a highlight function inside a chat box on a gaming site. I'm trying to make it so I can add keywords and different css styles to it. I'm looking for something that adds keywords into groups, so that I can make one style to several keywords in that group. And a different style to another group.

dctools.checkForChatKeyword = function(elements) {
if (GM_getValue("dct-options-hiflags") != null) {
$(elements).highlight('flag')

.highlight('keyword 1')
.highlight('keyword 2')
.highlight('keyword 3')
.highlight('keyword 4')
.highlight('keyword 5')
.highlight('keyword 6')
.highlight('keyword 7');
}
Is there a simple way to add css styles to these different keywords using arrays?

Post reply

Sign in to post a reply.