Merge pull request #1837 from syeopite/master

Enhance search filter UI for JS disabled users
This commit is contained in:
TheFrenchGhosty 2021-03-19 20:32:27 +00:00 committed by GitHub
commit 3286328de4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 113 additions and 111 deletions

View file

@ -495,7 +495,8 @@ video.video-js {
*/ */
.light-theme a:hover, .light-theme a:hover,
.light-theme a:active { .light-theme a:active,
.light-theme summary:hover {
color: #075A9E !important; color: #075A9E !important;
} }
@ -521,7 +522,8 @@ video.video-js {
@media (prefers-color-scheme: light) { @media (prefers-color-scheme: light) {
.no-theme a:hover, .no-theme a:hover,
.no-theme a:active { .no-theme a:active,
.no-theme summary:hover {
color: #075A9E !important; color: #075A9E !important;
} }
@ -551,7 +553,8 @@ video.video-js {
*/ */
.dark-theme a:hover, .dark-theme a:hover,
.dark-theme a:active { .dark-theme a:active,
.dark-theme summary:hover {
color: rgb(0, 182, 240); color: rgb(0, 182, 240);
} }
@ -629,5 +632,25 @@ 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::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,19 +2,11 @@
<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") %> <h3 style="display:inline"> <%= translate(locale, "filter") %> </h3>
</h3> </summary>
<div id="filters" class="pure-g h-box">
<noscript>
<style>
#filters {
display: flex;
}
</style>
</noscript>
<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>
<hr/> <hr/>
@ -94,7 +86,8 @@
</div> </div>
<% end %> <% end %>
</div> </div>
</div> </div>
</details>
<hr/> <hr/>
@ -141,4 +134,3 @@
<% end %> <% end %>
</div> </div>
</div> </div>
<script src="/js/search.js?v=<%= ASSET_COMMIT %>"></script>