diff --git a/4chan_x.user.js b/4chan_x.user.js index a331f1e99..036f4f56e 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3526,7 +3526,7 @@ } }, parseArchivedPost: function(req, board, postID, root, cb) { - var bq, br, capcode, data, email, file, filename, filesize, isOP, name, nameBlock, pc, pi, piM, span, spoiler, subject, threadID, threshold, thumb_src, timestamp, trip; + var bq, br, capcode, data, email, file, filename, filesize, isOP, name, nameBlock, pc, pi, piM, span, spoiler, subject, threadID, threshold, thumb_src, timestamp, trip, userID; data = JSON.parse(req.response); $.addClass(root, 'archivedPost'); if (data.error) { @@ -3537,6 +3537,7 @@ isOP = postID === threadID; name = data.name, trip = data.trip, timestamp = data.timestamp; subject = data.title; + userID = data.poster_hash; piM = $.el('div', { id: "pim" + postID, className: 'postInfoM mobile', @@ -3571,7 +3572,7 @@ pi = $.el('div', { id: "pi" + postID, className: 'postInfo desktop', - innerHTML: " data.fourchan_date No." + postID + "" + (isOP ? '   ' : '') + " " + innerHTML: " data.fourchan_date No." + postID + "" }); $('.subject', pi).textContent = subject; nameBlock = $('.nameBlock', pi); @@ -3587,6 +3588,14 @@ className: 'name', textContent: data.name })); + if (userID) { + $.add(nameBlock, [ + $.tn(' '), $.el('span', { + className: "posteruid id_" + userID, + innerHTML: "(ID: " + userID + ")" + }) + ]); + } if (trip) { $.add(nameBlock, [ $.tn(' '), $.el('span', { @@ -3595,23 +3604,49 @@ }) ]); } - if (capcode !== 'N') { - $.add(nameBlock, [ - $.tn(' '), $.el('strong', { - className: capcode === 'A' ? 'capcode capcodeAdmin' : 'capcode', - textContent: capcode === 'A' ? '## Admin' : '## Mod' - }) - ]); - nameBlock = $('.nameBlock', pi); - $.addClass(nameBlock, capcode === 'A' ? 'capcodeAdmin' : 'capcodeMod'); - $.add(nameBlock, [ - $.tn(' '), $.el('img', { - src: capcode === 'A' ? '//static.4chan.org/image/adminicon.gif' : '//static.4chan.org/image/modicon.gif', - alt: capcode === 'A' ? 'This user is the 4chan Administrator.' : 'This user is a 4chan Moderator.', - title: capcode === 'A' ? 'This user is the 4chan Administrator.' : 'This user is a 4chan Moderator.', - className: 'identityIcon' - }) - ]); + nameBlock = $('.nameBlock', pi); + switch (capcode) { + case 'A': + $.addClass(nameBlock, 'capcodeAdmin'); + $.add(nameBlock, [ + $.tn(' '), $.el('strong', { + className: 'capcode', + textContent: '## Admin' + }), $.tn(' '), $.el('img', { + src: '//static.4chan.org/image/adminicon.gif', + alt: 'This user is the 4chan Administrator.', + title: 'This user is the 4chan Administrator.', + className: 'identityIcon' + }) + ]); + break; + case 'M': + $.addClass(nameBlock, 'capcodeMod'); + $.add(nameBlock, [ + $.tn(' '), $.el('strong', { + className: 'capcode', + textContent: '## Mod' + }), $.tn(' '), $.el('img', { + src: '//static.4chan.org/image/modicon.gif', + alt: 'This user is a 4chan Moderator.', + title: 'This user is a 4chan Moderator.', + className: 'identityIcon' + }) + ]); + break; + case 'D': + $.addClass(nameBlock, 'capcodeDeveloper'); + $.add(nameBlock, [ + $.tn(' '), $.el('strong', { + className: 'capcode', + textContent: '## Developer' + }), $.tn(' '), $.el('img', { + src: '//static.4chan.org/image/developericon.gif', + alt: 'This user is a 4chan Developer.', + title: 'title="This user is a 4chan Developer.', + className: 'identityIcon' + }) + ]); } bq = $.el('blockquote', { id: "m" + postID, diff --git a/script.coffee b/script.coffee index 6e1731a1d..9172135df 100644 --- a/script.coffee +++ b/script.coffee @@ -2778,6 +2778,7 @@ Get = isOP = postID is threadID {name, trip, timestamp} = data subject = data.title + userID = data.poster_hash # post info (mobile) piM = $.el 'div', @@ -2814,7 +2815,7 @@ Get = pi = $.el 'div', id: "pi#{postID}" className: 'postInfo desktop' - innerHTML: " data.fourchan_date No.#{postID}#{if isOP then '   ' else ''} " + innerHTML: " data.fourchan_date No.#{postID}" # subject $('.subject', pi).textContent = subject nameBlock = $ '.nameBlock', pi @@ -2827,27 +2828,63 @@ Get = $.add nameBlock, $.el 'span', className: 'name' textContent: data.name + if userID + $.add nameBlock, [$.tn(' '), $.el('span', + className: "posteruid id_#{userID}" + innerHTML: "(ID: #{userID})" + )] if trip $.add nameBlock, [$.tn(' '), $.el('span', className: 'postertrip', textContent: trip)] - if capcode isnt 'N' # 'A'dmin or 'M'od - $.add nameBlock, [ - $.tn(' '), - $.el('strong', - className: if capcode is 'A' then 'capcode capcodeAdmin' else 'capcode', - textContent: if capcode is 'A' then '## Admin' else '## Mod' - ) - ] - nameBlock = $ '.nameBlock', pi - $.addClass nameBlock, if capcode is 'A' then 'capcodeAdmin' else 'capcodeMod' - $.add nameBlock, [ - $.tn(' '), - $.el('img', - src: if capcode is 'A' then '//static.4chan.org/image/adminicon.gif' else '//static.4chan.org/image/modicon.gif', - alt: if capcode is 'A' then 'This user is the 4chan Administrator.' else 'This user is a 4chan Moderator.', - title: if capcode is 'A' then 'This user is the 4chan Administrator.' else 'This user is a 4chan Moderator.', - className: 'identityIcon' - ) - ] + nameBlock = $ '.nameBlock', pi + switch capcode # 'A'dmin or 'M'od or 'D'eveloper + when 'A' + $.addClass nameBlock, 'capcodeAdmin' + $.add nameBlock, [ + $.tn(' '), + $.el('strong', + className: 'capcode' + textContent: '## Admin' + ), + $.tn(' '), + $.el('img', + src: '//static.4chan.org/image/adminicon.gif' + alt: 'This user is the 4chan Administrator.' + title: 'This user is the 4chan Administrator.' + className: 'identityIcon' + ) + ] + when 'M' + $.addClass nameBlock, 'capcodeMod' + $.add nameBlock, [ + $.tn(' '), + $.el('strong', + className: 'capcode' + textContent: '## Mod' + ), + $.tn(' '), + $.el('img', + src: '//static.4chan.org/image/modicon.gif' + alt: 'This user is a 4chan Moderator.' + title: 'This user is a 4chan Moderator.' + className: 'identityIcon' + ) + ] + when 'D' + $.addClass nameBlock, 'capcodeDeveloper' + $.add nameBlock, [ + $.tn(' '), + $.el('strong', + className: 'capcode' + textContent: '## Developer' + ), + $.tn(' '), + $.el('img', + src: '//static.4chan.org/image/developericon.gif' + alt: 'This user is a 4chan Developer.' + title: 'title="This user is a 4chan Developer.' + className: 'identityIcon' + ) + ] # comment bq = $.el 'blockquote',