Greasy Fork is available in English.

Games Done 24/7

Awesome/Summer Games Done Quick schedule in 24-hour time format with current game highlighting

// ==UserScript==
// @name Games Done 24/7
// @version 2.2.20230530
// @description Awesome/Summer Games Done Quick schedule in 24-hour time format with current game highlighting
// @namespace raina
// @match https://gamesdonequick.com/schedule*
// @grant none
// @license GPLv3
// ==/UserScript==
$(document).ready(function() {

	$('.start-time').each(function() {
	let time = $(this).html();
	if (/PM$/.test(time)) {
		time = time.replace(/^\d+/, function(match) {
			match = parseInt(match, 10);
			return match < 12 ? match + 12 : 12;
		});
	}
	time = time.replace(/^12(?=\:\d\d AM)/, "0");
	$(this).html(time.slice(0, -3));
	});

	const currentDate = new Date();
	const months = [
		"January",
		"February",
		"March",
		"April",
		"May",
		"June",
		"July",
		"August",
		"September",
		"October",
		"November",
		"December",
	];

	let daySplits = document.querySelectorAll(`tr.day-split`);
	days = [].filter.call(daySplits, el => {
		if (1 < el.children.length) return false;

		let month = months.findIndex(mo => new RegExp(mo).test(el.children[0].textContent));
		if (0 > month) return false;

		let day;
		if (!(day = el.children[0].textContent.match(/\d+/))) return false;

		month = ("0" + month).slice(-2);
		day = ("0" + day[0]).slice(-2);

		dateStr = `${month}-${day}`;
		el.dataset.date = dateStr;

		return true;
	});

	const gdqDaySelector = `tr.day-split[data-date="${("0" + currentDate.getMonth()).slice(-2)}-${("0" + currentDate.getDate()).slice(-2)}"]`;
	const gdqDay = document.querySelector(gdqDaySelector);
	if (!gdqDay) return console.log(`Games Done Quick doesn't seem to be running currently.`);

	let current;
	let upcoming = document.querySelectorAll(`${gdqDaySelector} ~ tr .start-time`);
	days = [].find.call(upcoming, el => {

		if ("undefined" == typeof current) current = el;

		startTime = new Date();
		try {
			startHour = el.textContent.match(/\d\d?(?=:)/)[0];
			startMinute = el.textContent.match(/(?<=:)\d\d/)[0];
			startTime.setHours(startHour, startMinute, 0);
		} catch (ex) {
			return false;
		}
		el.dataset.start = startTime;

		// hit a start time in the future, stop iterating
		if (startTime >= currentDate) return true;

		// set current game, continue iterating
		current = el;
		return false;

	});

	if (current) {
		current = current.parentElement;
		current.style.backgroundColor = "#cf8";
		current.nextElementSibling.style.backgroundColor = "#cf8";
		current.style.scrollMarginTop = "128px";
		current.id = "current";
		scrollTo(0, current.offsetTop + innerHeight / 2)
	}

	let header = document.querySelector(`tr.day-split`);
	header.style.position = "sticky";
	header.style.top = "0";

});