From 37933050a9634296daa4a9adca8d3108d6fd1dfb Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Fri, 7 Sep 2012 20:31:26 +0200 Subject: [PATCH] Add sticky and closed. --- 4chan_x.user.js | 12 ++++++++---- script.coffee | 19 +++++++++++++++++-- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 03f854597..c1fb119eb 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3687,7 +3687,9 @@ flagName: data.country_name, date: data.now, dateUTC: data.time, - comment: data.com + comment: data.com, + isSticky: !!data.sticky, + isClosed: !!data.closed }; if (data.ext || data.filedeleted) { o.file = { @@ -3713,8 +3715,8 @@ @license: https://github.com/4chan/4chan-JS/blob/master/LICENSE */ - var board, capcode, capcodeClass, capcodeStart, comment, container, date, dateUTC, email, emailEnd, emailStart, ext, file, fileDims, fileHTML, fileInfo, fileSize, fileThumb, flag, flagCode, flagName, href, imgSrc, isOP, name, postID, quote, staticPath, subject, threadID, tripcode, uniqueID, userID, _i, _len, _ref; - postID = o.postID, threadID = o.threadID, board = o.board, name = o.name, capcode = o.capcode, tripcode = o.tripcode, uniqueID = o.uniqueID, email = o.email, subject = o.subject, flagCode = o.flagCode, flagName = o.flagName, date = o.date, dateUTC = o.dateUTC, comment = o.comment, file = o.file; + var board, capcode, capcodeClass, capcodeStart, closed, comment, container, date, dateUTC, email, emailEnd, emailStart, ext, file, fileDims, fileHTML, fileInfo, fileSize, fileThumb, flag, flagCode, flagName, href, imgSrc, isClosed, isOP, isSticky, name, postID, quote, staticPath, sticky, subject, threadID, tripcode, uniqueID, userID, _i, _len, _ref; + postID = o.postID, threadID = o.threadID, board = o.board, name = o.name, capcode = o.capcode, tripcode = o.tripcode, uniqueID = o.uniqueID, email = o.email, subject = o.subject, flagCode = o.flagCode, flagName = o.flagName, date = o.date, dateUTC = o.dateUTC, isSticky = o.isSticky, isClosed = o.isClosed, comment = o.comment, file = o.file; isOP = postID === threadID; staticPath = '//static.4chan.org'; if (email) { @@ -3801,10 +3803,12 @@ fileHTML = ''; } tripcode = tripcode ? " " + tripcode + "" : ''; + sticky = isSticky ? ' Sticky' : ''; + closed = isClosed ? ' Closed' : ''; container = $.el('div', { id: "pc" + postID, className: "postContainer " + (isOP ? 'op' : 'reply') + "Container", - innerHTML: (isOP ? '' : "
>>
") + ("
") + ("' + (isOP ? fileHTML : '') + ("' + (isOP ? '' : fileHTML) + ("
" + comment + "
") + '
' + innerHTML: (isOP ? '' : "
>>
") + ("
") + ("' + (isOP ? fileHTML : '') + ("' + (isOP ? '' : fileHTML) + ("
" + comment + "
") + '
' }); _ref = $$('.quotelink', container); for (_i = 0, _len = _ref.length; _i < _len; _i++) { diff --git a/script.coffee b/script.coffee index f0d1e0c71..43b986ebf 100644 --- a/script.coffee +++ b/script.coffee @@ -2911,6 +2911,9 @@ Build = date: data.now dateUTC: data.time comment: data.com + # thread status + isSticky: !!data.sticky + isClosed: !!data.closed # file if data.ext or data.filedeleted o.file = @@ -2935,6 +2938,7 @@ Build = { postID, threadID, board name, capcode, tripcode, uniqueID, email, subject, flagCode, flagName, date, dateUTC + isSticky, isClosed comment file } = o @@ -3052,6 +3056,17 @@ Build = else '' + sticky = + if isSticky + ' Sticky' + else + '' + closed = + if isClosed + ' Closed' + else + '' + container = $.el 'div', id: "pc#{postID}" className: "postContainer #{if isOP then 'op' else 'reply'}Container" @@ -3063,7 +3078,7 @@ Build = "" + emailStart + "#{name}" + tripcode + - emailEnd + capcodeStart + capcode + userID + flag + + emailEnd + capcodeStart + capcode + userID + flag + sticky + closed + "
#{subject}" + "
#{date}" + '
' + @@ -3085,7 +3100,7 @@ Build = "" + emailStart + "#{name}" + tripcode + - emailEnd + capcodeStart + capcode + userID + flag + + emailEnd + capcodeStart + capcode + userID + flag + sticky + closed + ' ' + "#{date} " + "" +