Support hidpi post icons.

This commit is contained in:
Mayhem 2013-11-01 18:57:17 +01:00
parent 9c81b6e459
commit feb8e09c5a
2 changed files with 12 additions and 8 deletions

View File

@ -60,6 +60,10 @@ Build =
isOP = postID is threadID isOP = postID is threadID
staticPath = '//static.4chan.org/image/' staticPath = '//static.4chan.org/image/'
gifIcon = if window.devicePixelRatio >= 2
'@2x.gif'
else
'.gif'
if email if email
emailStart = '<a href="mailto:' + email + '" class="useremail">' emailStart = '<a href="mailto:' + email + '" class="useremail">'
@ -82,21 +86,21 @@ Build =
capcodeClass = " capcodeAdmin" capcodeClass = " capcodeAdmin"
capcodeStart = " <strong class='capcode hand id_admin'" + capcodeStart = " <strong class='capcode hand id_admin'" +
"title='Highlight posts by the Administrator'>## Admin</strong>" "title='Highlight posts by the Administrator'>## Admin</strong>"
capcode = " <img src='#{staticPath}adminicon.gif' " + capcode = " <img src='#{staticPath}adminicon#{gifIcon}' " +
"alt='This user is the 4chan Administrator.' " + "alt='This user is the 4chan Administrator.' " +
"title='This user is the 4chan Administrator.' class=identityIcon>" "title='This user is the 4chan Administrator.' class=identityIcon>"
when 'mod' when 'mod'
capcodeClass = " capcodeMod" capcodeClass = " capcodeMod"
capcodeStart = " <strong class='capcode hand id_mod' " + capcodeStart = " <strong class='capcode hand id_mod' " +
"title='Highlight posts by Moderators'>## Mod</strong>" "title='Highlight posts by Moderators'>## Mod</strong>"
capcode = " <img src='#{staticPath}modicon.gif' " + capcode = " <img src='#{staticPath}modicon#{gifIcon}' " +
"alt='This user is a 4chan Moderator.' " + "alt='This user is a 4chan Moderator.' " +
"title='This user is a 4chan Moderator.' class=identityIcon>" "title='This user is a 4chan Moderator.' class=identityIcon>"
when 'developer' when 'developer'
capcodeClass = " capcodeDeveloper" capcodeClass = " capcodeDeveloper"
capcodeStart = " <strong class='capcode hand id_developer' " + capcodeStart = " <strong class='capcode hand id_developer' " +
"title='Highlight posts by Developers'>## Developer</strong>" "title='Highlight posts by Developers'>## Developer</strong>"
capcode = " <img src='#{staticPath}developericon.gif' " + capcode = " <img src='#{staticPath}developericon#{gifIcon}' " +
"alt='This user is a 4chan Developer.' " + "alt='This user is a 4chan Developer.' " +
"title='This user is a 4chan Developer.' class=identityIcon>" "title='This user is a 4chan Developer.' class=identityIcon>"
else else
@ -114,11 +118,11 @@ Build =
if file?.isDeleted if file?.isDeleted
fileHTML = if isOP fileHTML = if isOP
"<div class=file id=f#{postID}><div class=fileInfo></div><span class=fileThumb>" + "<div class=file id=f#{postID}><div class=fileInfo></div><span class=fileThumb>" +
"<img src='#{staticPath}filedeleted.gif' alt='File deleted.' class=fileDeletedRes>" + "<img src='#{staticPath}filedeleted#{gifIcon}' alt='File deleted.' class=fileDeletedRes>" +
"</span></div>" "</span></div>"
else else
"<div class=file id=f#{postID}><span class=fileThumb>" + "<div class=file id=f#{postID}><span class=fileThumb>" +
"<img src='#{staticPath}filedeleted-res.gif' alt='File deleted.' class=fileDeletedRes>" + "<img src='#{staticPath}filedeleted-res#{gifIcon}' alt='File deleted.' class=fileDeletedRes>" +
"</span></div>" "</span></div>"
else if file else if file
ext = file.name[-3..] ext = file.name[-3..]
@ -178,11 +182,11 @@ Build =
'' ''
sticky = if isSticky sticky = if isSticky
" <img src=#{staticPath}sticky.gif alt=Sticky title=Sticky class=stickyIcon>" " <img src=#{staticPath}sticky#{gifIcon} alt=Sticky title=Sticky class=stickyIcon>"
else else
'' ''
closed = if isClosed closed = if isClosed
" <img src=#{staticPath}closed.gif alt=Closed title=Closed class=closedIcon>" " <img src=#{staticPath}closed#{gifIcon} alt=Closed title=Closed class=closedIcon>"
else else
'' ''

View File

@ -22,7 +22,7 @@ class Thread
$.rm $ ".#{typeLC}Icon", @OP.nodes.info $.rm $ ".#{typeLC}Icon", @OP.nodes.info
return return
icon = $.el 'img', icon = $.el 'img',
src: "//static.4chan.org/image/#{typeLC}.gif" src: "//static.4chan.org/image/#{typeLC}#{if window.devicePixelRatio >= 2 then '@2x' else ''}.gif"
alt: type alt: type
title: type title: type
className: "#{typeLC}Icon" className: "#{typeLC}Icon"