mirror of
https://github.com/vichan-devel/vichan.git
synced 2025-02-16 11:02:40 +01:00
Option to not show top boards
This commit is contained in:
parent
710d66457b
commit
de31d6fca8
@ -130,7 +130,7 @@ if ($admin) {
|
|||||||
unset($boards[$i]['img']);
|
unset($boards[$i]['img']);
|
||||||
}
|
}
|
||||||
|
|
||||||
array_splice($boards, 20);
|
array_splice($boards, 48);
|
||||||
|
|
||||||
$boards = array_values($boards);
|
$boards = array_values($boards);
|
||||||
|
|
||||||
|
@ -1,6 +1,27 @@
|
|||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
|
||||||
window.boards = new Array();
|
window.boards = new Array();
|
||||||
|
|
||||||
|
if (window.Options && Options.get_tab('general')) {
|
||||||
|
Options.extend_tab("general", "<label id='show-top'><input type='checkbox' /> "+_('Show top boards')+"</label>");
|
||||||
|
|
||||||
|
if (typeof localStorage.show_top === 'undefined') {
|
||||||
|
localStorage.show_top = 'true';
|
||||||
|
var show_top = JSON.parse(localStorage.show_top);
|
||||||
|
$('#show-top>input').attr('checked', 'checked');
|
||||||
|
} else {
|
||||||
|
var show_top = JSON.parse(localStorage.show_top);
|
||||||
|
if (show_top) $('#show-top>input').attr('checked', 'checked');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$('#show-top>input').on('change', function() {
|
||||||
|
var show_top = ($(this).is(':checked'));
|
||||||
|
|
||||||
|
localStorage.show_top = JSON.stringify(show_top);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function handle_boards(data) {
|
function handle_boards(data) {
|
||||||
$.each(data, function(k, v) {
|
$.each(data, function(k, v) {
|
||||||
if (v.uri != 'meta' && v.uri != 'b') {
|
if (v.uri != 'meta' && v.uri != 'b') {
|
||||||
@ -9,12 +30,12 @@ function handle_boards(data) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
if (boards[0]) {
|
if (boards[0]) {
|
||||||
$('.sub[data-description="2"]').after('<span class="sub" data-description="3"> [ '+boards.slice(0,15).join(" / ")+' ] </span>');
|
$('.sub[data-description="2"]').after('<span class="sub" data-description="3"> [ '+boards.slice(0,25).join(" / ")+' ] </span>');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$.getJSON("/boards-top20.json", handle_boards)
|
if (!(window.location.pathname != '' && window.location.pathname != '/' && window.location.pathname != '/index.html' && typeof show_top !== "undefined" && !show_top)) {
|
||||||
|
$.getJSON("/boards-top20.json", handle_boards)
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user