NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name Gladiabots tournament organizer tools
// @namespace http://tampermonkey.net/
// @version 0.5
// @description Gives more tools to tournament organizers
// @author GFX47
// @match https://organizer.toornament.com/*
// @grant none
// @license MIT
// ==/UserScript==
window.onload = function()
{
var pageURL = document.URL;
var pageURLMatches = pageURL.match('^.*/tournaments/([0-9]+)/.*$');
if (pageURLMatches == null)
{
return;
}
var tournamentExternalID = pageURLMatches[1];
var container = null;
// Schedule matches
pageURLMatches = pageURL.match('^.*/stages/([0-9]+)/edit.*$');
if (pageURLMatches != null)
{
var stageID = pageURLMatches[1];
container = document.querySelectorAll('.card-footer .grid-flex')[0];
container.innerHTML +=
'<div class="size-content mobile-size-full"><button class="button expand" onclick="' +
'var startTime = prompt(\'Start time (UTC)\', \'DD/MM/YYYY HH:MM\');' +
'var roundDuration = prompt(\'Rounds duration (in seconds)\', \'86400\');' +
'window.location= \'https://tournaments.gladiabots.com/organizerTools.php?action=scheduleStateMatches&tournamentExternalID='+tournamentExternalID+'&stageID='+stageID+'&startTime=\'+startTime+\'&roundDuration=\'+roundDuration;' +
'return false;' +
'"><i class="fa-pencil"></i><span>Schedule matches</span></button></div>';
}
// Add guild participants
pageURLMatches = pageURL.match('^.*/participants/.*$');
if (pageURLMatches != null)
{
container = document.querySelectorAll('.header-menu')[0];
container.innerHTML +=
'<div><a class="button success expand" onclick="' +
'var guildPlayerCount = prompt(\'Number of players per team\', \'20\');' +
'window.location= \'https://tournaments.gladiabots.com/organizerTools.php?action=addGuildParticipants&tournamentExternalID='+tournamentExternalID+'&guildPlayerCount=\'+guildPlayerCount;' +
'return false;' +
'"><i class="fa-plus"></i><span>Add team top players</span></a></div>';
}
};