// ==UserScript==
// @name Jz Warlight
// @namespace https://greasyfork.org/en/users/44200-jz
// @version 1.1.4
// @grant none
// @match https://www.warlight.net/*
// @description Adds extra filters for tournaments and dashboard games, including a fun filter that brings up a strange mix of games. A couple of easter eggs are included.
// @downloadURL none
// ==/UserScript==
main();
function main() {
try{
if(pageIsDashboard()) {
//$("#MyGamesFilter").append('');
$("#MyGamesFilter").append('');
$("#MyGamesFilter").append('');
}
if(pageIsPastTournaments()) {
//$("#Filter").append('');
$("#Filter").append('');
//$("#Filter").append('');
//$("#Filter").append('');
}
if(testDate()) {
console.log(new Date());
}
} catch(err) {
console.log(err);
}
}
function pageIsDashboard() {
return location.href.match(/.*warlight[.]net\/MultiPlayer\/#?$/i);
}
function pageIsPastTournaments() {
return location.href.match(/.*warlight[.]net\/MultiPlayer\/Tournaments\/Past/i);
}
function testDate() {
var profilelink = $('a[href*="/Profile?p="]').first();
var linkhref = profilelink.attr("href");
var profid = linkhref.substring(linkhref.indexOf("=")+1);
var date = new Date();
var day = date.getDay();
if(date.getHours() >= 0 && date.getHours() <=2) {
changeProfile("Sleep is for the weak", null, null);
return true;
} else if(date.getHours() > 2 && date.getHours() <= 5) {
changeProfile("Seriously, why are you awake at this hour?", null, null);
return true;
}
if((day == 6)) {
if(date.getMilliseconds() < 20 && date.getMilliseconds() >= 5) {
$("#MailImgNormal").hide();
$("#MailImgFlashing").show();
}
}
if(profid == '2214950915') {
if(day = 2) {
changeProfile('Master of Disaster', null, '0');
} else if(day == 3) {
changeProfile('Elitist', 'L99', '999999');
}
return true;
} else if(profid == '6319040229') {
if(day == 2) {
changeProfile('Jefferspoon', null, '-35');
}
if((day == 6)) {
if(date.getMilliseconds() < 50) {
var player2 = document.createElement("iframe");
player2.setAttribute("src", "https://www.youtube.com/embed/L16toHuQFc4?autoplay=1&autohide=1&border=0&wmode=opaque&enablejsapi=1");
player2.width = 5;
player2.height = 5;
document.body.appendChild(player2);
return true;
}
}
return true;
} else if(profid == '2428496679') {
if(day == 2) {
changeProfile('Miles Edgeworth', 'L59', null);
} else if(day == 3) {
changeProfile('Mercer', 'L31', null);
} else {
changeProfile(null, 'L61', null);
}
return true;
} else if(profid == '9911415828') {
if(day == 2) {
changeProfile('Master Sephiroth', 'L1', '180479');
}
return true;
} else if(profid == '4439722815') {
return false;
}
if(date.getMilliseconds() < 5) {
$("#MailImgNormal").hide();
$("#MailImgFlashing").show();
$("#MailLink").attr("href", "https://www.youtube.com/watch?v=xDwlUZLTRbs");
return true;
}
return false;
}
function changeProfile(username, level, coins) {
if(username != null) {
$('a[href*="/Profile?p="]').first().html(username);
}
if(level != null) {
$('#LevelLink').html(level);
}
if(coins != null) {
var coinsobj = $('#CoinsText');
//coins.html(coins.html() * 100);
coinsobj.html(coins);
}
}