use picocss
This commit is contained in:
parent
eaae9de31c
commit
9bab0c69af
4 changed files with 155 additions and 146 deletions
|
@ -7,37 +7,47 @@
|
|||
<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>
|
||||
<meta name="color-scheme" content="dark light">
|
||||
<link rel="stylesheet" href="https://static.stevenalexander.org/picocss/css/pico.jade.min.css">
|
||||
</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>
|
||||
<header class="container">
|
||||
<h2>UofL Events</h2>
|
||||
</header>
|
||||
<main class="container">
|
||||
<fieldset>
|
||||
<legend><strong>Date to display</strong></legend>
|
||||
<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>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend><strong>Filter rooms by event type</strong></legend>
|
||||
{%- for i in ["closed","available","class","exam","booked","food"] %}
|
||||
<input id="{{i}}" type="checkbox">
|
||||
<label for="{{i}}">{{i}}</label><br>
|
||||
{%- endfor %}
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<button class="outline" onclick="doFilters()">Show the events!</button>
|
||||
</fieldset>
|
||||
<script>
|
||||
function noClear(e) {
|
||||
function noClear(e){
|
||||
val=e.target.value
|
||||
if(val===""||val<"{{today}}"||val>"{{later}}"){e.target.value="{{dayafter}}"}
|
||||
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
|
||||
function doFilters(){
|
||||
d=document.querySelector('input[type="radio"]:checked').id;
|
||||
if(d=="custom"){document.querySelector('input[type="date"]').value}
|
||||
f=Array.from(document.querySelectorAll('input[type="checkbox"]:checked')).map(c=>c.id);
|
||||
f=f.length?"?"+f.join(","):"";
|
||||
document.location.href=d+f
|
||||
}
|
||||
</script>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue