Last active
January 4, 2021 18:24
-
-
Save omgitsraven/404ff29281c9e368eba7410bbff713eb to your computer and use it in GitHub Desktop.
Greasemonkey - skip GDQ schedule to now
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Skip GDQ schedule to now | |
// @version 1 | |
// @grant none | |
// @match https://gamesdonequick.com/schedule | |
// ==/UserScript== | |
window.addEventListener('load', function() { | |
setTimeout(function(){ | |
var now = new Date(); | |
var curDay = now.getDate(); | |
var curHour = now.getHours(); | |
var curMin = now.getMinutes(); | |
var daySplits = document.getElementsByClassName("day-split"); | |
for(var i=0; i<daySplits.length; i++){ | |
var curSplit = daySplits[i]; | |
var curDateLong = curSplit.children[0].innerHTML; | |
var curDateShort = curDateLong.substr(-5,2); | |
var curDateNum = parseInt(curDateShort); | |
if (curDateNum == curDay) { | |
//curSplit.scrollIntoView(); | |
var curEntry = curSplit; | |
while(curEntry = curEntry.nextElementSibling){ | |
if (curEntry.className == "day-split") break; | |
if (curEntry.className == "second-row") continue; | |
var timeString = curEntry.children[0].innerHTML; | |
var timeArray = timeString.split(" "); | |
var timeSubArray = timeArray[0].split(":"); | |
var hours = parseInt(timeSubArray[0]); | |
if (hours == 12) hours = 0; | |
if (timeArray[1] == "PM") hours += 12; | |
var mins = parseInt(timeSubArray[1]); | |
if (hours > curHour) break; | |
if ((hours == curHour) && (mins > curMin)) break; | |
} | |
curEntry.previousElementSibling.previousElementSibling.scrollIntoView(); | |
} | |
} | |
},100); | |
}, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment