Last active
May 31, 2016 09:56
-
-
Save Mezzle/f73b03319d86ade7baa7 to your computer and use it in GitHub Desktop.
ESL Userscripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Auto-Accept New GA Changes | |
// @namespace http://esl.eu/ | |
// @version 0.1 | |
// @description enter something useful | |
// @match http://www.esl.eu/*/admin_ga_changes/view/* | |
// @copyright 2013+, Martin Meredith | |
// ==/UserScript== | |
if (jQuery(jQuery(jQuery('#main_content table')[1]).find('tr')[3]).find('td')[1].innerHTML == '<em>none</em>') { | |
jQuery(jQuery(jQuery('#main_content table')[0]).find('div div')[5]).find('a')[0].click() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Colorize Date Specific Cups | |
// @namespace http://esl.eu/ | |
// @version 0.1 | |
// @description enter something useful | |
// @match http://www.esl.eu/*/admin_leaguejoins/* | |
// @copyright 2013+, Martin Meredith | |
// ==/UserScript== | |
var links = jQuery(jQuery('#main_content').find('.TextS')[0]).find('a'); | |
//var links = jQuery(jQuery('.TextS')[0]).find('a'); | |
var months=['01','02','03','04', '05','06','07','08','09','10','11','12']; | |
var d = new Date(); | |
if (d.getDate() < 10) { | |
var today = '0' + d.getDate() + '.' + months[d.getMonth()]; | |
} else { | |
var today = d.getDate() + '.' + months[d.getMonth()]; | |
} | |
var today_month = d.getMonth() + 1; | |
var today_date = d.getDate(); | |
for (var i=0; i<links.length; i++) { | |
mtch = jQuery(links[i]).text().match('.+\\((\\d\\d\\.\\d\\d)\\)\\s+\\(\\d+\\)'); | |
// If Date specific | |
if (mtch != null) { | |
if (mtch[1] != today) { | |
jQuery(links[i]).css({ "color": "#ddd"}); | |
} | |
m2 = mtch[1].match('(\\d\\d).(\\d\\d)'); | |
if (parseInt(m2[2]) < today_month || (parseInt(m2[2]) == today_month && parseInt(m2[1]) < today_date)) { | |
jQuery(links[i]).css({ "color": "#f00" }); | |
} | |
} | |
else { | |
jQuery(links[i]).css({ "color": "#d0d"}) | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Modify Matchadmin | |
// @namespace http://esl.eu/ | |
// @version 0.1 | |
// @description enter something useful | |
// @match http://www.esl.eu/*/admin_match/* | |
// @copyright 2013+, Martin Meredith | |
// ==/UserScript== | |
jQuery(jQuery('input[type=image]')[1]).parent().append('<input type="submit" id="send" value="Send"></input>'); | |
jQuery(jQuery('input[type=image]')[1]).parent().append('<input type="button" id="cnc" value="Close & Confirm"></input>'); | |
jQuery(jQuery('input[type=image]')[1]).remove(); | |
jQuery('#cnc').click(function() { | |
jQuery('select[name=status]').val('closed'); | |
jQuery('select[name=calculate]').val('yes'); | |
jQuery('input[type=checkbox]').prop('checked', true); | |
jQuery('input[name=featured]').prop('checked', false); | |
jQuery('#send').click(); | |
}); | |
var table = jQuery(jQuery('#main_content').find('table')[1]); | |
var len = table.find('tr').length | |
for (var i = len - 7; i < len; i++) { | |
jQuery(table.find('tr')[i]).toggle(); | |
} | |
jQuery(table.find('tr')[len-8]).click(function () { | |
for (var i = len - 7; i < len; i++) { | |
jQuery(table.find('tr')[i]).toggle(); | |
} | |
}); | |
if ((jQuery('input[name=contestant\\[2\\]]').val() == 0) || (jQuery('input[name=contestant\\[1\\]]').val() == 0)) { | |
jQuery('select[name=status]').val('closed'); | |
jQuery('select[name=calculate]').val('yes'); | |
jQuery('input[type=checkbox]').prop('checked', true); | |
jQuery('input[name=featured]').prop('checked', false); | |
var cnt = jQuery(jQuery('#main_content').find('table')[2]).find('input').length | |
var p2 = jQuery(jQuery('#main_content').find('table')[2]).find('input')[cnt-3]; | |
var p1 = jQuery(jQuery('#main_content').find('table')[2]).find('input')[cnt-7]; | |
if (jQuery('input[name=contestant\\[2\\]]').val() == 0) { | |
jQuery('select[name=defaultwin]').val(1); | |
jQuery(p1).prop('value','1'); | |
jQuery(p2).prop('value','0'); | |
} else { | |
jQuery('select[name=defaultwin]').val(2); | |
jQuery(p1).prop('value','0'); | |
jQuery(p2).prop('value','1'); | |
} | |
//alert('Defwin Detected, click send if correct'); | |
jQuery('#send').click(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Seed From toolbox | |
// @namespace http://esl.eu/ | |
// @version 0.2 | |
// @description Create button that will seed from toolbox | |
// @match http://www.esl.eu/eu/*/admin_contestants* | |
// @copyright 2014+, Martin Meredith | |
// ==/UserScript== | |
var cup_url; | |
cup_url = window.location.href.replace('/admin_contestants','/').replace(/\/\/$/, '/'); | |
jQuery.ajax({ | |
type: 'GET', | |
dataType: 'jsonp', | |
data: {}, | |
url: 'http://toolbox1.tedc.de:8000/go4/get_series_by_url?url=' + cup_url + '&jsonpCallbackFunction=?', | |
success: function (data) { | |
var slug = data.slug | |
jQuery('input[value="Randomize Seedings"]').after('<input type="button" id="toolboxseed" value="Seed From Toolbox" />'); | |
jQuery('#toolboxseed').click( | |
function () { | |
var contestants = {}; | |
var count = 0; | |
var result; | |
var arrayToSeed = new Array(); | |
jQuery.post('http://toolbox1.tedc.de:8000/go4/' + slug + '/seed?jsonpCallbackFunction=?', "", function (data) { | |
console.log(data); | |
result = data; | |
var count = 0; | |
jQuery('form table tr').each(function (index) { | |
var id = jQuery(this).find('td').eq(2).html(); | |
var contestantRanking = data[id]; | |
if (!isNaN(contestantRanking) && contestantRanking > 0) { | |
arrayToSeed[count] = id; | |
count++; | |
} | |
}); | |
arrayToSeed.sort(function(a,b) { | |
return data[b]-data[a] | |
}); | |
console.log(arrayToSeed); | |
jQuery('form table tr').each(function (index) { | |
var id = jQuery(this).find('td').eq(2).html(); | |
var seed = arrayToSeed.indexOf(id); | |
var textfield = jQuery(this).find('td input:text').first(); | |
if (!isNaN(seed) && seed >= 0) { | |
jQuery(textfield).val(seed+1); | |
} else { | |
jQuery(textfield).val(0); | |
} | |
}); | |
}, 'json'); | |
} | |
); | |
}} | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Show Leagues | |
// @namespace http://use.i.E.your.homepage/ | |
// @version 0.2 | |
// @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 otherparts = url.match(/..\.battle\.net/); | |
var api_url = 'http://' + otherparts[0] + '/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;"> </div>'); | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment