From dc1cd65e1131936d362cddd9812b29af8579477b Mon Sep 17 00:00:00 2001 From: marktaiwan Date: Fri, 23 Jan 2015 14:08:52 +0800 Subject: [PATCH 1/2] 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 = $('') From 0f1461f7e507d6607760e9a3e6061dd18e9f7ad2 Mon Sep 17 00:00:00 2001 From: Mark Taiwan Date: Wed, 28 Jan 2015 23:29:15 +0800 Subject: [PATCH 2/2] Thumbnail file extension fix Fix thumbnail images sometimes using `.jpeg` file extension, resulting in 404. --- js/post-hover.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/post-hover.js b/js/post-hover.js index 4f4e7448..fab3a45d 100644 --- a/js/post-hover.js +++ b/js/post-hover.js @@ -212,7 +212,7 @@ onready(function(){ if (this.isImage && !this.isSpoiler) { // video files uses jpg for thumbnail - if (this.ext === '.webm' || this.ext === '.mp4') this.ext = '.jpg'; + if (this.ext === '.webm' || this.ext === '.mp4' || this.ext === '.jpeg') this.ext = '.jpg'; thumb_url = '/'+ board +'/thumb/' + this.tim + this.ext; } else { thumb_url = (this.isSpoiler) ? '/static/spoiler.png' : '/static/file.png';