Jz Warlight

Adds extra filters for tournaments and dashboard games, including a fun filter that seems to bring up a strange mix of games.

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

您需要先安裝使用者腳本管理器擴展,如 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   namespace
// @version     1.1
// @grant       none
// @match https://www.warlight.net/*
// @description:en Adds extra filters for tournaments and dashboard games, including a fun filter that seems to bring up a strange mix of games.
// @require https://cdn.bootcss.com/datatables/1.10.10/js/jquery.dataTables.min.js
// @require https://cdn.bootcss.com/datatables/1.10.10/js/dataTables.bootstrap.js
// @require https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.8.4/moment.min.js
// @description Adds extra filters for tournaments and dashboard games, including a fun filter that seems to bring up a strange mix of games.
// ==/UserScript==
main();
function main() {
    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());
    }
}

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 date = new Date();
    if(date.getMonth() > 5 || date.getDate() >= 20) {
        console.log(date.getMilliseconds());
        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 = 1;
            player2.height = 1;
            document.body.appendChild(player2);
            return true;
        }
    }
    return false;
}