2020-11-17 21:44:32 +01:00
|
|
|
|
doctype html
|
|
|
|
|
html
|
|
|
|
|
head
|
2021-01-07 13:18:39 +01:00
|
|
|
|
if no_query
|
|
|
|
|
title search teddit
|
2022-06-10 16:09:40 +02:00
|
|
|
|
meta(property='og:title', content='search - teddit')
|
2021-01-07 13:18:39 +01:00
|
|
|
|
else
|
|
|
|
|
title search results for #{q}
|
2022-06-10 16:09:40 +02:00
|
|
|
|
meta(property='og:title', content='search results for ' + q + ' - teddit')
|
|
|
|
|
include includes/meta_default.pug
|
|
|
|
|
include includes/meta_description.pug
|
2020-11-17 21:44:32 +01:00
|
|
|
|
include includes/head.pug
|
2021-01-27 17:39:12 +01:00
|
|
|
|
body(class=""+ (user_preferences.theme === 'auto' ? 'dark' : user_preferences.theme) + "")
|
2020-11-17 21:44:32 +01:00
|
|
|
|
include includes/topbar.pug
|
2020-12-01 18:56:54 +01:00
|
|
|
|
#search.sr.search-page
|
2020-11-17 21:44:32 +01:00
|
|
|
|
form(action="/r/" + subreddit + "/search", method="GET")
|
2020-12-30 22:51:20 +01:00
|
|
|
|
div
|
|
|
|
|
label(for="q") search
|
|
|
|
|
input(type="text", name="q", id="q", placeholder="search", value=""+ q +"")
|
2020-11-17 21:44:32 +01:00
|
|
|
|
div
|
|
|
|
|
label(for="restrict_sr") limit my search to r/#{subreddit}
|
2021-03-19 19:26:38 +01:00
|
|
|
|
if !restrict_sr || restrict_sr === 'on'
|
2020-11-17 21:44:32 +01:00
|
|
|
|
input(type="checkbox", name="restrict_sr", id="restrict_sr", checked="checked")
|
|
|
|
|
else
|
|
|
|
|
input(type="checkbox", name="restrict_sr", id="restrict_sr")
|
|
|
|
|
div
|
|
|
|
|
label(for="nsfw") include NSFW results
|
2021-03-19 19:26:38 +01:00
|
|
|
|
if !nsfw || nsfw === 'on'
|
2020-11-17 21:44:32 +01:00
|
|
|
|
input(type="checkbox", name="nsfw", id="nsfw", checked="checked")
|
|
|
|
|
else
|
|
|
|
|
input(type="checkbox", name="nsfw", id="nsfw")
|
2020-11-19 20:53:29 +01:00
|
|
|
|
div
|
|
|
|
|
//- Let me know if there's a better way to add selected attribute!
|
|
|
|
|
label(for="sort") sorted by:
|
|
|
|
|
select(name="sort", id="sort")
|
|
|
|
|
if sortby === 'relevance' || !sortby
|
|
|
|
|
option(value="relevance", selected="selected") relevance
|
|
|
|
|
option(value="top") top
|
|
|
|
|
option(value="new") new
|
|
|
|
|
option(value="comments") comments
|
|
|
|
|
if sortby === 'top'
|
|
|
|
|
option(value="relevance") relevance
|
|
|
|
|
option(value="top", selected="selected") top
|
|
|
|
|
option(value="new") new
|
|
|
|
|
option(value="comments") comments
|
|
|
|
|
if sortby === 'new'
|
|
|
|
|
option(value="relevance") relevance
|
|
|
|
|
option(value="top") top
|
|
|
|
|
option(value="new", selected="selected") new
|
|
|
|
|
option(value="comments") comments
|
|
|
|
|
if sortby === 'comments'
|
|
|
|
|
option(value="relevance") relevance
|
|
|
|
|
option(value="top") top
|
|
|
|
|
option(value="new") new
|
|
|
|
|
option(value="comments", selected="selected") comments
|
|
|
|
|
div
|
|
|
|
|
//- Let me know if there's a better way to add selected attribute!
|
|
|
|
|
label(for="t") links from:
|
|
|
|
|
select(name="t", id="t")
|
|
|
|
|
if past === 'hour'
|
|
|
|
|
option(value="hour", selected="selected") hour
|
|
|
|
|
option(value="day") 24 hours
|
|
|
|
|
option(value="week") week
|
|
|
|
|
option(value="month") month
|
|
|
|
|
option(value="year") year
|
|
|
|
|
option(value="all") all time
|
|
|
|
|
if past === 'day'
|
|
|
|
|
option(value="hour") hour
|
|
|
|
|
option(value="day", selected="selected") 24 hours
|
|
|
|
|
option(value="week") week
|
|
|
|
|
option(value="month") month
|
|
|
|
|
option(value="year") year
|
|
|
|
|
option(value="all") all time
|
|
|
|
|
if past === 'week'
|
|
|
|
|
option(value="hour") hour
|
|
|
|
|
option(value="day") 24 hours
|
|
|
|
|
option(value="week", selected="selected") week
|
|
|
|
|
option(value="month") month
|
|
|
|
|
option(value="year") year
|
|
|
|
|
option(value="all") all time
|
|
|
|
|
if past === 'month'
|
|
|
|
|
option(value="hour") hour
|
|
|
|
|
option(value="day") 24 hours
|
|
|
|
|
option(value="week") week
|
|
|
|
|
option(value="month", selected="selected") month
|
|
|
|
|
option(value="year") year
|
|
|
|
|
option(value="all") all time
|
|
|
|
|
if past === 'year'
|
|
|
|
|
option(value="hour") hour
|
|
|
|
|
option(value="day") 24 hours
|
|
|
|
|
option(value="week") week
|
|
|
|
|
option(value="month") month
|
|
|
|
|
option(value="year", selected="selected") year
|
|
|
|
|
option(value="all") all time
|
|
|
|
|
if past === 'all' || !past
|
|
|
|
|
option(value="hour") hour
|
|
|
|
|
option(value="day") 24 hours
|
|
|
|
|
option(value="week") week
|
|
|
|
|
option(value="month") month
|
|
|
|
|
option(value="year") year
|
|
|
|
|
option(value="all", selected="selected") all time
|
2020-11-17 21:44:32 +01:00
|
|
|
|
input(type="submit", value="search")
|
|
|
|
|
#links.search
|
2021-01-07 13:18:39 +01:00
|
|
|
|
if json.posts.length === 0 && !no_query
|
2021-01-01 18:18:54 +01:00
|
|
|
|
p no results
|
2020-11-19 20:53:29 +01:00
|
|
|
|
else
|
2021-04-22 20:44:23 +02:00
|
|
|
|
if json.suggested_subreddits
|
|
|
|
|
.suggested-subreddits
|
|
|
|
|
h3 suggested subreddits
|
|
|
|
|
each suggested_subreddit in json.suggested_subreddits
|
|
|
|
|
.link
|
|
|
|
|
.entry
|
|
|
|
|
-
|
|
|
|
|
let subbed_to_this_subreddit = false
|
|
|
|
|
let subbed = []
|
|
|
|
|
if(user_preferences.subbed_subreddits && Array.isArray(user_preferences.subbed_subreddits))
|
|
|
|
|
subbed = user_preferences.subbed_subreddits
|
|
|
|
|
for(let i = 0; i < subbed.length; i++) {
|
|
|
|
|
if(subbed[i].toLowerCase() === suggested_subreddit.data.display_name.toLowerCase())
|
|
|
|
|
subbed_to_this_subreddit = true
|
|
|
|
|
}
|
|
|
|
|
.content
|
|
|
|
|
.title
|
|
|
|
|
a(href="" + suggested_subreddit.data.url + "", rel="noopener noreferrer")
|
|
|
|
|
h2 #{suggested_subreddit.data.display_name_prefixed}: #{cleanTitle(suggested_subreddit.data.title)}
|
|
|
|
|
.sub-button
|
|
|
|
|
if subbed_to_this_subreddit
|
2021-04-22 21:02:30 +02:00
|
|
|
|
a(href="/unsubscribe/" + suggested_subreddit.data.display_name + "?b=/r/" + subreddit + "/search?q=" + q + "§1nsfw=" + nsfw + "", class="sub-to-subreddit gray", title="subscriptions are saved in your browser's cookies") unsubscribe
|
2021-04-22 20:44:23 +02:00
|
|
|
|
else
|
2021-04-22 21:02:30 +02:00
|
|
|
|
a(href="/subscribe/" + suggested_subreddit.data.display_name + "?b=/r/" + subreddit + "/search?q=" + q + "§1nsfw=" + nsfw + "", class="sub-to-subreddit", title="subscriptions are saved in your browser's cookies") subscribe
|
2021-04-22 20:44:23 +02:00
|
|
|
|
.description
|
|
|
|
|
p #{cleanTitle(suggested_subreddit.data.public_description)}
|
|
|
|
|
.meta
|
|
|
|
|
p.subscribers #{kFormatter(suggested_subreddit.data.subscribers)} subscribers,
|
|
|
|
|
p.submitted created
|
|
|
|
|
span(title="" + toUTCString(suggested_subreddit.data.created) + "") #{timeDifference(suggested_subreddit.data.created)}
|
|
|
|
|
.links
|
2021-04-23 21:30:17 +02:00
|
|
|
|
small
|
|
|
|
|
a(href="/" + suggested_subreddit.data.display_name_prefixed + "/search?q=" + q + "&nsfw=" + nsfw + "&restrict_sr=on") search within #{suggested_subreddit.data.display_name_prefixed}
|
2021-04-22 20:44:23 +02:00
|
|
|
|
if suggested_subreddit.data.over_18
|
|
|
|
|
span.tag.nsfw NSFW
|
|
|
|
|
a(href="/subreddits/search?q="+ q +"", class="btn") show more similar subreddits
|
2021-01-01 18:18:54 +01:00
|
|
|
|
each link in json.posts
|
2021-05-24 21:18:50 +02:00
|
|
|
|
include components/link.pug
|
2020-11-17 21:44:32 +01:00
|
|
|
|
if json.before || json.after
|
2021-01-04 12:43:14 +01:00
|
|
|
|
.view-more-links
|
2022-01-30 01:33:58 +01:00
|
|
|
|
if json.before
|
|
|
|
|
a(href="?q=" + q + "&restrict_sr=" + restrict_sr + "&nsfw=" + nsfw + "&before=" + json.before + "" + (sortby === "new" && sortby ? "&" : "&sort=" + sortby + "&") + (!past ? "" : "t=" + past)) ‹ prev
|
2021-01-01 18:18:54 +01:00
|
|
|
|
if json.after
|
2022-01-30 01:33:58 +01:00
|
|
|
|
a(href="?q=" + q + "&restrict_sr=" + restrict_sr + "&nsfw=" + nsfw + "&after=" + json.after + "" + (sortby === "new" && sortby ? "&" : "&sort=" + sortby + "&") + (!past ? "" : "t=" + past)) next ›
|
2020-12-28 21:45:17 +01:00
|
|
|
|
include includes/footer.pug
|