NanoPi / sda marathon now playing

// ==UserScript==
// @id             sda marathon now playing
// @name           sda marathon now playing
// @version        2017.07.03
// @namespace      https://openuserjs.org/users/NanoPi
// @author
// @description
// @include        http://marathon.speeddemosarchive.com/schedule
// @include        https://www.gamesdonequick.com/schedule
// @include        http://www.gamesdonequick.com/schedule
// @include        https://gamesdonequick.com/schedule
// @include        http://gamesdonequick.com/schedule
// @match          http://marathon.speeddemosarchive.com/schedule
// @match          https://www.gamesdonequick.com/schedule
// @match          http://www.gamesdonequick.com/schedule
// @match          https://gamesdonequick.com/schedule
// @match          http://gamesdonequick.com/schedule
// @run-at         document-start
// ==/UserScript==

document.addEventListener('DOMContentLoaded', function(e) {
    //var list = document.querySelectorAll( "#runTable tr td:first-child" );
    var list = document.querySelectorAll( ".start-time" );

    var nowTime = new Date();
    //nowTime.setYear(2016)
    //nowTime.setMonth(0)
    //nowTime.setDate(4)
    var nowplaying = document.createElement('p');
    var upnext = document.createElement('p');
    var nowplaying2 = document.createElement('p');
    var upnext2 = document.createElement('p');
    var foundone = false;
    var firstnext = false;


    for (i=0;i<list.length;i++) {

        //console.log(list[i].textContent);
        var runTimestamp = Date.parse(list[i].textContent);
        var runTime = new Date(runTimestamp);

        //console.log(list[i].textContent + ' // ' + (runTimestamp <= Date.parse(nowTime)) + ' // ' + runTime);

        if (runTimestamp <= Date.parse(nowTime))
        {
            nowplaying = list[i];
            nowplaying2 = list[i+1];
            foundone = true;
        }
        if (!firstnext && runTimestamp > Date.parse(nowTime))
        {
            upnext = list[i];
            upnext2 = list[i+1];
            firstnext = true;
        }

    }
    if (foundone)
    {
        nowplaying.parentElement.className += " greenrow";
        //nowplaying2.parentElement.className += " greenrow";
        nowplaying.parentElement.nextElementSibling.className += " greenrow";
    }
    if (firstnext)
    {
        upnext.parentElement.className += " pinkrow";
        //upnext2.parentElement.className += " pinkrow";
        upnext.parentElement.nextElementSibling.className += " pinkrow";
    }

//}, false);  window.addEventListener('load', function(e) {
    var greenrows = document.createElement('style');
    greenrows.innerHTML = "#runTable .grekenrow, #runTable .greenrow td:nth-child(even), #runTable .greenrow td:nth-child(odd) { background-color: inherit; background-image: linear-gradient(#FDDC57,#FDDC57); background-blend-mode: multiply; }";
    document.body.appendChild(greenrows);
    var pinkrows = document.createElement('style');
    pinkrows.innerHTML = "#runTable .painkrow, #runTable .pinkrow td:nth-child(even), #runTable .pinkrow td:nth-child(odd) { background-color: inherit; background-image: linear-gradient(#97DCFD,#97DCFD); background-blend-mode: multiply; }";
    document.body.appendChild(pinkrows);

}, false);