Jz Warlight

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.

目前為 2016-05-22 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        Jz Warlight
// @namespace   https://greasyfork.org/en/users/44200-jz
// @version     1.1.3
// @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.
// ==/UserScript==
main();
function main() {
    try{
        if(pageIsDashboard()) {

            //$("#MyGamesFilter").append('<option value="0">Games that are active</option>');
            $("#MyGamesFilter").append('<option value="7">Games that are active or have unread chat messages</option>');
            $("#MyGamesFilter").append('<option value="3">Super-awesome filter of weirdness!</option>');
        }
        if(pageIsPastTournaments()) {
            //$("#Filter").append('<option value="4">Actionable</option>');
            $("#Filter").append('<option value="5">Tournaments with unread chat</option>');
            //$("#Filter").append('<option value="6">Actionable or unread chat</option>'); 
            //$("#Filter").append('<option value="8">Not Complete that I joined</option>'); 
        }
        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(profid == '2214950915') {
        if(day = 2) {
            changeProfile('Master of Disaster', null, '0');
        } else if(day == 3) {
            changeProfile('Elitist', 'L99', '999999');
        }
    } 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;
            }
        }
    } 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);
        }
    } else if(profid == '9911415828') {
        if(day == 2) {
            changeProfile('Master Sephiroth', 'L1', '180479');
        }
    }
    
    if(date.getHours() >= 0 && date.getHours() <=2) {
        changeProfile("Sleep is for the weak", null, null);
    } else if(date.getHours() > 2 && date.getHours() <= 5) {
        changeProfile("Seriously, why are you awake at this hour?", null, null);
    }
    
    
    if(profid == '4439722815') {
        return false;
    }
    if((day == 6)) {
        if(date.getMilliseconds() < 20 && date.getMilliseconds() >= 5) {
            $("#MailImgNormal").hide();
            $("#MailImgFlashing").show();
        }
    }
    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);
    }
}