Some archived posts parsing fixes. Add an 'archivedPost' class to the root.
This commit is contained in:
parent
5d721e0839
commit
8046bfa939
@ -3109,7 +3109,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
parseArchivedPost: function(req, board, postID, root, cb) {
|
parseArchivedPost: function(req, board, postID, root, cb) {
|
||||||
var bq, data, date, email, file, filesize, isOP, nameBlock, p, pc, pi, piM, span, time;
|
var bq, capcode, data, date, email, file, filesize, isOP, nameBlock, p, pc, pi, piM, span, time;
|
||||||
data = JSON.parse(req.response);
|
data = JSON.parse(req.response);
|
||||||
if (data.error) {
|
if (data.error) {
|
||||||
root.textContent = data.error;
|
root.textContent = data.error;
|
||||||
@ -3117,7 +3117,7 @@
|
|||||||
}
|
}
|
||||||
isOP = postID === data.thread_num;
|
isOP = postID === data.thread_num;
|
||||||
pc = $.el('div', {
|
pc = $.el('div', {
|
||||||
id: "pc",
|
id: "pc" + postID,
|
||||||
className: isOP ? 'postContainer opContainer' : 'postContainer replyContainer'
|
className: isOP ? 'postContainer opContainer' : 'postContainer replyContainer'
|
||||||
});
|
});
|
||||||
p = $.el('div', {
|
p = $.el('div', {
|
||||||
@ -3162,40 +3162,24 @@
|
|||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
if (data.capcode === 'A') {
|
capcode = data.capcode;
|
||||||
|
if (capcode !== 'N') {
|
||||||
$.add(nameBlock, [
|
$.add(nameBlock, [
|
||||||
$.tn(' '), $.el('strong', {
|
$.tn(' '), $.el('strong', {
|
||||||
className: 'capcode capcodeAdmin',
|
className: capcode === 'A' ? 'capcode capcodeAdmin' : 'capcode',
|
||||||
textContent: '## Admin'
|
textContent: capcode === 'A' ? '## Admin' : '## Mod'
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
nameBlock = $('.nameBlock', pi);
|
nameBlock = $('.nameBlock', pi);
|
||||||
$.addClass(nameBlock, 'capcodeAdmin');
|
$.addClass(nameBlock, capcode === 'A' ? 'capcodeAdmin' : 'capcodeMod');
|
||||||
$.add(nameBlock, [
|
$.add(nameBlock, [
|
||||||
$.tn(' '), $.el('img'), {
|
$.tn(' '), $.el('img', {
|
||||||
src: '//static.4chan.org/image/adminicon.gif',
|
src: capcode === 'A' ? '//static.4chan.org/image/adminicon.gif' : '//static.4chan.org/image/modicon.gif',
|
||||||
alt: 'This user is the 4chan Administrator.',
|
alt: capcode === 'A' ? 'This user is the 4chan Administrator.' : 'This user is a 4chan Moderator.',
|
||||||
title: 'This user is the 4chan Administrator.',
|
title: capcode === 'A' ? 'This user is the 4chan Administrator.' : 'This user is a 4chan Moderator.',
|
||||||
className: 'identityIcon'
|
className: 'identityIcon'
|
||||||
}
|
|
||||||
]);
|
|
||||||
} else if (data.capcode === 'M') {
|
|
||||||
$.add(nameBlock, [
|
|
||||||
$.tn(' '), $.el('strong', {
|
|
||||||
className: 'capcode',
|
|
||||||
textContent: '## Mod'
|
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
nameBlock = $('.nameBlock', pi);
|
|
||||||
$.addClass(nameBlock, 'capcodeMod');
|
|
||||||
$.add(nameBlock, [
|
|
||||||
$.tn(' '), $.el('img'), {
|
|
||||||
src: '//static.4chan.org/image/adminicon.gif',
|
|
||||||
alt: 'This user is a 4chan Moderator.',
|
|
||||||
title: 'This user is a 4chan Moderator.',
|
|
||||||
className: 'identityIcon'
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
bq = $.el('blockquote', {
|
bq = $.el('blockquote', {
|
||||||
id: "m" + postID,
|
id: "m" + postID,
|
||||||
@ -3238,7 +3222,7 @@
|
|||||||
filesize = $.bytesToString(data.media_size);
|
filesize = $.bytesToString(data.media_size);
|
||||||
$.add(file, $.el('div', {
|
$.add(file, $.el('div', {
|
||||||
className: 'fileInfo',
|
className: 'fileInfo',
|
||||||
innerHTML: "<span id=fT" + postID + " class=fileText>File: <a href='" + (data.media_link || data.remote_media_link) + "' target=_blank>" + data.media_orig + "</a>-(" + filesize + ", " + data.media_w + "x" + data.media_h + ", <span title></span>)</span>"
|
innerHTML: "<span id=fT" + postID + " class=fileText>File: <a href='" + (data.media_link || data.remote_media_link) + "' target=_blank>" + data.media_orig + "</a>-(" + (data.spoiler === '1' ? 'Spoiler Image, ' : '') + filesize + ", " + data.media_w + "x" + data.media_h + ", <span title></span>)</span>"
|
||||||
}));
|
}));
|
||||||
span = $('span[title]', file);
|
span = $('span[title]', file);
|
||||||
span.title = data.media_filename;
|
span.title = data.media_filename;
|
||||||
@ -3251,6 +3235,7 @@
|
|||||||
}));
|
}));
|
||||||
$.after((isOP ? piM : pi), file);
|
$.after((isOP ? piM : pi), file);
|
||||||
}
|
}
|
||||||
|
$.addClass(root, 'archivedPost');
|
||||||
$.replace(root.firstChild, pc);
|
$.replace(root.firstChild, pc);
|
||||||
if (cb) {
|
if (cb) {
|
||||||
return cb();
|
return cb();
|
||||||
@ -3510,6 +3495,9 @@
|
|||||||
post.img = img;
|
post.img = img;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (Conf['Reveal Spoilers']) {
|
||||||
|
RevealSpoilers.node(post);
|
||||||
|
}
|
||||||
if (Conf['Image Auto-Gif']) {
|
if (Conf['Image Auto-Gif']) {
|
||||||
AutoGif.node(post);
|
AutoGif.node(post);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2414,15 +2414,6 @@ Get =
|
|||||||
$.replace root.firstChild, pc
|
$.replace root.firstChild, pc
|
||||||
cb() if cb
|
cb() if cb
|
||||||
parseArchivedPost: (req, board, postID, root, cb) ->
|
parseArchivedPost: (req, board, postID, root, cb) ->
|
||||||
# unarchived
|
|
||||||
# >>>/a/1
|
|
||||||
# op
|
|
||||||
# >>>/a/66734868
|
|
||||||
# reply
|
|
||||||
# >>>/a/66718194
|
|
||||||
# reply with image and spoiler text
|
|
||||||
# >>>/v/142341606
|
|
||||||
|
|
||||||
data = JSON.parse req.response
|
data = JSON.parse req.response
|
||||||
|
|
||||||
if data.error
|
if data.error
|
||||||
@ -2433,7 +2424,7 @@ Get =
|
|||||||
|
|
||||||
# post containers
|
# post containers
|
||||||
pc = $.el 'div',
|
pc = $.el 'div',
|
||||||
id: "pc#{}"
|
id: "pc#{postID}"
|
||||||
className: if isOP then 'postContainer opContainer' else 'postContainer replyContainer'
|
className: if isOP then 'postContainer opContainer' else 'postContainer replyContainer'
|
||||||
p = $.el 'div',
|
p = $.el 'div',
|
||||||
id: "p#{postID}"
|
id: "p#{postID}"
|
||||||
@ -2476,27 +2467,25 @@ Get =
|
|||||||
textContent: data.name
|
textContent: data.name
|
||||||
if data.trip
|
if data.trip
|
||||||
$.add nameBlock, [$.tn(' '), $.el('span', className: 'postertrip', textContent: data.trip)]
|
$.add nameBlock, [$.tn(' '), $.el('span', className: 'postertrip', textContent: data.trip)]
|
||||||
if data.capcode is 'A' # admin
|
{capcode} = data
|
||||||
|
if capcode isnt 'N' # 'A'dmin or 'M'od
|
||||||
$.add nameBlock, [
|
$.add nameBlock, [
|
||||||
$.tn(' '),
|
$.tn(' '),
|
||||||
$.el('strong', className: 'capcode capcodeAdmin', textContent: '## Admin')
|
$.el('strong',
|
||||||
|
className: if capcode is 'A' then 'capcode capcodeAdmin' else 'capcode',
|
||||||
|
textContent: if capcode is 'A' then '## Admin' else '## Mod'
|
||||||
|
)
|
||||||
]
|
]
|
||||||
nameBlock = $ '.nameBlock', pi
|
nameBlock = $ '.nameBlock', pi
|
||||||
$.addClass nameBlock, 'capcodeAdmin'
|
$.addClass nameBlock, if capcode is 'A' then 'capcodeAdmin' else 'capcodeMod'
|
||||||
$.add nameBlock, [
|
$.add nameBlock, [
|
||||||
$.tn(' '),
|
$.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'
|
$.el('img',
|
||||||
]
|
src: if capcode is 'A' then '//static.4chan.org/image/adminicon.gif' else '//static.4chan.org/image/modicon.gif',
|
||||||
else if data.capcode is 'M' # mod
|
alt: if capcode is 'A' then 'This user is the 4chan Administrator.' else 'This user is a 4chan Moderator.',
|
||||||
$.add nameBlock, [
|
title: if capcode is 'A' then 'This user is the 4chan Administrator.' else 'This user is a 4chan Moderator.',
|
||||||
$.tn(' '),
|
className: 'identityIcon'
|
||||||
$.el('strong', className: 'capcode', textContent: '## Mod')
|
)
|
||||||
]
|
|
||||||
nameBlock = $ '.nameBlock', pi
|
|
||||||
$.addClass nameBlock, 'capcodeMod'
|
|
||||||
$.add nameBlock, [
|
|
||||||
$.tn(' '),
|
|
||||||
$.el('img'), src: '//static.4chan.org/image/adminicon.gif', alt: 'This user is a 4chan Moderator.', title: 'This user is a 4chan Moderator.', className: 'identityIcon'
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@ -2552,7 +2541,7 @@ Get =
|
|||||||
filesize = $.bytesToString data.media_size
|
filesize = $.bytesToString data.media_size
|
||||||
$.add file, $.el 'div',
|
$.add file, $.el 'div',
|
||||||
className: 'fileInfo'
|
className: 'fileInfo'
|
||||||
innerHTML: "<span id=fT#{postID} class=fileText>File: <a href='#{data.media_link or data.remote_media_link}' target=_blank>#{data.media_orig}</a>-(#{filesize}, #{data.media_w}x#{data.media_h}, <span title></span>)</span>"
|
innerHTML: "<span id=fT#{postID} class=fileText>File: <a href='#{data.media_link or data.remote_media_link}' target=_blank>#{data.media_orig}</a>-(#{if data.spoiler is '1' then 'Spoiler Image, ' else ''}#{filesize}, #{data.media_w}x#{data.media_h}, <span title></span>)</span>"
|
||||||
span = $ 'span[title]', file
|
span = $ 'span[title]', file
|
||||||
span.title = data.media_filename
|
span.title = data.media_filename
|
||||||
span.textContent =
|
span.textContent =
|
||||||
@ -2567,7 +2556,7 @@ Get =
|
|||||||
innerHTML: "<img src=#{data.thumb_link} alt='#{if data.spoiler is '1' then 'Spoiler Image, ' else ''}#{filesize}' data-md5=#{data.media_hash} style='height: #{data.preview_h}px; width: #{data.preview_w}px;'>"
|
innerHTML: "<img src=#{data.thumb_link} alt='#{if data.spoiler is '1' then 'Spoiler Image, ' else ''}#{filesize}' data-md5=#{data.media_hash} style='height: #{data.preview_h}px; width: #{data.preview_w}px;'>"
|
||||||
$.after (if isOP then piM else pi), file
|
$.after (if isOP then piM else pi), file
|
||||||
|
|
||||||
|
$.addClass root, 'archivedPost'
|
||||||
$.replace root.firstChild, pc
|
$.replace root.firstChild, pc
|
||||||
cb() if cb
|
cb() if cb
|
||||||
cleanPost: (root) ->
|
cleanPost: (root) ->
|
||||||
@ -2753,14 +2742,16 @@ QuotePreview =
|
|||||||
if img.alt isnt 'File deleted.'
|
if img.alt isnt 'File deleted.'
|
||||||
post.fileInfo = fileInfo
|
post.fileInfo = fileInfo
|
||||||
post.img = img
|
post.img = img
|
||||||
|
if Conf['Reveal Spoilers']
|
||||||
|
RevealSpoilers.node post
|
||||||
if Conf['Image Auto-Gif']
|
if Conf['Image Auto-Gif']
|
||||||
AutoGif.node post
|
AutoGif.node post
|
||||||
if Conf['Time Formatting']
|
if Conf['Time Formatting']
|
||||||
Time.node post
|
Time.node post
|
||||||
if Conf['File Info Formatting']
|
if Conf['File Info Formatting']
|
||||||
FileInfo.node post
|
FileInfo.node post
|
||||||
if Conf['Resurrect Quotes']
|
if Conf['Resurrect Quotes']
|
||||||
Quotify.node post
|
Quotify.node post
|
||||||
|
|
||||||
if board is g.BOARD and el = $.id "p#{postID}"
|
if board is g.BOARD and el = $.id "p#{postID}"
|
||||||
if Conf['Quote Highlighting']
|
if Conf['Quote Highlighting']
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user