44live/templates/index.html
2025-04-07 02:33:02 -04:00

43 lines
1.7 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta property="og:site_name" content="44live">
<title>UofL Events</title>
<meta name="description" content="Find events at the University of Louisville">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="icon" href="calendar.svg" type="image/svg+xml">
<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>