// ==UserScript== // @name pikabu comments highlighter // @namespace pikabu // @author knight, soa_project@mail.ru // @version 0.0.0.2 // @description pikabu comments highlighter // @license GNU General Public License // @include http://pikabu.ru/* // ==/UserScript== function _render() { if (!document.body) { return; } str = new String() nameStr = new String() nameStr = "[]" colorMark = "lightgreen" colorText = "white" colorMarkNew = "lightblue" //Найдем как нас зовут var listH4 = document.getElementsByTagName("h4") for (var i = 0; i < listH4.length; i++) { str = listH4[i].innerHTML reg = new RegExp("\/profile\/(.*?)\">", "gim") res = reg.exec(str, "$1") if (res != null){ nameStr = res[1] break } } var newCountInt = 0; var myCountInt = 0; //Пометим наши коменты var listTD = document.getElementsByTagName("td") for (var i = 0; i < listTD.length; i++) { if (listTD[i].className == "comment_msg_new"){ var listDIV = listTD[i].getElementsByTagName("div") for (var j = 0; j < listDIV.length; j++) { if (listDIV[j].className == "comment_desc"){ str = listDIV[j].innerHTML reg = new RegExp("\[\d+\]", "gim") res = reg.exec(str) listDIV[j].style.backgroundColor = colorMarkNew; listDIV[j].style.color = colorText if (res == null) { text = '<noindex>' + listDIV[j].innerHTML + '</noindex>'; listDIV[j].innerHTML = " <b>[#" + newCountInt + "]</b>" + text; } newCountInt = newCountInt + 1 } } } str = listTD[i].innerHTML reg = new RegExp("\/profile\/"+nameStr+"\"", "gim") res = reg.exec(str) if (res != null){ if (listTD[i].className == "info info_c"){ listTD[i].style.backgroundColor = colorMark; listTD[i].style.color = colorText listTD[i].innerHTML = " <b>[#" + myCountInt + "]</b>" + listTD[i].innerHTML; myCountInt = myCountInt + 1 } } } //Выведем инфу var listH4 = document.getElementsByTagName("h4") for (var i = 0; i < listH4.length; i++) { str = listH4[i].innerHTML reg = new RegExp("\/profile\/(.*?)\">", "gim") res = reg.exec(str, "$1") if (res != null){ //listH4[i].innerHTML = str.replace(">"+nameStr, ">"+nameStr + myCountInt); listH4[i].innerHTML = "<a href='/editprofile.php'>"+nameStr + "</a> <b>[<font color="+colorMark+">" +myCountInt+"</font>, <font color="+colorMarkNew+">" + newCountInt+"</font>]</b>"; break } } } document.addEventListener('load', function (e) { _render() }, true); _render();
Mozilla add on,User script,Grease Monkey Script, greasemonkey userscripts, updater userscripts mafia wars userscripts mafia wars autoplayer userscripts mafia wars wall userscripts scripts userscripts travian greasemonkey greasemonkey download greasemonkey facebook greasemonkey tutorial greasemonkey youtube greasemonkey travian greasemonkey chrome greasemonkey mafia wars greasemonkey mafia wars autoplayer
Monday, February 7, 2011
pikabu comments highlighter
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment