44live/templates/index.html
2025-03-06 00:33:46 -05:00

48 lines
1.8 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<title>UofL Events</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta content="44live" property="og:site_name">
<meta content="44live - find rooms at UofL" property="og:title">
<meta content="Work in progress. Don't expect much." property="og:description">
<meta content='https://44live.stevenalexander.org/calendar.svg' property='og:image'>
<link rel="icon" type="image/x-icon" href="/calendar.svg">
<style>
*{font-family:monospace;font-size:0.8cm;}
input[type="checkbox"],input[type="radio"]{width:0.7cm;height:0.7cm;}
</style>
</head>
<body>
<h1>Choose a day:</h1>
<input id="today" type="radio" name="date" checked>
<label for="today">today</label><br>
<input id="tomorrow" type="radio" name="date">
<label for="tomorrow">tomorrow</label><br>
<input id="custom" type="radio" name="date">
<label for="custom"><input id="date" type="date" min="{{today}}" max="{{later}}" value="{{dayafter}}" onchange="noClear(event)"></label>
<h1>[Optional] Select types of events to find:</h1>
{%- for i in ["available","class","exam","booked","food"] %}
<input id="{{i}}" type="checkbox">
<label for="{{i}}">{{i}}</label><br>
{%- endfor %}
<p><button onclick="changeURL()">Show me the events!</button></p>
<script>
function noClear(e) {
val=e.target.value
if(val===""||val<"{{today}}"||val>"{{later}}"){e.target.value="{{dayafter}}"}
document.getElementById("custom").click()
}
function changeURL(){
has=[]
document.querySelectorAll('input[type="checkbox"]:checked').forEach(i=>has.push(i.id))
if(has.length>0){has="?has="+has.join(",")
}else{has=""}
date=document.querySelector('input[type="radio"]:checked').id
if(date=="custom"){date=document.querySelector('input[type="date"]').value}
document.location.href=date+has
}
</script>
</body>
</html>