pixl-xyapp 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +11 -0
- package/README.md +485 -0
- package/css/base.css +2736 -0
- package/css/boilerplate.css +295 -0
- package/css/normalize.css +349 -0
- package/js/base.js +648 -0
- package/js/calendar.js +166 -0
- package/js/datetime.js +233 -0
- package/js/dialog.js +385 -0
- package/js/misc.js +311 -0
- package/js/page.js +1940 -0
- package/js/popover.js +158 -0
- package/js/select.js +845 -0
- package/js/tools.js +1212 -0
- package/js/unscroll.min.js +3 -0
- package/package.json +20 -0
package/js/dialog.js
ADDED
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
// Dialog Tools
|
|
2
|
+
// Author: Joseph Huckaby
|
|
3
|
+
|
|
4
|
+
var Dialog = {
|
|
5
|
+
|
|
6
|
+
active: false,
|
|
7
|
+
clickBlock: false,
|
|
8
|
+
progress: null,
|
|
9
|
+
onHide: null,
|
|
10
|
+
|
|
11
|
+
show: function(html, click_block) {
|
|
12
|
+
// show dialog, auto-size and center
|
|
13
|
+
this.clickBlock = click_block || false;
|
|
14
|
+
|
|
15
|
+
var temp = $('<div/>').addClass('dialog').css({
|
|
16
|
+
position: 'absolute',
|
|
17
|
+
visibility: 'hidden'
|
|
18
|
+
}).html(html).appendTo('body');
|
|
19
|
+
|
|
20
|
+
// var width = temp.width();
|
|
21
|
+
// var height = temp.height();
|
|
22
|
+
var width = temp[0].offsetWidth;
|
|
23
|
+
var height = temp[0].offsetHeight;
|
|
24
|
+
temp.remove();
|
|
25
|
+
|
|
26
|
+
var size = get_inner_window_size();
|
|
27
|
+
var x = Math.floor( (size.width / 2) - ((width + 0) / 2) );
|
|
28
|
+
var y = Math.floor( ((size.height / 2) - (height / 2)) * 0.75 );
|
|
29
|
+
|
|
30
|
+
if ($('#dialog_overlay').length) {
|
|
31
|
+
$('#dialog_overlay').stop().remove();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
var $overlay = $('<div id="dialog_overlay"></div>').css('opacity', 0);
|
|
35
|
+
$('body').append($overlay);
|
|
36
|
+
|
|
37
|
+
$overlay.fadeTo( 500, 0.75 ).on('mouseup', function() {
|
|
38
|
+
if (!Dialog.clickBlock) {
|
|
39
|
+
if (Dialog.active == 'confirmation') Dialog.confirm_click(false);
|
|
40
|
+
else Dialog.hide();
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
if ($('#dialog').length) {
|
|
45
|
+
$('#dialog').stop().remove();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
var $dialog = $('<div id="dialog" class="dialog"></div>').css({
|
|
49
|
+
opacity: 0,
|
|
50
|
+
left: '' + x + 'px',
|
|
51
|
+
top: '' + y + 'px'
|
|
52
|
+
}).html( html );
|
|
53
|
+
|
|
54
|
+
$('body').append($dialog);
|
|
55
|
+
$dialog.fadeTo( 250, 1.0 );
|
|
56
|
+
|
|
57
|
+
this.active = true;
|
|
58
|
+
unscroll();
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
autoResize: function() {
|
|
62
|
+
// automatically resize dialog to match changed content size
|
|
63
|
+
if (!this.active) return;
|
|
64
|
+
|
|
65
|
+
var $dialog = $('#dialog');
|
|
66
|
+
// var width = $dialog.width();
|
|
67
|
+
// var height = $dialog.height();
|
|
68
|
+
var width = $dialog[0].offsetWidth;
|
|
69
|
+
var height = $dialog[0].offsetHeight;
|
|
70
|
+
|
|
71
|
+
var size = get_inner_window_size();
|
|
72
|
+
var x = Math.floor( (size.width / 2) - ((width + 0) / 2) );
|
|
73
|
+
var y = Math.floor( ((size.height / 2) - (height / 2)) * 0.75 );
|
|
74
|
+
|
|
75
|
+
$dialog.css({
|
|
76
|
+
left: '' + x + 'px',
|
|
77
|
+
top: '' + y + 'px'
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
hide: function() {
|
|
82
|
+
// hide dialog
|
|
83
|
+
if (this.active) {
|
|
84
|
+
$('#dialog').stop().fadeOut( 250, function() { $(this).remove(); } );
|
|
85
|
+
$('#dialog_overlay').stop().fadeOut( 300, function() { $(this).remove(); } );
|
|
86
|
+
this.active = false;
|
|
87
|
+
unscroll.reset();
|
|
88
|
+
|
|
89
|
+
if (this.onHide) {
|
|
90
|
+
// one time hook for hide
|
|
91
|
+
var callback = this.onHide;
|
|
92
|
+
this.onHide = null;
|
|
93
|
+
callback();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
hideProgress: function() {
|
|
99
|
+
// hide progress dialog
|
|
100
|
+
this.hide();
|
|
101
|
+
delete this.progress;
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
showProgress: function(counter, title) {
|
|
105
|
+
// show or update progress bar
|
|
106
|
+
if (!$('#d_progress_bar').length) {
|
|
107
|
+
// no progress dialog is active, so set it up
|
|
108
|
+
if (!counter) counter = 0;
|
|
109
|
+
if (counter < 0) counter = 0;
|
|
110
|
+
if (counter > 1) counter = 1;
|
|
111
|
+
var cx = Math.floor( counter * 196 );
|
|
112
|
+
|
|
113
|
+
var html = '';
|
|
114
|
+
html += '<div style="padding:15px;">';
|
|
115
|
+
html += '<div id="d_progress_title" class="dialog_title" style="text-align:center; margin-bottom:15px;">' + title + '</div>';
|
|
116
|
+
|
|
117
|
+
var extra_classes = '';
|
|
118
|
+
if (counter == 1.0) extra_classes = 'indeterminate';
|
|
119
|
+
|
|
120
|
+
html += '<div id="d_progress_bar_cont" class="progress_bar_container '+extra_classes+'" style="width:196px; margin:0 auto 0 auto;">';
|
|
121
|
+
html += '<div id="d_progress_bar" class="progress_bar_inner" style="width:'+cx+'px;"></div>';
|
|
122
|
+
html += '</div>';
|
|
123
|
+
|
|
124
|
+
html += '</div>';
|
|
125
|
+
app.hideMessage();
|
|
126
|
+
this.show( html, true );
|
|
127
|
+
|
|
128
|
+
this.progress = {
|
|
129
|
+
start_counter: counter,
|
|
130
|
+
counter: counter,
|
|
131
|
+
counter_max: 1,
|
|
132
|
+
start_time: hires_time_now(),
|
|
133
|
+
last_update: hires_time_now(),
|
|
134
|
+
title: title
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
else if (this.progress) {
|
|
138
|
+
// progress dialog is active, so update existing elements
|
|
139
|
+
var now = hires_time_now();
|
|
140
|
+
var cx = Math.floor( counter * 196 );
|
|
141
|
+
$('#d_progress_bar').css( 'width', '' + cx + 'px' );
|
|
142
|
+
|
|
143
|
+
var prog_cont = $('#d_progress_bar_cont');
|
|
144
|
+
if ((counter == 1.0) && !prog_cont.hasClass('indeterminate')) prog_cont.addClass('indeterminate');
|
|
145
|
+
else if ((counter < 1.0) && prog_cont.hasClass('indeterminate')) prog_cont.removeClass('indeterminate');
|
|
146
|
+
|
|
147
|
+
if (title) this.progress.title = title;
|
|
148
|
+
$('#d_progress_title').html( this.progress.title );
|
|
149
|
+
|
|
150
|
+
this.progress.last_update = now;
|
|
151
|
+
this.progress.counter = counter;
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
showSimpleDialog: function(title, inner_html, buttons_html) {
|
|
156
|
+
// show simple dialog with title, content and buttons
|
|
157
|
+
var html = '';
|
|
158
|
+
html += '<div class="dialog_title">' + title + '</div>';
|
|
159
|
+
html += '<div class="dialog_content">' + inner_html + '</div>';
|
|
160
|
+
html += '<div class="dialog_buttons">' + buttons_html + '</div>';
|
|
161
|
+
|
|
162
|
+
this.show( html );
|
|
163
|
+
|
|
164
|
+
// add hover tooltips to mobile_collapse buttons
|
|
165
|
+
$('#dialog .dialog_buttons .button.mobile_collapse').each( function() {
|
|
166
|
+
var $this = $(this);
|
|
167
|
+
$this.attr('title', $this.find('span').text() );
|
|
168
|
+
} );
|
|
169
|
+
},
|
|
170
|
+
|
|
171
|
+
confirm: function(title, html, ok_btn_label, callback) {
|
|
172
|
+
// show simple OK / Cancel dialog with custom text
|
|
173
|
+
// fires callback with true (OK) or false (Cancel)
|
|
174
|
+
if (!ok_btn_label) ok_btn_label = ['check-circle', "OK"];
|
|
175
|
+
this.confirm_callback = callback;
|
|
176
|
+
|
|
177
|
+
var inner_html = "";
|
|
178
|
+
if (html.match(/^</)) inner_html = html;
|
|
179
|
+
else inner_html += '<div class="confirm_container">'+html+'</div>';
|
|
180
|
+
|
|
181
|
+
if (isa_array(ok_btn_label)) {
|
|
182
|
+
ok_btn_label = '<i class="mdi mdi-' + ok_btn_label[0] + '"> </i><span>' + ok_btn_label[1] + '</span>';
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
var buttons_html = "";
|
|
186
|
+
buttons_html += '<div id="btn_dialog_cancel" class="button" onClick="Dialog.confirm_click(false)"><i class="mdi mdi-close-circle-outline"> </i>Cancel</div>';
|
|
187
|
+
buttons_html += '<div id="btn_dialog_confirm" class="button primary" onClick="Dialog.confirm_click(true)">' + ok_btn_label + '</div>';
|
|
188
|
+
|
|
189
|
+
this.showSimpleDialog( title, inner_html, buttons_html );
|
|
190
|
+
|
|
191
|
+
// special mode for key capture
|
|
192
|
+
Dialog.active = 'confirmation';
|
|
193
|
+
|
|
194
|
+
setTimeout( function() {
|
|
195
|
+
// hold alt/opt key to immediately click default button
|
|
196
|
+
if (app.lastClick.altKey) return Dialog.confirm_click(true);
|
|
197
|
+
}, 1 );
|
|
198
|
+
},
|
|
199
|
+
|
|
200
|
+
confirmDanger: function(title, html, ok_btn_label, callback) {
|
|
201
|
+
// show simple OK / Cancel dialog with custom text
|
|
202
|
+
// fires callback with true (OK) or false (Cancel)
|
|
203
|
+
if (!ok_btn_label) ok_btn_label = ['check-circle', "OK"];
|
|
204
|
+
this.confirm_callback = callback;
|
|
205
|
+
|
|
206
|
+
var inner_html = "";
|
|
207
|
+
if (html.match(/^</)) inner_html = html;
|
|
208
|
+
else inner_html += '<div class="confirm_container">'+html+'</div>';
|
|
209
|
+
|
|
210
|
+
if (isa_array(ok_btn_label)) {
|
|
211
|
+
ok_btn_label = '<i class="mdi mdi-' + ok_btn_label[0] + '"> </i><span>' + ok_btn_label[1] + '</span>';
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
var buttons_html = "";
|
|
215
|
+
buttons_html += '<div id="btn_dialog_cancel" class="button" onMouseUp="Dialog.confirm_click(false)"><i class="mdi mdi-close-circle-outline"> </i>Cancel</div>';
|
|
216
|
+
buttons_html += '<div id="btn_dialog_confirm" class="button delete" onMouseUp="Dialog.confirm_click(true)">'+ok_btn_label+'</div>';
|
|
217
|
+
|
|
218
|
+
this.showSimpleDialog( '<span class="danger">' + title + '</span>', inner_html, buttons_html );
|
|
219
|
+
|
|
220
|
+
// special mode for key capture
|
|
221
|
+
Dialog.active = 'confirmation';
|
|
222
|
+
|
|
223
|
+
setTimeout( function() {
|
|
224
|
+
// hold alt/opt key to immediately click default button
|
|
225
|
+
if (app.lastClick.altKey) return Dialog.confirm_click(true);
|
|
226
|
+
}, 1 );
|
|
227
|
+
},
|
|
228
|
+
|
|
229
|
+
confirm_click: function(result) {
|
|
230
|
+
// user clicked OK or Cancel in confirmation dialog, fire callback
|
|
231
|
+
// caller MUST deal with Dialog.hide() if result is true
|
|
232
|
+
if (this.confirm_callback) {
|
|
233
|
+
this.confirm_callback(result);
|
|
234
|
+
if (!result) this.hide();
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
|
|
238
|
+
confirm_key: function(event) {
|
|
239
|
+
// handle keydown with active confirmation dialog
|
|
240
|
+
if ((this.active === 'editor') && (event.keyCode == 27)) {
|
|
241
|
+
// enable esc key for editor dialogs (codemirror)
|
|
242
|
+
Dialog.hide();
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
if (this.active !== 'confirmation') return;
|
|
247
|
+
if ((event.keyCode != 13) && (event.keyCode != 27)) return;
|
|
248
|
+
|
|
249
|
+
// skip enter check if textarea is active
|
|
250
|
+
if (document.activeElement && (event.keyCode == 13)) {
|
|
251
|
+
if ($(document.activeElement).prop('type') == 'textarea') return;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
event.stopPropagation();
|
|
255
|
+
event.preventDefault();
|
|
256
|
+
|
|
257
|
+
if (event.keyCode == 13) this.confirm_click(true);
|
|
258
|
+
else if (event.keyCode == 27) this.confirm_click(false);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
// Code Editor
|
|
264
|
+
|
|
265
|
+
var CodeEditor = {
|
|
266
|
+
|
|
267
|
+
active: false,
|
|
268
|
+
onHide: null,
|
|
269
|
+
|
|
270
|
+
show: function(html) {
|
|
271
|
+
// show dialog, auto-size and center
|
|
272
|
+
var temp = $('<div/>').addClass('dialog').css({
|
|
273
|
+
position: 'absolute',
|
|
274
|
+
visibility: 'hidden'
|
|
275
|
+
}).html(html).appendTo('body');
|
|
276
|
+
|
|
277
|
+
// var width = temp.width();
|
|
278
|
+
// var height = temp.height();
|
|
279
|
+
var width = temp[0].offsetWidth;
|
|
280
|
+
var height = temp[0].offsetHeight;
|
|
281
|
+
temp.remove();
|
|
282
|
+
|
|
283
|
+
var size = get_inner_window_size();
|
|
284
|
+
var x = Math.floor( (size.width / 2) - ((width + 0) / 2) );
|
|
285
|
+
var y = Math.floor( ((size.height / 2) - (height / 2)) * 0.75 );
|
|
286
|
+
|
|
287
|
+
if ($('#ceditor_overlay').length) {
|
|
288
|
+
$('#ceditor_overlay').stop().remove();
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
var $overlay = $('<div id="ceditor_overlay"></div>').css('opacity', 0);
|
|
292
|
+
$('body').append($overlay);
|
|
293
|
+
|
|
294
|
+
$overlay.fadeTo( 500, 0.75 ).on('mouseup', function() {
|
|
295
|
+
CodeEditor.hide();
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
if ($('#ceditor').length) {
|
|
299
|
+
$('#ceditor').stop().remove();
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
var $dialog = $('<div class="dialog" id="ceditor"></div>').css({
|
|
303
|
+
opacity: 0,
|
|
304
|
+
left: '' + x + 'px',
|
|
305
|
+
top: '' + y + 'px'
|
|
306
|
+
}).html( html );
|
|
307
|
+
|
|
308
|
+
$('body').append($dialog);
|
|
309
|
+
$dialog.fadeTo( 250, 1.0 );
|
|
310
|
+
|
|
311
|
+
this.active = true;
|
|
312
|
+
|
|
313
|
+
// only do the unscroll thing if another dialog isn't active under us
|
|
314
|
+
if (!Dialog.active) unscroll();
|
|
315
|
+
},
|
|
316
|
+
|
|
317
|
+
autoResize: function() {
|
|
318
|
+
// automatically resize dialog to match changed content size
|
|
319
|
+
if (!this.active) return;
|
|
320
|
+
|
|
321
|
+
var $dialog = $('#ceditor');
|
|
322
|
+
// var width = $dialog.width();
|
|
323
|
+
// var height = $dialog.height();
|
|
324
|
+
var width = $dialog[0].offsetWidth;
|
|
325
|
+
var height = $dialog[0].offsetHeight;
|
|
326
|
+
|
|
327
|
+
var size = get_inner_window_size();
|
|
328
|
+
var x = Math.floor( (size.width / 2) - ((width + 0) / 2) );
|
|
329
|
+
var y = Math.floor( ((size.height / 2) - (height / 2)) * 0.75 );
|
|
330
|
+
|
|
331
|
+
$dialog.css({
|
|
332
|
+
left: '' + x + 'px',
|
|
333
|
+
top: '' + y + 'px'
|
|
334
|
+
});
|
|
335
|
+
},
|
|
336
|
+
|
|
337
|
+
hide: function() {
|
|
338
|
+
// hide dialog
|
|
339
|
+
if (this.active) {
|
|
340
|
+
$('#ceditor').stop().fadeOut( 250, function() { $(this).remove(); } );
|
|
341
|
+
$('#ceditor_overlay').stop().fadeOut( 300, function() { $(this).remove(); } );
|
|
342
|
+
this.active = false;
|
|
343
|
+
|
|
344
|
+
// only release scroll lock if another dialog isn't active under us
|
|
345
|
+
if (!Dialog.active) unscroll.reset();
|
|
346
|
+
|
|
347
|
+
if (this.onHide) {
|
|
348
|
+
// one time hook for hide
|
|
349
|
+
var callback = this.onHide;
|
|
350
|
+
this.onHide = null;
|
|
351
|
+
callback();
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
|
|
356
|
+
showSimpleDialog: function(title, inner_html, buttons_html) {
|
|
357
|
+
// show simple dialog with title, content and buttons
|
|
358
|
+
var html = '';
|
|
359
|
+
html += '<div class="dialog_title">' + title + '</div>';
|
|
360
|
+
html += '<div class="dialog_content">' + inner_html + '</div>';
|
|
361
|
+
html += '<div class="dialog_buttons">' + buttons_html + '</div>';
|
|
362
|
+
|
|
363
|
+
this.show( html );
|
|
364
|
+
|
|
365
|
+
// add hover tooltips to mobile_collapse buttons
|
|
366
|
+
$('#ceditor .dialog_buttons .button.mobile_collapse').each( function() {
|
|
367
|
+
var $this = $(this);
|
|
368
|
+
$this.attr('title', $this.find('span').text() );
|
|
369
|
+
} );
|
|
370
|
+
},
|
|
371
|
+
|
|
372
|
+
handleKeyDown: function(event) {
|
|
373
|
+
// intercept keydown for custom actions
|
|
374
|
+
if (!this.active) return;
|
|
375
|
+
|
|
376
|
+
if (this.onKeyDown) {
|
|
377
|
+
this.onKeyDown(event);
|
|
378
|
+
}
|
|
379
|
+
else if (event.keyCode == 27) {
|
|
380
|
+
event.preventDefault();
|
|
381
|
+
this.hide();
|
|
382
|
+
}
|
|
383
|
+
},
|
|
384
|
+
|
|
385
|
+
}; // CodeEditor
|
package/js/misc.js
ADDED
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
// Misc 3rd party utilities for Orchestra
|
|
2
|
+
|
|
3
|
+
$.fn.innerBounds = function() {
|
|
4
|
+
// compute outer bounds of child elements
|
|
5
|
+
// (for non-measurable elems like ul w/display:contents)
|
|
6
|
+
var $this = this.length > 1 ? this.eq(0) : this;
|
|
7
|
+
var bounds = { left:-1, top:-1, right:-1, bottom:-1 };
|
|
8
|
+
|
|
9
|
+
$this.children().each( function() {
|
|
10
|
+
var temp = this.getBoundingClientRect();
|
|
11
|
+
if (temp.width && temp.height) {
|
|
12
|
+
if ((bounds.left == -1) || (temp.left < bounds.left)) bounds.left = temp.left;
|
|
13
|
+
if ((bounds.top == -1) || (temp.top < bounds.top)) bounds.top = temp.top;
|
|
14
|
+
if ((bounds.right == -1) || (temp.right > bounds.right)) bounds.right = temp.right;
|
|
15
|
+
if ((bounds.bottom == -1) || (temp.bottom > bounds.bottom)) bounds.bottom = temp.bottom;
|
|
16
|
+
}
|
|
17
|
+
} );
|
|
18
|
+
|
|
19
|
+
bounds.left += window.scrollX;
|
|
20
|
+
bounds.top += window.scrollY;
|
|
21
|
+
bounds.right += window.scrollX;
|
|
22
|
+
bounds.bottom += window.scrollY;
|
|
23
|
+
|
|
24
|
+
bounds.x = bounds.left;
|
|
25
|
+
bounds.y = bounds.top;
|
|
26
|
+
bounds.width = bounds.right - bounds.left;
|
|
27
|
+
bounds.height = bounds.bottom - bounds.top;
|
|
28
|
+
|
|
29
|
+
return bounds;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
// ----------------------------------------------
|
|
33
|
+
// https://github.com/teamdf/jquery-visible
|
|
34
|
+
(function($){
|
|
35
|
+
/**
|
|
36
|
+
* Copyright 2012, Digital Fusion
|
|
37
|
+
* Licensed under the MIT license.
|
|
38
|
+
* http://teamdf.com/jquery-plugins/license/
|
|
39
|
+
*
|
|
40
|
+
* @author Sam Sehnert
|
|
41
|
+
* @desc A small plugin that checks whether elements are within
|
|
42
|
+
* the user visible viewport of a web browser.
|
|
43
|
+
* only accounts for vertical position, not horizontal.
|
|
44
|
+
*/
|
|
45
|
+
var $w = $(window);
|
|
46
|
+
$.fn.visible = function(partial,hidden,direction){
|
|
47
|
+
|
|
48
|
+
if (this.length < 1)
|
|
49
|
+
return;
|
|
50
|
+
|
|
51
|
+
var $t = this.length > 1 ? this.eq(0) : this,
|
|
52
|
+
t = $t.get(0),
|
|
53
|
+
vpWidth = $w.width(),
|
|
54
|
+
vpHeight = $w.height(),
|
|
55
|
+
direction = (direction) ? direction : 'both',
|
|
56
|
+
clientSize = hidden === true ? t.offsetWidth * t.offsetHeight : true;
|
|
57
|
+
|
|
58
|
+
if (typeof t.getBoundingClientRect === 'function'){
|
|
59
|
+
|
|
60
|
+
// Use this native browser method, if available.
|
|
61
|
+
var rec = t.getBoundingClientRect(),
|
|
62
|
+
tViz = rec.top >= 0 && rec.top < vpHeight,
|
|
63
|
+
bViz = rec.bottom > 0 && rec.bottom <= vpHeight,
|
|
64
|
+
lViz = rec.left >= 0 && rec.left < vpWidth,
|
|
65
|
+
rViz = rec.right > 0 && rec.right <= vpWidth,
|
|
66
|
+
vVisible = partial ? tViz || bViz : tViz && bViz,
|
|
67
|
+
hVisible = partial ? lViz || rViz : lViz && rViz;
|
|
68
|
+
|
|
69
|
+
if(direction === 'both')
|
|
70
|
+
return clientSize && vVisible && hVisible;
|
|
71
|
+
else if(direction === 'vertical')
|
|
72
|
+
return clientSize && vVisible;
|
|
73
|
+
else if(direction === 'horizontal')
|
|
74
|
+
return clientSize && hVisible;
|
|
75
|
+
} else {
|
|
76
|
+
|
|
77
|
+
var viewTop = $w.scrollTop(),
|
|
78
|
+
viewBottom = viewTop + vpHeight,
|
|
79
|
+
viewLeft = $w.scrollLeft(),
|
|
80
|
+
viewRight = viewLeft + vpWidth,
|
|
81
|
+
offset = $t.offset(),
|
|
82
|
+
_top = offset.top,
|
|
83
|
+
_bottom = _top + $t.height(),
|
|
84
|
+
_left = offset.left,
|
|
85
|
+
_right = _left + $t.width(),
|
|
86
|
+
compareTop = partial === true ? _bottom : _top,
|
|
87
|
+
compareBottom = partial === true ? _top : _bottom,
|
|
88
|
+
compareLeft = partial === true ? _right : _left,
|
|
89
|
+
compareRight = partial === true ? _left : _right;
|
|
90
|
+
|
|
91
|
+
if(direction === 'both')
|
|
92
|
+
return !!clientSize && ((compareBottom <= viewBottom) && (compareTop >= viewTop)) && ((compareRight <= viewRight) && (compareLeft >= viewLeft));
|
|
93
|
+
else if(direction === 'vertical')
|
|
94
|
+
return !!clientSize && ((compareBottom <= viewBottom) && (compareTop >= viewTop));
|
|
95
|
+
else if(direction === 'horizontal')
|
|
96
|
+
return !!clientSize && ((compareRight <= viewRight) && (compareLeft >= viewLeft));
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
})(jQuery);
|
|
101
|
+
|
|
102
|
+
// onFontReady v1.1.0 (MIT License)
|
|
103
|
+
// https://github.com/dwighthouse/onfontready/blob/master/LICENSE
|
|
104
|
+
window.onfontready=function(e,t,i,n,o){i=i||0,i.timeoutAfter&&setTimeout(function(){n&&(document.body.removeChild(n),n=0,i.onTimeout&&i.onTimeout())},i.timeoutAfter),o=function(){n&&n.firstChild.clientWidth==n.lastChild.clientWidth&&(document.body.removeChild(n),n=0,t())},o(document.body.appendChild(n=document.createElement("div")).innerHTML='<div style="position:fixed;white-space:pre;bottom:999%;right:999%;font:999px '+(i.generic?"":"'")+e+(i.generic?"":"'")+',serif">'+(i.sampleText||" ")+'</div><div style="position:fixed;white-space:pre;bottom:999%;right:999%;font:999px '+(i.generic?"":"'")+e+(i.generic?"":"'")+',monospace">'+(i.sampleText||" ")+"</div>"),n&&(n.firstChild.appendChild(e=document.createElement("iframe")).style.width="999%",e.contentWindow.onresize=o,n.lastChild.appendChild(e=document.createElement("iframe")).style.width="999%",e.contentWindow.onresize=o,e=setTimeout(o))};
|
|
105
|
+
window.onfontsready=function(e,t,n,o,i){for(n=n||0,o=i=0;o<e.length;o++)window.onfontready(e[o],function(){++i>=e.length&&t()},{timeoutAfter:n.timeoutAfter,sampleText:n.sampleText instanceof Array?n.sampleText[o]:n.sampleText,generic:n.generic instanceof Array?n.generic[o]:n.generic});n.timeoutAfter&&n.onTimeout&&setTimeout(function(){i<e.length&&n.onTimeout(i=NaN)},n.timeoutAfter)};
|
|
106
|
+
|
|
107
|
+
/*
|
|
108
|
+
* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
|
|
109
|
+
*
|
|
110
|
+
* Uses the built in easing capabilities added In jQuery 1.1
|
|
111
|
+
* to offer multiple easing options
|
|
112
|
+
*
|
|
113
|
+
* TERMS OF USE - jQuery Easing
|
|
114
|
+
*
|
|
115
|
+
* Open source under the BSD License.
|
|
116
|
+
*
|
|
117
|
+
* Copyright © 2008 George McGinley Smith
|
|
118
|
+
* All rights reserved.
|
|
119
|
+
*
|
|
120
|
+
* Redistribution and use in source and binary forms, with or without modification,
|
|
121
|
+
* are permitted provided that the following conditions are met:
|
|
122
|
+
*
|
|
123
|
+
* Redistributions of source code must retain the above copyright notice, this list of
|
|
124
|
+
* conditions and the following disclaimer.
|
|
125
|
+
* Redistributions in binary form must reproduce the above copyright notice, this list
|
|
126
|
+
* of conditions and the following disclaimer in the documentation and/or other materials
|
|
127
|
+
* provided with the distribution.
|
|
128
|
+
*
|
|
129
|
+
* Neither the name of the author nor the names of contributors may be used to endorse
|
|
130
|
+
* or promote products derived from this software without specific prior written permission.
|
|
131
|
+
*
|
|
132
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
|
133
|
+
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
134
|
+
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
135
|
+
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
136
|
+
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
|
137
|
+
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
138
|
+
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
139
|
+
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
|
140
|
+
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
141
|
+
*
|
|
142
|
+
*/
|
|
143
|
+
|
|
144
|
+
// t: current time, b: begInnIng value, c: change In value, d: duration
|
|
145
|
+
jQuery.easing['jswing'] = jQuery.easing['swing'];
|
|
146
|
+
|
|
147
|
+
jQuery.extend( jQuery.easing,
|
|
148
|
+
{
|
|
149
|
+
def: 'easeOutQuad',
|
|
150
|
+
swing: function (x, t, b, c, d) {
|
|
151
|
+
//alert(jQuery.easing.default);
|
|
152
|
+
return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
|
|
153
|
+
},
|
|
154
|
+
easeInQuad: function (x, t, b, c, d) {
|
|
155
|
+
return c*(t/=d)*t + b;
|
|
156
|
+
},
|
|
157
|
+
easeOutQuad: function (x, t, b, c, d) {
|
|
158
|
+
return -c *(t/=d)*(t-2) + b;
|
|
159
|
+
},
|
|
160
|
+
easeInOutQuad: function (x, t, b, c, d) {
|
|
161
|
+
if ((t/=d/2) < 1) return c/2*t*t + b;
|
|
162
|
+
return -c/2 * ((--t)*(t-2) - 1) + b;
|
|
163
|
+
},
|
|
164
|
+
easeInCubic: function (x, t, b, c, d) {
|
|
165
|
+
return c*(t/=d)*t*t + b;
|
|
166
|
+
},
|
|
167
|
+
easeOutCubic: function (x, t, b, c, d) {
|
|
168
|
+
return c*((t=t/d-1)*t*t + 1) + b;
|
|
169
|
+
},
|
|
170
|
+
easeInOutCubic: function (x, t, b, c, d) {
|
|
171
|
+
if ((t/=d/2) < 1) return c/2*t*t*t + b;
|
|
172
|
+
return c/2*((t-=2)*t*t + 2) + b;
|
|
173
|
+
},
|
|
174
|
+
easeInQuart: function (x, t, b, c, d) {
|
|
175
|
+
return c*(t/=d)*t*t*t + b;
|
|
176
|
+
},
|
|
177
|
+
easeOutQuart: function (x, t, b, c, d) {
|
|
178
|
+
return -c * ((t=t/d-1)*t*t*t - 1) + b;
|
|
179
|
+
},
|
|
180
|
+
easeInOutQuart: function (x, t, b, c, d) {
|
|
181
|
+
if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
|
|
182
|
+
return -c/2 * ((t-=2)*t*t*t - 2) + b;
|
|
183
|
+
},
|
|
184
|
+
easeInQuint: function (x, t, b, c, d) {
|
|
185
|
+
return c*(t/=d)*t*t*t*t + b;
|
|
186
|
+
},
|
|
187
|
+
easeOutQuint: function (x, t, b, c, d) {
|
|
188
|
+
return c*((t=t/d-1)*t*t*t*t + 1) + b;
|
|
189
|
+
},
|
|
190
|
+
easeInOutQuint: function (x, t, b, c, d) {
|
|
191
|
+
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
|
|
192
|
+
return c/2*((t-=2)*t*t*t*t + 2) + b;
|
|
193
|
+
},
|
|
194
|
+
easeInSine: function (x, t, b, c, d) {
|
|
195
|
+
return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
|
|
196
|
+
},
|
|
197
|
+
easeOutSine: function (x, t, b, c, d) {
|
|
198
|
+
return c * Math.sin(t/d * (Math.PI/2)) + b;
|
|
199
|
+
},
|
|
200
|
+
easeInOutSine: function (x, t, b, c, d) {
|
|
201
|
+
return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
|
|
202
|
+
},
|
|
203
|
+
easeInExpo: function (x, t, b, c, d) {
|
|
204
|
+
return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
|
|
205
|
+
},
|
|
206
|
+
easeOutExpo: function (x, t, b, c, d) {
|
|
207
|
+
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
|
|
208
|
+
},
|
|
209
|
+
easeInOutExpo: function (x, t, b, c, d) {
|
|
210
|
+
if (t==0) return b;
|
|
211
|
+
if (t==d) return b+c;
|
|
212
|
+
if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
|
|
213
|
+
return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
|
|
214
|
+
},
|
|
215
|
+
easeInCirc: function (x, t, b, c, d) {
|
|
216
|
+
return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
|
|
217
|
+
},
|
|
218
|
+
easeOutCirc: function (x, t, b, c, d) {
|
|
219
|
+
return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
|
|
220
|
+
},
|
|
221
|
+
easeInOutCirc: function (x, t, b, c, d) {
|
|
222
|
+
if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
|
|
223
|
+
return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
|
|
224
|
+
},
|
|
225
|
+
easeInElastic: function (x, t, b, c, d) {
|
|
226
|
+
var s=1.70158;var p=0;var a=c;
|
|
227
|
+
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
|
|
228
|
+
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
|
229
|
+
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
|
230
|
+
return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
|
|
231
|
+
},
|
|
232
|
+
easeOutElastic: function (x, t, b, c, d) {
|
|
233
|
+
var s=1.70158;var p=0;var a=c;
|
|
234
|
+
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
|
|
235
|
+
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
|
236
|
+
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
|
237
|
+
return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
|
|
238
|
+
},
|
|
239
|
+
easeInOutElastic: function (x, t, b, c, d) {
|
|
240
|
+
var s=1.70158;var p=0;var a=c;
|
|
241
|
+
if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
|
|
242
|
+
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
|
243
|
+
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
|
244
|
+
if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
|
|
245
|
+
return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
|
|
246
|
+
},
|
|
247
|
+
easeInBack: function (x, t, b, c, d, s) {
|
|
248
|
+
if (s == undefined) s = 1.70158;
|
|
249
|
+
return c*(t/=d)*t*((s+1)*t - s) + b;
|
|
250
|
+
},
|
|
251
|
+
easeOutBack: function (x, t, b, c, d, s) {
|
|
252
|
+
if (s == undefined) s = 1.70158;
|
|
253
|
+
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
|
|
254
|
+
},
|
|
255
|
+
easeInOutBack: function (x, t, b, c, d, s) {
|
|
256
|
+
if (s == undefined) s = 1.70158;
|
|
257
|
+
if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
|
|
258
|
+
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
|
|
259
|
+
},
|
|
260
|
+
easeInBounce: function (x, t, b, c, d) {
|
|
261
|
+
return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
|
|
262
|
+
},
|
|
263
|
+
easeOutBounce: function (x, t, b, c, d) {
|
|
264
|
+
if ((t/=d) < (1/2.75)) {
|
|
265
|
+
return c*(7.5625*t*t) + b;
|
|
266
|
+
} else if (t < (2/2.75)) {
|
|
267
|
+
return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
|
|
268
|
+
} else if (t < (2.5/2.75)) {
|
|
269
|
+
return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
|
|
270
|
+
} else {
|
|
271
|
+
return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
easeInOutBounce: function (x, t, b, c, d) {
|
|
275
|
+
if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
|
|
276
|
+
return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
/*
|
|
281
|
+
*
|
|
282
|
+
* TERMS OF USE - EASING EQUATIONS
|
|
283
|
+
*
|
|
284
|
+
* Open source under the BSD License.
|
|
285
|
+
*
|
|
286
|
+
* Copyright © 2001 Robert Penner
|
|
287
|
+
* All rights reserved.
|
|
288
|
+
*
|
|
289
|
+
* Redistribution and use in source and binary forms, with or without modification,
|
|
290
|
+
* are permitted provided that the following conditions are met:
|
|
291
|
+
*
|
|
292
|
+
* Redistributions of source code must retain the above copyright notice, this list of
|
|
293
|
+
* conditions and the following disclaimer.
|
|
294
|
+
* Redistributions in binary form must reproduce the above copyright notice, this list
|
|
295
|
+
* of conditions and the following disclaimer in the documentation and/or other materials
|
|
296
|
+
* provided with the distribution.
|
|
297
|
+
*
|
|
298
|
+
* Neither the name of the author nor the names of contributors may be used to endorse
|
|
299
|
+
* or promote products derived from this software without specific prior written permission.
|
|
300
|
+
*
|
|
301
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
|
302
|
+
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
303
|
+
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
304
|
+
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
305
|
+
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
|
306
|
+
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
307
|
+
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
308
|
+
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
|
309
|
+
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
310
|
+
*
|
|
311
|
+
*/
|