JustPaste.it

// ==UserScript==
// @name        SST Text Hilite
// @namespace   muroph
// @description Highlights matched text on page
// @include       http://www.streamingsoundtracks.com/modules/ClearChat/block-files/view.php*
// @include       http://www.streamingsoundtracks.com/modules/ClearChat/atwork-files/view.php*
// @include       http://www.streamingsoundtracks.com/modules/ClearChat/undocked-files/undockedchat.php*
// @include       http://www.streamingsoundtracks.com/modules/ClearChat/common/log.php*
// @include       http://www.streamingsoundtracks.com/modules/ClearChat/*
// @version     1
// @grant       none
// ==/UserScript==

// https://greasyfork.org/scripts/5287-text-hilite

//----CONFIGURATION EXAMPLE
// Each rule must use the following blocks:
//
//AD.push(/<regex1>/i); //regex matching the URL of the page(s) for this rule
//MA.push(/(<regex2>)/i); //regex matching the desired text. round brackets are mandatory
//ST.push('<style>'); //style to use on the matched text
//
// You can use multiple rules

var AD=new Array();var MA=new Array();var ST=new Array();

//----RULES LIST
//AD.push(/^https?:\/\/greasyfork\.org.*$/i); //regex to match a site
//MA.push(/(script)/i); //regex to find some text
//ST.push('color: #fff;background: #f00;font-weight: bold;'); //style applied to text

//AD.push(/^https?:\/\/greasyfork\.org.*$/i);
//MA.push(/(user)/i);
//ST.push('color: #9ff;background: #00f;text-decoration: underline;');

//------------------------

//----------------
//Colors
// Proprietor = a769e3
// Admin = f5cb73
// Moderator = 9dfb78
// Ambassador = b5521d
// Visiting Mod = 4698f9
// Background = 000641

AD.push(/^https?:\/\/www\.streamingsoundtracks\.com\/modules\/ClearChat\/.*$/i); //regex to match a site
MA.push(/(j2brown)/i); //regex to find some text
ST.push('color: #000;background: #f00;font-weight: bold; padding-left: 2px; padding-right: 2px;'); //style applied to text

// Admins

AD.push(/^https?:\/\/www\.streamingsoundtracks\.com\/modules\/ClearChat\/.*$/i); //regex to match a site
MA.push(/(Morg:?)/i); //regex to find some text
ST.push('color: #000641;background: #f5cb73;font-weight: bold; padding-left: 2px; padding-right: 2px;'); //style applied to text

// Moderators

AD.push(/^https?:\/\/www\.streamingsoundtracks\.com\/modules\/ClearChat\/.*$/i); //regex to match a site
MA.push(/(Dragonel)/i); //regex to find some text
ST.push('color: #000641;background: #9dfb78;font-weight: bold; padding-left: 2px; padding-right: 2px;'); //style applied to text

// Visiting Mods
AD.push(/^https?:\/\/www\.streamingsoundtracks\.com\/modules\/ClearChat\/.*$/i); //regex to match a site
MA.push(/(LMarrese)/i); //regex to find some text
ST.push('color: #000641;background: #4698f9;font-weight: bold; padding-left: 2px; padding-right: 2px;'); //style applied to text

// Ambassadors
AD.push(/^https?:\/\/www\.streamingsoundtracks\.com\/modules\/ClearChat\/.*$/i); //regex to match a site
MA.push(/(Caliburn)/i); //regex to find some text
ST.push('color: #000641;background: #b5521d;font-weight: bold; padding-left: 2px; padding-right: 2px;'); //style applied to text
// Proprietors
AD.push(/^https?:\/\/www\.streamingsoundtracks\.com\/modules\/ClearChat\/.*$/i); //regex to match a site
MA.push(/(JERIC)/i); //regex to find some text
ST.push('color: #000641;background: #a769e3;font-weight: bold; padding-left: 2px; padding-right: 2px;'); //style applied to text

for(ind in AD){
    if(AD[ind].test(window.location.href)==true){
        for(var tx=document.evaluate('//text()[normalize-space(.)!=""]',document,null,6,null),t,i=0;t=tx.snapshotItem(i);i++){
            var before=t.textContent,st,matched=false;
            if(t.parentNode.tagName=='STYLE'||t.parentNode.tagName=='SCRIPT') continue;
            while((st=before.search(MA[ind]))!=-1){
                t.parentNode.insertBefore(document.createTextNode(before.substr(0,st)),t);
                with(t.parentNode.insertBefore(document.createElement('span'),t))
                    textContent=RegExp.$1,
                    style.cssText=ST[ind];
                matched=true;
                before=before.substr(st+RegExp.$1.length);
                }
            if(matched) t.textContent=before;
            }
        }
    }