WoTStatScript - Forums

Adds a part of the signature from WoTLabs underneath the posterbox info for every post in a thread in the World of Tanks forums.

当前为 2014-11-16 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name WoTStatScript - Forums
  3. // @version 0.92
  4. // @description Adds a part of the signature from WoTLabs underneath the posterbox info for every post in a thread in the World of Tanks forums.
  5. // @author Orrie
  6. // @namespace http://forum.worldoftanks.eu/index.php?/topic/263423-
  7. // @icon http://dl.dropboxusercontent.com/u/12497046/wot/projects/statscript/img/icon.png
  8. // @include http://forum.worldoftanks.eu/index.php?*topic*
  9. // @include http://forum.worldoftanks.eu/index.php?app=members&module=messaging&section=view&do=showConversation&topicID=*
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. // data uri
  14. var uri = {
  15. icon_arrow:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPwAAAAJCAMAAAAhKrH/AAAAV1BMVEUAAAD///+TKCf9AQmTLiX9AQmTMir9AQmTLif9AQmTMSz9AQmTMir9AQmTMyn9AQmTMirvGgKTMirsIAGTMirwGQOTMiqTMirsIAGaNDGgNzfqJwDrJABtE0DNAAAAGnRSTlMAABERIiIzM0REVVVmZnd3iIqZmrvDzN3g7thzQuwAAACHSURBVHja5dVLDsIwDEXRCySlP0IMoXXs7H+dDBASA1bQ3B0cPclm2Fe2wrfTQeO3qwqqAKWek80HxfO/l1/EBRgtU2tf+KkJ7TO9hdVSV3jU42f6ZClY6Qt/d4n+BGol29jTwQN1pE2QbA610BVefImuwL7xsNAXXhVpEYY8kNfO/rwsyA3ekEsOT2YDLE8AAAAASUVORK5CYII="
  16. };
  17.  
  18. // style contents
  19. var style = document.createElement('style');
  20. style.className = "wotstatscript";
  21. style.type ="text/css";
  22. style.innerHTML = ".author_info {z-index: 1;}"
  23. + ".user_details > br {display: none;}"
  24. + ".basic_info {margin: 0 0 4px;}"
  25. + ".user_stats {width: 106px;}"
  26. + ".user_stats table {margin: 5px 0;}"
  27. + ".user_stats td {padding: 0 0 2px; font-weight: bold;}"
  28. + ".user_stats td a { background: url("+uri.icon_arrow+") no-repeat scroll 0 2px rgba(0, 0, 0, 0); padding: 0 0 0 10px; vertical-align: middle;}"
  29. + ".user_stats td a:hover {background: url("+uri.icon_arrow+") no-repeat scroll -244px 2px rgba(0, 0, 0, 0);}"
  30. + "";
  31. document.head.appendChild(style);
  32. // end style
  33.  
  34. // get server info
  35. var server = host = document.location.host.match(/\.([^\.]+)$/)[1];
  36.  
  37. // looping for every post
  38. var post_block = document.getElementsByClassName('post_block');
  39. for (var i=0; i<post_block.length; i++) {
  40. var author_hcid = post_block[i].getElementsByClassName('ipsUserPhotoLink')[0].getAttribute("hovercard-id"),
  41. author_info = post_block[i].getElementsByClassName('author_info')[0],
  42. author_name = (author_hcid) ? author_hcid : post_block[i].getElementsByClassName('author')[0].firstElementChild.firstElementChild.innerHTML;
  43. stat_div = document.createElement('div');
  44. stat_div.className = "user_stats";
  45. stat_div.innerHTML = "<table><tr><td><a href='http://worldoftanks."+host+"/community/accounts/named/"+author_name+"' target='_blank'>Player Profile</a></td></tr><tr><td><a href='http://wotlabs.net/"+server+"/player/"+author_name+"' target='_blank'>WoTLabs</a></td></tr><tr><td><a href='http://noobmeter.com/player/"+server+"/"+author_name+"' target='_blank'>Noobmeter</a></td></tr><tr><td><a href='http://en.wot-life.com/"+server+"/player/"+author_name+"/' target='_blank'>WoT-Life</a></td></tr></table>";
  46. author_info.appendChild(stat_div);
  47. }