Repository navigation
Expand file tree
/
Copy pathsmartui.js
More file actions
executable file
·222 lines (200 loc) · 7 KB
/
Copy pathsmartui.js
File metadata and controls
executable file
·222 lines (200 loc) · 7 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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
//Main Function
var App = function () {
// IE mode
var isIE8 = false;
var isIE9 = false;
var isIE10 = false;
var $pageArea;
var currentPage = ''; // current page
//main settings
var HoldInit = function () {
isIE8 = !! navigator.userAgent.match(/MSIE 8.0/);
isIE9 = !! navigator.userAgent.match(/MSIE 9.0/);
isIE10 = !! navigator.userAgent.match(/MSIE 10.0/);
if (isIE10) {
jQuery('html').addClass('ie10'); // detect IE10 version
}
if (isIE10 || isIE9 || isIE8) {
jQuery('html').addClass('ie'); // detect IE10 version
}
}
//Tooltips
var HoldTooltips = function () {
if ($(".tooltips").length) {
$('.tooltips').tooltip();
}
$("[data-toggle='tooltip']").tooltip();
};
//Popovers
var HoldPopovers = function () {
if ($(".popovers").length) {
$('.popovers').popover();
}
};
//The size of the sidebar menu
var HoldNavigationToggler = function () {
$('.navigation-toggler').bind('click', function () {
if (!$('body').hasClass('small-nav')) {
$('body').addClass('small-nav');
$('.icon-arrow').hide();
// $('.brand-wrap').hide();
} else {
$('body').removeClass('small-nav');
$('.icon-arrow').hide();
// $('.brand-wrap').show();
};
});
};
//Panel tools
var HoldModuleTools = function () {
$('.panel-tools .panel-close').bind('click', function (e) {
$(this).parents(".panel").fadeOut(500, function(){
$(this).remove();
});
e.preventDefault();
});
$('.panel-tools .panel-refresh').bind('click', function (e) {
var el = $(this).parents(".panel");
el.block({
overlayCSS: {
backgroundColor: '#fff'
},
message: '<img src="assets/images/loading.gif" />',
css: {
border: 'none',
color: '#333',
background: 'none'
}
});
window.setTimeout(function () {
el.unblock();
}, 1000);
e.preventDefault();
});
$('.panel-tools .panel-collapse').bind('click', function (e) {
e.preventDefault();
var el = jQuery(this).parent().closest(".panel").children(".panel-body");
if ($(this).hasClass("collapses")) {
$(this).addClass("expand").removeClass("collapses");
el.slideUp(200);
} else {
$(this).addClass("collapses").removeClass("expand");
el.slideDown(200);
}
});
};
//Sidebar menus
var HoldSidebarNav = function () {
$('.sidebar-menu li.active').addClass('open');
$('.sidebar-menu > li a').bind('click', function () {
if ($(this).parent().children('ul').hasClass('sub') && (!$('body').hasClass('small-nav') || !$(this).parent().parent().hasClass('main-navigation-menu'))) {
if (!$(this).parent().hasClass('open')) {
$(this).parent().addClass('open');
$(this).parent().parent().children('li.open').not($(this).parent()).not($('.main-navigation-menu > li.active')).removeClass('open').children('ul').slideUp(300);
$(this).parent().children('ul').slideDown(300);
} else {
if (!$(this).parent().hasClass('active')) {
$(this).parent().parent().children('li.open').not($('.main-navigation-menu > li.active')).removeClass('open').children('ul').slideUp(300);
} else {
$(this).parent().parent().children('li.open').removeClass('open').children('ul').slideUp(300);
}
}
}
});
};
//function scroll to top
var HoldGoTop = function () {
$('.go-to-top').click(function(e) {
$("html, body").animate({
scrollTop: 0}, "slow");
e.preventDefault();
});
};
//Sparkline
var HoldSparkline = function () {
$('#visit_1').sparkline([67547], {
type: "bar",
barSpacing: 2,
barColor: "#00bdaf",
barWidth: "57",
height: "42",
chartRangeMin: "10"
});
$('#visit_2').sparkline([30141], {
type: "bar",
barSpacing: 2,
barColor: "#1c84c6",
barWidth: "57",
height: "20",
chartRangeMin: "10"
});
};
//Custom checkboxes & radios using jQuery Uniform plugin
var HoldUniform = function () {
if (!jQuery().uniform) {
return;
}
var test = $("input[type=checkbox]:not(.toggle), input[type=radio]:not(.toggle, .star)");
if (test.size() > 0) {
test.each(function () {
if ($(this).parents(".checker").size() == 0) {
$(this).show();
$(this).uniform();
}
});
}
}
// range slider
var HoldRangeSlider = function () {
$("#slider-range").slider({
range: true,
min: 0,
max: 500,
values: [75, 300],
slide: function (event, ui) {
$("#slider-range-amount").text("$" + ui.values[0] + " - $" + ui.values[1]);
}
});
}
//iCheck plugin for login page
var HoldCustomCheckbox = function () {
$('input[type="checkbox"].grey, input[type="radio"].grey').iCheck({
checkboxClass: 'icheckbox_minimal-grey',
radioClass: 'iradio_minimal-grey',
increaseArea: '10%' // optional
});
};
return {
//main function to initiate template pages
init: function () {
// page level handlers
if (App.isPage("index")) {
HoldVisitorsChart(); // handles plot charts for main page
HoldSparkline(); // handles sparklines
HoldPieChart();
HoldCustomCheckbox();
}
// page level holders
if (App.isPage("product")) {
HoldRangeSlider();
}
HoldInit();
HoldNavigationToggler(); //Navigation Toggler
HoldSidebarNav(); //Saide bar navigation
HoldGoTop(); //Got to top button
HoldModuleTools(); //Tools
HoldTooltips(); //Tooltips
HoldPopovers(); //Popovers
HoldUniform(); //Uniform
HoldCustomCheckbox();
},
// set map page
setPage: function (name) {
currentPage = name;
},
// check current page
isPage: function (name) {
return currentPage == name ? true : false;
}
};
}();