From 192f985f5580e008c2ebe3cbd2d2d5c50200d104 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Fri, 24 Apr 2015 19:31:49 -0700 Subject: [PATCH] Move post info into o.info. --- src/General/Build.coffee | 32 ++++++++++++++------------------ src/General/html/Build/File.html | 2 +- src/General/html/Build/Post.html | 2 +- src/General/lib/fetcher.class | 12 +++++------- 4 files changed, 21 insertions(+), 27 deletions(-) diff --git a/src/General/Build.coffee b/src/General/Build.coffee index e7e7b0f89..ec38cc312 100755 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -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 diff --git a/src/General/html/Build/File.html b/src/General/html/Build/File.html index e43c0e78b..88cf2f86c 100644 --- a/src/General/html/Build/File.html +++ b/src/General/html/Build/File.html @@ -25,7 +25,7 @@ } }{ - ?{fileDeleted}{ + ?{o.fileDeleted}{
File deleted. diff --git a/src/General/html/Build/Post.html b/src/General/html/Build/Post.html index 35ebe5c5f..4ac9ff192 100644 --- a/src/General/html/Build/Post.html +++ b/src/General/html/Build/Post.html @@ -1,5 +1,5 @@ ?{!isOP}{
>>
} -
+
?{isOP}{&{fileBlock}&{postInfo}}{&{postInfo}&{fileBlock}}
&{commentHTML}
diff --git a/src/General/lib/fetcher.class b/src/General/lib/fetcher.class index d73cd97d5..628da13f5 100644 --- a/src/General/lib/fetcher.class +++ b/src/General/lib/fetcher.class @@ -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