Add support for community polls to Invidious

This commit is contained in:
syeopite 2021-07-27 00:58:44 -07:00
parent ed4cfd1060
commit 2af442ca2f
No known key found for this signature in database
GPG key ID: 6FA616E5A5294A82
42 changed files with 258 additions and 42 deletions

47
assets/css/community.css Normal file
View file

@ -0,0 +1,47 @@
.community-poll {
padding: 0px 10px;
border-radius: 5px;
display: flex;
flex-direction: column;
}
.community-poll-item {
padding: 5px;
border-radius: 5px;
}
.dark-theme .community-poll {
background-color: #363636;
}
.dark-theme .community-poll-item {
background-color: #3d3d3d;
}
@media (prefers-color-scheme: dark) {
.no-theme .community-poll {
background-color: #363636;
}
.no-theme .community-poll-item {
background-color: #3d3d3d;
}
}
.light-theme .community-poll {
background-color: #f2f2f2;
}
.light-theme .community-poll-item {
background-color: #e6e6e6;
}
@media (prefers-color-scheme: light) {
.no-theme .community-poll {
background-color: #f2f2f2;
}
.no-theme .community-poll-item {
background-color: #e6e6e6;
}
}

View file

@ -423,5 +423,9 @@
"Current version: ": "الإصدار الحالي: ",
"next_steps_error_message": "بعد ذلك يجب أن تحاول: ",
"next_steps_error_message_refresh": "تحديث",
"next_steps_error_message_go_to_youtube": "انتقل إلى يوتيوب"
"next_steps_error_message_go_to_youtube": "انتقل إلى يوتيوب",
"community-poll-votes": {
"([^.,0-9]|^)1([^.,0-9]|$)": "",
"": ""
}
}

View file

@ -423,5 +423,9 @@
"Current version: ": "",
"next_steps_error_message": "",
"next_steps_error_message_refresh": "",
"next_steps_error_message_go_to_youtube": ""
"next_steps_error_message_go_to_youtube": "",
"community-poll-votes": {
"([^.,0-9]|^)1([^.,0-9]|$)": "",
"": ""
}
}

View file

@ -423,5 +423,9 @@
"Current version: ": "",
"next_steps_error_message": "",
"next_steps_error_message_refresh": "",
"next_steps_error_message_go_to_youtube": ""
"next_steps_error_message_go_to_youtube": "",
"community-poll-votes": {
"([^.,0-9]|^)1([^.,0-9]|$)": "",
"": ""
}
}

View file

@ -423,5 +423,9 @@
"Current version: ": "",
"next_steps_error_message": "",
"next_steps_error_message_refresh": "",
"next_steps_error_message_go_to_youtube": ""
"next_steps_error_message_go_to_youtube": "",
"community-poll-votes": {
"([^.,0-9]|^)1([^.,0-9]|$)": "",
"": ""
}
}

View file

@ -423,5 +423,9 @@
"Current version: ": "Aktuelle Version: ",
"next_steps_error_message": "Danach folgendes versuchen: ",
"next_steps_error_message_refresh": "Neuladen",
"next_steps_error_message_go_to_youtube": "Zu YouTube gehen"
"next_steps_error_message_go_to_youtube": "Zu YouTube gehen",
"community-poll-votes": {
"([^.,0-9]|^)1([^.,0-9]|$)": "",
"": ""
}
}

View file

@ -423,5 +423,9 @@
"Current version: ": "Τρέχουσα έκδοση: ",
"next_steps_error_message": "",
"next_steps_error_message_refresh": "",
"next_steps_error_message_go_to_youtube": ""
"next_steps_error_message_go_to_youtube": "",
"community-poll-votes": {
"([^.,0-9]|^)1([^.,0-9]|$)": "",
"": ""
}
}

View file

@ -423,5 +423,9 @@
"Current version: ": "Current version: ",
"next_steps_error_message": "After which you should try to: ",
"next_steps_error_message_refresh": "Refresh",
"next_steps_error_message_go_to_youtube": "Go to YouTube"
"next_steps_error_message_go_to_youtube": "Go to YouTube",
"community-poll-votes": {
"([^.,0-9]|^)1([^.,0-9]|$)": "`x` vote",
"": "`x` votes"
}
}

View file

@ -421,7 +421,11 @@
"hdr": "granddinamikgama",
"filter": "filtri",
"Current version: ": "Nuna versio: ",
"next_steps_error_message": "Poste, vi provu: ",
"next_steps_error_message": "",
"next_steps_error_message_refresh": "Reŝargi",
"next_steps_error_message_go_to_youtube": "Iri al JuTubo"
"next_steps_error_message_go_to_youtube": "Iri al JuTubo",
"community-poll-votes": {
"([^.,0-9]|^)1([^.,0-9]|$)": "",
"": ""
}
}

View file

@ -421,7 +421,11 @@
"hdr": "hdr",
"filter": "filtro",
"Current version: ": "Versión actual: ",
"next_steps_error_message": "Después de lo cual deberías intentar: ",
"next_steps_error_message": "",
"next_steps_error_message_refresh": "Recargar",
"next_steps_error_message_go_to_youtube": "Ir a YouTube"
"next_steps_error_message_go_to_youtube": "Ir a YouTube",
"community-poll-votes": {
"([^.,0-9]|^)1([^.,0-9]|$)": "",
"": ""
}
}

View file

@ -423,5 +423,9 @@
"Current version: ": "",
"next_steps_error_message": "",
"next_steps_error_message_refresh": "",
"next_steps_error_message_go_to_youtube": ""
"next_steps_error_message_go_to_youtube": "",
"community-poll-votes": {
"([^.,0-9]|^)1([^.,0-9]|$)": "",
"": ""
}
}

View file

@ -423,5 +423,9 @@
"Current version: ": "نسخه فعلی: ",
"next_steps_error_message": "",
"next_steps_error_message_refresh": "",
"next_steps_error_message_go_to_youtube": ""
"next_steps_error_message_go_to_youtube": "",
"community-poll-votes": {
"([^.,0-9]|^)1([^.,0-9]|$)": "",
"": ""
}
}

View file

@ -423,5 +423,9 @@
"Current version: ": "Tämänhetkinen versio: ",
"next_steps_error_message": "Sinun tulisi kokeilla seuraavia: ",
"next_steps_error_message_refresh": "Päivitä",
"next_steps_error_message_go_to_youtube": "Siirry YouTubeen"
"next_steps_error_message_go_to_youtube": "Siirry YouTubeen",
"community-poll-votes": {
"([^.,0-9]|^)1([^.,0-9]|$)": "",
"": ""
}
}

View file

@ -423,5 +423,9 @@
"Current version: ": "Version actuelle : ",
"next_steps_error_message": "Vous pouvez essayer de : ",
"next_steps_error_message_refresh": "Rafraîchir la page",
"next_steps_error_message_go_to_youtube": "Aller sur YouTube"
"next_steps_error_message_go_to_youtube": "Aller sur YouTube",
"community-poll-votes": {
"([^.,0-9]|^)1([^.,0-9]|$)": "",
"": ""
}
}

View file

@ -423,5 +423,9 @@
"Current version: ": "הגרסה הנוכחית: ",
"next_steps_error_message": "",
"next_steps_error_message_refresh": "",
"next_steps_error_message_go_to_youtube": ""
"next_steps_error_message_go_to_youtube": "",
"community-poll-votes": {
"([^.,0-9]|^)1([^.,0-9]|$)": "",
"": ""
}
}

View file

@ -423,5 +423,9 @@
"Current version: ": "Trenutačna verzija: ",
"next_steps_error_message": "Nakon toga pokušaj sljedeće: ",
"next_steps_error_message_refresh": "Aktualiziraj stranicu",
"next_steps_error_message_go_to_youtube": "Idi na YouTube"
"next_steps_error_message_go_to_youtube": "Idi na YouTube",
"community-poll-votes": {
"([^.,0-9]|^)1([^.,0-9]|$)": "",
"": ""
}
}

View file

@ -423,5 +423,9 @@
"Current version: ": "Jelenlegi verzió: ",
"next_steps_error_message": "",
"next_steps_error_message_refresh": "",
"next_steps_error_message_go_to_youtube": ""
"next_steps_error_message_go_to_youtube": "",
"community-poll-votes": {
"([^.,0-9]|^)1([^.,0-9]|$)": "",
"": ""
}
}

View file

@ -423,5 +423,9 @@
"Current version: ": "Versi saat ini: ",
"next_steps_error_message": "Setelah itu Anda harus mencoba: ",
"next_steps_error_message_refresh": "Segarkan",
"next_steps_error_message_go_to_youtube": "Buka YouTube"
"next_steps_error_message_go_to_youtube": "Buka YouTube",
"community-poll-votes": {
"([^.,0-9]|^)1([^.,0-9]|$)": "",
"": ""
}
}

View file

@ -423,5 +423,9 @@
"Current version: ": "Núverandi útgáfa: ",
"next_steps_error_message": "",
"next_steps_error_message_refresh": "",
"next_steps_error_message_go_to_youtube": ""
"next_steps_error_message_go_to_youtube": "",
"community-poll-votes": {
"([^.,0-9]|^)1([^.,0-9]|$)": "",
"": ""
}
}

View file

@ -423,5 +423,9 @@
"Current version: ": "Versione attuale: ",
"next_steps_error_message": "",
"next_steps_error_message_refresh": "",
"next_steps_error_message_go_to_youtube": ""
"next_steps_error_message_go_to_youtube": "",
"community-poll-votes": {
"([^.,0-9]|^)1([^.,0-9]|$)": "",
"": ""
}
}

View file

@ -423,5 +423,9 @@
"Current version: ": "現在のバージョン: ",
"next_steps_error_message": "下記のものを試して下さい: ",
"next_steps_error_message_refresh": "再読込",
"next_steps_error_message_go_to_youtube": "YouTubeへ"
"next_steps_error_message_go_to_youtube": "YouTubeへ",
"community-poll-votes": {
"([^.,0-9]|^)1([^.,0-9]|$)": "",
"": ""
}
}

View file

@ -423,5 +423,9 @@
"today": "오늘",
"hour": "지난 1시간",
"sort": "정렬기준",
"features": "기능별"
"features": "기능별",
"community-poll-votes": {
"([^.,0-9]|^)1([^.,0-9]|$)": "",
"": ""
}
}

View file

@ -423,5 +423,9 @@
"Current version: ": "Dabartinė versija: ",
"next_steps_error_message": "Po to turėtumėte pabandyti: ",
"next_steps_error_message_refresh": "Atnaujinti",
"next_steps_error_message_go_to_youtube": "Eiti į YouTube"
"next_steps_error_message_go_to_youtube": "Eiti į YouTube",
"community-poll-votes": {
"([^.,0-9]|^)1([^.,0-9]|$)": "",
"": ""
}
}

View file

@ -423,5 +423,9 @@
"Current version: ": "Gjeldende versjon: ",
"next_steps_error_message": "Etterpå bør du prøve dette: ",
"next_steps_error_message_refresh": "Gjenoppfrisk",
"next_steps_error_message_go_to_youtube": "Gå til YouTube"
"next_steps_error_message_go_to_youtube": "Gå til YouTube",
"community-poll-votes": {
"([^.,0-9]|^)1([^.,0-9]|$)": "",
"": ""
}
}

View file

@ -423,5 +423,9 @@
"Current version: ": "Huidige versie: ",
"next_steps_error_message": "",
"next_steps_error_message_refresh": "",
"next_steps_error_message_go_to_youtube": ""
"next_steps_error_message_go_to_youtube": "",
"community-poll-votes": {
"([^.,0-9]|^)1([^.,0-9]|$)": "",
"": ""
}
}

View file

@ -423,5 +423,9 @@
"Current version: ": "Aktualna wersja: ",
"next_steps_error_message": "Po czym powinien*ś spróbować: ",
"next_steps_error_message_refresh": "Odśwież",
"next_steps_error_message_go_to_youtube": "Przejdź do YouTube"
"next_steps_error_message_go_to_youtube": "Przejdź do YouTube",
"community-poll-votes": {
"([^.,0-9]|^)1([^.,0-9]|$)": "",
"": ""
}
}

View file

@ -423,5 +423,9 @@
"Current version: ": "Versão atual: ",
"next_steps_error_message": "Depois disso, você deve tentar: ",
"next_steps_error_message_refresh": "Atualizar",
"next_steps_error_message_go_to_youtube": "Ir para o YouTube"
"next_steps_error_message_go_to_youtube": "Ir para o YouTube",
"community-poll-votes": {
"([^.,0-9]|^)1([^.,0-9]|$)": "",
"": ""
}
}

View file

@ -423,5 +423,9 @@
"Current version: ": "Versão atual: ",
"next_steps_error_message": "Pode tentar as seguintes opções: ",
"next_steps_error_message_refresh": "Atualizar",
"next_steps_error_message_go_to_youtube": "Ir ao YouTube"
"next_steps_error_message_go_to_youtube": "Ir ao YouTube",
"community-poll-votes": {
"([^.,0-9]|^)1([^.,0-9]|$)": "",
"": ""
}
}

View file

@ -423,5 +423,9 @@
"`x` subscribers": {
"": "`x` subscritores",
"([^.,0-9]|^)1([^.,0-9]|$)": "`x` subscritores"
},
"community-poll-votes": {
"([^.,0-9]|^)1([^.,0-9]|$)": "",
"": ""
}
}

View file

@ -423,5 +423,9 @@
"Current version: ": "Versiunea actuală: ",
"next_steps_error_message": "",
"next_steps_error_message_refresh": "",
"next_steps_error_message_go_to_youtube": ""
"next_steps_error_message_go_to_youtube": "",
"community-poll-votes": {
"([^.,0-9]|^)1([^.,0-9]|$)": "",
"": ""
}
}

View file

@ -423,5 +423,9 @@
"Current version: ": "Текущая версия: ",
"next_steps_error_message": "После чего следует попробовать: ",
"next_steps_error_message_refresh": "Обновить",
"next_steps_error_message_go_to_youtube": "Перейти на YouTube"
"next_steps_error_message_go_to_youtube": "Перейти на YouTube",
"community-poll-votes": {
"([^.,0-9]|^)1([^.,0-9]|$)": "",
"": ""
}
}

View file

@ -423,5 +423,9 @@
"Current version: ": "",
"next_steps_error_message": "",
"next_steps_error_message_refresh": "",
"next_steps_error_message_go_to_youtube": ""
"next_steps_error_message_go_to_youtube": "",
"community-poll-votes": {
"([^.,0-9]|^)1([^.,0-9]|$)": "",
"": ""
}
}

View file

@ -423,5 +423,9 @@
"Current version: ": "",
"next_steps_error_message": "",
"next_steps_error_message_refresh": "",
"next_steps_error_message_go_to_youtube": ""
"next_steps_error_message_go_to_youtube": "",
"community-poll-votes": {
"([^.,0-9]|^)1([^.,0-9]|$)": "",
"": ""
}
}

View file

@ -423,5 +423,9 @@
"Current version: ": "",
"next_steps_error_message": "",
"next_steps_error_message_refresh": "",
"next_steps_error_message_go_to_youtube": ""
"next_steps_error_message_go_to_youtube": "",
"community-poll-votes": {
"([^.,0-9]|^)1([^.,0-9]|$)": "",
"": ""
}
}

View file

@ -423,5 +423,9 @@
"Current version: ": "Тренутна верзија: ",
"next_steps_error_message": "",
"next_steps_error_message_refresh": "",
"next_steps_error_message_go_to_youtube": ""
"next_steps_error_message_go_to_youtube": "",
"community-poll-votes": {
"([^.,0-9]|^)1([^.,0-9]|$)": "",
"": ""
}
}

View file

@ -423,5 +423,9 @@
"Current version: ": "Nuvarande version: ",
"next_steps_error_message": "",
"next_steps_error_message_refresh": "Uppdatera",
"next_steps_error_message_go_to_youtube": "Gå till Youtube"
"next_steps_error_message_go_to_youtube": "Gå till Youtube",
"community-poll-votes": {
"([^.,0-9]|^)1([^.,0-9]|$)": "",
"": ""
}
}

View file

@ -423,5 +423,9 @@
"Current version: ": "Şu anki sürüm: ",
"next_steps_error_message": "Bundan sonra şunları denemelisiniz: ",
"next_steps_error_message_refresh": "Yenile",
"next_steps_error_message_go_to_youtube": "YouTube'a git"
"next_steps_error_message_go_to_youtube": "YouTube'a git",
"community-poll-votes": {
"([^.,0-9]|^)1([^.,0-9]|$)": "",
"": ""
}
}

View file

@ -423,5 +423,9 @@
"Current version: ": "Поточна версія: ",
"next_steps_error_message": "",
"next_steps_error_message_refresh": "",
"next_steps_error_message_go_to_youtube": ""
"next_steps_error_message_go_to_youtube": "",
"community-poll-votes": {
"([^.,0-9]|^)1([^.,0-9]|$)": "",
"": ""
}
}

View file

@ -423,5 +423,9 @@
"Current version: ": "Phiên bản hiện tại: ",
"next_steps_error_message": "",
"next_steps_error_message_refresh": "",
"next_steps_error_message_go_to_youtube": ""
"next_steps_error_message_go_to_youtube": "",
"community-poll-votes": {
"([^.,0-9]|^)1([^.,0-9]|$)": "",
"": ""
}
}

View file

@ -423,5 +423,9 @@
"Current version: ": "当前版本: ",
"next_steps_error_message": "在此之后你应尝试: ",
"next_steps_error_message_refresh": "刷新",
"next_steps_error_message_go_to_youtube": "转到 YouTube"
"next_steps_error_message_go_to_youtube": "转到 YouTube",
"community-poll-votes": {
"([^.,0-9]|^)1([^.,0-9]|$)": "",
"": ""
}
}

View file

@ -423,5 +423,9 @@
"Current version: ": "目前版本: ",
"next_steps_error_message": "之後您應該嘗試: ",
"next_steps_error_message_refresh": "重新整理",
"next_steps_error_message_go_to_youtube": "到 YouTube"
"next_steps_error_message_go_to_youtube": "到 YouTube",
"community-poll-votes": {
"([^.,0-9]|^)1([^.,0-9]|$)": "",
"": ""
}
}

View file

@ -3,6 +3,7 @@
<% content_for "header" do %>
<title><%= author %> - Invidious</title>
<link rel="stylesheet" href="/css/community.css?v=<%= ASSET_COMMIT %>">
<% end %>
<% if channel.banner %>
@ -86,11 +87,19 @@
</div>
<% elsif attachment.is_a? YouTubeStructs::PlaylistRenderer %>
<% elsif attachment.is_a? YouTubeStructs::CommunityPoll %>
<span class="community-poll-metadata"><%-= translate(locale, "community-poll-votes", number_to_short_text(attachment.total_votes)) %></span>
<div class="community-poll">
<%- attachment.choices.each do |choice| %>
<p class="community-poll-item"><%-= choice%></p>
<%- end %>
</div>
<% elsif attachment.nil? %>
<% else %>
<img style="width: 90%" src="/ggpht<%= URI.parse(attachment).request_target%>"/>
<img style="width: 90%" src="/ggpht<%= URI.parse(attachment).request_target %>"/>
<% end %>
</div>
<% -%>
<div class="pure-menu pure-menu-horizontal">
<ul class="pure-menu-list">
<li class="pure-menu-item" id="likes" style="margin-right: 15px;"><i class="icon ion-ios-thumbs-up" style="margin-right: 5px;"></i><%-= thread.likes %></li>