Merge pull request #1977 from syeopite/add996

Change empty home page to search engine like layout
This commit is contained in:
TheFrenchGhosty 2021-04-17 17:02:47 +00:00 committed by GitHub
commit b9e57d0283
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
44 changed files with 132 additions and 60 deletions

View File

@ -178,7 +178,7 @@ img.thumbnail {
flex: 1; flex: 1;
} }
.navbar > .searchbar { .searchbar {
flex-grow: 2; /* take double the space of the other items */ flex-grow: 2; /* take double the space of the other items */
} }
@ -191,7 +191,7 @@ img.thumbnail {
display: inline; display: inline;
} }
.navbar > .searchbar .pure-form input[type="search"] { .searchbar .pure-form input[type="search"] {
margin-bottom: 1px; margin-bottom: 1px;
border-top: 0; border-top: 0;
@ -216,12 +216,12 @@ input[type="search"]::-webkit-search-cancel-button {
background-size: 14px; background-size: 14px;
} }
.navbar > .searchbar .pure-form fieldset { .searchbar .pure-form fieldset {
padding: 0; padding: 0;
} }
/* attract focus to the searchbar by adding a subtle transition */ /* attract focus to the searchbar by adding a subtle transition */
.navbar > .searchbar .pure-form input[type="search"]:focus { .searchbar .pure-form input[type="search"]:focus {
margin-bottom: 0px; margin-bottom: 0px;
border-bottom: 2px solid #aaa; border-bottom: 2px solid #aaa;
} }
@ -594,7 +594,7 @@ body.dark-theme {
color: #f0f0f0; color: #f0f0f0;
} }
.dark-theme .navbar > .searchbar input { .dark-theme .searchbar input {
background-color: inherit; background-color: inherit;
color: inherit; color: inherit;
} }
@ -633,7 +633,7 @@ body.dark-theme {
color: #f0f0f0; color: #f0f0f0;
} }
.no-theme .navbar > .searchbar input { .no-theme .searchbar input {
background-color: inherit; background-color: inherit;
color: inherit; color: inherit;
} }

16
assets/css/empty.css Normal file
View File

@ -0,0 +1,16 @@
#search-widget {
text-align: center;
margin: 20vh 0 50px 0;
}
#logo > h1 {
font-size: 3.5em;
margin: 0;
padding: 0;
}
@media screen and (max-width: 1500px) and (max-height: 1000px) {
#logo > h1 {
font-size: 10vmin;
}
}

View File

@ -310,6 +310,7 @@
"`x` seconds": "`x` ثوانى", "`x` seconds": "`x` ثوانى",
"Fallback comments: ": "التعليقات البديلة: ", "Fallback comments: ": "التعليقات البديلة: ",
"Popular": "الأكثر شعبية", "Popular": "الأكثر شعبية",
"Search": "",
"Top": "الأفضل", "Top": "الأفضل",
"About": "حول", "About": "حول",
"Rating: ": "التقييم: ", "Rating: ": "التقييم: ",

View File

@ -327,6 +327,7 @@
"`x` seconds.": "", "`x` seconds.": "",
"Fallback comments: ": "", "Fallback comments: ": "",
"Popular": "", "Popular": "",
"Search": "",
"Top": "", "Top": "",
"About": "", "About": "",
"Rating: ": "", "Rating: ": "",

View File

@ -361,6 +361,7 @@
}, },
"Fallback comments: ": "", "Fallback comments: ": "",
"Popular": "", "Popular": "",
"Search": "",
"Top": "", "Top": "",
"About": "Informace", "About": "Informace",
"Rating: ": "Hodnocení: ", "Rating: ": "Hodnocení: ",

View File

@ -361,6 +361,7 @@
}, },
"Fallback comments: ": "", "Fallback comments: ": "",
"Popular": "", "Popular": "",
"Search": "",
"Top": "", "Top": "",
"About": "", "About": "",
"Rating: ": "", "Rating: ": "",

View File

@ -310,6 +310,7 @@
"`x` seconds": "`x` Sekunden", "`x` seconds": "`x` Sekunden",
"Fallback comments: ": "Alternative Kommentare: ", "Fallback comments: ": "Alternative Kommentare: ",
"Popular": "Populär", "Popular": "Populär",
"Search": "",
"Top": "Top", "Top": "Top",
"About": "Über", "About": "Über",
"Rating: ": "Bewertung: ", "Rating: ": "Bewertung: ",

View File

@ -325,6 +325,7 @@
"`x` seconds.": "`x` δευτερόλεπτα.", "`x` seconds.": "`x` δευτερόλεπτα.",
"Fallback comments: ": "Εναλλακτικά σχόλια: ", "Fallback comments: ": "Εναλλακτικά σχόλια: ",
"Popular": "Δημοφιλή", "Popular": "Δημοφιλή",
"Search": "",
"Top": "Κορυφαία", "Top": "Κορυφαία",
"About": "Σχετικά", "About": "Σχετικά",
"Rating: ": "Aξιολόγηση: ", "Rating: ": "Aξιολόγηση: ",

View File

@ -361,6 +361,7 @@
}, },
"Fallback comments: ": "Fallback comments: ", "Fallback comments: ": "Fallback comments: ",
"Popular": "Popular", "Popular": "Popular",
"Search": "Search",
"Top": "Top", "Top": "Top",
"About": "About", "About": "About",
"Rating: ": "Rating: ", "Rating: ": "Rating: ",

View File

@ -310,6 +310,7 @@
"`x` seconds": "`x` sekundoj", "`x` seconds": "`x` sekundoj",
"Fallback comments: ": "Retrodefaŭltaj komentoj: ", "Fallback comments: ": "Retrodefaŭltaj komentoj: ",
"Popular": "Popularaj", "Popular": "Popularaj",
"Search": "",
"Top": "Supraj", "Top": "Supraj",
"About": "Pri", "About": "Pri",
"Rating: ": "Takso: ", "Rating: ": "Takso: ",

View File

@ -310,6 +310,7 @@
"`x` seconds": "`x` segundos", "`x` seconds": "`x` segundos",
"Fallback comments: ": "Comentarios alternativos: ", "Fallback comments: ": "Comentarios alternativos: ",
"Popular": "Populares", "Popular": "Populares",
"Search": "",
"Top": "Destacados", "Top": "Destacados",
"About": "Acerca de", "About": "Acerca de",
"Rating: ": "Valoración: ", "Rating: ": "Valoración: ",

View File

@ -310,6 +310,7 @@
"`x` seconds": "", "`x` seconds": "",
"Fallback comments: ": "", "Fallback comments: ": "",
"Popular": "", "Popular": "",
"Search": "",
"Top": "", "Top": "",
"About": "", "About": "",
"Rating: ": "", "Rating: ": "",

View File

@ -327,6 +327,7 @@
"`x` seconds.": "`x` ثانیه.", "`x` seconds.": "`x` ثانیه.",
"Fallback comments: ": "نظرات عقب گرد: ", "Fallback comments: ": "نظرات عقب گرد: ",
"Popular": "محبوب", "Popular": "محبوب",
"Search": "",
"Top": "بالا", "Top": "بالا",
"About": "درباره", "About": "درباره",
"Rating: ": "رتبه دهی: ", "Rating: ": "رتبه دهی: ",

View File

@ -327,6 +327,7 @@
"`x` seconds.": "`x` sekuntia.", "`x` seconds.": "`x` sekuntia.",
"Fallback comments: ": "varakommentit: ", "Fallback comments: ": "varakommentit: ",
"Popular": "Suosittu", "Popular": "Suosittu",
"Search": "",
"Top": "Ylin", "Top": "Ylin",
"About": "Tietoa", "About": "Tietoa",
"Rating: ": "Arvosana: ", "Rating: ": "Arvosana: ",

View File

@ -310,6 +310,7 @@
"`x` seconds": "`x` secondes", "`x` seconds": "`x` secondes",
"Fallback comments: ": "Commentaires alternatifs : ", "Fallback comments: ": "Commentaires alternatifs : ",
"Popular": "Populaire", "Popular": "Populaire",
"Search": "",
"Top": "Top", "Top": "Top",
"About": "À propos", "About": "À propos",
"Rating: ": "Évaluation : ", "Rating: ": "Évaluation : ",

View File

@ -361,6 +361,7 @@
}, },
"Fallback comments: ": "", "Fallback comments: ": "",
"Popular": "", "Popular": "",
"Search": "",
"Top": "Top", "Top": "Top",
"About": "על אודות", "About": "על אודות",
"Rating: ": "דירוג: ", "Rating: ": "דירוג: ",

View File

@ -361,6 +361,7 @@
}, },
"Fallback comments: ": "Alternativni komentari: ", "Fallback comments: ": "Alternativni komentari: ",
"Popular": "Popularni", "Popular": "Popularni",
"Search": "",
"Top": "Najbolji", "Top": "Najbolji",
"About": "Informacije", "About": "Informacije",
"Rating: ": "Ocjena: ", "Rating: ": "Ocjena: ",

View File

@ -309,6 +309,7 @@
"`x` seconds": "`x` másodperc", "`x` seconds": "`x` másodperc",
"Fallback comments: ": "Másodlagos kommentek: ", "Fallback comments: ": "Másodlagos kommentek: ",
"Popular": "Népszerű", "Popular": "Népszerű",
"Search": "",
"Top": "Top", "Top": "Top",
"About": "Leírás", "About": "Leírás",
"Rating: ": "Besorolás: ", "Rating: ": "Besorolás: ",

View File

@ -361,6 +361,7 @@
}, },
"Fallback comments: ": "", "Fallback comments: ": "",
"Popular": "Populer", "Popular": "Populer",
"Search": "",
"Top": "", "Top": "",
"About": "Ihwal", "About": "Ihwal",
"Rating: ": "Peringkat: ", "Rating: ": "Peringkat: ",

View File

@ -325,7 +325,7 @@
"`x` seconds.": "`x` sekúndur.", "`x` seconds.": "`x` sekúndur.",
"Fallback comments: ": "Vara ummæli: ", "Fallback comments: ": "Vara ummæli: ",
"Popular": "Vinsælt", "Popular": "Vinsælt",
"permalink": "Varanlegur tengill", "Search": "",
"Top": "Topp", "Top": "Topp",
"About": "Um", "About": "Um",
"Rating: ": "Einkunn: ", "Rating: ": "Einkunn: ",
@ -342,6 +342,7 @@
"%A %B %-d, %Y": "%A %B %-d, %Y", "%A %B %-d, %Y": "%A %B %-d, %Y",
"(edited)": "(breytt)", "(edited)": "(breytt)",
"YouTube comment permalink": "YouTube ummæli varanlegur tengill", "YouTube comment permalink": "YouTube ummæli varanlegur tengill",
"permalink": "Varanlegur tengill",
"`x` marked it with a ❤": "`x` merkti það með ❤", "`x` marked it with a ❤": "`x` merkti það með ❤",
"Audio mode": "Hljóð ham", "Audio mode": "Hljóð ham",
"Video mode": "Myndband ham", "Video mode": "Myndband ham",

View File

@ -325,6 +325,7 @@
"`x` seconds..": "`x` secondi.", "`x` seconds..": "`x` secondi.",
"Fallback comments: ": "Commenti alternativi: ", "Fallback comments: ": "Commenti alternativi: ",
"Popular": "Popolare", "Popular": "Popolare",
"Search": "",
"Top": "Top", "Top": "Top",
"About": "Al riguardo", "About": "Al riguardo",
"Rating: ": "Punteggio: ", "Rating: ": "Punteggio: ",

View File

@ -361,6 +361,7 @@
}, },
"Fallback comments: ": "フォールバック時のコメント: ", "Fallback comments: ": "フォールバック時のコメント: ",
"Popular": "人気", "Popular": "人気",
"Search": "",
"Top": "トップ", "Top": "トップ",
"About": "このサービスについて", "About": "このサービスについて",
"Rating: ": "評価: ", "Rating: ": "評価: ",

View File

@ -310,6 +310,7 @@
"`x` seconds": "`x` sekunder", "`x` seconds": "`x` sekunder",
"Fallback comments: ": "Tilbakefallskommentarer: ", "Fallback comments: ": "Tilbakefallskommentarer: ",
"Popular": "Populært", "Popular": "Populært",
"Search": "",
"Top": "Topp", "Top": "Topp",
"About": "Om", "About": "Om",
"Rating: ": "Vurdering: ", "Rating: ": "Vurdering: ",

View File

@ -310,6 +310,7 @@
"`x` seconds": "`x` seconden", "`x` seconds": "`x` seconden",
"Fallback comments: ": "Terugvallen op ", "Fallback comments: ": "Terugvallen op ",
"Popular": "Populair", "Popular": "Populair",
"Search": "",
"Top": "Top", "Top": "Top",
"About": "Over", "About": "Over",
"Rating: ": "Waardering: ", "Rating: ": "Waardering: ",

View File

@ -310,6 +310,7 @@
"`x` seconds": "`x` sekund", "`x` seconds": "`x` sekund",
"Fallback comments: ": "Zastępcze komentarze: ", "Fallback comments: ": "Zastępcze komentarze: ",
"Popular": "Popularne", "Popular": "Popularne",
"Search": "",
"Top": "Top", "Top": "Top",
"About": "Informacje", "About": "Informacje",
"Rating: ": "Ocena: ", "Rating: ": "Ocena: ",

View File

@ -310,6 +310,7 @@
"`x` seconds": "`x` segundos", "`x` seconds": "`x` segundos",
"Fallback comments: ": "Comentários alternativos: ", "Fallback comments: ": "Comentários alternativos: ",
"Popular": "Populares", "Popular": "Populares",
"Search": "",
"Top": "No topo", "Top": "No topo",
"About": "Sobre", "About": "Sobre",
"Rating: ": "Avaliação: ", "Rating: ": "Avaliação: ",

View File

@ -327,6 +327,7 @@
"`x` seconds..": "`x` segundos.", "`x` seconds..": "`x` segundos.",
"Fallback comments: ": "Comentários alternativos: ", "Fallback comments: ": "Comentários alternativos: ",
"Popular": "Popular", "Popular": "Popular",
"Search": "",
"Top": "Top", "Top": "Top",
"About": "Sobre", "About": "Sobre",
"Rating: ": "Avaliação: ", "Rating: ": "Avaliação: ",

View File

@ -310,6 +310,7 @@
"`x` seconds": "`x` secunde", "`x` seconds": "`x` secunde",
"Fallback comments: ": "Comentarii alternative: ", "Fallback comments: ": "Comentarii alternative: ",
"Popular": "Popular", "Popular": "Popular",
"Search": "",
"Top": "Top", "Top": "Top",
"About": "Despre", "About": "Despre",
"Rating: ": "Evaluare: ", "Rating: ": "Evaluare: ",

View File

@ -310,6 +310,7 @@
"`x` seconds": "`x` секунд", "`x` seconds": "`x` секунд",
"Fallback comments: ": "Резервные комментарии: ", "Fallback comments: ": "Резервные комментарии: ",
"Popular": "Популярное", "Popular": "Популярное",
"Search": "",
"Top": "Топ", "Top": "Топ",
"About": "О сайте", "About": "О сайте",
"Rating: ": "Рейтинг: ", "Rating: ": "Рейтинг: ",

View File

@ -361,6 +361,7 @@
}, },
"Fallback comments: ": "", "Fallback comments: ": "",
"Popular": "", "Popular": "",
"Search": "",
"Top": "", "Top": "",
"About": "", "About": "",
"Rating: ": "", "Rating: ": "",

View File

@ -327,6 +327,7 @@
"`x` seconds.": "", "`x` seconds.": "",
"Fallback comments: ": "", "Fallback comments: ": "",
"Popular": "", "Popular": "",
"Search": "",
"Top": "", "Top": "",
"About": "", "About": "",
"Rating: ": "", "Rating: ": "",

View File

@ -361,6 +361,7 @@
}, },
"Fallback comments: ": "", "Fallback comments: ": "",
"Popular": "", "Popular": "",
"Search": "",
"Top": "", "Top": "",
"About": "", "About": "",
"Rating: ": "", "Rating: ": "",

View File

@ -310,6 +310,7 @@
"`x` seconds.": "", "`x` seconds.": "",
"Fallback comments: ": "", "Fallback comments: ": "",
"Popular": "", "Popular": "",
"Search": "",
"Top": "", "Top": "",
"About": "", "About": "",
"Rating: ": "", "Rating: ": "",

View File

@ -310,6 +310,7 @@
"`x` seconds": "`x` sekunder", "`x` seconds": "`x` sekunder",
"Fallback comments: ": "Fallback-kommentarer: ", "Fallback comments: ": "Fallback-kommentarer: ",
"Popular": "Populärt", "Popular": "Populärt",
"Search": "",
"Top": "Topp", "Top": "Topp",
"About": "Om", "About": "Om",
"Rating: ": "Betyg: ", "Rating: ": "Betyg: ",

View File

@ -318,6 +318,7 @@
"`x` seconds": "`x` saniye", "`x` seconds": "`x` saniye",
"Fallback comments: ": "Yedek yorumlar: ", "Fallback comments: ": "Yedek yorumlar: ",
"Popular": "Popüler", "Popular": "Popüler",
"Search": "",
"Top": "Enler", "Top": "Enler",
"About": "Hakkında", "About": "Hakkında",
"Rating: ": "Değerlendirme: ", "Rating: ": "Değerlendirme: ",

View File

@ -310,6 +310,7 @@
"`x` seconds": "`x` секунд", "`x` seconds": "`x` секунд",
"Fallback comments: ": "Резервні коментарі: ", "Fallback comments: ": "Резервні коментарі: ",
"Popular": "Популярне", "Popular": "Популярне",
"Search": "",
"Top": "Топ", "Top": "Топ",
"About": "Про сайт", "About": "Про сайт",
"Rating: ": "Рейтинг: ", "Rating: ": "Рейтинг: ",

View File

@ -310,6 +310,7 @@
"`x` seconds": "`x` 秒", "`x` seconds": "`x` 秒",
"Fallback comments: ": "后备评论: ", "Fallback comments: ": "后备评论: ",
"Popular": "热门频道", "Popular": "热门频道",
"Search": "",
"Top": "热门视频", "Top": "热门视频",
"About": "关于", "About": "关于",
"Rating: ": "评分: ", "Rating: ": "评分: ",

View File

@ -325,6 +325,7 @@
"`x` seconds.": "`x` 秒", "`x` seconds.": "`x` 秒",
"Fallback comments: ": "汰退留言: ", "Fallback comments: ": "汰退留言: ",
"Popular": "熱門頻道", "Popular": "熱門頻道",
"Search": "",
"Top": "熱門影片", "Top": "熱門影片",
"About": "關於", "About": "關於",
"Rating: ": "評分: ", "Rating: ": "評分: ",

View File

@ -48,7 +48,8 @@ module JSON::Serializable
end end
end end
macro templated(filename, template = "template") macro templated(filename, template = "template", navbar_search = true)
navbar_search = {{navbar_search}}
render "src/invidious/views/#{{{filename}}}.ecr", "src/invidious/views/#{{{template}}}.ecr" render "src/invidious/views/#{{{filename}}}.ecr", "src/invidious/views/#{{{template}}}.ecr"
end end

View File

@ -22,7 +22,7 @@ class Invidious::Routes::Misc < Invidious::Routes::BaseRoute
env.redirect "/feed/popular" env.redirect "/feed/popular"
end end
else else
templated "empty" templated "search_homepage", navbar_search: false
end end
end end

View File

@ -1,8 +0,0 @@
<% content_for "header" do %>
<meta name="description" content="<%= translate(locale, "An alternative front-end to YouTube") %>">
<title>
Invidious
</title>
<% end %>
<%= rendered "components/feed_menu" %>

View File

@ -150,7 +150,7 @@
<label for="default_home"><%= translate(locale, "Default homepage: ") %></label> <label for="default_home"><%= translate(locale, "Default homepage: ") %></label>
<select name="default_home" id="default_home"> <select name="default_home" id="default_home">
<% feed_options.each do |option| %> <% feed_options.each do |option| %>
<option value="<%= option %>" <% if preferences.default_home == option %> selected <% end %>><%= translate(locale, option.blank? ? "none" : option) %></option> <option value="<%= option %>" <% if preferences.default_home == option %> selected <% end %>><%= translate(locale, option.blank? ? "Search" : option) %></option>
<% end %> <% end %>
</select> </select>
</div> </div>
@ -160,7 +160,7 @@
<% (feed_options.size - 1).times do |index| %> <% (feed_options.size - 1).times do |index| %>
<select name="feed_menu[<%= index %>]" id="feed_menu[<%= index %>]"> <select name="feed_menu[<%= index %>]" id="feed_menu[<%= index %>]">
<% feed_options.each do |option| %> <% feed_options.each do |option| %>
<option value="<%= option %>" <% if preferences.feed_menu[index]? == option %> selected <% end %>><%= translate(locale, option.blank? ? "none" : option) %></option> <option value="<%= option %>" <% if preferences.feed_menu[index]? == option %> selected <% end %>><%= translate(locale, option.blank? ? "Search" : option) %></option>
<% end %> <% end %>
</select> </select>
<% end %> <% end %>

View File

@ -0,0 +1,24 @@
<% content_for "header" do %>
<meta name="description" content="<%= translate(locale, "An alternative front-end to YouTube") %>">
<title>
Invidious
</title>
<link rel="stylesheet" href="/css/empty.css?v=<%= ASSET_COMMIT %>">
<% end %>
<%= rendered "components/feed_menu" %>
<div class="pure-g h-box" id="search-widget">
<div class="pure-u-1" id="logo">
<h1 href="/" class="pure-menu-heading">Invidious</h1>
</div>
<div class="pure-u-1-4"></div>
<div class="pure-u-1 pure-u-md-12-24 searchbar">
<form class="pure-form" action="/search" method="get">
<fieldset>
<input type="search" style="width:100%" name="q" placeholder="<%= translate(locale, "search") %>" value="<%= env.get?("search").try {|x| HTML.escape(x.as(String)) } %>">
</fieldset>
</form>
</div>
<div class="pure-u-1-4"></div>
</div>

View File

@ -28,16 +28,19 @@
<div class="pure-u-1 pure-u-md-2-24"></div> <div class="pure-u-1 pure-u-md-2-24"></div>
<div class="pure-u-1 pure-u-md-20-24", id="contents"> <div class="pure-u-1 pure-u-md-20-24", id="contents">
<div class="pure-g navbar h-box"> <div class="pure-g navbar h-box">
<div class="pure-u-1 pure-u-md-4-24"> <% if navbar_search %>
<a href="/" class="index-link pure-menu-heading">Invidious</a> <div class="pure-u-1 pure-u-md-4-24">
</div> <a href="/" class="index-link pure-menu-heading">Invidious</a>
<div class="pure-u-1 pure-u-md-12-24 searchbar"> </div>
<form class="pure-form" action="/search" method="get"> <div class="pure-u-1 pure-u-md-12-24 searchbar">
<fieldset> <form class="pure-form" action="/search" method="get">
<input type="search" style="width:100%" name="q" placeholder="<%= translate(locale, "search") %>" value="<%= env.get?("search").try {|x| HTML.escape(x.as(String)) } %>"> <fieldset>
</fieldset> <input type="search" style="width:100%" name="q" placeholder="<%= translate(locale, "search") %>" value="<%= env.get?("search").try {|x| HTML.escape(x.as(String)) } %>">
</form> </fieldset>
</div> </form>
</div>
<% end %>
<div class="pure-u-1 pure-u-md-8-24 user-field"> <div class="pure-u-1 pure-u-md-8-24 user-field">
<% if env.get? "user" %> <% if env.get? "user" %>
<div class="pure-u-1-4"> <div class="pure-u-1-4">