Update filename threshold in parseArchivedPost.
This commit is contained in:
parent
6956b4a4e1
commit
bfbfcf1de9
@ -3497,7 +3497,7 @@
|
||||
}
|
||||
},
|
||||
parseArchivedPost: function(req, board, postID, root, cb) {
|
||||
var bq, br, capcode, data, email, file, filename, filesize, isOP, max, name, nameBlock, pc, pi, piM, span, spoiler, subject, threadID, 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;
|
||||
data = JSON.parse(req.response);
|
||||
$.addClass(root, 'archivedPost');
|
||||
if (data.error) {
|
||||
@ -3635,8 +3635,8 @@
|
||||
}));
|
||||
span = $('span[title]', file);
|
||||
span.title = filename;
|
||||
max = isOP ? 40 : 30;
|
||||
span.textContent = filename.replace(/\.\w+$/, '').length > max ? "" + filename.slice(0, max) + "(...)" + (filename.match(/\.\w+$/)) : filename;
|
||||
threshold = isOP ? 40 : 30;
|
||||
span.textContent = filename.replace(/\.\w+$/, '').length > threshold ? "" + filename.slice(0, threshold - 5) + "(...)" + (filename.match(/\.\w+$/)) : filename;
|
||||
thumb_src = data.media_status === 'available' ? "src=" + data.thumb_link : '';
|
||||
$.add(file, $.el('a', {
|
||||
className: spoiler ? 'fileThumb imgspoiler' : 'fileThumb',
|
||||
|
||||
@ -2892,15 +2892,13 @@ Get =
|
||||
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 spoiler then 'Spoiler Image, ' else ''}#{filesize}, #{data.media_w}x#{data.media_h}, <span title></span>)</span>"
|
||||
span = $ 'span[title]', file
|
||||
span.title = filename
|
||||
max = if isOP then 40 else 30
|
||||
threshold = if isOP then 40 else 30
|
||||
span.textContent =
|
||||
# FILENAME SHORTENING SCIENCE:
|
||||
# OPs have +10 characters max.
|
||||
# OPs have a +10 characters threshold.
|
||||
# The file extension is not taken into account.
|
||||
# abcdefghijklmnopqrstuvwxyz_1234.jpg is shortened.
|
||||
# abcdefghijklmnopqrstuvwxyz_123.jpg is not shortened.
|
||||
if filename.replace(/\.\w+$/, '').length > max
|
||||
"#{filename[...max]}(...)#{filename.match(/\.\w+$/)}"
|
||||
if filename.replace(/\.\w+$/, '').length > threshold
|
||||
"#{filename[...threshold - 5]}(...)#{filename.match(/\.\w+$/)}"
|
||||
else
|
||||
filename
|
||||
thumb_src = if data.media_status is 'available' then "src=#{data.thumb_link}" else ''
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user