Add Hide Unselected checkbox

This is all client-side JS and CSS which is pretty cool. the checkbox just adds a class to the
table, and the CSS handles the rest.
main
Ryan Rix 2017-07-01 20:03:53 -07:00
parent eb1bcee77c
commit 69db285def
3 changed files with 24 additions and 8 deletions

View File

@ -4,34 +4,34 @@
padding-top: 75px; padding-top: 75px;
} }
.the_table { #the_table {
table-layout: fixed; table-layout: fixed;
width: 100%; width: 100%;
border-collapse: collapse; border-collapse: collapse;
border: 1px solid #dfdfdf; border: 1px solid #dfdfdf;
} }
.the_table th:nth-child(1) { #the_table th:nth-child(1) {
width: 15%; width: 15%;
} }
.the_table th:nth-child(2) { #the_table th:nth-child(2) {
width: 55%; width: 55%;
} }
.the_table th:nth-child(3) { #the_table th:nth-child(3) {
width: 30%; width: 30%;
} }
.the_table tr.selected { #the_table tr.selected {
background-color: #efefef; background-color: #efefef;
} }
.the_table td,th { #the_table td,th {
padding: 0.5em 2px; padding: 0.5em 2px;
} }
.the_table td { #the_table td {
vertical-align: top; vertical-align: top;
} }
@ -39,3 +39,7 @@
font-style: italic; font-style: italic;
color: #888888; color: #888888;
} }
#the_table.hide-unselected tr:not(.selected) td {
display: none;
}

View File

@ -10,3 +10,8 @@ function toggleRow(e) {
var row = e.currentTarget; var row = e.currentTarget;
row.className == "run selected" ? row.className = "run" : row.className = "run selected" row.className == "run selected" ? row.className = "run" : row.className = "run selected"
} }
function updateHideUnselected() {
var table = document.getElementById('the_table');
table.className == "hide-unselected" ? table.className = "" : table.className = "hide-unselected";
}

View File

@ -6,7 +6,14 @@
<div class="row"> <div class="row">
<h1>Summer Games Done Quick Schedulizer</h1> <h1>Summer Games Done Quick Schedulizer</h1>
<table class="the_table"> <p>
Build and share your Summer Games Done Quick schedule!
</p>
<label for="showToggle">Hide unselected</label>
<input type="checkbox" id="showToggle" onchange="updateHideUnselected()">
<table id="the_table">
<tr> <tr>
<th scope="col">Time & Estimate</th> <th scope="col">Time & Estimate</th>
<th scope="col">Run</th> <th scope="col">Run</th>