Add collapsible list of all days

sql-rework
Tomasz Goliński 2019-11-11 23:28:37 +01:00
rodzic c3babed88f
commit 679eaf4092
3 zmienionych plików z 63 dodań i 4 usunięć

Wyświetl plik

@ -61,4 +61,4 @@ run `meson build; cd build; ninja`. You might need to set `CXX` variable to poin
* Maps of Voivodeships of Poland come from `https://commons.wikimedia.org/wiki/File:Podlaskie_Voivodeship_location_map.svg`, `https://commons.wikimedia.org/wiki/File:Pomeranian_Voivodeship_location_map.svg`, `https://pl.wikipedia.org/wiki/Plik:Kuyavian-Pomeranian_Voivodeship_location_map.svg`, `https://pl.wikipedia.org/wiki/Plik:Warmian-Masurian_Voivodeship_location_map.svg`, `https://pl.wikipedia.org/wiki/Plik:Masovian_Voivodeship_location_map.svg`, `https://pl.wikipedia.org/wiki/Plik:Lesser_Poland_Voivodeship_location_map.svg`, `https://pl.wikipedia.org/wiki/Plik:Greater_Poland_Voivodeship_location_map.svg`, `https://pl.wikipedia.org/wiki/Plik:Opole_Voivodeship_location_map.svg`, `https://pl.wikipedia.org/wiki/Plik:Lower_Silesian_Voivodeship_location_map.svg`, `https://pl.wikipedia.org/wiki/Plik:Silesian_Voivodeship_location_map.svg`, `https://pl.wikipedia.org/wiki/Plik:Lublin_Voivodeship_location_map.svg`, `https://pl.wikipedia.org/wiki/Plik:Subcarpathian_Voivodeship_location_map.svg`, `https://pl.wikipedia.org/wiki/Plik:West_Pomeranian_Voivodeship_location_map.svg`, `https://pl.wikipedia.org/wiki/Plik:%C5%9Awi%C4%99tokrzyskie_Voivodeship_location_map.svg`, `https://pl.wikipedia.org/wiki/Plik:Lubusz_Voivodeship_location_map.svg`, `https://pl.wikipedia.org/wiki/Plik:%C5%81%C3%B3d%C5%BA_Voivodeship_location_map.svg`
and are licensed under CC-BY-SA.
* CSS tricks used to render histograms are based on `https://css-tricks.com/making-charts-with-css`.
* CSS tricks used to render histograms are based on `https://css-tricks.com/making-charts-with-css` and collapsibles are based on `https://alligator.io/css/collapsible/`.

57
geo.css
Wyświetl plik

@ -119,3 +119,60 @@ dt {
margin-left: 130px;
}
*/
.wrap-collabsible {
margin-bottom: 1.2rem 0;
}
input[type='checkbox'] {
display: none;
}
.lbl-toggle {
display: inline;
font-weight: bold;
font-family: 'Lato', serif;
color: #48B;
cursor: pointer;
border-radius: 7px;
transition: all 0.25s ease-out;
padding-left: 1em;
}
.lbl-toggle:hover {
color: #A02020;
}
.lbl-toggle::before {
content: ' ';
display: inline-block;
border-top: 5px solid transparent;
border-bottom: 5px solid transparent;
border-left: 5px solid currentColor;
vertical-align: middle;
margin-right: .7rem;
transform: translateY(-2px);
transition: transform .2s ease-out;
}
.toggle:checked + .lbl-toggle::before {
transform: rotate(90deg) translateX(-3px);
}
.collapsible-content {
font-size: 12px;
max-height: 0px;
overflow: hidden;
transition: max-height .25s ease-in-out;
}
.toggle:checked + .lbl-toggle + .collapsible-content {
max-height: 10000em;
}
.collapsible-content .content-inner {
background: rgba(240, 245, 255, 1);
padding: .5rem 1rem;
}

Wyświetl plik

@ -272,9 +272,11 @@ int main(int argc, char** argv) {
auto best_day = std::max_element(dates.begin(), dates.end(), [&](auto& a, auto& b) { return a.second < b.second; });
std::cout << "Number of caching days: " << dates.size() << "<br>\n";
std::cout << "Average caches per caching day: " << std::setprecision(3) << (1.0 * cc.size()) / dates.size() << "<br>\n";
std::cout << "Best caching day: " << best_day->first << ", found " << best_day->second << " caches<br>\n";
// for (auto& i : dates)
// std::cout << i.first << ", found " << i.second << " caches<br>\n";
std::cout << "Best caching day: " << best_day->first << ", found " << best_day->second << " caches\n";
std::cout << "<span class=\"wrap-collabsible\">\n <input id=\"collapsible\" class=\"toggle\" type=\"checkbox\">\n <label for=\"collapsible\" class=\"lbl-toggle\">Details</label>\n <div class=\"collapsible-content\">\n <div class=\"content-inner\">\n";
for (auto& i : dates)
std::cout << i.first << ", found " << i.second << " caches<br>\n";
std::cout << " </div>\n </div>\n</span>\n";
int tot_dist = 0;
for (auto i = sorted_caches.begin(); i != std::prev(sorted_caches.end()); i++) {