checkbox for tree view

Conflicts:
	js/post-hover.js
This commit is contained in:
topkek 2014-11-28 01:15:10 +00:00 committed by czaks
parent 1888e174b3
commit 8de9b68f5f
2 changed files with 9 additions and 13 deletions

View File

@ -54,7 +54,6 @@ if (active_page == 'thread' || active_page == 'index') {
$(document).ready(function(){
var favorites = JSON.parse(localStorage.favorites);
var is_board_favorite = ~$.inArray(board_name, favorites);
console.log(is_board_favorite);
$('header>h1').append('<a id="favorite-star" href="#" data-active="'+(is_board_favorite ? 'true' : 'false')+'" style="color: '+(is_board_favorite ? 'yellow' : 'grey')+'; text-decoration:none">\u2605</span>');
add_favorites();

View File

@ -31,10 +31,8 @@ $(function() {
if (active_page == 'thread')
$(function() {
var treeview_on = false;
var treeview = function() {
if (!treeview_on) {
treeview_on = true;
var treeview = function(enable) {
if (enable === true) {
$('.post.reply').each(function(){
var references = [];
$(this).find('.body a').each(function(){
@ -56,23 +54,22 @@ $(function() {
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');
post.detach().css('margin-left', '').appendTo('.thread');
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(); });
$('hr:first').before('<div class="unimportant" style="text-align:right"><label for="treeview"><input type="checkbox" id="treeview"> '+_('Tree view')+'</label></div>');
$('input#treeview').on('change', function(e) { treeview($(this).is(':checked')); });
if (localStorage.treeview === 'true') {
treeview(true);
$('input#treeview').attr('checked', true);
}
});