Advertisement
Guest User

krunk

a guest
Jul 25th, 2008
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function FindMahShit(regex) {
  2.   for (var tx = document.evaluate('//text()[normalize-space(.)!=""]', document, null, 6, null), t, i = 0; t = tx.snapshotItem(i); i++) {
  3.     var before =  t.textContent, st, matched = false;
  4.     if (t.parentNode.tagName == 'STYLE' || t.parentNode.tagName == 'SCRIPT') continue;
  5.     while ((st = before.search(regex)) != -1) {
  6.         t.parentNode.insertBefore(document.createTextNode(before.substr(0, st)), t);
  7.         with (t.parentNode.insertBefore(document.createElement('span'), t))
  8.             textContent = RegExp.$1,
  9.             style.cssText = 'color: #f00; font-size: 14pt;';
  10.         matched = true;
  11.         before = before.substr(st + RegExp.$1.length);
  12.     }
  13.     if (matched) t.textContent = before;
  14.   }
  15. }
  16.  
  17. window.addEventListener("load", function() {
  18.   var RE = /(bin|high|lig|bef|by|dix|con|nt|di|sd|re|ele|ins|rt|var)/i;
  19.   FindMahShit(RE);
  20. }, false );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement