From 83b5fd252e2cef88f5cc4164b84fa94737a4dae1 Mon Sep 17 00:00:00 2001 From: syeopite Date: Mon, 1 Mar 2021 01:28:54 -0800 Subject: [PATCH 1/5] Enhance search filter UI for JS disabled users Change filters UI box to use
. Stylize detail button for filter ui Fix localization for 'filter' Fix CSS Fix styling --- assets/css/default.css | 31 ++++++++++++++++++++++++++++--- assets/js/search.js | 13 ------------- src/invidious/views/search.ecr | 19 ++++++------------- 3 files changed, 34 insertions(+), 29 deletions(-) delete mode 100644 assets/js/search.js diff --git a/assets/css/default.css b/assets/css/default.css index 793295d9..09c7d237 100644 --- a/assets/css/default.css +++ b/assets/css/default.css @@ -628,6 +628,31 @@ body.dark-theme { } } -#filters { - display: none; -} \ No newline at end of file +#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; +} diff --git a/assets/js/search.js b/assets/js/search.js deleted file mode 100644 index 36edd053..00000000 --- a/assets/js/search.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/src/invidious/views/search.ecr b/src/invidious/views/search.ecr index 3fa9242b..92e32b30 100644 --- a/src/invidious/views/search.ecr +++ b/src/invidious/views/search.ecr @@ -2,18 +2,10 @@ <%= search_query.not_nil!.size > 30 ? HTML.escape(query.not_nil![0,30].rstrip(".") + "...") : HTML.escape(query.not_nil!) %> - Invidious <% end %> -

- [ + ] - <%= translate(locale, "filter") %> -

- - +
+ +

<%= translate(locale, "filter") %>

+
<%= translate(locale, "date") %> @@ -95,6 +87,7 @@ <% end %>
+

@@ -141,4 +134,4 @@ <% end %> - \ No newline at end of file + From b56ebd13b6fc9e02e92710dc40ca1516584bbd0b Mon Sep 17 00:00:00 2001 From: syeopite Date: Sat, 13 Mar 2021 09:14:55 -0800 Subject: [PATCH 2/5] Fix indent in search.ecr for filters --- src/invidious/views/search.ecr | 166 ++++++++++++++++----------------- 1 file changed, 83 insertions(+), 83 deletions(-) diff --git a/src/invidious/views/search.ecr b/src/invidious/views/search.ecr index 92e32b30..f24d8c43 100644 --- a/src/invidious/views/search.ecr +++ b/src/invidious/views/search.ecr @@ -3,90 +3,90 @@ <% end %>
- -

<%= translate(locale, "filter") %>

-
-
-
- <%= translate(locale, "date") %> -
- <% ["hour", "today", "week", "month", "year"].each do |date| %> -
- <% if operator_hash.fetch("date", "all") == date %> - <%= translate(locale, date) %> - <% else %> - &page=<%= page %>"> - <%= translate(locale, date) %> - - <% end %> -
- <% end %> + +

<%= translate(locale, "filter") %>

+
+
+
+ <%= translate(locale, "date") %> +
+ <% ["hour", "today", "week", "month", "year"].each do |date| %> +
+ <% if operator_hash.fetch("date", "all") == date %> + <%= translate(locale, date) %> + <% else %> + &page=<%= page %>"> + <%= translate(locale, date) %> + + <% end %> +
+ <% end %> +
+
+ <%= translate(locale, "content_type") %> +
+ <% ["video", "channel", "playlist", "movie", "show"].each do |content_type| %> +
+ <% if operator_hash.fetch("content_type", "all") == content_type %> + <%= translate(locale, content_type) %> + <% else %> + &page=<%= page %>"> + <%= translate(locale, content_type) %> + + <% end %> +
+ <% end %> +
+
+ <%= translate(locale, "duration") %> +
+ <% ["short", "long"].each do |duration| %> +
+ <% if operator_hash.fetch("duration", "all") == duration %> + <%= translate(locale, duration) %> + <% else %> + &page=<%= page %>"> + <%= translate(locale, duration) %> + + <% end %> +
+ <% end %> +
+
+ <%= translate(locale, "features") %> +
+ <% ["hd", "subtitles", "creative_commons", "3d", "live", "purchased", "4k", "360", "location", "hdr"].each do |feature| %> +
+ <% if operator_hash.fetch("features", "all").includes?(feature) %> + <%= translate(locale, feature) %> + <% elsif operator_hash.has_key?("features") %> + &page=<%= page %>"> + <%= translate(locale, feature) %> + + <% else %> + &page=<%= page %>"> + <%= translate(locale, feature) %> + + <% end %> +
+ <% end %> +
+
+ <%= translate(locale, "sort") %> +
+ <% ["relevance", "rating", "date", "views"].each do |sort| %> +
+ <% if operator_hash.fetch("sort", "relevance") == sort %> + <%= translate(locale, sort) %> + <% else %> + &page=<%= page %>"> + <%= translate(locale, sort) %> + + <% end %> +
+ <% end %> +
-
- <%= translate(locale, "content_type") %> -
- <% ["video", "channel", "playlist", "movie", "show"].each do |content_type| %> -
- <% if operator_hash.fetch("content_type", "all") == content_type %> - <%= translate(locale, content_type) %> - <% else %> - &page=<%= page %>"> - <%= translate(locale, content_type) %> - - <% end %> -
- <% end %> -
-
- <%= translate(locale, "duration") %> -
- <% ["short", "long"].each do |duration| %> -
- <% if operator_hash.fetch("duration", "all") == duration %> - <%= translate(locale, duration) %> - <% else %> - &page=<%= page %>"> - <%= translate(locale, duration) %> - - <% end %> -
- <% end %> -
-
- <%= translate(locale, "features") %> -
- <% ["hd", "subtitles", "creative_commons", "3d", "live", "purchased", "4k", "360", "location", "hdr"].each do |feature| %> -
- <% if operator_hash.fetch("features", "all").includes?(feature) %> - <%= translate(locale, feature) %> - <% elsif operator_hash.has_key?("features") %> - &page=<%= page %>"> - <%= translate(locale, feature) %> - - <% else %> - &page=<%= page %>"> - <%= translate(locale, feature) %> - - <% end %> -
- <% end %> -
-
- <%= translate(locale, "sort") %> -
- <% ["relevance", "rating", "date", "views"].each do |sort| %> -
- <% if operator_hash.fetch("sort", "relevance") == sort %> - <%= translate(locale, sort) %> - <% else %> - &page=<%= page %>"> - <%= translate(locale, sort) %> - - <% end %> -
- <% end %> -
-

From fab9ae64a072167bbd6f934c87e06e965bcbec89 Mon Sep 17 00:00:00 2001 From: syeopite Date: Sat, 13 Mar 2021 10:55:12 -0800 Subject: [PATCH 3/5] Remove duplicate styling code --- assets/css/default.css | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/assets/css/default.css b/assets/css/default.css index 09c7d237..18b7d7ad 100644 --- a/assets/css/default.css +++ b/assets/css/default.css @@ -628,7 +628,7 @@ body.dark-theme { } } -#filters +#filters { display: inline; margin-top: 15px; } @@ -639,12 +639,7 @@ body.dark-theme { #filters > summary { display: inline-block; - margin-bottom:15px; -} - -#filters > summary { - display: inline-block; - margin-bottom:15px; + margin-bottom: 15px; } #filters > summary::before { From 48a3c3a0c13c6bd0b7bec916ebac1c0f5bcd2e38 Mon Sep 17 00:00:00 2001 From: syeopite Date: Sat, 13 Mar 2021 10:57:27 -0800 Subject: [PATCH 4/5] Add hover state to filter UI --- assets/css/default.css | 9 ++++++--- src/invidious/views/search.ecr | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/assets/css/default.css b/assets/css/default.css index 18b7d7ad..a76ecd48 100644 --- a/assets/css/default.css +++ b/assets/css/default.css @@ -495,7 +495,8 @@ video.video-js { */ .light-theme a:hover, -.light-theme a:active { +.light-theme a:active, +.light-theme summary:hover { color: #075A9E !important; } @@ -521,7 +522,8 @@ video.video-js { @media (prefers-color-scheme: light) { .no-theme a:hover, - .no-theme a:active { + .no-theme a:active, + .no-theme summary:hover { color: #075A9E !important; } @@ -551,7 +553,8 @@ video.video-js { */ .dark-theme a:hover, -.dark-theme a:active { +.dark-theme a:active, +.dark-theme summary:hover { color: rgb(0, 182, 240); } diff --git a/src/invidious/views/search.ecr b/src/invidious/views/search.ecr index f24d8c43..873ec20f 100644 --- a/src/invidious/views/search.ecr +++ b/src/invidious/views/search.ecr @@ -4,7 +4,7 @@
-

<%= translate(locale, "filter") %>

+

<%= translate(locale, "filter") %>

From 977c34c0d72eacb07d5e51c537402fff6f4ae3fc Mon Sep 17 00:00:00 2001 From: syeopite Date: Fri, 19 Mar 2021 11:33:27 -0700 Subject: [PATCH 5/5] Remove unused script element in search.ecr --- src/invidious/views/search.ecr | 1 - 1 file changed, 1 deletion(-) diff --git a/src/invidious/views/search.ecr b/src/invidious/views/search.ecr index 873ec20f..fefc9fbb 100644 --- a/src/invidious/views/search.ecr +++ b/src/invidious/views/search.ecr @@ -134,4 +134,3 @@ <% end %>
-