teddit-reddit-frontend-alte.../views/subreddit.pug

145 lines
5.9 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

doctype html
html
head
title /r/#{subreddit}
include includes/head.pug
body(class=""+ user_preferences.theme +"")
include includes/topbar.pug
if json === null
h1 Error occured
if error
if json.error_data.reason === "private"
h2 This is a private subreddit.
p Error: #{JSON.stringify(json.error_data)}
else
header
a(href="/", class="main")
h1 teddit
.bottom
if !subreddit.includes('+')
a(href="/r/" + subreddit + "", class="subreddit")
h2 #{subreddit}
ul.tabmenu
li(class=!sortby || sortby == 'hot' ? 'active' : '')
a(href="/r/" + subreddit) hot
li(class=sortby === 'new' ? 'active' : '')
a(href="/r/" + subreddit + "/new") new
li(class=sortby === 'rising' ? 'active' : '')
a(href="/r/" + subreddit + "/rising") rising
li(class=sortby === 'controversial' ? 'active' : '')
a(href="/r/" + subreddit + "/controversial") controversial
li(class=sortby === 'top' ? 'active' : '')
a(href="/r/" + subreddit + "/top") top
#links.sr
if sortby === 'top' || sortby === 'controversial'
details
summary
if past === 'hour'
span links from: past hour
if past === 'day'
span links from: past 24 hours
if past === 'week'
span links from: past week
if past === 'month'
span links from: past month
if past === 'year'
span links from: past year
if past === 'all'
span links from: all time
ul
li(class=past === 'hour' ? 'active' : '')
a(href="?t=hour") past hour
li(class=past === 'day' ? 'active' : '')
a(href="?t=day") past 24 hours
li(class=past === 'week' ? 'active' : '')
a(href="?t=week") past week
li(class=past === 'month' ? 'active' : '')
a(href="?t=month") past month
li(class=past === 'year' ? 'active' : '')
a(href="?t=year") past year
li(class=past === 'all' ? 'active' : '')
a(href="?t=all") all time
if json.links.length === 0
p nothing here
else
each link in json.links
.link
.upvotes
.arrow
span #{kFormatter(link.ups)}
.arrow.down
.image
if link.images
if link.is_self_link
a(href="" + link.permalink + "")
img(src="" + link.images.thumb + "", alt="")
else
a(href=""+ link.url +"")
img(src="" + link.images.thumb + "", alt="")
else
a(href="" + link.permalink + "")
.no-image
.entry
.title
if link.is_self_link
a(href="" + link.permalink + "")
h2(class="" + (link.stickied ? 'green' : '') + "") #{cleanTitle(link.title)}
span (#{link.domain})
else
a(href="" + link.url + "")
h2(class="" + (link.stickied ? 'green' : '') + "") #{cleanTitle(link.title)}
span (#{link.domain})
.meta
p.submitted submitted
span(title="" + toUTCString(link.created) + "") #{timeDifference(link.created)} by
a(href="/u/" + link.author + "")
| #{link.author}
p.to to
a(href="/r/" + link.subreddit + "")
| #{link.subreddit}
if link.stickied
span(class="green") stickied
p.comments
a(href="" + link.permalink + "", class="comments")
| #{link.num_comments} comments
if json.info.before || json.info.after
.view-more-inks
if json.info.before && !subreddit_front
a(href="/r/" + subreddit + "/" + sortby + "?t="+ (past ? past : '') +"&before=" + json.info.before + "") prev
if json.info.after
a(href="/r/" + subreddit + "/" + sortby + "?t=" + (past ? past : '') + "&after=" + json.info.after + "") next
#sidebar
#search.sr
p search
form(action="/r/" + subreddit + "/search", method="GET")
input(type="text", name="q", id="q", placeholder="search")
div
label(for="restrict_sr") limit my search to r/#{subreddit}
input(type="checkbox", name="restrict_sr", id="restrict_sr", checked="checked")
div
label(for="nsfw") include NSFW results
input(type="checkbox", name="nsfw", id="nsfw", checked="checked")
input(type="submit", value="search")
if sidebar_data
if sidebar_data.subscribers
.content
p subscribers: #{sidebar_data.subscribers.toLocaleString()}
p users here right now: #{sidebar_data.active_user_count.toLocaleString()}
br
.heading
p.title #{sidebar_data.title}
.short-description
!= unescape(sidebar_data.public_description_html)
.description
!= unescape(sidebar_data.description_html)
else
if subreddit.includes('+')
.content
p These subreddits
-
let subreddits = subreddit.split('+')
ul(class="subreddit-listing")
each subreddit in subreddits
li
a(href="/r/" + subreddit + "") #{subreddit}