all titles through cleanTitle()

This commit is contained in:
teddit 2020-12-02 17:02:32 +01:00
parent da33b5c456
commit 6f1b88a4c7
6 changed files with 16 additions and 12 deletions

View File

@ -94,3 +94,7 @@ meta(name="viewport", content="width=device-width, initial-scale=1.0")
function secondsToMMSS(time) {
return new Date(time * 1000).toISOString().substr(14,5)
}
function cleanTitle(title) {
return title.replace(/&/g, '&')
}

View File

@ -82,11 +82,11 @@ html
.title
if link.is_self_link
a(href="" + link.permalink + "")
h2 #{link.title}
h2 #{cleanTitle(link.title)}
span (#{link.domain})
else
a(href="" + link.url + "")
h2 #{link.title}
h2 #{cleanTitle(link.title)}
span (#{link.domain})
.meta
p.submitted submitted

View File

@ -1,7 +1,7 @@
doctype html
html
head
title #{post.title} : #{subreddit}
title #{cleanTitle(post.title)} : #{subreddit}
include includes/head.pug
body(class=""+ user_preferences.theme +"")
include includes/topbar.pug
@ -22,7 +22,7 @@ html
div.arrow.down
.title
a(href="" + localize(post.url) + "")
h2 #{post.title}
h2 #{cleanTitle(post.title)}
p.submitted
span(title="" + toUTCString(post.created) + "") submitted #{timeDifference(post.created)} by
a(href="/u/" + post.author + "")
@ -31,7 +31,7 @@ html
.crosspost
.title
a(href="" + localize(post.crosspost.permalink) + "")
h2 #{post.crosspost.title}
h2 #{cleanTitle(post.crosspost.title)}
.num_comments
| #{post.crosspost.num_comments} comments
.score
@ -85,13 +85,13 @@ html
.video
.title
a(href="" + post.media.embed_src + "", target="_blank")
p #{post.media.title}
p #{cleanTitle(post.media.title)}
.video-holder
a(href="" + post.media.embed_src + "", target="_blank")
img(src="" + post.media.thumbnail + "")
div(class="youtube-info")
p YouTube video info:
p #{post.media.title} <a href="#{post.media.embed_src}">#{post.media.embed_src}</a>
p #{cleanTitle(post.media.title)} <a href="#{post.media.embed_src}">#{post.media.embed_src}</a>
p #{post.media.author_name} <a href="#{post.media.author_url}">#{post.media.author_url}</a>
else
if post.media.source === 'external'

View File

@ -105,7 +105,7 @@ html
a(href="" + post.permalink + "")
div.no-image
.title
a(href="" + post.permalink + "") #{post.title}
a(href="" + post.permalink + "") #{cleanTitle(post.title)}
.meta
p.submitted(title="" + toUTCString(post.created) + "") submitted #{timeDifference(post.created)} by
a(href="/u/" + post.author + "") #{post.author}

View File

@ -82,11 +82,11 @@ html
.title
if link.is_self_link
a(href="" + link.permalink + "")
h2 #{link.title}
h2 #{cleanTitle(link.title)}
span (#{link.domain})
else
a(href="" + link.url + "")
h2 #{link.title}
h2 #{cleanTitle(link.title)}
span (#{link.domain})
.meta
p.submitted submitted

View File

@ -78,7 +78,7 @@ html
a(href="" + post.permalink + "")
div.no-image
.title
a(href="" + post.permalink + "") #{post.title}
a(href="" + post.permalink + "") #{cleanTitle(post.title)}
.meta
p.submitted(title="" + toUTCString(post.created) + "") submitted #{timeDifference(post.created)} by
a(href="/u/" + data.username + "") #{data.username}
@ -89,7 +89,7 @@ html
.entry
.meta
.title
a(href="" + post.url + "") #{post.link_title}
a(href="" + post.url + "") #{cleanTitle(post.link_title)}
.author
p by
if post.link_author !== '[deleted]'