1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-12-01 10:37:18 +01:00

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

Bugfix: display correct time on post preview
This commit is contained in:
Fredrick Brennan 2015-03-08 12:47:43 +08:00
commit 3026d8e952

View File

@ -181,12 +181,12 @@ onready(function(){
return (i === 0) ? bytes +' '+ sizes[i] : (bytes / Math.pow(1024, i)).toFixed(2) +' ' +sizes[i]; return (i === 0) ? bytes +' '+ sizes[i] : (bytes / Math.pow(1024, i)).toFixed(2) +' ' +sizes[i];
}; };
var time = (!localStorage.show_relative_time || localStorage.show_relative_time === 'false') ? dateformat(new Date(data.time)) : timeDifference(Date.now(), data.time); var time = (!localStorage.show_relative_time || localStorage.show_relative_time === 'false') ? dateformat(new Date(data.time*1000)) : timeDifference(Date.now(), data.time*1000);
var $post = $('<div class="post reply hidden" id="reply_'+ data.no +'">') var $post = $('<div class="post reply hidden" id="reply_'+ data.no +'">')
.append($('<p class="intro"></p>') .append($('<p class="intro"></p>')
.append('<span class="name">'+ data.name +'</span> ') .append('<span class="name">'+ data.name +'</span> ')
.append('<time>'+ time +'</time>') .append('<time datetime="'+ new Date(data.time*1000).toISOString() +'">'+ time +'</time>')
.append('<a class="post_no">No.'+ data.no +'</a>') .append('<a class="post_no"> No.'+ data.no +'</a>')
) )
.append($('<div class="body"></div>') .append($('<div class="body"></div>')
.html(data.com) .html(data.com)
@ -198,6 +198,7 @@ onready(function(){
if ('trip' in data) $post.find('.name').after('<span class="trip">'+ data.trip +'</span>'); if ('trip' in data) $post.find('.name').after('<span class="trip">'+ data.trip +'</span>');
if ('capcode' in data) $post.find('.post_no').before('<span class="capcode">## '+ data.capcode +'</span>'); if ('capcode' in data) $post.find('.post_no').before('<span class="capcode">## '+ data.capcode +'</span>');
if ('id' in data) $post.find('.post_no').before('<span class="poster_id">'+ data.id +'</span>'); if ('id' in data) $post.find('.post_no').before('<span class="poster_id">'+ data.id +'</span>');
if ('embed' in data) $post.find('p.intro').after(data.embed);
if ('filename' in data) { if ('filename' in data) {
var $files = $('<div class="files">'); var $files = $('<div class="files">');
@ -260,10 +261,6 @@ onready(function(){
$post.children('p.intro').after($files); $post.children('p.intro').after($files);
// youtube embed
if ('embed' in data) {
$post.children('p.intro').after(data.embed);
}
} }
var mythreadid = (data.resto !== 0) ? data.resto : data.no; var mythreadid = (data.resto !== 0) ? data.resto : data.no;