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
pull/1837/head
syeopite 4 years ago
parent 489d0151ad
commit 83b5fd252e
No known key found for this signature in database
GPG Key ID: 6AD1167E363D939E

@ -628,6 +628,31 @@ body.dark-theme {
} }
} }
#filters { #filters
display: none; 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;
} }

@ -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;

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

Loading…
Cancel
Save