Enhance search filter UI for JS disabled users

Change filters UI box to use <details>.

Stylize detail button for filter ui

Fix localization for 'filter'

Fix CSS

Fix styling
This commit is contained in:
syeopite 2021-03-01 01:28:54 -08:00
parent 489d0151ad
commit 83b5fd252e
No known key found for this signature in database
GPG key ID: 6AD1167E363D939E
3 changed files with 34 additions and 29 deletions

View file

@ -628,6 +628,31 @@ body.dark-theme {
}
}
#filters {
display: none;
#filters
display: inline;
margin-top: 15px;
}
#filters > div {
display: inline-block;
}
#filters > summary {
display: inline-block;
margin-bottom:15px;
}
#filters > summary {
display: inline-block;
margin-bottom:15px;
}
#filters > summary::before {
content: "[ + ]";
font-size: 1.5em;
}
#filters[open] > summary::before {
content: "[ - ]";
font-size: 1.5em;
}

View file

@ -1,13 +0,0 @@
function toggle_comments(event) {
var target = event.target;
var body = document.getElementById('filters');
if (body.style.display === 'flex') {
target.innerHTML = '[ + ]';
body.style.display = 'none';
} else {
target.innerHTML = '[ - ]';
body.style.display = 'flex';
}
}
document.getElementById('togglefilters').onclick = toggle_comments;

View file

@ -2,18 +2,10 @@
<title><%= search_query.not_nil!.size > 30 ? HTML.escape(query.not_nil![0,30].rstrip(".") + "...") : HTML.escape(query.not_nil!) %> - Invidious</title>
<% end %>
<h3>
<a id="togglefilters" href="javascript:void(0)">[ + ]</a>
<%= translate(locale, "filter") %>
</h3>
<noscript>
<style>
#filters {
display: flex;
}
</style>
</noscript>
<details id="filters">
<summary>
<a><h3 style="display:inline"> <%= translate(locale, "filter") %> </h3></a>
</summary>
<div id="filters" class="pure-g h-box">
<div class="pure-u-1-3 pure-u-md-1-5">
<b><%= translate(locale, "date") %></b>
@ -95,6 +87,7 @@
<% end %>
</div>
</div>
</details>
<hr/>