Hummingbird Compare

enter something useful

As of 22/10/2014. See the latest version.

// ==UserScript==
// @name       Hummingbird Compare
// @version    1.2
// @description  enter something useful
// @match      http*://hummingbird.me/*
// @match      http*://forums.hummingbird.me/*
// @require https://greasyfork.org/scripts/5679-wait-for-elements/code/Wait%20For%20Elements.js?version=22195
// @namespace https://greasyfork.org/users/649
// ==/UserScript==

var process = function(btn) {
    btn = $(btn);
    //clear the "Coming Soon" hover text
    btn.parent().addClass('hidetooltip');
    //get two user names
    var userlink = $('ul.right-nav-section:last li:first a:first').attr('href');
    if (!userlink) // they're on the forums and the selector is different
        var userlink = $('ul.user-dropdown-links li:first a:first').attr('href');
    var user1 = userlink.substring(userlink.lastIndexOf('/') + 1, userlink.length);
    var user2 = $('h1.username:first').text().trim();
    //add link
    btn.attr('href', 'http://fuzetsu.github.io/hummingbird-user-compare/?user1=' + user1 + '&user2=' + user2);
    btn.attr('target', '_blank');
    btn.attr('title', '');
    $('h1.username:first').bind('DOMSubtreeModified', function(){
        process(btn.eq(0));
    });
}

//css to hide tooltip
$('<style type="text/css">.hidetooltip div { display:none }</style>').appendTo('head');

waitForElems('div.account-info ul.inline-list li:nth-child(1) a', process, false);