toggle tree view
This commit is contained in:
parent
2256604dad
commit
d67351534a
@ -31,7 +31,10 @@ $(function() {
|
|||||||
|
|
||||||
if (active_page == 'thread')
|
if (active_page == 'thread')
|
||||||
$(function() {
|
$(function() {
|
||||||
|
var treeview_on = false;
|
||||||
var treeview = function() {
|
var treeview = function() {
|
||||||
|
if (!treeview_on) {
|
||||||
|
treeview_on = true;
|
||||||
$('.post.reply').each(function(){
|
$('.post.reply').each(function(){
|
||||||
var references = [];
|
var references = [];
|
||||||
$(this).find('.body a').each(function(){
|
$(this).find('.body a').each(function(){
|
||||||
@ -52,6 +55,17 @@ $(function() {
|
|||||||
post.detach().css("margin-left", margin).insertAfter(parent_post.next());
|
post.detach().css("margin-left", margin).insertAfter(parent_post.next());
|
||||||
br.detach().insertAfter(post);
|
br.detach().insertAfter(post);
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
treeview_on = false;
|
||||||
|
$('.post.reply').sort(function(a,b) {
|
||||||
|
return parseInt(a.id.replace('reply_', '')) > parseInt(b.id.replace('reply_', ''));
|
||||||
|
}).each(function () {
|
||||||
|
var post = $(this);
|
||||||
|
var br = post.next();
|
||||||
|
post.detach().css('margin-left', '0').appendTo('.thread');
|
||||||
|
br.detach().insertAfter(post);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (localStorage.treeview === 'true') {
|
if (localStorage.treeview === 'true') {
|
||||||
treeview();
|
treeview();
|
||||||
|
Loading…
Reference in New Issue
Block a user