Better Games Done Quick Schedule

try to take over the world!

Per 11-01-2017. Zie de nieuwste versie.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey, Greasemonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals {tampermonkey_link:Tampermonkey}.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Userscripts.

Voor het installeren van scripts heb je een extensie nodig, zoals {tampermonkey_link:Tampermonkey}.

Voor het installeren van scripts heb je een gebruikersscriptbeheerder nodig.

(Ik heb al een user script manager, laat me het downloaden!)

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

(Ik heb al een beheerder - laat me doorgaan met de installatie!)

// ==UserScript==
// @name         Better Games Done Quick Schedule
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  try to take over the world!
// @author       You
// @match        https://gamesdonequick.com/schedule
// @grant        none
// @require http://code.jquery.com/jquery-latest.js
// ==/UserScript==

(function() {
    'use strict';

    console.log("Better AGDQ Shedule loading...");
    var tableRows = $("#runTable tbody tr");
    var time = "";
    var day = 0;
    var currentDate = new Date($.now());
    var rowOfCurrentRun = 0;
    console.log("Collecting and formatting dates and times...");
    for(var i = 0; i < tableRows.length; i = i +2)
    {
        if(tableRows.eq(i).hasClass("day-split"))
        {
            day = tableRows.eq(i).text().match(/\d+/)[0];
            i++;
            continue;
        }
        time = timeFormatting(tableRows.eq(i).children().eq(0).text());
        var date="2017/01/" + day +" " + time;
        var newDate = new Date(Date.parse(date));
        if(currentDate < newDate)
        {
            console.log("Highlighting current runs...");
            //console.log(newDate);
            //console.log(currentDate);
            //console.log(tableRows.eq(i-2));
            //console.log(tableRows.eq(i-1));
            //Ändere Background vom vorheriger Run
            tableRows.eq(i-4).css("background-color", "#f2dede");
            tableRows.eq(i-4).css("color", "black");
            if(tableRows.eq(i-3).hasClass("day-split"))
            {
                tableRows.eq(i-5).css("background-color", "#f2dede");
                tableRows.eq(i-5).css("color", "black");
                $(tableRows.eq(i-5)).attr('id', 'currentRun');
            }
            else
            {
                tableRows.eq(i-3).css("background-color", "#f2dede");
                tableRows.eq(i-3).css("color", "black");
                $(tableRows.eq(i-4)).attr('id', 'currentRun');
            }
            //Ändere Background vom aktuellem Run
            tableRows.eq(i-2).css("background-color", "#a00303");
            tableRows.eq(i-2).css("color", "white");
            tableRows.eq(i-1).css("background-color", "#a00303");
            tableRows.eq(i-1).css("color", "white");
            //Ändere Background vom nächsten Run
            if(tableRows.eq(i).hasClass("day-split"))
            {
                tableRows.eq(i+2).css("background-color", "#f2dede");
                tableRows.eq(i+2).css("color", "black");
            }
            else
            {
                tableRows.eq(i).css("background-color", "#f2dede");
                tableRows.eq(i).css("color", "black");
            }
            tableRows.eq(i+1).css("background-color", "#f2dede");
            tableRows.eq(i+1).css("color", "black");
            rowOfCurrentRun = i;
            i = tableRows.length;
        }
    }
    console.log("Adding current run to the top of the page...");
    //Den aktuellen RUN an den Anfang der Seite einfügen
    var top = $(tableRows.eq(rowOfCurrentRun-2)).children();
    var bottom = $(tableRows.eq(rowOfCurrentRun-1)).children();
    var goToCurrentRun = "<a href='#currentRun' id='goToCurrentRun' style='display: inline-block; padding: 5px 20px; color: white; line-height: 25px; padding-left: 15px; height: 100%; width: 140px; text-decoration: none; background-color: #8c1616; /*box-shadow: 6px 6px 12px rgba(0, 0, 0, 0.44); -moz-box-shadow: 6px 6px 12px rgba(0, 0, 0, 0.44); -webkit-box-shadow: 6px 6px 12px rgba(0, 0, 0, 0.44)*/'>Go to Current Run</a>";
    var currentRun = "<div style='overflow-x: auto; display: inline-block; max-width: 100%; vertical-align: top;'><nobr><div style='background-color: #a00303; color: white; padding: 5px 20px; line-height: 25px; display: inline-block; /*box-shadow: 6px 6px 12px rgba(0, 0, 0, 0.44); -moz-box-shadow: 6px 6px 12px rgba(0, 0, 0, 0.44); -webkit-box-shadow: 6px 6px 12px rgba(0, 0, 0, 0.44)*/;'>Current Run: <b>" + top.eq(1).text() + " (" + bottom.eq(1).text() + ")</b>&emsp;From <b>" + top.eq(2).text() + "</b><br/>Start: <b>" + timeFormatting(top.eq(0).text()) + "&emsp;</b> Duration: <b>" + timeFormatting(bottom.eq(0).text()) + "&emsp;</b> Setup Length: <b>" + timeFormatting(top.eq(3).text()) + "</b></div></nobr></div>" + goToCurrentRun;

    $("#top").after(currentRun);
    //console.log($("#white-bg").eq(2));
    $("#goToCurrentRun").mouseenter(function() {
        $(this).css("background-color", "#c32323");
    }).mouseleave(function() {
        $(this).css("background-color", "#8c1616");
    });
    console.log("Better AGDQ Shedule done");
}
 )();

function timeFormatting(time)
{
    //console.log("TimeFormatting:" + time);
    //console.log("Länge: " + time.length);
    //console.log(time);
    if(time.length == 7)
    {
        time = "0" + time;
    }
    else if(time.length == 10)
    {
        time = time.replace(/  /g, "0");
    }
    else
    {
        time = time;
    }
    return time;
}