Move post info into o.info.

This commit is contained in:
ccd0 2015-04-24 19:31:49 -07:00
parent 72f048377b
commit 192f985f55
4 changed files with 21 additions and 27 deletions

View File

@ -32,25 +32,25 @@ Build =
postID: data.no
threadID: data.resto or data.no
boardID: boardID
# info
name: Build.unescape(data.name) or ''
tripcode: data.trip
uniqueID: data.id
email: Build.unescape data.email
subject: Build.unescape data.sub
flagCode: data.country
flag: Build.unescape data.country_name
dateText: data.now
dateUTC: data.time
commentHTML: {innerHTML: data.com or ''}
# thread status
isSticky: !!data.sticky
isClosed: !!data.closed
isArchived: !!data.archived
# file status
fileDeleted: !!data.filedeleted
o.info =
subject: Build.unescape data.sub
email: Build.unescape data.email
name: Build.unescape(data.name) or ''
tripcode: data.trip
uniqueID: data.id
flagCode: data.country
flag: Build.unescape data.country_name
dateUTC: data.time
dateText: data.now
commentHTML: {innerHTML: data.com or ''}
if data.capcode
o.capcode = data.capcode.replace(/_highlight$/, '').replace(/_/g, ' ').replace(/\b\w/g, (c) -> c.toUpperCase())
o.info.capcode = data.capcode.replace(/_highlight$/, '').replace(/_/g, ' ').replace(/\b\w/g, (c) -> c.toUpperCase())
o.capcodeHighlight = /_highlight$/.test data.capcode
if data.ext
o.file =
@ -75,12 +75,8 @@ Build =
This function contains code from 4chan-JS (https://github.com/4chan/4chan-JS).
@license: https://github.com/4chan/4chan-JS/blob/master/LICENSE
###
{
postID, threadID, boardID
name, capcode, capcodeHighlight, tripcode, uniqueID, email, subject, flagCode, flag, dateText, dateUTC
commentHTML
file, fileDeleted
} = o
{postID, threadID, boardID, file} = o
{subject, email, name, tripcode, capcode, uniqueID, flagCode, flag, dateUTC, dateText, commentHTML} = o.info
isOP = postID is threadID
{staticPath, gifIcon} = Build

View File

@ -25,7 +25,7 @@
}
</div>
}{
?{fileDeleted}{
?{o.fileDeleted}{
<div class="file" id="f${postID}">
<span class="fileThumb">
<img src="${staticPath}filedeleted-res${gifIcon}" alt="File deleted." class="fileDeletedRes retina">

View File

@ -1,5 +1,5 @@
?{!isOP}{<div class="sideArrows" id="sa${postID}">&gt;&gt;</div>}
<div id="p${postID}" class="post ${postClass}?{capcodeHighlight}{ highlightPost}">
<div id="p${postID}" class="post ${postClass}?{o.capcodeHighlight}{ highlightPost}">
?{isOP}{&{fileBlock}&{postInfo}}{&{postInfo}&{fileBlock}}
<blockquote class="postMessage" id="m${postID}">&{commentHTML}</blockquote>
</div>

View File

@ -126,26 +126,24 @@ class Fetcher
@threadID = +data.thread_num
o =
# id
postID: @postID
threadID: @threadID
boardID: @boardID
# info
o.info =
subject: data.title
email: data.email
name: data.name or ''
tripcode: data.trip
capcode: switch data.capcode
when 'M' then 'Mod'
when 'A' then 'Admin'
when 'D' then 'Developer'
tripcode: data.trip
uniqueID: data.poster_hash
email: data.email
subject: data.title
flagCode: data.poster_country
flag: data.poster_country_name
dateText: data.fourchan_date
dateUTC: data.timestamp
dateText: data.fourchan_date
commentHTML: comment
# file
if data.media?.media_filename
o.file =
name: data.media.media_filename