1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2025-02-21 13:09:41 +01:00

Merge pull request #361 from marktaiwan/external-post-preview

Bug fix: external post preview
This commit is contained in:
Fredrick Brennan 2015-01-29 09:53:39 +08:00
commit e3ce9f6301

View File

@ -212,11 +212,17 @@ onready(function(){
if (this.isImage && !this.isSpoiler) { if (this.isImage && !this.isSpoiler) {
// video files uses jpg for thumbnail // 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; thumb_url = '/'+ board +'/thumb/' + this.tim + this.ext;
} else { } else {
thumb_url = (this.isSpoiler) ? '/static/spoiler.png' : '/static/file.png'; 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 // file infos
var $ele = $('<div class="file">') var $ele = $('<div class="file">')
.append($('<p class="fileinfo">') .append($('<p class="fileinfo">')
@ -224,7 +230,7 @@ onready(function(){
.append('<a>'+ this.filename + file_ext +'</a>') .append('<a>'+ this.filename + file_ext +'</a>')
.append('<span class="unimportant"> ('+ bytesToSize(this.fsize) +', '+ this.w +'x'+ this.h +')</span>') .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 // image
var $img = $('<img class="post-image">') var $img = $('<img class="post-image">')