Statify Official WoT Forums

Adds WoTLabs stats to the official forums

30.09.2014 itibariyledir. En son verisyonu görün.

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name        Statify Official WoT Forums
// @namespace   BocajSretep
// @description Adds WoTLabs stats to the official forums
// @include     http://forum.worldoftanks.com/*
// @version     1.2
// @grant       none
// ==/UserScript==
(function statifyWotForums() {
    var poasts = document.querySelectorAll('.post_block'),
        fragment = document.createDocumentFragment(),
        listItem = document.createElement('li'),
        nmDiv = document.createElement('div'),
        nmLink = document.createElement('a'),
        wlDiv = document.createElement('div'),
        wlLink = document.createElement('a'),
        sigDiv = document.createElement('div'),
        statsSig = document.createElement('img'),
        cssRules = document.createElement('style'),
        playerName;
    
    cssRules.innerHTML = '.wotLabsStats{width: 107px; padding: 2px; margin-top: 5px; background: white; border: 1px solid grey; overflow-x: hidden; transition: width 500ms}.wotLabsStats:hover{width: 472px}.statsLink:before {content: "";display: inline-block;height: 0;width: 0;margin-right: 0.5em;border-left: 4px solid #5A5A5A;border-top: 4px solid transparent;border-bottom: 4px solid transparent;}.statsLink{margin-top: 5px;}';
    document.head.appendChild(cssRules);
    
    
    listItem.classList.add('desc');
    listItem.classList.add('stats');
    
    nmDiv.classList.add('statsLink');
    wlDiv.classList.add('statsLink');
    sigDiv.classList.add('wotLabsStats');
    
    nmLink.innerHTML = 'NoobMeter';
    wlLink.innerHTML = 'WotLabs';
    
    nmDiv.appendChild(nmLink);
    listItem.appendChild(nmDiv);
    wlDiv.appendChild(wlLink);
    listItem.appendChild(wlDiv);
    sigDiv.appendChild(statsSig);
    listItem.appendChild(sigDiv);
    fragment.appendChild(listItem);
    
    for(var i = 0; i < poasts.length; ++i) {
        playerName = poasts[i].querySelector('.name').getAttribute('hovercard-id');
        
        nmLink.href = "http://www.noobmeter.com/player/na/" + playerName;
        wlLink.href = "http://wotlabs.net/na/player/" + playerName;
        statsSig.src = "http://wotlabs.net/sig/na/" + playerName + "/signature.png"
        
        poasts[i].querySelector('.basic_info').appendChild(fragment.cloneNode(true));
        
    }
})();