elements.js
7.3 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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
jQuery(function($) {
/**
$('#myTab a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
//console.log(e.target.getAttribute("href"));
})
$('#accordion').on('shown.bs.collapse', function (e) {
//console.log($(e.target).is('#collapseTwo'))
});
*/
$('#myTab a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
if($(e.target).attr('href') == "#home") drawChartNow();
})
/**
//go to next tab, without user clicking
$('#myTab > .active').next().find('> a').trigger('click');
*/
$('#accordion-style').on('click', function(ev){
var target = $('input', ev.target);
var which = parseInt(target.val());
if(which == 2) $('#accordion').addClass('accordion-style2');
else $('#accordion').removeClass('accordion-style2');
});
//$('[href="#collapseTwo"]').trigger('click');
var oldie = /msie\s*(8|7|6)/.test(navigator.userAgent.toLowerCase());
$('.easy-pie-chart.percentage').each(function(){
$(this).easyPieChart({
barColor: $(this).data('color'),
trackColor: '#EEEEEE',
scaleColor: false,
lineCap: 'butt',
lineWidth: 8,
animate: oldie ? false : 1000,
size:75
}).css('color', $(this).data('color'));
});
$('[data-rel=tooltip]').tooltip();
$('[data-rel=popover]').popover({html:true});
$('#gritter-regular').on(ace.click_event, function(){
$.gritter.add({
title: 'This is a regular notice!',
text: 'This will fade out after a certain amount of time. Vivamus eget tincidunt velit. Cum sociis natoque penatibus et <a href="#" class="blue">magnis dis parturient</a> montes, nascetur ridiculus mus.',
image: $path_assets+'/avatars/avatar1.png',
sticky: false,
time: '',
class_name: (!$('#gritter-light').get(0).checked ? 'gritter-light' : '')
});
return false;
});
$('#gritter-sticky').on(ace.click_event, function(){
var unique_id = $.gritter.add({
title: 'This is a sticky notice!',
text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus eget tincidunt velit. Cum sociis natoque penatibus et <a href="#" class="red">magnis dis parturient</a> montes, nascetur ridiculus mus.',
image: $path_assets+'/avatars/avatar.png',
sticky: true,
time: '',
class_name: 'gritter-info' + (!$('#gritter-light').get(0).checked ? ' gritter-light' : '')
});
return false;
});
$('#gritter-without-image').on(ace.click_event, function(){
$.gritter.add({
// (string | mandatory) the heading of the notification
title: 'This is a notice without an image!',
// (string | mandatory) the text inside the notification
text: 'This will fade out after a certain amount of time. Vivamus eget tincidunt velit. Cum sociis natoque penatibus et <a href="#" class="orange">magnis dis parturient</a> montes, nascetur ridiculus mus.',
class_name: 'gritter-success' + (!$('#gritter-light').get(0).checked ? ' gritter-light' : '')
});
return false;
});
$('#gritter-max3').on(ace.click_event, function(){
$.gritter.add({
title: 'This is a notice with a max of 3 on screen at one time!',
text: 'This will fade out after a certain amount of time. Vivamus eget tincidunt velit. Cum sociis natoque penatibus et <a href="#" class="green">magnis dis parturient</a> montes, nascetur ridiculus mus.',
image: $path_assets+'/avatars/avatar3.png',
sticky: false,
before_open: function(){
if($('.gritter-item-wrapper').length >= 3)
{
return false;
}
},
class_name: 'gritter-warning' + (!$('#gritter-light').get(0).checked ? ' gritter-light' : '')
});
return false;
});
$('#gritter-center').on(ace.click_event, function(){
$.gritter.add({
title: 'This is a centered notification',
text: 'Just add a "gritter-center" class_name to your $.gritter.add or globally to $.gritter.options.class_name',
class_name: 'gritter-info gritter-center' + (!$('#gritter-light').get(0).checked ? ' gritter-light' : '')
});
return false;
});
$('#gritter-error').on(ace.click_event, function(){
$.gritter.add({
title: 'This is a warning notification',
text: 'Just add a "gritter-light" class_name to your $.gritter.add or globally to $.gritter.options.class_name',
class_name: 'gritter-error' + (!$('#gritter-light').get(0).checked ? ' gritter-light' : '')
});
return false;
});
$("#gritter-remove").on(ace.click_event, function(){
$.gritter.removeAll();
return false;
});
///////
$("#bootbox-regular").on(ace.click_event, function() {
bootbox.prompt("What is your name?", function(result) {
if (result === null) {
} else {
}
});
});
$("#bootbox-confirm").on(ace.click_event, function() {
bootbox.confirm("Are you sure?", function(result) {
if(result) {
//
}
});
});
/**
$("#bootbox-confirm").on(ace.click_event, function() {
bootbox.confirm({
message: "Are you sure?",
buttons: {
confirm: {
label: "OK",
className: "btn-primary btn-sm",
},
cancel: {
label: "Cancel",
className: "btn-sm",
}
},
callback: function(result) {
if(result) alert(1)
}
}
);
});
**/
$("#bootbox-options").on(ace.click_event, function() {
bootbox.dialog({
message: "<span class='bigger-110'>I am a custom dialog with smaller buttons</span>",
buttons:
{
"success" :
{
"label" : "<i class='ace-icon fa fa-check'></i> Success!",
"className" : "btn-sm btn-success",
"callback": function() {
//Example.show("great success");
}
},
"danger" :
{
"label" : "Danger!",
"className" : "btn-sm btn-danger",
"callback": function() {
//Example.show("uh oh, look out!");
}
},
"click" :
{
"label" : "Click ME!",
"className" : "btn-sm btn-primary",
"callback": function() {
//Example.show("Primary button");
}
},
"button" :
{
"label" : "Just a button...",
"className" : "btn-sm"
}
}
});
});
$('#spinner-opts small').css({display:'inline-block', width:'60px'})
var slide_styles = ['', 'green','red','purple','orange', 'dark'];
var ii = 0;
$("#spinner-opts input[type=text]").each(function() {
var $this = $(this);
$this.hide().after('<span />');
$this.next().addClass('ui-slider-small').
addClass("inline ui-slider-"+slide_styles[ii++ % slide_styles.length]).
css('width','125px').slider({
value:parseInt($this.val()),
range: "min",
animate:true,
min: parseInt($this.attr('data-min')),
max: parseInt($this.attr('data-max')),
step: parseFloat($this.attr('data-step')) || 1,
slide: function( event, ui ) {
$this.val(ui.value);
spinner_update();
}
});
});
//CSS3 spinner
$.fn.spin = function(opts) {
this.each(function() {
var $this = $(this),
data = $this.data();
if (data.spinner) {
data.spinner.stop();
delete data.spinner;
}
if (opts !== false) {
data.spinner = new Spinner($.extend({color: $this.css('color')}, opts)).spin(this);
}
});
return this;
};
function spinner_update() {
var opts = {};
$('#spinner-opts input[type=text]').each(function() {
opts[this.name] = parseFloat(this.value);
});
opts['left'] = 'auto';
$('#spinner-preview').spin(opts);
}
$('#id-pills-stacked').removeAttr('checked').on('click', function(){
$('.nav-pills').toggleClass('nav-stacked');
});
///////////
$(document).one('ajaxloadstart.page', function(e) {
$.gritter.removeAll();
$('.modal').modal('hide');
});
});