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.

Tính đến 16-11-2014. Xem phiên bản mới nhất.

// ==UserScript==
// @name        WoTStatScript - Forums
// @version     0.92
// @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.
// @author      Orrie
// @namespace   http://forum.worldoftanks.eu/index.php?/topic/263423-
// @icon        http://dl.dropboxusercontent.com/u/12497046/wot/projects/statscript/img/icon.png
// @include     http://forum.worldoftanks.eu/index.php?*topic*
// @include     http://forum.worldoftanks.eu/index.php?app=members&module=messaging&section=view&do=showConversation&topicID=*
// @grant       none
// ==/UserScript==

// data uri
var uri = {
	icon_arrow:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPwAAAAJCAMAAAAhKrH/AAAAV1BMVEUAAAD///+TKCf9AQmTLiX9AQmTMir9AQmTLif9AQmTMSz9AQmTMir9AQmTMyn9AQmTMirvGgKTMirsIAGTMirwGQOTMiqTMirsIAGaNDGgNzfqJwDrJABtE0DNAAAAGnRSTlMAABERIiIzM0REVVVmZnd3iIqZmrvDzN3g7thzQuwAAACHSURBVHja5dVLDsIwDEXRCySlP0IMoXXs7H+dDBASA1bQ3B0cPclm2Fe2wrfTQeO3qwqqAKWek80HxfO/l1/EBRgtU2tf+KkJ7TO9hdVSV3jU42f6ZClY6Qt/d4n+BGol29jTwQN1pE2QbA610BVefImuwL7xsNAXXhVpEYY8kNfO/rwsyA3ekEsOT2YDLE8AAAAASUVORK5CYII="
};

// style contents
var style = document.createElement('style');
	style.className = "wotstatscript";
	style.type ="text/css";
	style.innerHTML = ".author_info {z-index: 1;}"
					+ ".user_details > br {display: none;}"
					+ ".basic_info {margin: 0 0 4px;}"
					+ ".user_stats {width: 106px;}"
					+ ".user_stats table {margin: 5px 0;}"
					+ ".user_stats td {padding: 0 0 2px; font-weight: bold;}"
					+ ".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;}"
					+ ".user_stats td a:hover {background: url("+uri.icon_arrow+") no-repeat scroll -244px 2px rgba(0, 0, 0, 0);}"
					+ "";
	document.head.appendChild(style);
// end style

// get server info
var server = host = document.location.host.match(/\.([^\.]+)$/)[1];

// looping for every post
var post_block = document.getElementsByClassName('post_block');
for (var i=0; i<post_block.length; i++) {
	var author_hcid = post_block[i].getElementsByClassName('ipsUserPhotoLink')[0].getAttribute("hovercard-id"),
		author_info = post_block[i].getElementsByClassName('author_info')[0],
		author_name = (author_hcid) ? author_hcid : post_block[i].getElementsByClassName('author')[0].firstElementChild.firstElementChild.innerHTML;
		stat_div = document.createElement('div');
		stat_div.className = "user_stats";
		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>";
		author_info.appendChild(stat_div);
}