1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-28 17:31:00 +01:00

checkbox for tree view

This commit is contained in:
topkek 2014-11-28 01:15:10 +00:00
parent 2a2f64c098
commit 82fc6c241b
3 changed files with 10 additions and 14 deletions

View File

@ -56,7 +56,6 @@ if (active_page == 'thread' || active_page == 'index' || active_page == 'catalog
$(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

@ -73,7 +73,7 @@ onready(function(){
.css('font-style', 'normal')
.css('z-index', '100')
.css('left', '0')
.css('margin-left', '0')
.css('margin-left', '')
.addClass('reply').addClass('post')
.appendTo(link.closest('div.post'))

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);
});
}
}
$('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();
treeview(true);
$('input#treeview').attr('checked', true);
}
$('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(); });
});