ace.settings.js
2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/**
<b>Settings box</b>. It's good for demo only. You don't need this.
*/
ace.settings_box = function($) {
$('#ace-settings-btn').on(ace.click_event, function(e){
e.preventDefault();
$(this).toggleClass('open');
$('#ace-settings-box').toggleClass('open');
});
$('#ace-settings-navbar').on('click', function(){
ace.settings.navbar_fixed(this.checked);//@ ace-extra.js
//$(window).triggerHandler('resize.navbar');
//force redraw?
//if(ace.vars['webkit']) ace.helper.redraw(document.body);
}).each(function(){this.checked = ace.settings.is('navbar', 'fixed')})
$('#ace-settings-sidebar').on('click', function(){
ace.settings.sidebar_fixed(this.checked);//@ ace-extra.js
//if(ace.vars['webkit']) ace.helper.redraw(document.body);
}).each(function(){this.checked = ace.settings.is('sidebar', 'fixed')})
$('#ace-settings-breadcrumbs').on('click', function(){
ace.settings.breadcrumbs_fixed(this.checked);//@ ace-extra.js
//if(ace.vars['webkit']) ace.helper.redraw(document.body);
}).each(function(){this.checked = ace.settings.is('breadcrumbs', 'fixed')})
$('#ace-settings-add-container').on('click', function(){
ace.settings.main_container_fixed(this.checked);//@ ace-extra.js
//if(ace.vars['webkit']) ace.helper.redraw(document.body);
}).each(function(){this.checked = ace.settings.is('main-container', 'fixed')})
$('#ace-settings-compact').removeAttr('checked').on('click', function(){
if(this.checked) {
$('#sidebar').addClass('compact');
var hover = $('#ace-settings-hover');
if( hover.length > 0 && !hover.get(0).checked ) {
hover.removeAttr('checked').trigger('click');
}
}
else {
$('#sidebar').removeClass('compact');
if('sidebar_scroll' in ace.helper) ace.helper.sidebar_scroll.reset();
}
});
$('#ace-settings-highlight').removeAttr('checked').on('click', function(){
if(this.checked) $('#sidebar .nav-list > li').addClass('highlight');
else $('#sidebar .nav-list > li').removeClass('highlight');
});
$('#ace-settings-hover').removeAttr('checked').on('click', function(){
if($('.sidebar').hasClass('h-sidebar')) return;
if(this.checked) {
$('#sidebar li').addClass('hover')
.filter('.open').removeClass('open').find('> .submenu').css('display', 'none');
//and remove .open items
}
else {
$('#sidebar li.hover').removeClass('hover');
var compact = $('#ace-settings-compact');
if( compact.length > 0 && compact.get(0).checked ) {
compact.trigger('click');
}
if('sidebar_hover' in ace.helper) ace.helper.sidebar_hover.reset();
}
if('sidebar_scroll' in ace.helper) ace.helper.sidebar_scroll.reset();
});
}