// Schedule generation.
const form = document.querySelector('.generation-form')
if (form) {
	const html = document.querySelector('.schedule-content').innerHTML
	form.querySelector('input[name="html"]').value = html
	form.style.display = 'block'
}


// Replace localed URL with current locale prefix.
const I18N = JSON.parse(document.getElementById('i18n_variables').textContent)
function findPrefix(u) {
	const possiblePrefixes = []
	for (const prefix of I18N.LANGUAGE_PREFIXES) {
		if (u.startsWith(prefix)) {
			return prefix
		}
	}
	return ''
}
for (const el of document.querySelectorAll('.localed-url')) {
	const original = el.getAttribute('href')
	if (!original) {
		continue
	}
	const prefix = findPrefix(original)
	if (!prefix) {
		continue
	}
	const sub = original.substr(prefix.length)
	el.setAttribute('href', `${I18N.LANGUAGE_PREFIX}${sub}`)
}

@@ -1,8 +1,1020 @@
+function clickOnDay1() %7B%0A%09document.querySelector('.py-schedule-tabs__tab%5Bdata-target=%22day-1%22%5D').click();%0A%7D%0A%0A// Toggle schedule by day%0Aconst $scheduleTabs = document.querySelectorAll('.py-schedule-tabs__tab');%0A$scheduleTabs.forEach(function setupTab($tab) %7B%0A%09$tab.addEventListener('click', function onClickTab(e) %7B%0A%09%09const selectedDay = $tab.getAttribute('data-target');%0A%09%09const tableClassInCommon = 'py-schedule-timetable';%0A%09%09const tableToActivate = %60.$%7BselectedDay%7D.$%7BtableClassInCommon%7D%60;%0A%09%09const activeClass = '--active';%0A%0A%09%09function inactivateAll($t) %7B%0A%09%09%09$t.classList.remove('--active');%0A%09%09%7D%0A%0A%09%09$scheduleTabs.forEach(inactivateAll)%0A%09%09$tab.classList.add(activeClass);%0A%09%09document.querySelectorAll(%60.$%7BtableClassInCommon%7D-header%60).forEach(inactivateAll);%0A%09%09document.querySelectorAll(%60.$%7BtableClassInCommon%7D-body%60).forEach(inactivateAll);%0A%09%09document.querySelector(%60$%7BtableToActivate%7D-header%60).classList.add(activeClass);%0A%09%09document.querySelector(%60$%7BtableToActivate%7D-body%60).classList.add(activeClass);%0A%09%7D);%0A%7D);%0A%0A
 // Sched
@@ -1384,16 +1384,17 @@
 ontent)%0A
+%0A
 function
@@ -1554,16 +1554,17 @@
 rn ''%0A%7D%0A
+%0A
 for (con
@@ -1860,10 +1860,98 @@
 %7Bsub%7D%60)%0A
-
 %7D%0A
+%0Adocument.addEventListener('DOMContentLoaded', function onReady() %7B%0A%09clickOnDay1();%0A%7D);%0A

allow toggling shcedule by day