diff --git a/assets/css/default.css b/assets/css/default.css index 919d64c32..590f70446 100644 --- a/assets/css/default.css +++ b/assets/css/default.css @@ -671,6 +671,11 @@ body.dark-theme { color: #f0f0f0; } +.dark-theme .length-watch-page { + background-color: rgba(255, 255, 255, 0.12); + color: #f0f0f0; +} + .dark-theme .pure-form legend { color: #f0f0f0; } @@ -731,6 +736,11 @@ body.dark-theme { color: #f0f0f0; } + .no-theme .length-watch-page { + background-color: rgba(255, 255, 255, 0.12); + color: #f0f0f0; + } + .no-theme .pure-form legend { color: #f0f0f0; } @@ -927,3 +937,18 @@ h1, h2, h3, h4, h5, p, #comments-turned-off-on-video-message > p, #comments-disabled-message > p { text-align: center; } + +.length-watch-page{ + position: relative; + background-color: rgba(35, 35, 35, 0.75); + color: #fff; + border-radius: 3px; + padding: 4px 10px; + font-size: 20px; + right: 0.25em; + bottom: 0.25em; + margin-left: 10px; + margin-right: 10px; + -webkit-user-select: none; + user-select: none; +} diff --git a/src/invidious/helpers/utils.cr b/src/invidious/helpers/utils.cr index 0a443bc80..1cb052922 100644 --- a/src/invidious/helpers/utils.cr +++ b/src/invidious/helpers/utils.cr @@ -1,5 +1,20 @@ PUBSUB_URL = URI.parse("https://pubsubhubbub.appspot.com") +# 2026-11-01: Add support for locales! +def video_length_abbreviated(length) + if length.days > 0 + length_abbreviated = "#{length.days} d #{length.hours} hr #{length.minutes} min" + elsif length.hours > 0 + length_abbreviated = "#{length.hours} h #{length.minutes} min" + elsif length.minutes > 0 + length_abbreviated = "#{length.minutes} min" + else + length_abbreviated = "#{length.seconds} seconds" + end + + length_abbreviated +end + def decode_length_seconds(string) length_seconds = string.gsub(/[^0-9:]/, "") return 0_i32 if length_seconds.empty? diff --git a/src/invidious/views/watch.ecr b/src/invidious/views/watch.ecr index d6644ad95..f9a11fde2 100644 --- a/src/invidious/views/watch.ecr +++ b/src/invidious/views/watch.ecr @@ -84,6 +84,11 @@ we're going to need to do it here in order to allow for translations.