more HTML fixes

This commit is contained in:
ccd0 2014-06-17 01:09:20 -07:00
parent 7a73160710
commit 85b129d06b
2 changed files with 18 additions and 13 deletions

View File

@ -11,9 +11,8 @@ Build =
{'&amp;': '&', '&#039;': "'", '&quot;': '"', '&lt;': '<', '&gt;': '>'}[c] {'&amp;': '&', '&#039;': "'", '&quot;': '"', '&lt;': '<', '&gt;': '>'}[c]
shortFilename: (filename, isReply) -> shortFilename: (filename, isReply) ->
# FILENAME SHORTENING SCIENCE: # FILENAME SHORTENING SCIENCE:
# OPs have a +10 characters threshold.
# The file extension is not taken into account. # The file extension is not taken into account.
threshold = if isReply then 30 else 40 threshold = 30
ext = filename.match(/\.?[^\.]*$/)[0] ext = filename.match(/\.?[^\.]*$/)[0]
if filename.length - ext.length > threshold if filename.length - ext.length > threshold
"#{filename[...threshold - 5]}(...)#{ext}" "#{filename[...threshold - 5]}(...)#{ext}"
@ -100,7 +99,8 @@ Build =
h_tripcode = '' h_tripcode = ''
if email if email
h_emailStart = "<a href='mailto:#{E encodeURIComponent(email)}' class='useremail'>" emailProcessed = encodeURIComponent(email).replace(/%40/g, '@')
h_emailStart = "<a href='mailto:#{E emailProcessed}' class='useremail'>"
h_emailEnd = '</a>' h_emailEnd = '</a>'
else else
h_emailStart = '' h_emailStart = ''
@ -110,20 +110,25 @@ Build =
when 'admin', 'admin_highlight' when 'admin', 'admin_highlight'
h_capcodeClass = ' capcodeAdmin' h_capcodeClass = ' capcodeAdmin'
h_capcodeStart = ' <strong class="capcode hand id_admin" title="Highlight posts by the Administrator">## Admin</strong>' h_capcodeStart = ' <strong class="capcode hand id_admin" title="Highlight posts by the Administrator">## Admin</strong>'
h_capcodeIcon = " <img src='#{h_staticPath}adminicon#{h_gifIcon}' title='This user is the 4chan Administrator.' class='identityIcon'>" h_capcodeIcon = "<img src='#{h_staticPath}adminicon#{h_gifIcon}' alt='Admin Icon' title='This user is the 4chan Administrator.' class='identityIcon retina'>"
when 'mod' when 'mod'
h_capcodeClass = ' capcodeMod' h_capcodeClass = ' capcodeMod'
h_capcodeStart = ' <strong class="capcode hand id_mod" title="Highlight posts by Moderators">## Mod</strong>' h_capcodeStart = ' <strong class="capcode hand id_mod" title="Highlight posts by Moderators">## Mod</strong>'
h_capcodeIcon = " <img src='#{h_staticPath}modicon#{h_gifIcon}' title='This user is a 4chan Moderator.' class='identityIcon'>" h_capcodeIcon = "<img src='#{h_staticPath}modicon#{h_gifIcon}' alt='Mod Icon' title='This user is a 4chan Moderator.' class='identityIcon retina'>"
when 'developer' when 'developer'
h_capcodeClass = ' capcodeDeveloper' h_capcodeClass = ' capcodeDeveloper'
h_capcodeStart = ' <strong class="capcode hand id_developer" title="Highlight posts by Developers">## Developer</strong>' h_capcodeStart = ' <strong class="capcode hand id_developer" title="Highlight posts by Developers">## Developer</strong>'
h_capcodeIcon = " <img src='#{h_staticPath}developericon#{h_gifIcon}' title='This user is a 4chan Developer.' class='identityIcon'>" h_capcodeIcon = "<img src='#{h_staticPath}developericon#{h_gifIcon}' alt='Developer Icon' title='This user is a 4chan Developer.' class='identityIcon retina'>"
else else
h_capcodeClass = '' h_capcodeClass = ''
h_capcodeStart = '' h_capcodeStart = ''
h_capcodeIcon = '' h_capcodeIcon = ''
if capcode
h_nameClass = ' capcode'
else
h_nameClass = ''
if !capcode and uniqueID if !capcode and uniqueID
h_userID = " <span class='posteruid id_#{E uniqueID}'>(ID: <span class='hand' title='Highlight posts by this ID'>#{E uniqueID}</span>)</span> " h_userID = " <span class='posteruid id_#{E uniqueID}'>(ID: <span class='hand' title='Highlight posts by this ID'>#{E uniqueID}</span>)</span> "
else else
@ -132,9 +137,9 @@ Build =
unless flagCode unless flagCode
h_flag = '' h_flag = ''
else if boardID is 'pol' else if boardID is 'pol'
h_flag = " <img src='#{h_staticPath}country/troll/#{E flagCode.toLowerCase()}.gif' alt='#{E flagCode}' title='#{E flagName}' class='countryFlag'>" h_flag = "<img src='#{h_staticPath}country/troll/#{E flagCode.toLowerCase()}.gif' alt='#{E flagCode}' title='#{E flagName}' class='countryFlag'>"
else else
h_flag = " <span title='#{E flagName}' class='flag flag-#{E flagCode.toLowerCase()}'></span>" h_flag = "<span title='#{E flagName}' class='flag flag-#{E flagCode.toLowerCase()}'></span>"
if file?.isDeleted if file?.isDeleted
if isOP if isOP
@ -158,7 +163,7 @@ Build =
file.twidth = file.theight = 100 file.twidth = file.theight = 100
shortFilename = 'Spoiler Image' shortFilename = 'Spoiler Image'
else else
shortFilename = Build.shortFilename file.name shortFilename = Build.shortFilename file.name, !isOP
if boardID is 'f' if boardID is 'f'
h_imgSrc = '' h_imgSrc = ''
@ -195,12 +200,12 @@ Build =
quoteLink = "/#{boardID}/thread/#{threadID}\#q#{postID}" quoteLink = "/#{boardID}/thread/#{threadID}\#q#{postID}"
if isSticky if isSticky
h_sticky = " <img src='#{h_staticPath}sticky#{h_gifIcon}' alt='Sticky' title='Sticky' class='stickyIcon'>" h_sticky = " <img src='#{h_staticPath}sticky#{h_gifIcon}' alt='Sticky' title='Sticky' class='stickyIcon retina'>"
else else
h_sticky = '' h_sticky = ''
if isClosed if isClosed
h_closed = " <img src='#{h_staticPath}closed#{h_gifIcon}' alt='Closed' title='Closed' class='closedIcon'>" h_closed = " <img src='#{h_staticPath}closed#{h_gifIcon}' alt='Closed' title='Closed' class='closedIcon retina'>"
else else
h_closed = '' h_closed = ''

View File

@ -8,8 +8,8 @@
#{h_subject} #{h_subject}
<span class='nameBlock#{h_capcodeClass}'> <span class='nameBlock#{h_capcodeClass}'>
#{h_emailStart} #{h_emailStart}
<span class='name'>#{E name}</span>#{' '} <span class='name#{h_nameClass}'>#{E name}</span>
#{h_tripcode}#{h_capcodeStart}#{h_emailEnd}#{h_capcodeIcon}#{h_userID}#{h_flag} #{h_tripcode}#{h_capcodeStart}#{h_emailEnd} #{h_capcodeIcon}#{h_userID}#{h_flag}
</span>#{' '} </span>#{' '}
<span class='dateTime' data-utc='#{+dateUTC}'>#{E date}</span>#{' '} <span class='dateTime' data-utc='#{+dateUTC}'>#{E date}</span>#{' '}
<span class='postNum desktop'> <span class='postNum desktop'>