From 1a9360ca754e684947df566ad8d3c6f0deec8664 Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Wed, 1 May 2019 20:03:39 -0500 Subject: [PATCH] Minor formatting changes --- assets/js/watch.js | 68 +- src/invidious/comments.cr | 2 +- src/invidious/mixes.cr | 2 +- src/invidious/playlists.cr | 2 +- src/invidious/views/authorize_token.ecr | 126 ++-- src/invidious/views/channel.ecr | 79 ++- src/invidious/views/components/feed_menu.ecr | 14 +- src/invidious/views/components/item.ecr | 243 +++---- src/invidious/views/components/player.ecr | 320 ++++----- .../views/components/player_sources.ecr | 12 +- .../views/components/subscribe_widget.ecr | 32 +- .../components/subscribe_widget_script.ecr | 43 +- src/invidious/views/embed.ecr | 68 +- src/invidious/views/error.ecr | 2 +- src/invidious/views/history.ecr | 84 +-- src/invidious/views/licenses.ecr | 8 +- src/invidious/views/login.ecr | 156 ++--- src/invidious/views/mix.ecr | 10 +- src/invidious/views/playlist.ecr | 33 +- src/invidious/views/playlists.ecr | 55 +- src/invidious/views/popular.ecr | 18 +- src/invidious/views/preferences.ecr | 262 +++---- src/invidious/views/privacy.ecr | 92 +-- src/invidious/views/search.ecr | 30 +- src/invidious/views/subscription_manager.ecr | 78 ++- src/invidious/views/subscriptions.ecr | 61 +- src/invidious/views/template.ecr | 130 ++-- src/invidious/views/token_manager.ecr | 24 +- src/invidious/views/top.ecr | 18 +- src/invidious/views/trending.ecr | 32 +- src/invidious/views/watch.ecr | 651 +++++++++--------- 31 files changed, 1412 insertions(+), 1343 deletions(-) diff --git a/assets/js/watch.js b/assets/js/watch.js index 7a68c30c..799d6af9 100644 --- a/assets/js/watch.js +++ b/assets/js/watch.js @@ -1,52 +1,52 @@ function toggle_parent(target) { - body = target.parentNode.parentNode.children[1]; - if (body.style.display === null || body.style.display === "") { - target.innerHTML = "[ + ]"; - body.style.display = "none"; - } else { - target.innerHTML = "[ - ]"; - body.style.display = ""; - } + body = target.parentNode.parentNode.children[1]; + if (body.style.display === null || body.style.display === "") { + target.innerHTML = "[ + ]"; + body.style.display = "none"; + } else { + target.innerHTML = "[ - ]"; + body.style.display = ""; + } } function toggle_comments(target) { - body = target.parentNode.parentNode.parentNode.children[1]; - if (body.style.display === null || body.style.display === "") { - target.innerHTML = "[ + ]"; - body.style.display = "none"; - } else { - target.innerHTML = "[ - ]"; - body.style.display = ""; - } + body = target.parentNode.parentNode.parentNode.children[1]; + if (body.style.display === null || body.style.display === "") { + target.innerHTML = "[ + ]"; + body.style.display = "none"; + } else { + target.innerHTML = "[ - ]"; + body.style.display = ""; + } } function swap_comments(source) { - if (source == "youtube") { - get_youtube_comments(); - } else if (source == "reddit") { - get_reddit_comments(); - } + if (source == "youtube") { + get_youtube_comments(); + } else if (source == "reddit") { + get_reddit_comments(); + } } -String.prototype.supplant = function(o) { - return this.replace(/{([^{}]*)}/g, function(a, b) { - var r = o[b]; - return typeof r === "string" || typeof r === "number" ? r : a; - }); +String.prototype.supplant = function (o) { + return this.replace(/{([^{}]*)}/g, function (a, b) { + var r = o[b]; + return typeof r === "string" || typeof r === "number" ? r : a; + }); }; function show_youtube_replies(target, inner_text, sub_text) { - body = target.parentNode.parentNode.children[1]; - body.style.display = ""; + body = target.parentNode.parentNode.children[1]; + body.style.display = ""; - target.innerHTML = inner_text; - target.setAttribute("onclick", "hide_youtube_replies(this, \'" + inner_text + "\', \'" + sub_text + "\')"); + target.innerHTML = inner_text; + target.setAttribute("onclick", "hide_youtube_replies(this, \'" + inner_text + "\', \'" + sub_text + "\')"); } function hide_youtube_replies(target, inner_text, sub_text) { - body = target.parentNode.parentNode.children[1]; - body.style.display = "none"; + body = target.parentNode.parentNode.children[1]; + body.style.display = "none"; - target.innerHTML = sub_text; - target.setAttribute("onclick", "show_youtube_replies(this, \'" + inner_text + "\', \'" + sub_text + "\')"); + target.innerHTML = sub_text; + target.setAttribute("onclick", "show_youtube_replies(this, \'" + inner_text + "\', \'" + sub_text + "\')"); } diff --git a/src/invidious/comments.cr b/src/invidious/comments.cr index e1d8604d..df8d5ca4 100644 --- a/src/invidious/comments.cr +++ b/src/invidious/comments.cr @@ -309,7 +309,7 @@ def template_youtube_comments(comments, locale, thin_mode) html += <<-END_HTML
- +

diff --git a/src/invidious/mixes.cr b/src/invidious/mixes.cr index 65e03a06..47c480d7 100644 --- a/src/invidious/mixes.cr +++ b/src/invidious/mixes.cr @@ -105,7 +105,7 @@ def template_mix(mix)

#{video["title"]}

- #{video["author"]} + #{video["author"]}

diff --git a/src/invidious/playlists.cr b/src/invidious/playlists.cr index 6015e5ec..92d9b977 100644 --- a/src/invidious/playlists.cr +++ b/src/invidious/playlists.cr @@ -248,7 +248,7 @@ def template_playlist(playlist)

#{video["title"]}

- #{video["author"]} + #{video["author"]}

diff --git a/src/invidious/views/authorize_token.ecr b/src/invidious/views/authorize_token.ecr index d00335e2..267f8ad9 100644 --- a/src/invidious/views/authorize_token.ecr +++ b/src/invidious/views/authorize_token.ecr @@ -3,76 +3,76 @@ <% end %> <% if env.get? "access_token" %> -
-
-

- <%= translate(locale, "Token") %> -

-
- - -
-

- <%= env.get "access_token" %> -

-
+
+

+ <%= env.get "access_token" %> +

+
<% else %> -
-
- <% if callback_url %> - <%= translate(locale, "Authorize token for `x`?", "#{callback_url.scheme}://#{callback_url.host}") %> - <% else %> - <%= translate(locale, "Authorize token?") %> - <% end %> +
+ + <% if callback_url %> + <%= translate(locale, "Authorize token for `x`?", "#{callback_url.scheme}://#{callback_url.host}") %> + <% else %> + <%= translate(locale, "Authorize token?") %> + <% end %> -
-
-
    - <% scopes.each do |scope| %> -
  • <%= scope %>
  • - <% end %> -
+
+
+
    + <% scopes.each do |scope| %> +
  • <%= scope %>
  • + <% end %> +
+
-
-
-
- -
- - <% scopes.each_with_index do |scope, i| %> - - <% end %> - <% if callback_url %> - - <% end %> - <% if expire %> - - <% end %> + <% scopes.each_with_index do |scope, i| %> + + <% end %> + <% if callback_url %> + + <% end %> + <% if expire %> + + <% end %> - - -
-<% end %> \ No newline at end of file + + +
+<% end %> diff --git a/src/invidious/views/channel.ecr b/src/invidious/views/channel.ecr index d52c01ca..6737c0d2 100644 --- a/src/invidious/views/channel.ecr +++ b/src/invidious/views/channel.ecr @@ -7,7 +7,7 @@

<%= author %>

-
+

@@ -15,41 +15,40 @@
-<% sub_count_text = number_to_short_text(sub_count) %> -<%= rendered "components/subscribe_widget" %> + <% sub_count_text = number_to_short_text(sub_count) %> + <%= rendered "components/subscribe_widget" %>
<%= translate(locale, "View channel on YouTube") %> <% if !auto_generated %> -
- <%= translate(locale, "Videos") %> -
+
+ <%= translate(locale, "Videos") %> +
<% end %>
- <% if auto_generated %> - <%= translate(locale, "Playlists") %> - <% else %> - <%= translate(locale, "Playlists") %> - <% end %> + <% if auto_generated %> + <%= translate(locale, "Playlists") %> + <% else %> + <%= translate(locale, "Playlists") %> + <% end %>
+
-
-
-
- <% sort_options.each do |sort| %> -
- <% if sort_by == sort %> - <%= translate(locale, sort) %> - <% else %> - - <%= translate(locale, sort) %> - - <% end %> -
- <% end %> +
+ <% sort_options.each do |sort| %> +
+ <% if sort_by == sort %> + <%= translate(locale, sort) %> + <% else %> + + <%= translate(locale, sort) %> + + <% end %> +
+ <% end %>
@@ -59,28 +58,28 @@
-<% items.each_slice(4) do |slice| %> - <% slice.each do |item| %> - <%= rendered "components/item" %> + <% items.each_slice(4) do |slice| %> + <% slice.each do |item| %> + <%= rendered "components/item" %> + <% end %> <% end %> -<% end %>
- diff --git a/src/invidious/views/components/feed_menu.ecr b/src/invidious/views/components/feed_menu.ecr index 378601a1..9867f56f 100644 --- a/src/invidious/views/components/feed_menu.ecr +++ b/src/invidious/views/components/feed_menu.ecr @@ -4,16 +4,16 @@
<% feed_menu = config.feed_menu.dup %> <% if !env.get?("user") %> - <% feed_menu.reject! {|feed| feed == "Subscriptions"} %> + <% feed_menu.reject! {|feed| feed == "Subscriptions"} %> <% end %> <% feed_menu.each do |feed| %> - + <% end %>
-
\ No newline at end of file +
diff --git a/src/invidious/views/components/item.ecr b/src/invidious/views/components/item.ecr index 484a340f..e9f03982 100644 --- a/src/invidious/views/components/item.ecr +++ b/src/invidious/views/components/item.ecr @@ -1,133 +1,138 @@
- <% case item when %> - <% when SearchChannel %> - - <% if env.get("preferences").as(Preferences).thin_mode %> - <% else %> -
- -
- <% end %> -

<%= item.author %>

-
-

<%= translate(locale, "`x` subscribers", number_with_separator(item.subscriber_count)) %>

-

<%= translate(locale, "`x` videos", number_with_separator(item.video_count)) %>

-
<%= item.description_html %>
- <% when SearchPlaylist %> - <% if item.id.starts_with? "RD" %> - <% url = "/mix?list=#{item.id}&continuation=#{item.thumbnail_id}" %> - <% else %> - <% url = "/playlist?list=#{item.id}" %> - <% end %> - - <% if env.get("preferences").as(Preferences).thin_mode %> + <% case item when %> + <% when SearchChannel %> + + <% if !env.get("preferences").as(Preferences).thin_mode %> +
+ +
+ <% end %> +

<%= item.author %>

+
+

<%= translate(locale, "`x` subscribers", number_with_separator(item.subscriber_count)) %>

+

<%= translate(locale, "`x` videos", number_with_separator(item.video_count)) %>

+
<%= item.description_html %>
+ <% when SearchPlaylist %> + <% if item.id.starts_with? "RD" %> + <% url = "/mix?list=#{item.id}&continuation=#{item.thumbnail_id}" %> <% else %> -
- -

<%= number_with_separator(item.video_count) %> videos

-
+ <% url = "/playlist?list=#{item.id}" %> <% end %> -

<%= item.title %>

- -

- <%= item.author %> -

- <% when MixVideo %> - - <% if env.get("preferences").as(Preferences).thin_mode %> - <% else %> - - <% end %> -

<%= item.title %>

-
-

- <%= item.author %> -

- <% when PlaylistVideo %> - - <% if env.get("preferences").as(Preferences).thin_mode %> - <% else %> - - <% end %> -

<%= item.title %>

-
-

- <%= item.author %> -

+

<%= item.title %>

+ +

+ + <%= item.author %> + +

+ <% when PlaylistVideo %> + + <% if !env.get("preferences").as(Preferences).thin_mode %> +
+ + <% if item.responds_to?(:live_now) && item.live_now %> +

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

+ <% elsif item.length_seconds != 0 %> +

<%= recode_length_seconds(item.length_seconds) %>

+ <% end %> +
+ <% end %> +

<%= item.title %>

+
+

+ + <%= item.author %> + +

-
- <% if item.responds_to?(:premiere_timestamp) && item.premiere_timestamp && item.premiere_timestamp.not_nil! > Time.now %> - <%= translate(locale, "Premieres in `x`", recode_date((item.premiere_timestamp.as(Time) - Time.now).ago, locale)) %>
- <% elsif Time.now - item.published > 1.minute %> -
<%= translate(locale, "Shared `x` ago", recode_date(item.published, locale)) %>
- <% else %> -
- <% end %> +
+ <% if item.responds_to?(:premiere_timestamp) && item.premiere_timestamp && item.premiere_timestamp.not_nil! > Time.now %> + <%= translate(locale, "Premieres in `x`", recode_date((item.premiere_timestamp.as(Time) - Time.now).ago, locale)) %>
+ <% elsif Time.now - item.published > 1.minute %> +
<%= translate(locale, "Shared `x` ago", recode_date(item.published, locale)) %>
+ <% else %> +
+ <% end %> -
- <%= item.responds_to?(:views) ? translate(locale, "`x` views", number_to_short_text(item.views)) : "" %> -
- - <% else %> - <% if env.get("preferences").as(Preferences).thin_mode %> +
+ <%= item.responds_to?(:views) ? translate(locale, "`x` views", number_to_short_text(item.views)) : "" %> +
+ <% else %> - -
- - <% if env.get? "show_watched" %> -
" method="post"> - "> -

- - - -

-
- <% end %> - <% if item.responds_to?(:live_now) && item.live_now %> -

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

- <% elsif item.length_seconds != 0 %> -

<%= recode_length_seconds(item.length_seconds) %>

- <% end %> -
- - <% end %> -

<%= item.title %>

-

- <%= item.author %> -

+ <% if !env.get("preferences").as(Preferences).thin_mode %> + +
+ + <% if env.get? "show_watched" %> +
" method="post"> + "> +

+ + + +

+
+ <% end %> -
- <% if item.responds_to?(:premiere_timestamp) && item.premiere_timestamp && item.premiere_timestamp.not_nil! > Time.now %> - <%= translate(locale, "Premieres in `x`", recode_date((item.premiere_timestamp.as(Time) - Time.now).ago, locale)) %>
- <% elsif Time.now - item.published > 1.minute %> -
<%= translate(locale, "Shared `x` ago", recode_date(item.published, locale)) %>
- <% else %> -
+ <% if item.responds_to?(:live_now) && item.live_now %> +

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

+ <% elsif item.length_seconds != 0 %> +

<%= recode_length_seconds(item.length_seconds) %>

+ <% end %> +
+ <% end %> +

<%= item.title %>

+

+ + <%= item.author %> + +

-
- <%= item.responds_to?(:views) ? translate(locale, "`x` views", number_to_short_text(item.views)) : "" %> -
- - <% end %> +
+ <% if item.responds_to?(:premiere_timestamp) && item.premiere_timestamp && item.premiere_timestamp.not_nil! > Time.now %> + <%= translate(locale, "Premieres in `x`", recode_date((item.premiere_timestamp.as(Time) - Time.now).ago, locale)) %>
+ <% elsif Time.now - item.published > 1.minute %> +
<%= translate(locale, "Shared `x` ago", recode_date(item.published, locale)) %>
+ <% else %> +
+ <% end %> + +
+ <%= item.responds_to?(:views) ? translate(locale, "`x` views", number_to_short_text(item.views)) : "" %> +
+ + <% end %>
diff --git a/src/invidious/views/components/player.ecr b/src/invidious/views/components/player.ecr index eecaf160..6ad70033 100644 --- a/src/invidious/views/components/player.ecr +++ b/src/invidious/views/components/player.ecr @@ -25,161 +25,163 @@ <% if params.local %>&local=true<% end %>" type='<%= fmt["type"] %>' label="<%= fmt["label"] %>" selected="<%= i == 0 ? true : false %>"> <% end %> <% end %> - <% end %> + <% end %> <% preferred_captions.each_with_index do |caption, i| %> - " - label="<%= caption.name.simpleText %>" <% if i == 0 %>default<% end %>> + " + label="<%= caption.name.simpleText %>" <% if i == 0 %>default<% end %>> <% end %> <% captions.each do |caption| %> - " - label="<%= caption.name.simpleText %>"> + " + label="<%= caption.name.simpleText %>"> <% end %> <% end %> + <% if params.annotations %> - - + + <% end %> + <% if params.listen || params.quality != "dash" %> - - -<% end %> \ No newline at end of file + + +<% end %> diff --git a/src/invidious/views/components/subscribe_widget.ecr b/src/invidious/views/components/subscribe_widget.ecr index 7988d2f1..a3d6a55f 100644 --- a/src/invidious/views/components/subscribe_widget.ecr +++ b/src/invidious/views/components/subscribe_widget.ecr @@ -1,22 +1,22 @@ <% if user %> <% if subscriptions.includes? ucid %> -

-

" method="post"> - "> - - | <%= sub_count_text %>"> - -
-

+

+

" method="post"> + "> + + | <%= sub_count_text %>"> + +
+

<% else %> -

-

" method="post"> - "> - - | <%= sub_count_text %>"> - -
-

+

+

" method="post"> + "> + + | <%= sub_count_text %>"> + +
+

<% end %> <% else %>

diff --git a/src/invidious/views/components/subscribe_widget_script.ecr b/src/invidious/views/components/subscribe_widget_script.ecr index f8c7416a..107bd3a2 100644 --- a/src/invidious/views/components/subscribe_widget_script.ecr +++ b/src/invidious/views/components/subscribe_widget_script.ecr @@ -1,27 +1,29 @@ -subscribe_button = document.getElementById("subscribe"); +subscribe_button = document.getElementById('subscribe'); + if (subscribe_button.getAttribute('onclick')) { - subscribe_button["href"] = "javascript:void(0)"; + subscribe_button['href'] = 'javascript:void(0)'; } function subscribe(timeouts = 0) { - subscribe_button = document.getElementById("subscribe"); + subscribe_button = document.getElementById('subscribe'); if (timeouts > 10) { - console.log("Failed to subscribe."); + console.log('Failed to subscribe.'); return; } - var url = "/subscription_ajax?action_create_subscription_to_channel=1&redirect=false&c=<%= ucid %>&referer=<%= env.get("current_page") %>"; + var url = '/subscription_ajax?action_create_subscription_to_channel=1&redirect=false' + + '&c=<%= ucid %>&referer=<%= env.get("current_page") %>'; var xhr = new XMLHttpRequest(); - xhr.responseType = "json"; + xhr.responseType = 'json'; xhr.timeout = 20000; - xhr.open("POST", url, true); + xhr.open('POST', url, true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); - xhr.send("csrf_token=<%= URI.escape(env.get?("csrf_token").try &.as(String) || "") %>"); + xhr.send('csrf_token=<%= URI.escape(env.get?("csrf_token").try &.as(String) || "") %>'); var fallback = subscribe_button.innerHTML; subscribe_button.onclick = unsubscribe; - subscribe_button.innerHTML = '<%= translate(locale, "Unsubscribe").gsub("'", "\\'") %> | <%= sub_count_text %>' + subscribe_button.innerHTML = '<%= translate(locale, "Unsubscribe").gsub("'", "\\'") %> | <%= sub_count_text %>'; xhr.onreadystatechange = function() { if (xhr.readyState == 4) { @@ -33,31 +35,31 @@ function subscribe(timeouts = 0) { } xhr.ontimeout = function() { - console.log("Subscribing timed out."); - + console.log('Subscribing timed out.'); subscribe(timeouts + 1); }; } function unsubscribe(timeouts = 0) { - subscribe_button = document.getElementById("subscribe"); + subscribe_button = document.getElementById('subscribe'); if (timeouts > 10) { - console.log("Failed to subscribe"); + console.log('Failed to subscribe'); return; } - var url = "/subscription_ajax?action_remove_subscriptions=1&redirect=false&c=<%= ucid %>&referer=<%= env.get("current_page") %>"; + var url = '/subscription_ajax?action_remove_subscriptions=1&redirect=false' + + '&c=<%= ucid %>&referer=<%= env.get("current_page") %>'; var xhr = new XMLHttpRequest(); - xhr.responseType = "json"; + xhr.responseType = 'json'; xhr.timeout = 20000; - xhr.open("POST", url, true); - xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); - xhr.send("csrf_token=<%= URI.escape(env.get?("csrf_token").try &.as(String) || "") %>"); + xhr.open('POST', url, true); + xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + xhr.send('csrf_token=<%= URI.escape(env.get?("csrf_token").try &.as(String) || "") %>'); var fallback = subscribe_button.innerHTML; subscribe_button.onclick = subscribe; - subscribe_button.innerHTML = '<%= translate(locale, "Subscribe").gsub("'", "\\'") %> | <%= sub_count_text %>' + subscribe_button.innerHTML = '<%= translate(locale, "Subscribe").gsub("'", "\\'") %> | <%= sub_count_text %>'; xhr.onreadystatechange = function() { if (xhr.readyState == 4) { @@ -69,8 +71,7 @@ function unsubscribe(timeouts = 0) { } xhr.ontimeout = function() { - console.log("Unsubscribing timed out."); - + console.log('Unsubscribing timed out.'); unsubscribe(timeouts + 1); }; } diff --git a/src/invidious/views/embed.ecr b/src/invidious/views/embed.ecr index 51097df1..e08bad02 100644 --- a/src/invidious/views/embed.ecr +++ b/src/invidious/views/embed.ecr @@ -27,24 +27,26 @@ diff --git a/src/invidious/views/error.ecr b/src/invidious/views/error.ecr index e5572776..d0752e5b 100644 --- a/src/invidious/views/error.ecr +++ b/src/invidious/views/error.ecr @@ -3,5 +3,5 @@ <% end %>

-<%= error_message %> + <%= error_message %>
diff --git a/src/invidious/views/history.ecr b/src/invidious/views/history.ecr index a207145b..e7bf06d1 100644 --- a/src/invidious/views/history.ecr +++ b/src/invidious/views/history.ecr @@ -6,12 +6,12 @@

<%= translate(locale, "`x` videos", %(#{user.watched.size})) %>

-
+ -
+

<%= translate(locale, "Clear watch history") %>

@@ -21,29 +21,28 @@
<% watched.each_slice(4) do |slice| %> <% slice.each do |item| %> - @@ -52,22 +51,23 @@ function mark_unwatched(target) { var tile = target.parentNode.parentNode.parentNode.parentNode.parentNode; tile.style.display = "none"; - var count = document.getElementById("count") + var count = document.getElementById('count') count.innerText = count.innerText - 1; - var url = "/watch_ajax?action_mark_unwatched=1&redirect=false&id=" + target.getAttribute("data-id"); + var url = '/watch_ajax?action_mark_unwatched=1&redirect=false' + + '&id=' + target.getAttribute('data-id'); var xhr = new XMLHttpRequest(); - xhr.responseType = "json"; + xhr.responseType = 'json'; xhr.timeout = 20000; - xhr.open("POST", url, true); - xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); - xhr.send("csrf_token=<%= URI.escape(env.get?("csrf_token").try &.as(String) || "") %>"); + xhr.open('POST', url, true); + xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + xhr.send('csrf_token=<%= URI.escape(env.get?("csrf_token").try &.as(String) || "") %>'); xhr.onreadystatechange = function() { if (xhr.readyState == 4) { if (xhr.status != 200) { count.innerText = count.innerText - 1 + 2; - tile.style.display = ""; + tile.style.display = ''; } } } @@ -76,18 +76,18 @@ function mark_unwatched(target) {
- <% if page >= 2 %> - - <%= translate(locale, "Previous page") %> - - <% end %> + <% if page >= 2 %> + + <%= translate(locale, "Previous page") %> + + <% end %>
-
- <% if watched.size >= limit %> - - <%= translate(locale, "Next page") %> - - <% end %> +
+ <% if watched.size >= limit %> + + <%= translate(locale, "Next page") %> + + <% end %>
diff --git a/src/invidious/views/licenses.ecr b/src/invidious/views/licenses.ecr index a7798ff0..bab7762a 100644 --- a/src/invidious/views/licenses.ecr +++ b/src/invidious/views/licenses.ecr @@ -2,8 +2,8 @@ - - + + @@ -59,7 +59,7 @@ Expat - + <%= translate(locale, "source") %> @@ -136,4 +136,4 @@ - \ No newline at end of file + diff --git a/src/invidious/views/login.ecr b/src/invidious/views/login.ecr index 3acb2501..7fa25278 100644 --- a/src/invidious/views/login.ecr +++ b/src/invidious/views/login.ecr @@ -18,95 +18,97 @@
-
- <% if account_type == "invidious" %> -
-
- <% if email %> - - <% else %> - - "> - <% end %> - <% if password %> - - <% else %> - - "> - <% end %> +
- <% if captcha %> - <% case captcha_type when %> - <% when "image" %> - <% captcha = captcha.not_nil! %> - - <% captcha[:tokens].each_with_index do |token, i| %> - + <% if account_type == "invidious" %> + +
+ <% if email %> + + <% else %> + + "> <% end %> - - - - <% when "text" %> - <% captcha = captcha.not_nil! %> - <% captcha[:tokens].each_with_index do |token, i| %> - + + <% if password %> + + <% else %> + + "> <% end %> - - - "> - <% end %> - + <% if captcha %> + <% case captcha_type when %> + <% when "image" %> + <% captcha = captcha.not_nil! %> + + <% captcha[:tokens].each_with_index do |token, i| %> + + <% end %> + + + + <% when "text" %> + <% captcha = captcha.not_nil! %> + <% captcha[:tokens].each_with_index do |token, i| %> + + <% end %> + + + "> + <% end %> - <% case captcha_type when %> - <% when "image" %> - - <% when "text" %> - + <% when "text" %> + + <% end %> + <% else %> + - - <% end %> - <% else %> - - <% end %> -
- + <% end %> +
+ <% elsif account_type == "google" %> -
-
- <% if email %> - - <% else %> - - "> - <% end %> + +
+ <% if email %> + + <% else %> + + "> + <% end %> - <% if password %> - - <% else %> - - "> - <% end %> + <% if password %> + + <% else %> + + "> + <% end %> - <% if tfa %> - - "> - <% end %> + <% if tfa %> + + "> + <% end %> - -
- + +
+ <% end %>
diff --git a/src/invidious/views/mix.ecr b/src/invidious/views/mix.ecr index 0e88b263..e9c0dcbc 100644 --- a/src/invidious/views/mix.ecr +++ b/src/invidious/views/mix.ecr @@ -6,7 +6,7 @@

<%= mix.title %>

-
+

@@ -14,9 +14,9 @@
-<% mix.videos.each_slice(4) do |slice| %> - <% slice.each do |item| %> - <%= rendered "components/item" %> + <% mix.videos.each_slice(4) do |slice| %> + <% slice.each do |item| %> + <%= rendered "components/item" %> + <% end %> <% end %> -<% end %>
diff --git a/src/invidious/views/playlist.ecr b/src/invidious/views/playlist.ecr index 6bd0dc9e..b43bd89c 100644 --- a/src/invidious/views/playlist.ecr +++ b/src/invidious/views/playlist.ecr @@ -7,12 +7,13 @@

<%= playlist.title %>

-
+

+
-<% videos.each_slice(4) do |slice| %> - <% slice.each do |item| %> - <%= rendered "components/item" %> + <% videos.each_slice(4) do |slice| %> + <% slice.each do |item| %> + <%= rendered "components/item" %> + <% end %> <% end %> -<% end %>
-
- <% if videos.size == 100 %> - - <%= translate(locale, "Next page") %> - - <% end %> +
+ <% if videos.size == 100 %> + + <%= translate(locale, "Next page") %> + + <% end %>
diff --git a/src/invidious/views/playlists.ecr b/src/invidious/views/playlists.ecr index ee7918e7..88d51268 100644 --- a/src/invidious/views/playlists.ecr +++ b/src/invidious/views/playlists.ecr @@ -6,7 +6,7 @@

<%= author %>

-
+

@@ -14,8 +14,8 @@
-<% sub_count_text = number_to_short_text(sub_count) %> -<%= rendered "components/subscribe_widget" %> + <% sub_count_text = number_to_short_text(sub_count) %> + <%= rendered "components/subscribe_widget" %>
@@ -28,25 +28,24 @@
<% if !auto_generated %> - <%= translate(locale, "Playlists") %> + <%= translate(locale, "Playlists") %> <% end %>
+
-
-
-
- <% {"last", "oldest", "newest"}.each do |sort| %> -
- <% if sort_by == sort %> - <%= translate(locale, sort) %> - <% else %> - - <%= translate(locale, sort) %> - - <% end %> -
- <% end %> +
+ <% {"last", "oldest", "newest"}.each do |sort| %> +
+ <% if sort_by == sort %> + <%= translate(locale, sort) %> + <% else %> + + <%= translate(locale, sort) %> + + <% end %> +
+ <% end %>
@@ -56,21 +55,21 @@
-<% items.each_slice(4) do |slice| %> - <% slice.each do |item| %> - <%= rendered "components/item" %> + <% items.each_slice(4) do |slice| %> + <% slice.each do |item| %> + <%= rendered "components/item" %> + <% end %> <% end %> -<% end %>
- diff --git a/src/invidious/views/popular.ecr b/src/invidious/views/popular.ecr index d60ae557..88c49582 100644 --- a/src/invidious/views/popular.ecr +++ b/src/invidious/views/popular.ecr @@ -1,14 +1,20 @@ <% content_for "header" do %> "> -<% if config.default_home != "Popular" %><%= translate(locale, "Popular") %> - <% end %>Invidious + + <% if config.default_home != "Popular" %> + <%= translate(locale, "Popular") %> - Invidious + <% else %> + Invidious + <% end %> + <% end %> <%= rendered "components/feed_menu" %>
-<% popular_videos.each_slice(4) do |slice| %> - <% slice.each do |item| %> - <%= rendered "components/item" %> - <% end %> -<% end %> + <% popular_videos.each_slice(4) do |slice| %> + <% slice.each do |item| %> + <%= rendered "components/item" %> + <% end %> + <% end %>
diff --git a/src/invidious/views/preferences.ecr b/src/invidious/views/preferences.ecr index 9128c3f5..12513a64 100644 --- a/src/invidious/views/preferences.ecr +++ b/src/invidious/views/preferences.ecr @@ -46,18 +46,18 @@ function update_value(element) {
@@ -70,22 +70,22 @@ function update_value(element) {
<% preferences.comments.each_with_index do |comments, index| %> - + <% end %>
<% preferences.captions.each_with_index do |caption, index| %> - + <% end %>
@@ -104,9 +104,9 @@ function update_value(element) {
@@ -121,131 +121,131 @@ function update_value(element) {
<% if env.get? "user" %> - <%= translate(locale, "Subscription preferences") %> - -
- - checked<% end %>> -
- -
- - checked<% end %>> -
- -
- - -
- -
- - -
- -
- <% if preferences.unseen_only %> - - <% else %> - - <% end %> - checked<% end %>> -
- -
- - checked<% end %>> -
- -
- - checked<% end %>> -
+ <%= translate(locale, "Subscription preferences") %> + +
+ + checked<% end %>> +
+ +
+ + checked<% end %>> +
+ +
+ + +
+ +
+ + +
+ +
+ <% if preferences.unseen_only %> + + <% else %> + + <% end %> + checked<% end %>> +
+ +
+ + checked<% end %>> +
+ +
+ + checked<% end %>> +
<% end %> <% if env.get?("user") && config.admins.includes? env.get?("user").as(User).email %> - <%= translate(locale, "Administrator preferences") %> - -
- - -
- -
- - <% 4.times do |index| %> - - <% end %> -
- -
- - checked<% end %>> -
- -
- - checked<% end %>> -
- -
- - checked<% end %>> -
- -
- - checked<% end %>> -
- -
- - checked<% end %>> -
+ <%= translate(locale, "Administrator preferences") %> + +
+ + +
+ +
+ + <% 4.times do |index| %> + + <% end %> +
+ +
+ + checked<% end %>> +
+ +
+ + checked<% end %>> +
+ +
+ + checked<% end %>> +
+ +
+ + checked<% end %>> +
+ +
+ + checked<% end %>> +
<% end %> <% if env.get? "user" %> - <%= translate(locale, "Data preferences") %> + <%= translate(locale, "Data preferences") %> - + - + - + - + - + - + - + <% end %>
diff --git a/src/invidious/views/privacy.ecr b/src/invidious/views/privacy.ecr index 79206c56..f273b250 100644 --- a/src/invidious/views/privacy.ecr +++ b/src/invidious/views/privacy.ecr @@ -3,73 +3,73 @@ <% end %>
-<%= Markdown.to_html(<<-END_PRIVACY_POLICY - ## Privacy + <%= Markdown.to_html(<<-END_PRIVACY_POLICY + ## Privacy - This document concerns what data you provide to this website, the purpose of the data, how the data is stored, and how the data can be removed. + This document concerns what data you provide to this website, the purpose of the data, how the data is stored, and how the data can be removed. - ### Data you directly provide + ### Data you directly provide - Data that you provide to the website for the purpose of the site's operation (for example: an account name, account password, or channel subscription) will be stored in the website's database until the user decides to remove it. This data will not be intentionally shared with anyone or anything. + Data that you provide to the website for the purpose of the site's operation (for example: an account name, account password, or channel subscription) will be stored in the website's database until the user decides to remove it. This data will not be intentionally shared with anyone or anything. - Information stored about a registered user is limited to: + Information stored about a registered user is limited to: - - a list of session tokens for remaining logged in across devices - - the last time an account was updated (to provide accurate notifications) - - a list of video IDs identifying notifications from a user's subscriptions - - a list of channel UCIDs the user is subscribed to - - a user ID (for persistent storage of subscriptions and preferences) - - a json object containing user preferences - - a hashed password if applicable (not present on google accounts) - - a randomly generated token for providing an RSS feed of a user's subscriptions - - a list of video IDs identifying watched videos + - a list of session tokens for remaining logged in across devices + - the last time an account was updated (to provide accurate notifications) + - a list of video IDs identifying notifications from a user's subscriptions + - a list of channel UCIDs the user is subscribed to + - a user ID (for persistent storage of subscriptions and preferences) + - a json object containing user preferences + - a hashed password if applicable (not present on google accounts) + - a randomly generated token for providing an RSS feed of a user's subscriptions + - a list of video IDs identifying watched videos - The above list reflects [this code](https://github.com/omarroth/invidious/blob/master/src/invidious/users.cr#L14-L51). + The above list reflects [this code](https://github.com/omarroth/invidious/blob/master/src/invidious/users.cr#L14-L51). - Users can clear their watch history using the [clear watch history](/clear_watch_history) page. + Users can clear their watch history using the [clear watch history](/clear_watch_history) page. - If a user is logged in with a Google account, no password will ever be stored. This website uses the session token provided by Google to identify a user, but does not store the information required to make requests on a user's behalf without their knowledge or consent. + If a user is logged in with a Google account, no password will ever be stored. This website uses the session token provided by Google to identify a user, but does not store the information required to make requests on a user's behalf without their knowledge or consent. - ### Data you passively provide + ### Data you passively provide - When you request any resource from this website (for example: a page, a font, an image, or an API endpoint) information about the request may be logged. + When you request any resource from this website (for example: a page, a font, an image, or an API endpoint) information about the request may be logged. - Information about a request is limited to: + Information about a request is limited to: - - the time the request was made - - the status code of the response - - the method of the request - - the requested URL - - how long it took to complete the request. + - the time the request was made + - the status code of the response + - the method of the request + - the requested URL + - how long it took to complete the request. - No identifying information is logged, such as the visitor's cookie, user-agent, or IP address. Here are a couple lines to serve as an example: + No identifying information is logged, such as the visitor's cookie, user-agent, or IP address. Here are a couple lines to serve as an example: - ``` - 2019-01-19 16:37:47 +00:00 200 GET /api/v1/comments/xrlETJYzH-c?format=html&hl=en-US 1345.88ms - 2019-01-19 16:37:53 +00:00 200 GET /vi/r5P-f5arPXE/maxres.jpg 1085.41ms - 2019-01-19 16:37:54 +00:00 200 GET /watch 7.04ms - ``` + ``` + 2019-01-19 16:37:47 +00:00 200 GET /api/v1/comments/xrlETJYzH-c?format=html&hl=en-US 1345.88ms + 2019-01-19 16:37:53 +00:00 200 GET /vi/r5P-f5arPXE/maxres.jpg 1085.41ms + 2019-01-19 16:37:54 +00:00 200 GET /watch 7.04ms + ``` - This website does not store the visitor's user-agent or IP address and does not use fingerprinting, advertisements, or tracking of any form. + This website does not store the visitor's user-agent or IP address and does not use fingerprinting, advertisements, or tracking of any form. - This website provides links to googlevideo.com to provide audio and video playback. googlevideo.com is owned by Google and is subject to their [privacy policy](https://policies.google.com/privacy). + This website provides links to googlevideo.com to provide audio and video playback. googlevideo.com is owned by Google and is subject to their [privacy policy](https://policies.google.com/privacy). - ### Data stored in your browser + ### Data stored in your browser - This website uses browser cookies to authenticate registered users. This data consists of: + This website uses browser cookies to authenticate registered users. This data consists of: - - An account token to keep you logged into the website between visits, which is sent when any page is loaded while you are logged in + - An account token to keep you logged into the website between visits, which is sent when any page is loaded while you are logged in - This website also provides an option to store site preferences, such as the theme or locale, without an account. Using this feature will store a cookie in the visitor's browser containing their preferences. This cookie is sent on every request and does not contain any identifying information. + This website also provides an option to store site preferences, such as the theme or locale, without an account. Using this feature will store a cookie in the visitor's browser containing their preferences. This cookie is sent on every request and does not contain any identifying information. - You can remove this data from your browser by logging out of this website, or by using your browser's cookie-related controls to delete the data. + You can remove this data from your browser by logging out of this website, or by using your browser's cookie-related controls to delete the data. - ### Removal of data + ### Removal of data - To remove data stored in your browser, you can log out of the website, or you can use your browser's cookie-related controls to delete the data. + To remove data stored in your browser, you can log out of the website, or you can use your browser's cookie-related controls to delete the data. - To remove data that has been stored in the website's database, you can use the [delete my account](/delete_account) page. - END_PRIVACY_POLICY - ) -%> -
\ No newline at end of file + To remove data that has been stored in the website's database, you can use the [delete my account](/delete_account) page. + END_PRIVACY_POLICY + ) + %> +
diff --git a/src/invidious/views/search.ecr b/src/invidious/views/search.ecr index 4d943127..f08444b3 100644 --- a/src/invidious/views/search.ecr +++ b/src/invidious/views/search.ecr @@ -3,27 +3,27 @@ <% end %>
-<% videos.each_slice(4) do |slice| %> - <% slice.each do |item| %> - <%= rendered "components/item" %> + <% videos.each_slice(4) do |slice| %> + <% slice.each do |item| %> + <%= rendered "components/item" %> + <% end %> <% end %> -<% end %>
- <% if page >= 2 %> - - <%= translate(locale, "Previous page") %> - - <% end %> + <% if page >= 2 %> + + <%= translate(locale, "Previous page") %> + + <% end %>
-
- <% if count >= 20 %> - - <%= translate(locale, "Next page") %> - - <% end %> +
+ <% if count >= 20 %> + + <%= translate(locale, "Next page") %> + + <% end %>
diff --git a/src/invidious/views/subscription_manager.ecr b/src/invidious/views/subscription_manager.ecr index ad572968..6e015738 100644 --- a/src/invidious/views/subscription_manager.ecr +++ b/src/invidious/views/subscription_manager.ecr @@ -5,70 +5,78 @@ <% subscriptions.each do |channel| %> -
-
-
-

- <%= channel.author %> -

+
+
+ +
+
+

+
" method="post"> + "> + + "> + +
+

+
-
-
-

-
" method="post"> - "> - - "> - -
-

-
-
- <% if subscriptions[-1].author != channel.author %> -
- <% end %> -
+ <% if subscriptions[-1].author != channel.author %> +
+ <% end %> +
<% end %> \ No newline at end of file + diff --git a/src/invidious/views/subscriptions.ecr b/src/invidious/views/subscriptions.ecr index 5f0f7680..806e6124 100644 --- a/src/invidious/views/subscriptions.ecr +++ b/src/invidious/views/subscriptions.ecr @@ -11,32 +11,34 @@ <%= translate(locale, "Manage subscriptions") %>
-
+ -
+

-
<%= translate(locale, "`x` unseen notifications", "#{notifications.size}") %>
+
+ <%= translate(locale, "`x` unseen notifications", "#{notifications.size}") %> +
<% if !notifications.empty? %> -
-
-
+
+
+
<% end %>
-<% notifications.each_slice(4) do |slice| %> - <% slice.each do |item| %> - <%= rendered "components/item" %> - <% end %> -<% end %> + <% notifications.each_slice(4) do |slice| %> + <% slice.each do |item| %> + <%= rendered "components/item" %> + <% end %> + <% end %>
@@ -44,30 +46,31 @@
-<% videos.each_slice(4) do |slice| %> - <% slice.each do |item| %> - <%= rendered "components/item" %> - <% end %> -<% end %> + <% videos.each_slice(4) do |slice| %> + <% slice.each do |item| %> + <%= rendered "components/item" %> + <% end %> + <% end %>
\ No newline at end of file + diff --git a/src/invidious/views/top.ecr b/src/invidious/views/top.ecr index 44faf706..d5fb3de6 100644 --- a/src/invidious/views/top.ecr +++ b/src/invidious/views/top.ecr @@ -1,14 +1,20 @@ <% content_for "header" do %> "> -<% if config.default_home != "Top" %><%= translate(locale, "Top") %> - <% end %>Invidious + + <% if config.default_home != "Top" %> + <%= translate(locale, "Top") %> - Invidious + <% else %> + Invidious + <% end %> + <% end %> <%= rendered "components/feed_menu" %>
-<% top_videos.each_slice(4) do |slice| %> - <% slice.each do |item| %> - <%= rendered "components/item" %> - <% end %> -<% end %> + <% top_videos.each_slice(4) do |slice| %> + <% slice.each do |item| %> + <%= rendered "components/item" %> + <% end %> + <% end %>
diff --git a/src/invidious/views/trending.ecr b/src/invidious/views/trending.ecr index d6c25266..d7784928 100644 --- a/src/invidious/views/trending.ecr +++ b/src/invidious/views/trending.ecr @@ -1,6 +1,12 @@ <% content_for "header" do %> "> -<% if config.default_home != "Trending" %><%= translate(locale, "Trending") %> - <% end %>Invidious + + <% if config.default_home != "Trending" %> + <%= translate(locale, "Trending") %> - Invidious + <% else %> + Invidious + <% end %> + <% end %> <%= rendered "components/feed_menu" %> @@ -8,19 +14,21 @@
-
+
<% {"Default", "Music", "Gaming", "News", "Movies"}.each do |option| %>
<% if trending_type == option %> - <%= translate(locale, option) %> + <%= translate(locale, option) %> <% else %> - - <%= translate(locale, option) %> - + + <%= translate(locale, option) %> + <% end %>
<% end %> @@ -33,9 +41,9 @@
-<% trending.each_slice(4) do |slice| %> - <% slice.each do |item| %> - <%= rendered "components/item" %> - <% end %> -<% end %> + <% trending.each_slice(4) do |slice| %> + <% slice.each do |item| %> + <%= rendered "components/item" %> + <% end %> + <% end %>
diff --git a/src/invidious/views/watch.ecr b/src/invidious/views/watch.ecr index f74cf594..856752ce 100644 --- a/src/invidious/views/watch.ecr +++ b/src/invidious/views/watch.ecr @@ -28,106 +28,114 @@ <% end %>
- <%= rendered "components/player" %> + <%= rendered "components/player" %>
-

- <%= HTML.escape(video.title) %> - <% if params.listen %> - " href="/watch?<%= env.params.query %>&listen=0"> - - - <% else %> - " href="/watch?<%= env.params.query %>&listen=1"> - - +

+ <%= HTML.escape(video.title) %> + <% if params.listen %> + " href="/watch?<%= env.params.query %>&listen=0"> + + + <% else %> + " href="/watch?<%= env.params.query %>&listen=1"> + + + <% end %> +

+ + <% if !video.is_listed %> +

+ <%= translate(locale, "Unlisted") %> +

+ <% end %> + + <% if !reason.empty? %> +

+ <%= reason %> +

<% end %> - -<% if !video.is_listed %> -

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

-<% end %> -<% if !reason.empty? %> -

<%= reason %>

-<% end %>
-

<%= translate(locale, "Watch on YouTube") %>

- <% if params.annotations %> - - <%= translate(locale, "Hide annotations") %> - - <% else %> - - <%=translate(locale, "Show annotations")%> - - <% end %> + <%= translate(locale, "Watch on YouTube") %> +

+

+ <% if params.annotations %> + + <%= translate(locale, "Hide annotations") %> + + <% else %> + + <%=translate(locale, "Show annotations")%> + + <% end %>

<% if CONFIG.dmca_content.includes? video.id %> -

Download is disabled.

+

<%= translate(locale, "Download is disabled.") %>

<% else %> -
-
- - -
+ +
+ + +
- -
+ + <% end %>

<%= number_with_separator(video.views) %>

<%= number_with_separator(video.likes) %>

<%= number_with_separator(video.dislikes) %>

-

<%= translate(locale, "Genre: ") %> - <% if video.genre_url.empty? %> - <%= video.genre %> - <% else %> - <%= video.genre %> - <% end %> +

<%= translate(locale, "Genre: ") %> + <% if video.genre_url.empty? %> + <%= video.genre %> + <% else %> + <%= video.genre %> + <% end %>

<% if !video.license.empty? %> -

<%= translate(locale, "License: ") %><%= video.license %>

+

<%= translate(locale, "License: ") %><%= video.license %>

<% end %> -

<%= translate(locale, "Family friendly? ") %><%= translate_bool(locale, video.is_family_friendly) %>

-

<%= translate(locale, "Wilson score: ") %><%= video.wilson_score.round(4) %>

-

<%= translate(locale, "Rating: ") %><%= rating.round(4) %> / 5

-

<%= translate(locale, "Engagement: ") %><%= engagement.round(2) %>%

+

<%= translate(locale, "Family friendly? ") %><%= translate_bool(locale, video.is_family_friendly) %>

+

<%= translate(locale, "Wilson score: ") %><%= video.wilson_score.round(4) %>

+

<%= translate(locale, "Rating: ") %><%= rating.round(4) %> / 5

+

<%= translate(locale, "Engagement: ") %><%= engagement.round(2) %>%

<% if video.allowed_regions.size != REGIONS.size %> -

- <% if video.allowed_regions.size < REGIONS.size / 2 %> - <%= translate(locale, "Whitelisted regions: ") %><%= video.allowed_regions.join(", ") %> - <% else %> - <%= translate(locale, "Blacklisted regions: ") %><%= (REGIONS.to_a - video.allowed_regions).join(", ") %> - <% end %> +

+ <% if video.allowed_regions.size < REGIONS.size / 2 %> + <%= translate(locale, "Whitelisted regions: ") %><%= video.allowed_regions.join(", ") %> + <% else %> + <%= translate(locale, "Blacklisted regions: ") %><%= (REGIONS.to_a - video.allowed_regions).join(", ") %> + <% end %>

<% end %>
@@ -140,96 +148,100 @@

<%= video.author %>

+ <% ucid = video.ucid %> <% author = video.author %> <% sub_count_text = video.sub_count_text %> <%= rendered "components/subscribe_widget" %> +

<%= translate(locale, "Shared `x`", video.published.to_s("%B %-d, %Y")) %>

+
<%= video.description %>
+
+
- <% if params.related_videos || plid %> - <% end %>