mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-12-01 10:37:18 +01:00
checkbox for tree view
This commit is contained in:
parent
2a2f64c098
commit
82fc6c241b
@ -56,7 +56,6 @@ if (active_page == 'thread' || active_page == 'index' || active_page == 'catalog
|
|||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
var favorites = JSON.parse(localStorage.favorites);
|
var favorites = JSON.parse(localStorage.favorites);
|
||||||
var is_board_favorite = ~$.inArray(board_name, 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>');
|
$('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();
|
add_favorites();
|
||||||
|
@ -73,7 +73,7 @@ onready(function(){
|
|||||||
.css('font-style', 'normal')
|
.css('font-style', 'normal')
|
||||||
.css('z-index', '100')
|
.css('z-index', '100')
|
||||||
.css('left', '0')
|
.css('left', '0')
|
||||||
.css('margin-left', '0')
|
.css('margin-left', '')
|
||||||
.addClass('reply').addClass('post')
|
.addClass('reply').addClass('post')
|
||||||
.appendTo(link.closest('div.post'))
|
.appendTo(link.closest('div.post'))
|
||||||
|
|
||||||
|
@ -31,10 +31,8 @@ $(function() {
|
|||||||
|
|
||||||
if (active_page == 'thread')
|
if (active_page == 'thread')
|
||||||
$(function() {
|
$(function() {
|
||||||
var treeview_on = false;
|
var treeview = function(enable) {
|
||||||
var treeview = function() {
|
if (enable === true) {
|
||||||
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(){
|
||||||
@ -56,23 +54,22 @@ $(function() {
|
|||||||
br.detach().insertAfter(post);
|
br.detach().insertAfter(post);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
treeview_on = false;
|
|
||||||
$('.post.reply').sort(function(a,b) {
|
$('.post.reply').sort(function(a,b) {
|
||||||
return parseInt(a.id.replace('reply_', '')) - parseInt(b.id.replace('reply_', ''));
|
return parseInt(a.id.replace('reply_', '')) - parseInt(b.id.replace('reply_', ''));
|
||||||
}).each(function () {
|
}).each(function () {
|
||||||
var post = $(this);
|
var post = $(this);
|
||||||
var br = post.next();
|
var br = post.next();
|
||||||
post.detach().css('margin-left', '0').appendTo('.thread');
|
post.detach().css('margin-left', '').appendTo('.thread');
|
||||||
br.detach().insertAfter(post);
|
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') {
|
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(); });
|
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user