Skip to content

Instantly share code, notes, and snippets.

@Mezzle
Last active May 31, 2016 09:56
Show Gist options
  • Save Mezzle/ee3a27fec16cfe5f6c7a to your computer and use it in GitHub Desktop.
Save Mezzle/ee3a27fec16cfe5f6c7a to your computer and use it in GitHub Desktop.
Show Leagues against SC2 Leaguejoins
// ==UserScript==
// @name Show Leagues
// @namespace http://use.i.E.your.homepage/
// @version 0.1
// @description Show Leagues against SC2 LJs
// @match http://www.esl.eu/eu/sc2/*/admin_leaguejoins*
// @copyright 2013, Martin "Mez" Meredith
// ==/UserScript==
jQuery('a.TextVSblack').each(function() {
if (jQuery(this).text() == 'B.net') {
var el = this;
var url = jQuery(this).attr('href');
var parts = url.match(/profile\/\d+\/\d\/.*\//);
var api_url = 'http://eu.battle.net/api/sc2/' + parts[0] + '?callback=?'
jQuery.getJSON(api_url, function(data) {
if (data.career.league == undefined) {
var img_url = "http://eu.battle.net/sc2/static/images/icons/league/none.png";
} else {
var img_url = "http://eu.battle.net/sc2/static/images/icons/league/" + data.career.league.toLowerCase() + ".png";
}
jQuery(el).parent().parent().find('img').before('<div style="display: inline-block; width:25px; height:25px; background: url(' + img_url + '); background-position: -145px 0; margin-right: 3px;">&nbsp;</div>');
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment