mirror of
https://github.com/iv-org/invidious
synced 2024-11-10 13:13:33 +01:00
Add menu for selecting trending page
This commit is contained in:
parent
1360d67c11
commit
0feb414a1d
@ -1743,7 +1743,10 @@ get "/feed/trending" do |env|
|
||||
locale = LOCALES[env.get("locale").as(String)]?
|
||||
|
||||
trending_type = env.params.query["type"]?
|
||||
trending_type ||= "Default"
|
||||
|
||||
region = env.params.query["region"]?
|
||||
region ||= "US"
|
||||
|
||||
begin
|
||||
trending = fetch_trending(trending_type, proxies, region, locale)
|
||||
|
@ -7,7 +7,7 @@ def fetch_trending(trending_type, proxies, region, locale)
|
||||
region = region.upcase
|
||||
|
||||
trending = ""
|
||||
if trending_type
|
||||
if trending_type && trending_type != "Default"
|
||||
trending_type = trending_type.downcase.capitalize
|
||||
|
||||
response = client.get("/feed/trending?gl=#{region}&hl=en", headers).body
|
||||
|
@ -2,6 +2,32 @@
|
||||
<title><%= translate(locale, "Trending") %> - Invidious</title>
|
||||
<% end %>
|
||||
|
||||
<div class="pure-g h-box">
|
||||
<div class="pure-u-2-3">
|
||||
<form class="pure-form pure-form-aligned" action="/feed/trending" method="get">
|
||||
</form>
|
||||
</div>
|
||||
<div class="pure-u-1-3">
|
||||
<div class="pure-g" style="text-align:right;">
|
||||
<% {"Default", "Music", "Gaming", "News", "Movies"}.each do |option| %>
|
||||
<div class="pure-u-1 pure-md-1-3">
|
||||
<% if trending_type == option %>
|
||||
<b><%= translate(locale, option) %></b>
|
||||
<% else %>
|
||||
<a href="/feed/trending?type=<%= option %>®ion=<%= region %>">
|
||||
<%= translate(locale, option) %>
|
||||
</a>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="h-box">
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<div class="pure-g">
|
||||
<% trending.each_slice(4) do |slice| %>
|
||||
<% slice.each do |item| %>
|
||||
|
Loading…
Reference in New Issue
Block a user