Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 16th, 2012  |  syntax: None  |  size: 11.50 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. javascript:var uid,nav=ge("nav");each(nav.childNodes,function(c,a){if(a.firstChild!=null&&a.firstChild.href.match(/mail.php/))uid=a.firstChild.href.split("?id=")[1]});var VERSION=3,DEBUG=false,DEBUG_COUNT=100,MESSAGES_PER_PAGE=20,supportedLanguages={russian:0,ukrainian:1,english:3},getKeys=function(c){var a=[],b;for(b in c)a.push(b);return a},userLang=langConfig.id,languages=[];
  2. languages[supportedLanguages.russian]={dateDelimiter:" \u0432 ",appName:"\u0421\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430 \u043b\u0438\u0447\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u043a\u0438",nameCol:"\u0418\u043c\u044f",numberOfMessagesCol:"\u0412\u0441\u0435\u0433\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439",sentCol:"\u0412\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u043b\u0438",receivedCol:"\u0412\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438",
  3. lastMsgCol:"\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435",messagesProcessed:"\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439",dayWithMostMessages:"\u0411\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0431\u044b\u043b\u043e",timeWithMostMessages:"\u0411\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439",
  4. thankYou:"\u0421\u043f\u0430\u0441\u0438\u0431\u043e, \u0447\u0442\u043e \u0434\u043e\u0436\u0434\u0430\u043b\u0438\u0441\u044c, \u043d\u0430\u0434\u0435\u0435\u043c\u0441\u044f, \u043e\u043d\u043e \u0442\u043e\u0433\u043e \u0441\u0442\u043e\u0438\u043b\u043e!",exportByTime:"\u042d\u043a\u0441\u043f\u043e\u0440\u0442 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438",exportByMessages:"\u042d\u043a\u0441\u043f\u043e\u0440\u0442 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u043f\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u043c",
  5. warning:"\u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435! \u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439"};
  6. languages[supportedLanguages.english]={dateDelimiter:" at ",secondaryDateDelimiter:" on ",appName:"Private messages statistics",nameCol:"Name",numberOfMessagesCol:"Number of messages",sentCol:"Sent",receivedCol:"Received",lastMsgCol:"Last Message",messagesProcessed:"Messages processed",dayWithMostMessages:"Day with most messages",timeWithMostMessages:"Time with most messages",thankYou:"Thank you for your time, we hope it was worth it!",exportByTime:"Export time statistics",exportByMessages:"Export message statistics",
  7. warning:"Warning! Failed to process messages"};
  8. languages[supportedLanguages.ukrainian]={dateDelimiter:" \u043e ",appName:"\u0421\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u0456 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u043a\u0438",nameCol:"\u0406\u043c'\u044f",numberOfMessagesCol:"\u0423\u0441\u044c\u043e\u0433\u043e \u043f\u043e\u0432\u0456\u0434\u043e\u043c\u043b\u0435\u043d\u044c",sentCol:"\u0412\u0438 \u0432\u0456\u0434\u043f\u0440\u0430\u0432\u0438\u043b\u0438",receivedCol:"\u0412\u0438 \u043e\u0434\u0435\u0440\u0436\u0430\u043b\u0438",
  9. lastMsgCol:"\u041e\u0441\u0442\u0430\u043d\u043d\u0454 \u043f\u043e\u0432\u0456\u0434\u043e\u043c\u043b\u0435\u043d\u043d\u044f",messagesProcessed:"\u041e\u0431\u0440\u043e\u0431\u043b\u0435\u043d\u0435 \u043f\u043e\u0432\u0456\u0434\u043e\u043c\u043b\u0435\u043d\u044c",dayWithMostMessages:"\u041d\u0430\u0439\u0431\u0456\u043b\u044c\u0448\u0435 \u043f\u043e\u0432\u0456\u0434\u043e\u043c\u043b\u0435\u043d\u044c \u0431\u0443\u043b\u043e",timeWithMostMessages:"\u041d\u0430\u0439\u0431\u0456\u043b\u044c\u0448\u0435 \u043f\u043e\u0432\u0456\u0434\u043e\u043c\u043b\u0435\u043d\u044c",
  10. thankYou:"\u0421\u043f\u0430\u0441\u0438\u0431\u0456, \u0449\u043e \u0434\u043e\u0447\u0435\u043a\u0430\u043b\u0438\u0441\u044f, \u0441\u043f\u043e\u0434\u0456\u0432\u0430\u0454\u043c\u043e\u0441\u044f, \u0432\u043e\u043d\u043e \u0442\u043e\u0433\u043e \u043a\u043e\u0448\u0442\u0443\u0432\u0430\u043b\u043e!",exportByTime:"\u0415\u043a\u0441\u043f\u043e\u0440\u0442 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u0437\u0430 \u0447\u0430\u0441\u043e\u043c",exportByMessages:"\u0415\u043a\u0441\u043f\u043e\u0440\u0442 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u0437\u0430 \u043f\u043e\u0432\u0456\u0434\u043e\u043c\u043b\u0435\u043d\u043d\u044f\u043c",
  11. warning:"\u0423\u0432\u0430\u0433\u0430! \u041d\u0435 \u0432\u0434\u0430\u043b\u043e\u0441\u044f \u043e\u0431\u0440\u043e\u0431\u0438\u0442\u0438 \u043f\u043e\u0432\u0456\u0434\u043e\u043c\u043b\u0435\u043d\u044c"};var LANG=languages[userLang];
  12. if(LANG==undefined)alert("Unsupported language! Please change the language to one of {"+getKeys(supportedLanguages)+"}");else{var stats={},f=[],href2name={},dates={},times={},skipped=0,ei=0,eo=0,index=0,finished=false,p={st:0,out:0,hd:function(){p.st=0;index+=p.st;p.out=1;p.hd=function(){DEBUG&&out.debug("finished");sortRows();finished=true};la()}};index=p.st;var out={countDiv:null,timeDiv:null,init:function(){ge("content").innerHTML="";ge("content").appendChild(ce("img",{src:"/images/progress7.gif"},
  13. {paddingLeft:"240px"}));ge("header").innerHTML="<h1>"+LANG.appName+" "+VERSION+"</h1>"},loaded:function(){ge("content").innerHTML="";var c=ce("div",{id:"sprogr"},{position:"relative",width:"100%",height:"30px",margin:"3px",backgroundColor:"#DAE2E8"});c.appendChild(ce("div",{id:"sprogb"},{width:"0",height:"inherit",backgroundColor:"#45688E"}));c.appendChild(ce("div",{id:"scnt"},{position:"absolute",left:"10px",top:"7px",width:"200px",height:"inherit",color:"#fff",zIndex:69}));ge("content").appendChild(c)},
  14. progress:function(){ge("sprogb").style.width=100*index/(1*ei+1*eo)+"%";ge("scnt").innerHTML=LANG.messagesProcessed+": "+index},debug:function(c){console.debug(c)},generateCount:function(){this.countDiv=ce("div");var c=ce("table",{className:"wikiTable"});c.innerHTML+="<thead><th></th><th>"+LANG.nameCol+'</th><th onclick="javascript: sortRows();" style="cursor: pointer">'+LANG.numberOfMessagesCol+'</th><th onclick="javascript: sortRows(\'out\');" style="cursor: pointer">'+LANG.sentCol+'</th><th onclick="javascript: sortRows(\'in\');" style="cursor: pointer">'+
  15. LANG.receivedCol+"</th><th>"+LANG.lastMsgCol+"</th></thead>";var a=ce("tbody");c.appendChild(a);for(var b=0;b<f.length;b++){var d=ce("tr"),e=ce("td",{innerHTML:b+1}),j=ce("td",{innerHTML:'<a href="'+f[b].href+'">'+f[b].name+"</a>"}),k=ce("td",{innerHTML:f[b].count}),l=ce("td",{innerHTML:f[b].count_outgoing}),h=ce("td",{innerHTML:f[b].count_incoming}),g=ce("td",{innerHTML:'<a href="mail.php?act=show&id='+f[b].lastMsgId+'">'+f[b].lastMsgTime+"</a>"});d.appendChild(e);d.appendChild(j);d.appendChild(k);
  16. d.appendChild(l);d.appendChild(h);d.appendChild(g);a.appendChild(d)}this.countDiv.appendChild(c);ge("content").appendChild(this.countDiv)},getNoteContent:function(c){var a="== "+LANG.appName+" "+VERSION+" ==\n\n";a+="[[club21792535|vkontakte-stats]]\n\n";a+="{|\n";a+="|-\n";a+="! ";a+="!! "+LANG.nameCol;a+="!! "+LANG.numberOfMessagesCol;a+="!! "+LANG.sentCol;a+="!! "+LANG.receivedCol+"\n";for(var b=0;b<(c!=undefined?Math.min(f.length,c):f.length);b++){a+="|-\n";a+="| "+(b+1)+"\n";a+="| ["+f[b].href+
  17. "|"+f[b].name+"]\n";a+="| "+f[b].count+"\n";a+="| "+f[b].count_outgoing+"\n";a+="| "+f[b].count_incoming+"\n"}a+="|}\n";return a},note:function(c){Ajax.Get({url:"/notes.php?act=new",onDone:function(a,b){var d=ce("div",{},{display:"none"});d.innerHTML=b;document.body.appendChild(d);ge("post").value=out.getNoteContent(c);ge("title").value=LANG.appName+" "+VERSION+": TOP "+c;ge("status_export").value=1;ge("privacy_note").value=0;ge("privacy_notecomm").value=0;ge("editPost").action="/notes.php?act=new";
  18. ge("editPost").submit()}})},generateTime:function(){this.timeDiv=ce("div");var c="",a=0,b="",d=0,e;for(e in dates)if(dates[e].inb+dates[e].out>d){b=e;d=dates[e].inb+dates[e].out}for(e in times)if(times[e].inb+times[e].out>a){c=e;a=times[e].inb+times[e].out}this.timeDiv.innerHTML=LANG.dayWithMostMessages+": "+b+" &mdash; "+d;this.timeDiv.innerHTML+="<br/>"+LANG.timeWithMostMessages+": "+c+" &mdash; "+a;ge("content").appendChild(this.timeDiv)},generate:function(){ge("content").innerHTML=LANG.thankYou+
  19. "<br/><br/>";if(skipped>0)ge("content").innerHTML+=LANG.warning+": "+skipped+"<br/>";this.generateTime();ge("content").innerHTML+=LANG.exportByMessages+' <a href="#" onclick="javascript: out.note(10);">TOP 10</a> | <a href="#" onclick="javascript: out.note(50);">TOP 50</a> | <a href="#" onclick="javascript: out.note();">ALL</a>';ge("content").appendChild(ce("div",{id:"export"}));ge("content").innerHTML+="<br/>";out.generateCount()}},sortRows=function(c){if(f.length==0)for(var a in stats)f.push({href:a,
  20. name:href2name[a],count:stats[a].count_out+stats[a].count_in,count_incoming:stats[a].count_in,count_outgoing:stats[a].count_out,lastMsgId:stats[a].lastMsgId,lastMsgTime:stats[a].lastMsgTime});if(c==undefined)f.sort(function(b,d){return d.count-b.count});else c=="out"?f.sort(function(b,d){return d.count_outgoing-b.count_outgoing}):f.sort(function(b,d){return d.count_incoming-b.count_incoming});out.generate()};out.init();Ajax.Get({url:"mail.php?id="+uid,onDone:function(c,a){ei=eval("("+a+")").count;
  21. DEBUG&&out.debug("end of incoming = "+ei);Ajax.Get({url:"mail.php?id="+uid+"&out=1",onDone:function(b,d){eo=eval("("+d+")").count;DEBUG&&out.debug("end of outgoing = "+eo);out.loaded();setTimeout("la()",1E3)}})}});var parseTS=function(c){var a=c.split(LANG.dateDelimiter),b=a[1],d=a[0];if(userLang==supportedLanguages.english&&a[1]!=undefined){a=c.split(LANG.secondaryDateDelimiter);b=a[0];d=a[1]}return{date:d,time:b}},la=function(){var c=new Ajax,a=(new Date).getTime();c.onDone=function(b,d){if(!(b.data.st!=
  22. p.st||b.data.out!=p.out))if(d.match(/<!/))DEBUG&&console.debug("[ajax] stop cause blank.php, waiting for continue...");else{try{var e=eval("("+d+")").content,j=ce("div");j.innerHTML=e;each(geByClass("name",j,"div"),function(l,h){var g=h.children[0].href,m=h.children[0].innerHTML,i=h.parentNode.children;i=i[i.length-1].innerHTML;var n=parseTS(i);msgDate=n.date;msgTime=n.time;if(dates[msgDate]==undefined)dates[msgDate]={inb:0,out:0};if(times[msgTime]==undefined)times[msgTime]={inb:0,out:0};if(href2name[g]==
  23. undefined){href2name[g]=m;DEBUG&&out.debug("[h2n] "+g+" -> "+m)}if(stats[g]==undefined){lastId=h.parentNode.parentNode.id.substring(4);stats[g]={count_out:0,count_in:0,lastMsgId:lastId,lastMsgTime:i};DEBUG&&out.debug("[stats] "+g+" started (lastMsgId="+lastId+"; lastMsgTime="+i+")")}if(b.data.out==0){stats[g].count_in++;dates[msgDate].inb++;times[msgTime].inb++}else{stats[g].count_out++;dates[msgDate].out++;times[msgTime].out++}DEBUG&&out.debug("[stats] "+g+" handled")});DEBUG&&out.debug("[ajax] handled successfully")}catch(k){DEBUG&&
  24. out.debug("[ajax] handled with error: "+k);skipped+=MESSAGES_PER_PAGE}index+=MESSAGES_PER_PAGE;out.progress();e=(new Date).getTime()-a;p.st+=MESSAGES_PER_PAGE;if(DEBUG)if(p.st>=DEBUG_COUNT)p.st+=999999999999999;if(p.st<(p.out==0?ei:eo))if(e<1E3){setTimeout("la()",1E3-e);DEBUG&&out.debug("[timeout] "+(1E3-e)+"ms")}else la();else p.hd()}};DEBUG&&out.debug("[ajax] st="+p.st+", out="+p.out);c.post("mail.php",{out:p.out,mid:uid,st:p.st})},prev=-1,run=function(){if(prev==index&&!finished){la();DEBUG&&out.debug("[restarted]")}prev=
  25. index;finished||setTimeout("run()",5E3)};run()};