mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-08-14.git
synced 2024-08-15 00:53:20 +00:00
56ebef4352
Fixes: * Sanitize user-provided content in HTML (Fixes #2193) * Fix encoding of search query in prev/next pages (Fixes #2229) * Fix some issues introduced with #2196: - Fix alignment of all <h3> elements (Move the inline style from the parent to the <h3> element) - Add missing comma on 'dir' HTML attribute (Typo introduced by PR #2196) Code cleaning: * Remove unnecessary 'each_sclice' + 'each' double loop in ECR files * Clean the player's <source> list generation code (in player.ecr)
147 lines
6.5 KiB
Text
147 lines
6.5 KiB
Text
<% content_for "header" do %>
|
|
<title><%= search_query.not_nil!.size > 30 ? HTML.escape(query.not_nil![0,30].rstrip(".") + "...") : HTML.escape(query.not_nil!) %> - Invidious</title>
|
|
<% end %>
|
|
|
|
<% search_query_encoded = env.get?("search").try { |x| URI.encode(x.as(String), space_to_plus: true) } %>
|
|
|
|
<!-- Search redirection and filtering UI -->
|
|
<% if count == 0 %>
|
|
<h3 style="text-align: center">
|
|
<a href="/redirect?referer=<%= env.get?("current_page") %>"><%= translate(locale, "Broken? Try another Invidious Instance!") %></a>
|
|
</h3>
|
|
<% else %>
|
|
<details id="filters">
|
|
<summary>
|
|
<h3 style="display:inline"> <%= translate(locale, "filter") %> </h3>
|
|
</summary>
|
|
<div id="filters" class="pure-g h-box">
|
|
<div class="pure-u-1-3 pure-u-md-1-5">
|
|
<b><%= translate(locale, "date") %></b>
|
|
<hr/>
|
|
<% ["hour", "today", "week", "month", "year"].each do |date| %>
|
|
<div class="pure-u-1 pure-md-1-5">
|
|
<% if operator_hash.fetch("date", "all") == date %>
|
|
<b><%= translate(locale, date) %></b>
|
|
<% else %>
|
|
<a href="/search?q=<%= HTML.escape(query.not_nil!.gsub(/ ?date:[a-z]+/, "") + " date:" + date) %>&page=<%= page %>">
|
|
<%= translate(locale, date) %>
|
|
</a>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
<div class="pure-u-1-3 pure-u-md-1-5">
|
|
<b><%= translate(locale, "content_type") %></b>
|
|
<hr/>
|
|
<% ["video", "channel", "playlist", "movie", "show"].each do |content_type| %>
|
|
<div class="pure-u-1 pure-md-1-5">
|
|
<% if operator_hash.fetch("content_type", "all") == content_type %>
|
|
<b><%= translate(locale, content_type) %></b>
|
|
<% else %>
|
|
<a href="/search?q=<%= HTML.escape(query.not_nil!.gsub(/ ?content_type:[a-z]+/, "") + " content_type:" + content_type) %>&page=<%= page %>">
|
|
<%= translate(locale, content_type) %>
|
|
</a>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
<div class="pure-u-1-3 pure-u-md-1-5">
|
|
<b><%= translate(locale, "duration") %></b>
|
|
<hr/>
|
|
<% ["short", "long"].each do |duration| %>
|
|
<div class="pure-u-1 pure-md-1-5">
|
|
<% if operator_hash.fetch("duration", "all") == duration %>
|
|
<b><%= translate(locale, duration) %></b>
|
|
<% else %>
|
|
<a href="/search?q=<%= HTML.escape(query.not_nil!.gsub(/ ?duration:[a-z]+/, "") + " duration:" + duration) %>&page=<%= page %>">
|
|
<%= translate(locale, duration) %>
|
|
</a>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
<div class="pure-u-1-3 pure-u-md-1-5">
|
|
<b><%= translate(locale, "features") %></b>
|
|
<hr/>
|
|
<% ["hd", "subtitles", "creative_commons", "3d", "live", "purchased", "4k", "360", "location", "hdr"].each do |feature| %>
|
|
<div class="pure-u-1 pure-md-1-5">
|
|
<% if operator_hash.fetch("features", "all").includes?(feature) %>
|
|
<b><%= translate(locale, feature) %></b>
|
|
<% elsif operator_hash.has_key?("features") %>
|
|
<a href="/search?q=<%= HTML.escape(query.not_nil!.gsub(/features:/, "features:" + feature + ",")) %>&page=<%= page %>">
|
|
<%= translate(locale, feature) %>
|
|
</a>
|
|
<% else %>
|
|
<a href="/search?q=<%= HTML.escape(query.not_nil! + " features:" + feature) %>&page=<%= page %>">
|
|
<%= translate(locale, feature) %>
|
|
</a>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
<div class="pure-u-1-3 pure-u-md-1-5">
|
|
<b><%= translate(locale, "sort") %></b>
|
|
<hr/>
|
|
<% ["relevance", "rating", "date", "views"].each do |sort| %>
|
|
<div class="pure-u-1 pure-md-1-5">
|
|
<% if operator_hash.fetch("sort", "relevance") == sort %>
|
|
<b><%= translate(locale, sort) %></b>
|
|
<% else %>
|
|
<a href="/search?q=<%= HTML.escape(query.not_nil!.gsub(/ ?sort:[a-z]+/, "") + " sort:" + sort) %>&page=<%= page %>">
|
|
<%= translate(locale, sort) %>
|
|
</a>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
</details>
|
|
<% end %>
|
|
|
|
<% if count == 0 %>
|
|
<hr style="margin: 0;"/>
|
|
<% else %>
|
|
<hr/>
|
|
<% end %>
|
|
|
|
<div class="pure-g h-box v-box">
|
|
<div class="pure-u-1 pure-u-lg-1-5">
|
|
<% if page > 1 %>
|
|
<a href="/search?q=<%= search_query_encoded %>&page=<%= page - 1 %>">
|
|
<%= translate(locale, "Previous page") %>
|
|
</a>
|
|
<% end %>
|
|
</div>
|
|
<div class="pure-u-1 pure-u-lg-3-5"></div>
|
|
<div class="pure-u-1 pure-u-lg-1-5" style="text-align:right">
|
|
<% if count >= 20 %>
|
|
<a href="/search?q=<%= search_query_encoded %>&page=<%= page + 1 %>">
|
|
<%= translate(locale, "Next page") %>
|
|
</a>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="pure-g">
|
|
<% videos.each do |item| %>
|
|
<%= rendered "components/item" %>
|
|
<% end %>
|
|
</div>
|
|
|
|
<div class="pure-g h-box">
|
|
<div class="pure-u-1 pure-u-lg-1-5">
|
|
<% if page > 1 %>
|
|
<a href="/search?q=<%= search_query_encoded %>&page=<%= page - 1 %>">
|
|
<%= translate(locale, "Previous page") %>
|
|
</a>
|
|
<% end %>
|
|
</div>
|
|
<div class="pure-u-1 pure-u-lg-3-5"></div>
|
|
<div class="pure-u-1 pure-u-lg-1-5" style="text-align:right">
|
|
<% if count >= 20 %>
|
|
<a href="/search?q=<%= search_query_encoded %>&page=<%= page + 1 %>">
|
|
<%= translate(locale, "Next page") %>
|
|
</a>
|
|
<% end %>
|
|
</div>
|
|
</div>
|