Fix shortened filename too short for OPs.
This commit is contained in:
parent
0248c180bd
commit
58f40bf917
@ -489,7 +489,7 @@
|
||||
},
|
||||
shortenFilename: function(filename, isOP) {
|
||||
var threshold;
|
||||
threshold = isOP ? 40 : 30;
|
||||
threshold = 30 + 10 * isOP;
|
||||
if (filename.replace(/\.\w+$/, '').length > threshold) {
|
||||
return "" + filename.slice(0, threshold - 5) + "(...)" + (filename.match(/\.\w+$/));
|
||||
} else {
|
||||
@ -3401,7 +3401,7 @@
|
||||
unit: alt.match(/\w+$/)[0],
|
||||
resolution: node.textContent.match(/\d+x\d+|PDF/)[0],
|
||||
fullname: filename,
|
||||
shortname: $.shortenFilename(filename, post.isOP)
|
||||
shortname: $.shortenFilename(filename, post.ID === post.threadID)
|
||||
};
|
||||
node.setAttribute('data-filename', filename);
|
||||
return node.innerHTML = FileInfo.funk(FileInfo);
|
||||
|
||||
@ -372,7 +372,7 @@ $.extend $,
|
||||
# FILENAME SHORTENING SCIENCE:
|
||||
# OPs have a +10 characters threshold.
|
||||
# The file extension is not taken into account.
|
||||
threshold = if isOP then 40 else 30
|
||||
threshold = 30 + 10 * isOP
|
||||
if filename.replace(/\.\w+$/, '').length > threshold
|
||||
"#{filename[...threshold - 5]}(...)#{filename.match(/\.\w+$/)}"
|
||||
else
|
||||
@ -2692,7 +2692,7 @@ FileInfo =
|
||||
unit: alt.match(/\w+$/)[0]
|
||||
resolution: node.textContent.match(/\d+x\d+|PDF/)[0]
|
||||
fullname: filename
|
||||
shortname: $.shortenFilename filename, post.isOP
|
||||
shortname: $.shortenFilename filename, post.ID is post.threadID
|
||||
# XXX GM/Scriptish
|
||||
node.setAttribute 'data-filename', filename
|
||||
node.innerHTML = FileInfo.funk FileInfo
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user