main.js
7.01 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
$(function () {
var heightDocs = $(window).height() - 70;
var window_h = $(window).height() - 70;
var content_h = $('#page-wrapper').height();
if (window_h <= content_h) {
$('.page-footer').css('position', 'relative');
$('#page-wrapper').css('min-height', heightDocs);
} else {
$('.page-footer').css('position', 'absolute');
$('#sidebar').css('height', heightDocs);
$('#page-wrapper').css('height', window_h);
}
/*********************/
/*** Menu SideBar ***/
$('#side-menu').metisMenu();
$(window).bind("load resize", function () {
if ($(this).width() < 768) {
$('body').removeClass('left-side-collapsed');
$('.navbar-header').removeClass('logo-collapsed');
$('div.sidebar-collapse').addClass('collapse');
$('#sidebar').css('height', 'auto');
} else {
$('div.sidebar-collapse').removeClass('collapse');
$('#sidebar').css('height', 'auto');
}
});
var page_wrapper_h = $('#page-wrapper').height();
var menu_h = $('#side-menu').height();
var sidebar_h;
if (page_wrapper_h < menu_h) {
sidebar_h = page_wrapper_h;
//BEGIN JQUERY SLIMSCROLL
$('.menu-scroll').slimScroll({
"height": sidebar_h,
"wheelStep": 5
});
//END JQUERY SLIMSCROLL
}
/*** Menu SideBar ***/
/*******************/
//BEGIN TOOTLIP
$("[data-toggle='tooltip'], [data-hover='tooltip']").tooltip();
//END TOOLTIP
//BEGIN POPOVER
$("[data-toggle='popover'], [data-hover='popover']").popover();
//END POPOVER
/*************************/
/*** Template Setting ***/
$('#template-setting > a.btn-template-setting').click(function () {
if ($('#template-setting').css('right') < '0') {
$('#template-setting').css('right', '0');
} else {
$('#template-setting').css('right', '-250px');
}
});
// Begin Change Color Theme
var setColorTheme = function (color) {
$.cookie('#color-style', color);
$('#color-style').attr( 'css/themes/' + color + '.css');
}
$('ul.color-theme > li').click(function () {
var color = $(this).attr('data-style');
setColorTheme(color);
});
if ($.cookie('#color-style')) {
setColorTheme($.cookie('#color-style'));
}
// End Change Color Theme
// Begin Change Style
$('#change-style').change(function () {
if ($(this).val() == '0') {
$('#theme-style').attr('href', 'css/style-mango.css');
} else {
$('#theme-style').attr('href', 'css/style-none-border-bottom.css');
}
});
// End Change Style
/*** Template Setting ***/
/***********************/
/****************************/
/******* Full Screen *******/
$('.btn-fullscreen').click(function () {
if (!document.fullscreenElement && // alternative standard method
!document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement) { // current working methods
if (document.documentElement.requestFullscreen) {
document.documentElement.requestFullscreen();
} else if (document.documentElement.msRequestFullscreen) {
document.documentElement.msRequestFullscreen();
} else if (document.documentElement.mozRequestFullScreen) {
document.documentElement.mozRequestFullScreen();
} else if (document.documentElement.webkitRequestFullscreen) {
document.documentElement.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
}
} else {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.webkitExitFullscreen) {
document.webkitExitFullscreen();
}
}
});
/******* Full Screen *******/
/**************************/
/*************************/
/******** Portlet *******/
$(".portlet").each(function (index, element) {
var me = $(this);
$(">.portlet-header>.tools>i", me).click(function (e) {
if ($(this).hasClass('fa-chevron-up')) {
$(">.portlet-body", me).slideUp('fast');
$(this).removeClass('fa-chevron-up').addClass('fa-chevron-down');
}
else if ($(this).hasClass('fa-chevron-down')) {
$(">.portlet-body", me).slideDown('fast');
$(this).removeClass('fa-chevron-down').addClass('fa-chevron-up');
}
else if ($(this).hasClass('fa-cog')) {
//Show modal
}
else if ($(this).hasClass('fa-refresh')) {
//$(">.portlet-body", me).hide();
$(">.portlet-body", me).addClass('wait');
setTimeout(function () {
//$(">.portlet-body>div", me).show();
$(">.portlet-body", me).removeClass('wait');
}, 1000);
}
else if ($(this).hasClass('fa-times')) {
me.remove();
}
});
});
/******** Portlet *******/
/***********************/
/******************************************/
/********** Jquery Digital Clock *********/
window.onload = function () {
date()
}, setInterval(function () {
date()
}, 1000);
function date() {
var dt = new Date();
var day = dt.getDay();
var mm, dd, h, m, s;
mm = (mm = dt.getMonth() + 1) < 10 ? '0' + mm : mm
dd = (dd = dt.getDate()) < 10 ? '0' + dd : dd
h = (h = dt.getHours()) < 10 ? '0' + h : h
m = (m = dt.getMinutes()) < 10 ? '0' + m : m
s = (s = dt.getSeconds()) < 10 ? '0' + s : s
var days = new Array("Domingo", "Lunes", "Martes", "Miercoles", "Jueves", "Viernes", "Sabado");
$('#get-date').html(days[day] + ', ' + dd + '.' + mm + '.' + dt.getFullYear());
$('#getHours').html(h);
$('#getMinutes').html(m);
$('#getSeconds').html(s);
}
/********** Jquery Digital Clock *********/
/****************************************/
/***********************************/
/************ Back To Top *********/
$(window).scroll(function () {
if ($(this).scrollTop() < 200) {
$('#totop').fadeOut();
} else {
$('#totop').fadeIn();
}
});
$('#totop').on('click', function () {
$('html, body').animate({scrollTop: 0}, 'fast');
return false;
});
/************ Back To Top *********/
/*********************************/
});