From e15597573f932af94e73db0bcec295e6107b0a85 Mon Sep 17 00:00:00 2001 From: Ashley Date: Sat, 11 Nov 2023 18:38:29 +0000 Subject: [PATCH] add filters!! --- html/search.ejs | 178 ++++++++++++++++++++---------------------------- 1 file changed, 72 insertions(+), 106 deletions(-) diff --git a/html/search.ejs b/html/search.ejs index 32ee96fc..2038fa1f 100644 --- a/html/search.ejs +++ b/html/search.ejs @@ -33,7 +33,7 @@ <% } %> <% if (q != "do the harlem shake") { %> - + <% } %> @@ -403,7 +403,58 @@ video[counter].classList.add("shake");
-
+
+
Filters +
+ + +
+
Upload date
+
+<% const selectedDate = date || "none"; %> + +<% ['none', 'hour', 'today', 'week', 'month', 'year'].forEach(option => { %> +
+ > + +
+<% }) %>
+
+
Duration
+
+ <% const selectedDuration = duration || "none"; %> + +<% ['none', 'short', 'long', 'medium'].forEach(option => { %> +
+ > + +
+<% }) %> + +
+ +
+
Sort By
+
+ <% const selectedSort = sort || "relevance"; %> + +<% ['relevance', 'rating', 'date', 'views'].forEach(option => { %> +
+ > + +
+<% }) %> + +
+
+ +
+
+ <% if (!tab) { %> - - <% if (Array.isArray( j.Search.Results.Video)) { %> -
- <% if (j.Search.Results.DynamicItem) { %> - - <% if (j.Search.Results.DynamicItem.id == "didYouMeanRenderer") { %> - <% if (h) { %> - - <% if (h.correctedQueryEndpoint) { %> - - <% if (h.correctedQueryEndpoint.searchEndpoint) { %> - -
-

- Did you mean: <%= h.correctedQueryEndpoint.searchEndpoint.query %> :3 -

-
- <% } %> <% } %> - <% } %> <% } %> - <% } %> - -
- <% if (!j.Search.Results.DynamicItem) { %> - - <% if (!continuation) { %> - - <% if (summary.extract_html) { %> -
- -
From da web From wikipedia under CC-BY-SA 3.0 -
- -
- - <%-summary.extract_html%> - - - - - - -

-
- - <% } %> <% } %> - <% } %> - - <% if (j.Search.Results.CardList) { %> - - <% if (j.Search.Results.CardList.title == "People also search for") { %> - - - -
- - <% } %> <% } %> - - - <% j.Search.Results.Video.forEach(x => { %> + <% invresults.forEach (x => { %>
<%=x.duration %> + style="background-image: url('/vi/<%= x.videoId %>/hqdefault.jpg?sqp=-oaymwEXCNAFEJQDSFryq4qpAwkIARUAAIhCGAE=&rs=AOn4CLBmAOZV7CM3NdDKlEFxGX7PpI5UWQ');border-radius: 10px;" + ><%=turntomins(x.lengthSeconds) %>
@@ -527,32 +495,31 @@ font-weight: 1000; <% }) %> - -

- <%=j.Search.estimatedResults.toLocaleString()%> Results (estimated) -

+ - +

- <% if (continuation) { %> + <% if (continuation !== "1") { %>

First Page

-

- Next Page -

+

+ Next Page +

+ <% } %> - <% if (!continuation) { %> + <% if (continuation == "1" || !continuation) { %>

- Next Page + Next Page

<% } %> @@ -561,8 +528,7 @@ font-weight: 1000;
- <% } %> - <% if (!Array.isArray( j.Search.Results.Video)) { %> + <% if (!Array.isArray(invresults)) { %>