Fix thumbnail overlapping on external preview

Fix the occasional thumbnail and filename overlap by truncating longer
filenames and set file container width according to thumbnail width.
This commit is contained in:
marktaiwan 2015-01-23 14:08:52 +08:00
parent 987dc2c8af
commit dc1cd65e11

View File

@ -217,6 +217,12 @@ onready(function(){
} else {
thumb_url = (this.isSpoiler) ? '/static/spoiler.png' : '/static/file.png';
}
// truncate long filenames
if (this.filename.length > 23) {
this.filename = this.filename.substr(0, 22) + '…';
}
// file infos
var $ele = $('<div class="file">')
.append($('<p class="fileinfo">')
@ -224,7 +230,7 @@ onready(function(){
.append('<a>'+ this.filename + file_ext +'</a>')
.append('<span class="unimportant"> ('+ bytesToSize(this.fsize) +', '+ this.w +'x'+ this.h +')</span>')
);
if (multifile) $ele.addClass('multifile').css('max-width', '200px');
if (multifile) $ele.addClass('multifile').css('width', this.thumb_w + 30);
// image
var $img = $('<img class="post-image">')