|
|
@ -11,14 +11,27 @@ |
|
|
|
* |
|
|
|
*/ |
|
|
|
|
|
|
|
if (active_page == 'thread') |
|
|
|
if (active_page == 'thread' || active_page == 'ukko' || active_page == 'index') |
|
|
|
$(function() { |
|
|
|
$('hr:first').before('<div id="treeview" style="text-align:right"><a class="unimportant" href="javascript:void(0)"></a></div>'); |
|
|
|
$('div#treeview a') |
|
|
|
.text(_('Tree view')) |
|
|
|
.click(function(e) { |
|
|
|
e.preventDefault(); |
|
|
|
if (window.Options && Options.get_tab('general')) { |
|
|
|
var selector = '#treeview-global>input'; |
|
|
|
Options.extend_tab("general", "<label id='treeview-global'><input type='checkbox' /> "+_('Use tree view by default')+"</label>"); |
|
|
|
} |
|
|
|
$(selector).on('change', function () { |
|
|
|
if (localStorage.treeview === 'true') { |
|
|
|
localStorage.treeview = 'false'; |
|
|
|
} else { |
|
|
|
localStorage.treeview = 'true'; |
|
|
|
} |
|
|
|
}); |
|
|
|
if (localStorage.treeview === 'true') { |
|
|
|
$(selector).attr('checked', 'checked'); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
if (active_page == 'thread') |
|
|
|
$(function() { |
|
|
|
var treeview = function() { |
|
|
|
$('.post.reply').each(function(){ |
|
|
|
var references = []; |
|
|
|
$(this).find('.body a').each(function(){ |
|
|
@ -26,7 +39,6 @@ $(function() { |
|
|
|
references.push(parseInt($(this).html().replace('>>', ''))); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
var maxref = references.reduce(function(a,b) { return a > b ? a : b; }, 0); |
|
|
|
|
|
|
|
var parent_post = $("#reply_"+maxref); |
|
|
@ -39,7 +51,14 @@ $(function() { |
|
|
|
|
|
|
|
post.detach().css("margin-left", margin).insertAfter(parent_post.next()); |
|
|
|
br.detach().insertAfter(post); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
if (localStorage.treeview === 'true') { |
|
|
|
treeview(); |
|
|
|
} |
|
|
|
|
|
|
|
$('hr:first').before('<div id="treeview" style="text-align:right"><a class="unimportant" href="javascript:void(0)"></a></div>'); |
|
|
|
$('div#treeview a') |
|
|
|
.text(_('Tree view')) |
|
|
|
.click(function(e) { treeview(); e.preventDefault(); }); |
|
|
|
}); |
|
|
|