From dc1cd65e1131936d362cddd9812b29af8579477b Mon Sep 17 00:00:00 2001 From: marktaiwan Date: Fri, 23 Jan 2015 14:08:52 +0800 Subject: [PATCH] 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. --- js/post-hover.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/js/post-hover.js b/js/post-hover.js index aa4f5c60..4f4e7448 100644 --- a/js/post-hover.js +++ b/js/post-hover.js @@ -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 = $('
') .append($('

') @@ -224,7 +230,7 @@ onready(function(){ .append(''+ this.filename + file_ext +'') .append(' ('+ bytesToSize(this.fsize) +', '+ this.w +'x'+ this.h +')') ); - if (multifile) $ele.addClass('multifile').css('max-width', '200px'); + if (multifile) $ele.addClass('multifile').css('width', this.thumb_w + 30); // image var $img = $('')