1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-24 07:30:10 +01:00

Merge branch 'staging' of github.com:vichan-devel/Tinyboard into staging

This commit is contained in:
czaks 2014-05-05 17:29:52 +02:00
commit e3ac13289d
2 changed files with 19 additions and 12 deletions

View File

@ -2261,17 +2261,13 @@ function mod_recent_posts($lim) {
// Still need to fix this: // Still need to fix this:
$po = new Thread($post, '?/', $mod, false); $po = new Thread($post, '?/', $mod, false);
$string = $po->build(true); $string = $po->build(true);
$replacement = str_replace('<p class="fileinfo">', $string = '<div class="post-wrapper" data-board="'.$post['board'].'"><hr/><a class="eita-link" id="eita-'.$post['board'].'-'.$post['id'].'" href="?/'.$post['board'].'/res/'.$post['id'].'.html#'.$post['id'].'">/'.$post['board'].'/'.$post['id'].'</a><br>' . $string;
'<div class="post-wrapper" data-board="'.$post['board'].'"><a class="eita-link" id="eita-'.$post['board'].'-'.$post['id'].'" href="?/'.$post['board'].'/res/'.$post['id'].'.html#'.$post['id'].'">/'.$post['board'].'/'.$post['id'].'</a><br><p class="fileinfo">',
$string);
} else { } else {
$po = new Post($post, '?/', $mod); $po = new Post($post, '?/', $mod);
$string = $po->build(true); $string = $po->build(true);
$replacement = str_replace('<div class="post reply"', $string = '<div class="post-wrapper" data-board="'.$post['board'].'"><hr/><a class="eita-link" id="eita-'.$post['board'].'-'.$post['id'].'" href="?/'.$post['board'].'/res/'.$post['thread'].'.html#'.$post['id'].'">/'.$post['board'].'/'.$post['id'].'</a><br>' . $string;
'<div class="post-wrapper" data-board="'.$post['board'].'"><a class="eita-link" id="eita-'.$post['board'].'-'.$post['id'].'" href="?/'.$post['board'].'/res/'.$post['thread'].'.html#'.$post['id'].'">/'.$post['board'].'/'.$post['id'].'</a><br><div class="post reply"',
$string);
} }
$body .= $replacement . '</div>'; $body .= $string . '</div>';
} }
echo Element('page.html', array( echo Element('page.html', array(

View File

@ -38,10 +38,10 @@ $(document).ready(function(){
} }
var handle_images = function() { var handle_images = function() {
var index = $(this).parents('.file').index();
var img = this; var img = this;
var fileinfo = $(this).parent().prev(); var fileinfo = $(this).parent().prev();
var id = $(this).parent().parent().find('>p.intro>a.post_no:eq(1),>div.post.op>p.intro>a.post_no:eq(1)').text(); var id = $(this).parents('div.post, div[id^="thread_"]').attr('id').split('_')[1];
var board = $(this).parents('[id^="thread_"]').data("board"); var board = $(this).parents('[id^="thread_"]').data("board");
if (!hidden_data[board]) { if (!hidden_data[board]) {
@ -51,11 +51,21 @@ $(document).ready(function(){
var replacement = $('<span>'+_('File')+' <small>(<a class="hide-image-link" href="javascript:void(0)">'+_('hide')+'</a>)</small>: </span>'); var replacement = $('<span>'+_('File')+' <small>(<a class="hide-image-link" href="javascript:void(0)">'+_('hide')+'</a>)</small>: </span>');
replacement.find('a').click(function() { replacement.find('a').click(function() {
hidden_data[board][id] = Math.round(Date.now() / 1000); if (hidden_data[board][id]) {
hidden_data[board][id]['ts'] = Math.round(Date.now() / 1000);
if (hidden_data[board][id]['index'].indexOf(index) === -1)
hidden_data[board][id]['index'].push(index);
} else {
hidden_data[board][id] = {ts: Math.round(Date.now() / 1000), index: [index]};
}
store_data(); store_data();
var show_link = $('<a class="show-image-link" href="javascript:void(0)">'+_('show')+'</a>').click(function() { var show_link = $('<a class="show-image-link" href="javascript:void(0)">'+_('show')+'</a>').click(function() {
delete hidden_data[board][id]; var i = hidden_data[board][id]['index'].indexOf(index);
if (i > -1) hidden_data[board][id]['index'].splice(i,1);
if (hidden_data[board][id]['index'].length === 0)
delete hidden_data[board][id];
store_data(); store_data();
$(img) $(img)
@ -70,6 +80,7 @@ $(document).ready(function(){
if ($(img).parent()[0].dataset.expanded == 'true') { if ($(img).parent()[0].dataset.expanded == 'true') {
$(img).parent().click(); $(img).parent().click();
} }
$(img) $(img)
.data('orig', img.src) .data('orig', img.src)
.attr('src', 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==') .attr('src', 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==')
@ -78,7 +89,7 @@ $(document).ready(function(){
$(this).parent().prev().contents().first().replaceWith(replacement); $(this).parent().prev().contents().first().replaceWith(replacement);
if (hidden_data[board][id]) if (hidden_data[board][id] && hidden_data[board][id]['index'].indexOf(index) !== -1)
$(this).parent().prev().find('.hide-image-link').click(); $(this).parent().prev().find('.hide-image-link').click();
}; };