Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
malwaredllc
GitHub Repository: malwaredllc/byob
Path: blob/master/web-gui/buildyourownbotnet/assets/js/joinable.js
1292 views
1
;(function($, window, undefined){
2
3
/* Hover Intent Plugin */
4
(function($) {
5
$.fn.hoverIntent = function(handlerIn,handlerOut,selector) {
6
7
// default configuration values
8
var cfg = {
9
interval: 100,
10
sensitivity: 7,
11
timeout: 0
12
};
13
14
if ( typeof handlerIn === "object" ) {
15
cfg = $.extend(cfg, handlerIn );
16
} else if ($.isFunction(handlerOut)) {
17
cfg = $.extend(cfg, { over: handlerIn, out: handlerOut, selector: selector } );
18
} else {
19
cfg = $.extend(cfg, { over: handlerIn, out: handlerIn, selector: handlerOut } );
20
}
21
22
// instantiate variables
23
// cX, cY = current X and Y position of mouse, updated by mousemove event
24
// pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
25
var cX, cY, pX, pY;
26
27
// A private function for getting mouse position
28
var track = function(ev) {
29
cX = ev.pageX;
30
cY = ev.pageY;
31
};
32
33
// A private function for comparing current and previous mouse position
34
var compare = function(ev,ob) {
35
ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
36
// compare mouse positions to see if they've crossed the threshold
37
if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
38
$(ob).off("mousemove.hoverIntent",track);
39
// set hoverIntent state to true (so mouseOut can be called)
40
ob.hoverIntent_s = 1;
41
return cfg.over.apply(ob,[ev]);
42
} else {
43
// set previous coordinates for next time
44
pX = cX; pY = cY;
45
// use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
46
ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval );
47
}
48
};
49
50
// A private function for delaying the mouseOut function
51
var delay = function(ev,ob) {
52
ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
53
ob.hoverIntent_s = 0;
54
return cfg.out.apply(ob,[ev]);
55
};
56
57
// A private function for handling mouse 'hovering'
58
var handleHover = function(e) {
59
// copy objects to be passed into t (required for event object to be passed in IE)
60
var ev = jQuery.extend({},e);
61
var ob = this;
62
63
// cancel hoverIntent timer if it exists
64
if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }
65
66
// if e.type == "mouseenter"
67
if (e.type == "mouseenter") {
68
// set "previous" X and Y position based on initial entry point
69
pX = ev.pageX; pY = ev.pageY;
70
// update "current" X and Y position based on mousemove
71
$(ob).on("mousemove.hoverIntent",track);
72
// start polling interval (self-calling timeout) to compare mouse coordinates over time
73
if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}
74
75
// else e.type == "mouseleave"
76
} else {
77
// unbind expensive mousemove event
78
$(ob).off("mousemove.hoverIntent",track);
79
// if hoverIntent state is true, then call the mouseOut function after the specified delay
80
if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
81
}
82
};
83
84
// listen for mouseenter and mouseleave
85
return this.on({'mouseenter.hoverIntent':handleHover,'mouseleave.hoverIntent':handleHover}, cfg.selector);
86
};
87
})(jQuery);
88
89
90
91
/* Images Loaded Plugin */
92
(function(c,q){var m="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";c.fn.imagesLoaded=function(f){function n(){var b=c(j),a=c(h);d&&(h.length?d.reject(e,b,a):d.resolve(e));c.isFunction(f)&&f.call(g,e,b,a)}function p(b){k(b.target,"error"===b.type)}function k(b,a){b.src===m||-1!==c.inArray(b,l)||(l.push(b),a?h.push(b):j.push(b),c.data(b,"imagesLoaded",{isBroken:a,src:b.src}),r&&d.notifyWith(c(b),[a,e,c(j),c(h)]),e.length===l.length&&(setTimeout(n),e.unbind(".imagesLoaded",
93
p)))}var g=this,d=c.isFunction(c.Deferred)?c.Deferred():0,r=c.isFunction(d.notify),e=g.find("img").add(g.filter("img")),l=[],j=[],h=[];c.isPlainObject(f)&&c.each(f,function(b,a){if("callback"===b)f=a;else if(d)d[b](a)});e.length?e.bind("load.imagesLoaded error.imagesLoaded",p).each(function(b,a){var d=a.src,e=c.data(a,"imagesLoaded");if(e&&e.src===d)k(a,e.isBroken);else if(a.complete&&a.naturalWidth!==q)k(a,0===a.naturalWidth||0===a.naturalHeight);else if(a.readyState||a.complete)a.src=m,a.src=d}):
94
n();return d?d.promise(g):g}})(jQuery);
95
96
97
98
99
100
/*!
101
* jQuery blockUI plugin
102
* Version 2.66.0-2013.10.09
103
* Requires jQuery v1.7 or later
104
*
105
* Examples at: http://malsup.com/jquery/block/
106
* Copyright (c) 2007-2013 M. Alsup
107
* Dual licensed under the MIT and GPL licenses:
108
* http://www.opensource.org/licenses/mit-license.php
109
* http://www.gnu.org/licenses/gpl.html
110
*
111
* Thanks to Amir-Hossein Sobhi for some excellent contributions!
112
*/
113
114
;(function() {
115
/*jshint eqeqeq:false curly:false latedef:false */
116
"use strict";
117
118
function setup($) {
119
$.fn._fadeIn = $.fn.fadeIn;
120
121
var noOp = $.noop || function() {};
122
123
// this bit is to ensure we don't call setExpression when we shouldn't (with extra muscle to handle
124
// confusing userAgent strings on Vista)
125
var msie = /MSIE/.test(navigator.userAgent);
126
var ie6 = /MSIE 6.0/.test(navigator.userAgent) && ! /MSIE 8.0/.test(navigator.userAgent);
127
var mode = document.documentMode || 0;
128
var setExpr = $.isFunction( document.createElement('div').style.setExpression );
129
130
// global $ methods for blocking/unblocking the entire page
131
$.blockUI = function(opts) { install(window, opts); };
132
$.unblockUI = function(opts) { remove(window, opts); };
133
134
// convenience method for quick growl-like notifications (http://www.google.com/search?q=growl)
135
$.growlUI = function(title, message, timeout, onClose) {
136
var $m = $('<div class="growlUI"></div>');
137
if (title) $m.append('<h1>'+title+'</h1>');
138
if (message) $m.append('<h2>'+message+'</h2>');
139
if (timeout === undefined) timeout = 3000;
140
141
// Added by konapun: Set timeout to 30 seconds if this growl is moused over, like normal toast notifications
142
var callBlock = function(opts) {
143
opts = opts || {};
144
145
$.blockUI({
146
message: $m,
147
fadeIn : typeof opts.fadeIn !== 'undefined' ? opts.fadeIn : 700,
148
fadeOut: typeof opts.fadeOut !== 'undefined' ? opts.fadeOut : 1000,
149
timeout: typeof opts.timeout !== 'undefined' ? opts.timeout : timeout,
150
centerY: false,
151
showOverlay: false,
152
onUnblock: onClose,
153
css: $.blockUI.defaults.growlCSS
154
});
155
};
156
157
callBlock();
158
var nonmousedOpacity = $m.css('opacity');
159
$m.mouseover(function() {
160
callBlock({
161
fadeIn: 0,
162
timeout: 30000
163
});
164
165
var displayBlock = $('.blockMsg');
166
displayBlock.stop(); // cancel fadeout if it has started
167
displayBlock.fadeTo(300, 1); // make it easier to read the message by removing transparency
168
}).mouseout(function() {
169
$('.blockMsg').fadeOut(1000);
170
});
171
// End konapun additions
172
};
173
174
// plugin method for blocking element content
175
$.fn.block = function(opts) {
176
if ( this[0] === window ) {
177
$.blockUI( opts );
178
return this;
179
}
180
var fullOpts = $.extend({}, $.blockUI.defaults, opts || {});
181
this.each(function() {
182
var $el = $(this);
183
if (fullOpts.ignoreIfBlocked && $el.data('blockUI.isBlocked'))
184
return;
185
$el.unblock({ fadeOut: 0 });
186
});
187
188
return this.each(function() {
189
if ($.css(this,'position') == 'static') {
190
this.style.position = 'relative';
191
$(this).data('blockUI.static', true);
192
}
193
this.style.zoom = 1; // force 'hasLayout' in ie
194
install(this, opts);
195
});
196
};
197
198
// plugin method for unblocking element content
199
$.fn.unblock = function(opts) {
200
if ( this[0] === window ) {
201
$.unblockUI( opts );
202
return this;
203
}
204
return this.each(function() {
205
remove(this, opts);
206
});
207
};
208
209
$.blockUI.version = 2.66; // 2nd generation blocking at no extra cost!
210
211
// override these in your code to change the default behavior and style
212
$.blockUI.defaults = {
213
// message displayed when blocking (use null for no message)
214
message: '<h1>Please wait...</h1>',
215
216
title: null, // title string; only used when theme == true
217
draggable: true, // only used when theme == true (requires jquery-ui.js to be loaded)
218
219
theme: false, // set to true to use with jQuery UI themes
220
221
// styles for the message when blocking; if you wish to disable
222
// these and use an external stylesheet then do this in your code:
223
// $.blockUI.defaults.css = {};
224
css: {
225
padding: 0,
226
margin: 0,
227
width: '30%',
228
top: '40%',
229
left: '35%',
230
textAlign: 'center',
231
color: '#000',
232
border: '3px solid #aaa',
233
backgroundColor:'#fff',
234
cursor: 'wait'
235
},
236
237
// minimal style set used when themes are used
238
themedCSS: {
239
width: '30%',
240
top: '40%',
241
left: '35%'
242
},
243
244
// styles for the overlay
245
overlayCSS: {
246
backgroundColor: '#000',
247
opacity: 0.6,
248
cursor: 'wait'
249
},
250
251
// style to replace wait cursor before unblocking to correct issue
252
// of lingering wait cursor
253
cursorReset: 'default',
254
255
// styles applied when using $.growlUI
256
growlCSS: {
257
width: '350px',
258
top: '10px',
259
left: '',
260
right: '10px',
261
border: 'none',
262
padding: '5px',
263
opacity: 0.6,
264
cursor: 'default',
265
color: '#fff',
266
backgroundColor: '#000',
267
'-webkit-border-radius':'10px',
268
'-moz-border-radius': '10px',
269
'border-radius': '10px'
270
},
271
272
// IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w
273
// (hat tip to Jorge H. N. de Vasconcelos)
274
/*jshint scripturl:true */
275
iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank',
276
277
// force usage of iframe in non-IE browsers (handy for blocking applets)
278
forceIframe: false,
279
280
// z-index for the blocking overlay
281
baseZ: 1000,
282
283
// set these to true to have the message automatically centered
284
centerX: true, // <-- only effects element blocking (page block controlled via css above)
285
centerY: true,
286
287
// allow body element to be stetched in ie6; this makes blocking look better
288
// on "short" pages. disable if you wish to prevent changes to the body height
289
allowBodyStretch: true,
290
291
// enable if you want key and mouse events to be disabled for content that is blocked
292
bindEvents: true,
293
294
// be default blockUI will supress tab navigation from leaving blocking content
295
// (if bindEvents is true)
296
constrainTabKey: true,
297
298
// fadeIn time in millis; set to 0 to disable fadeIn on block
299
fadeIn: 200,
300
301
// fadeOut time in millis; set to 0 to disable fadeOut on unblock
302
fadeOut: 400,
303
304
// time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock
305
timeout: 0,
306
307
// disable if you don't want to show the overlay
308
showOverlay: true,
309
310
// if true, focus will be placed in the first available input field when
311
// page blocking
312
focusInput: true,
313
314
// elements that can receive focus
315
focusableElements: ':input:enabled:visible',
316
317
// suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity)
318
// no longer needed in 2012
319
// applyPlatformOpacityRules: true,
320
321
// callback method invoked when fadeIn has completed and blocking message is visible
322
onBlock: null,
323
324
// callback method invoked when unblocking has completed; the callback is
325
// passed the element that has been unblocked (which is the window object for page
326
// blocks) and the options that were passed to the unblock call:
327
// onUnblock(element, options)
328
onUnblock: null,
329
330
// callback method invoked when the overlay area is clicked.
331
// setting this will turn the cursor to a pointer, otherwise cursor defined in overlayCss will be used.
332
onOverlayClick: null,
333
334
// don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493
335
quirksmodeOffsetHack: 4,
336
337
// class name of the message block
338
blockMsgClass: 'blockMsg',
339
340
// if it is already blocked, then ignore it (don't unblock and reblock)
341
ignoreIfBlocked: false
342
};
343
344
// private data and functions follow...
345
346
var pageBlock = null;
347
var pageBlockEls = [];
348
349
function install(el, opts) {
350
var css, themedCSS;
351
var full = (el == window);
352
var msg = (opts && opts.message !== undefined ? opts.message : undefined);
353
opts = $.extend({}, $.blockUI.defaults, opts || {});
354
355
if (opts.ignoreIfBlocked && $(el).data('blockUI.isBlocked'))
356
return;
357
358
opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {});
359
css = $.extend({}, $.blockUI.defaults.css, opts.css || {});
360
if (opts.onOverlayClick)
361
opts.overlayCSS.cursor = 'pointer';
362
363
themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {});
364
msg = msg === undefined ? opts.message : msg;
365
366
// remove the current block (if there is one)
367
if (full && pageBlock)
368
remove(window, {fadeOut:0});
369
370
// if an existing element is being used as the blocking content then we capture
371
// its current place in the DOM (and current display style) so we can restore
372
// it when we unblock
373
if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) {
374
var node = msg.jquery ? msg[0] : msg;
375
var data = {};
376
$(el).data('blockUI.history', data);
377
data.el = node;
378
data.parent = node.parentNode;
379
data.display = node.style.display;
380
data.position = node.style.position;
381
if (data.parent)
382
data.parent.removeChild(node);
383
}
384
385
$(el).data('blockUI.onUnblock', opts.onUnblock);
386
var z = opts.baseZ;
387
388
// blockUI uses 3 layers for blocking, for simplicity they are all used on every platform;
389
// layer1 is the iframe layer which is used to supress bleed through of underlying content
390
// layer2 is the overlay layer which has opacity and a wait cursor (by default)
391
// layer3 is the message content that is displayed while blocking
392
var lyr1, lyr2, lyr3, s;
393
if (msie || opts.forceIframe)
394
lyr1 = $('<iframe class="blockUI" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+opts.iframeSrc+'"></iframe>');
395
else
396
lyr1 = $('<div class="blockUI" style="display:none"></div>');
397
398
if (opts.theme)
399
lyr2 = $('<div class="blockUI blockOverlay ui-widget-overlay" style="z-index:'+ (z++) +';display:none"></div>');
400
else
401
lyr2 = $('<div class="blockUI blockOverlay" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');
402
403
if (opts.theme && full) {
404
s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:fixed">';
405
if ( opts.title ) {
406
s += '<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || '&nbsp;')+'</div>';
407
}
408
s += '<div class="ui-widget-content ui-dialog-content"></div>';
409
s += '</div>';
410
}
411
else if (opts.theme) {
412
s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement ui-dialog ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:absolute">';
413
if ( opts.title ) {
414
s += '<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || '&nbsp;')+'</div>';
415
}
416
s += '<div class="ui-widget-content ui-dialog-content"></div>';
417
s += '</div>';
418
}
419
else if (full) {
420
s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage" style="z-index:'+(z+10)+';display:none;position:fixed"></div>';
421
}
422
else {
423
s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement" style="z-index:'+(z+10)+';display:none;position:absolute"></div>';
424
}
425
lyr3 = $(s);
426
427
// if we have a message, style it
428
if (msg) {
429
if (opts.theme) {
430
lyr3.css(themedCSS);
431
lyr3.addClass('ui-widget-content');
432
}
433
else
434
lyr3.css(css);
435
}
436
437
// style the overlay
438
if (!opts.theme /*&& (!opts.applyPlatformOpacityRules)*/)
439
lyr2.css(opts.overlayCSS);
440
lyr2.css('position', full ? 'fixed' : 'absolute');
441
442
// make iframe layer transparent in IE
443
if (msie || opts.forceIframe)
444
lyr1.css('opacity',0.0);
445
446
//$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el);
447
var layers = [lyr1,lyr2,lyr3], $par = full ? $('body') : $(el);
448
$.each(layers, function() {
449
this.appendTo($par);
450
});
451
452
if (opts.theme && opts.draggable && $.fn.draggable) {
453
lyr3.draggable({
454
handle: '.ui-dialog-titlebar',
455
cancel: 'li'
456
});
457
}
458
459
// ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling)
460
var expr = setExpr && (!$.support.boxModel || $('object,embed', full ? null : el).length > 0);
461
if (ie6 || expr) {
462
// give body 100% height
463
if (full && opts.allowBodyStretch && $.support.boxModel)
464
$('html,body').css('height','100%');
465
466
// fix ie6 issue when blocked element has a border width
467
if ((ie6 || !$.support.boxModel) && !full) {
468
var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth');
469
var fixT = t ? '(0 - '+t+')' : 0;
470
var fixL = l ? '(0 - '+l+')' : 0;
471
}
472
473
// simulate fixed position
474
$.each(layers, function(i,o) {
475
var s = o[0].style;
476
s.position = 'absolute';
477
if (i < 2) {
478
if (full)
479
s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.support.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"');
480
else
481
s.setExpression('height','this.parentNode.offsetHeight + "px"');
482
if (full)
483
s.setExpression('width','jQuery.support.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"');
484
else
485
s.setExpression('width','this.parentNode.offsetWidth + "px"');
486
if (fixL) s.setExpression('left', fixL);
487
if (fixT) s.setExpression('top', fixT);
488
}
489
else if (opts.centerY) {
490
if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');
491
s.marginTop = 0;
492
}
493
else if (!opts.centerY && full) {
494
var top = (opts.css && opts.css.top) ? parseInt(opts.css.top, 10) : 0;
495
var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"';
496
s.setExpression('top',expression);
497
}
498
});
499
}
500
501
// show the message
502
if (msg) {
503
if (opts.theme)
504
lyr3.find('.ui-widget-content').append(msg);
505
else
506
lyr3.append(msg);
507
if (msg.jquery || msg.nodeType)
508
$(msg).show();
509
}
510
511
if ((msie || opts.forceIframe) && opts.showOverlay)
512
lyr1.show(); // opacity is zero
513
if (opts.fadeIn) {
514
var cb = opts.onBlock ? opts.onBlock : noOp;
515
var cb1 = (opts.showOverlay && !msg) ? cb : noOp;
516
var cb2 = msg ? cb : noOp;
517
if (opts.showOverlay)
518
lyr2._fadeIn(opts.fadeIn, cb1);
519
if (msg)
520
lyr3._fadeIn(opts.fadeIn, cb2);
521
}
522
else {
523
if (opts.showOverlay)
524
lyr2.show();
525
if (msg)
526
lyr3.show();
527
if (opts.onBlock)
528
opts.onBlock();
529
}
530
531
// bind key and mouse events
532
bind(1, el, opts);
533
534
if (full) {
535
pageBlock = lyr3[0];
536
pageBlockEls = $(opts.focusableElements,pageBlock);
537
if (opts.focusInput)
538
setTimeout(focus, 20);
539
}
540
else
541
center(lyr3[0], opts.centerX, opts.centerY);
542
543
if (opts.timeout) {
544
// auto-unblock
545
var to = setTimeout(function() {
546
if (full)
547
$.unblockUI(opts);
548
else
549
$(el).unblock(opts);
550
}, opts.timeout);
551
$(el).data('blockUI.timeout', to);
552
}
553
}
554
555
// remove the block
556
function remove(el, opts) {
557
var count;
558
var full = (el == window);
559
var $el = $(el);
560
var data = $el.data('blockUI.history');
561
var to = $el.data('blockUI.timeout');
562
if (to) {
563
clearTimeout(to);
564
$el.removeData('blockUI.timeout');
565
}
566
opts = $.extend({}, $.blockUI.defaults, opts || {});
567
bind(0, el, opts); // unbind events
568
569
if (opts.onUnblock === null) {
570
opts.onUnblock = $el.data('blockUI.onUnblock');
571
$el.removeData('blockUI.onUnblock');
572
}
573
574
var els;
575
if (full) // crazy selector to handle odd field errors in ie6/7
576
els = $('body').children().filter('.blockUI').add('body > .blockUI');
577
else
578
els = $el.find('>.blockUI');
579
580
// fix cursor issue
581
if ( opts.cursorReset ) {
582
if ( els.length > 1 )
583
els[1].style.cursor = opts.cursorReset;
584
if ( els.length > 2 )
585
els[2].style.cursor = opts.cursorReset;
586
}
587
588
if (full)
589
pageBlock = pageBlockEls = null;
590
591
if (opts.fadeOut) {
592
count = els.length;
593
els.stop().fadeOut(opts.fadeOut, function() {
594
if ( --count === 0)
595
reset(els,data,opts,el);
596
});
597
}
598
else
599
reset(els, data, opts, el);
600
}
601
602
// move blocking element back into the DOM where it started
603
function reset(els,data,opts,el) {
604
var $el = $(el);
605
if ( $el.data('blockUI.isBlocked') )
606
return;
607
608
els.each(function(i,o) {
609
// remove via DOM calls so we don't lose event handlers
610
if (this.parentNode)
611
this.parentNode.removeChild(this);
612
});
613
614
if (data && data.el) {
615
data.el.style.display = data.display;
616
data.el.style.position = data.position;
617
if (data.parent)
618
data.parent.appendChild(data.el);
619
$el.removeData('blockUI.history');
620
}
621
622
if ($el.data('blockUI.static')) {
623
$el.css('position', 'static'); // #22
624
}
625
626
if (typeof opts.onUnblock == 'function')
627
opts.onUnblock(el,opts);
628
629
// fix issue in Safari 6 where block artifacts remain until reflow
630
var body = $(document.body), w = body.width(), cssW = body[0].style.width;
631
body.width(w-1).width(w);
632
body[0].style.width = cssW;
633
}
634
635
// bind/unbind the handler
636
function bind(b, el, opts) {
637
var full = el == window, $el = $(el);
638
639
// don't bother unbinding if there is nothing to unbind
640
if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked')))
641
return;
642
643
$el.data('blockUI.isBlocked', b);
644
645
// don't bind events when overlay is not in use or if bindEvents is false
646
if (!full || !opts.bindEvents || (b && !opts.showOverlay))
647
return;
648
649
// bind anchors and inputs for mouse and key events
650
var events = 'mousedown mouseup keydown keypress keyup touchstart touchend touchmove';
651
if (b)
652
$(document).bind(events, opts, handler);
653
else
654
$(document).unbind(events, handler);
655
656
// former impl...
657
// var $e = $('a,:input');
658
// b ? $e.bind(events, opts, handler) : $e.unbind(events, handler);
659
}
660
661
// event handler to suppress keyboard/mouse events when blocking
662
function handler(e) {
663
// allow tab navigation (conditionally)
664
if (e.type === 'keydown' && e.keyCode && e.keyCode == 9) {
665
if (pageBlock && e.data.constrainTabKey) {
666
var els = pageBlockEls;
667
var fwd = !e.shiftKey && e.target === els[els.length-1];
668
var back = e.shiftKey && e.target === els[0];
669
if (fwd || back) {
670
setTimeout(function(){focus(back);},10);
671
return false;
672
}
673
}
674
}
675
var opts = e.data;
676
var target = $(e.target);
677
if (target.hasClass('blockOverlay') && opts.onOverlayClick)
678
opts.onOverlayClick(e);
679
680
// allow events within the message content
681
if (target.parents('div.' + opts.blockMsgClass).length > 0)
682
return true;
683
684
// allow events for content that is not being blocked
685
return target.parents().children().filter('div.blockUI').length === 0;
686
}
687
688
function focus(back) {
689
if (!pageBlockEls)
690
return;
691
var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0];
692
if (e)
693
e.focus();
694
}
695
696
function center(el, x, y) {
697
var p = el.parentNode, s = el.style;
698
var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth');
699
var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth');
700
if (x) s.left = l > 0 ? (l+'px') : '0';
701
if (y) s.top = t > 0 ? (t+'px') : '0';
702
}
703
704
function sz(el, p) {
705
return parseInt($.css(el,p),10)||0;
706
}
707
708
}
709
710
711
/*global define:true */
712
if (typeof define === 'function' && define.amd && define.amd.jQuery) {
713
define(['jquery'], setup);
714
} else {
715
setup(jQuery);
716
}
717
718
})();
719
720
721
722
723
724
/*!
725
Autosize v1.18.1 - 2013-11-05
726
Automatically adjust textarea height based on user input.
727
(c) 2013 Jack Moore - http://www.jacklmoore.com/autosize
728
license: http://www.opensource.org/licenses/mit-license.php
729
*/
730
(function(e){var t,o={className:"autosizejs",append:"",callback:!1,resizeDelay:10},i='<textarea tabindex="-1" style="position:absolute; top:-999px; left:0; right:auto; bottom:auto; border:0; padding: 0; -moz-box-sizing:content-box; -webkit-box-sizing:content-box; box-sizing:content-box; word-wrap:break-word; height:0 !important; min-height:0 !important; overflow:hidden; transition:none; -webkit-transition:none; -moz-transition:none;"/>',n=["fontFamily","fontSize","fontWeight","fontStyle","letterSpacing","textTransform","wordSpacing","textIndent"],s=e(i).data("autosize",!0)[0];s.style.lineHeight="99px","99px"===e(s).css("lineHeight")&&n.push("lineHeight"),s.style.lineHeight="",e.fn.autosize=function(i){return this.length?(i=e.extend({},o,i||{}),s.parentNode!==document.body&&e(document.body).append(s),this.each(function(){function o(){var t,o;"getComputedStyle"in window?(t=window.getComputedStyle(u,null),o=u.getBoundingClientRect().width,e.each(["paddingLeft","paddingRight","borderLeftWidth","borderRightWidth"],function(e,i){o-=parseInt(t[i],10)}),s.style.width=o+"px"):s.style.width=Math.max(p.width(),0)+"px"}function a(){var a={};if(t=u,s.className=i.className,d=parseInt(p.css("maxHeight"),10),e.each(n,function(e,t){a[t]=p.css(t)}),e(s).css(a),o(),window.chrome){var r=u.style.width;u.style.width="0px",u.offsetWidth,u.style.width=r}}function r(){var e,n;t!==u?a():o(),s.value=u.value+i.append,s.style.overflowY=u.style.overflowY,n=parseInt(u.style.height,10),s.scrollTop=0,s.scrollTop=9e4,e=s.scrollTop,d&&e>d?(u.style.overflowY="scroll",e=d):(u.style.overflowY="hidden",c>e&&(e=c)),e+=w,n!==e&&(u.style.height=e+"px",f&&i.callback.call(u,u))}function l(){clearTimeout(h),h=setTimeout(function(){var e=p.width();e!==g&&(g=e,r())},parseInt(i.resizeDelay,10))}var d,c,h,u=this,p=e(u),w=0,f=e.isFunction(i.callback),z={height:u.style.height,overflow:u.style.overflow,overflowY:u.style.overflowY,wordWrap:u.style.wordWrap,resize:u.style.resize},g=p.width();p.data("autosize")||(p.data("autosize",!0),("border-box"===p.css("box-sizing")||"border-box"===p.css("-moz-box-sizing")||"border-box"===p.css("-webkit-box-sizing"))&&(w=p.outerHeight()-p.height()),c=Math.max(parseInt(p.css("minHeight"),10)-w||0,p.height()),p.css({overflow:"hidden",overflowY:"hidden",wordWrap:"break-word",resize:"none"===p.css("resize")||"vertical"===p.css("resize")?"none":"horizontal"}),"onpropertychange"in u?"oninput"in u?p.on("input.autosize keyup.autosize",r):p.on("propertychange.autosize",function(){"value"===event.propertyName&&r()}):p.on("input.autosize",r),i.resizeDelay!==!1&&e(window).on("resize.autosize",l),p.on("autosize.resize",r),p.on("autosize.resizeIncludeStyle",function(){t=null,r()}),p.on("autosize.destroy",function(){t=null,clearTimeout(h),e(window).off("resize",l),p.off("autosize").off(".autosize").css(z).removeData("autosize")}),r())})):this}})(window.jQuery||window.$);
731
732
733
/*
734
Bootstrap - File Input
735
======================
736
737
This is meant to convert all file input tags into a set of elements that displays consistently in all browsers.
738
739
Converts all
740
<input type="file">
741
into Bootstrap buttons
742
<a class="btn">Browse</a>
743
744
*/
745
$(function() {
746
747
$.fn.bootstrapFileInput = function(browseText) {
748
749
this.each(function(i,elem){
750
751
var $elem = $(elem);
752
753
// Maybe some fields don't need to be standardized.
754
if (typeof $elem.attr('data-bfi-disabled') != 'undefined') {
755
return;
756
}
757
758
// Set the word to be displayed on the button
759
var buttonWord = browseText && browseText.length ? browseText : 'Browse';
760
761
if (typeof $elem.attr('title') != 'undefined') {
762
buttonWord = $elem.attr('title');
763
}
764
765
// Start by getting the HTML of the input element.
766
// Thanks for the tip http://stackoverflow.com/a/1299069
767
var input = $('<div>').append( $elem.eq(0).clone() ).html();
768
var className = '';
769
770
if (!!$elem.attr('class')) {
771
className = ' ' + $elem.attr('class');
772
}
773
774
// Now we're going to replace that input field with a Bootstrap button.
775
// The input will actually still be there, it will just be float above and transparent (done with the CSS).
776
$elem.replaceWith('<a class="file-input-wrapper btn' + className + '">'+buttonWord+input+'</a>');
777
})
778
779
// After we have found all of the file inputs let's apply a listener for tracking the mouse movement.
780
// This is important because the in order to give the illusion that this is a button in FF we actually need to move the button from the file input under the cursor. Ugh.
781
.promise().done( function(){
782
783
// As the cursor moves over our new Bootstrap button we need to adjust the position of the invisible file input Browse button to be under the cursor.
784
// This gives us the pointer cursor that FF denies us
785
$('.file-input-wrapper').mousemove(function(cursor) {
786
787
var input, wrapper,
788
wrapperX, wrapperY,
789
inputWidth, inputHeight,
790
cursorX, cursorY;
791
792
// This wrapper element (the button surround this file input)
793
wrapper = $(this);
794
// The invisible file input element
795
input = wrapper.find("input");
796
// The left-most position of the wrapper
797
wrapperX = wrapper.offset().left;
798
// The top-most position of the wrapper
799
wrapperY = wrapper.offset().top;
800
// The with of the browsers input field
801
inputWidth= input.width();
802
// The height of the browsers input field
803
inputHeight= input.height();
804
//The position of the cursor in the wrapper
805
cursorX = cursor.pageX;
806
cursorY = cursor.pageY;
807
808
//The positions we are to move the invisible file input
809
// The 20 at the end is an arbitrary number of pixels that we can shift the input such that cursor is not pointing at the end of the Browse button but somewhere nearer the middle
810
moveInputX = cursorX - wrapperX - inputWidth + 20;
811
// Slides the invisible input Browse button to be positioned middle under the cursor
812
moveInputY = cursorY- wrapperY - (inputHeight/2);
813
814
// Apply the positioning styles to actually move the invisible file input
815
input.css({
816
left:moveInputX,
817
top:moveInputY
818
});
819
});
820
821
$('.file-input-wrapper input[type=file]').change(function(){
822
823
var fileName;
824
fileName = $(this).val();
825
826
// Remove any previous file names
827
$(this).parent().next('.file-input-name').remove();
828
if (!!$(this).prop('files') && $(this).prop('files').length > 1) {
829
fileName = $(this)[0].files.length+' files';
830
//$(this).parent().after('<span class="file-input-name">'+$(this)[0].files.length+' files</span>');
831
}
832
else {
833
// var fakepath = 'C:\\fakepath\\';
834
// fileName = $(this).val().replace('C:\\fakepath\\','');
835
fileName = fileName.substring(fileName.lastIndexOf('\\')+1,fileName.length);
836
}
837
838
$(this).parent().after('<span class="file-input-name">'+fileName+'</span>');
839
});
840
841
});
842
843
};
844
845
// Add the styles before the first stylesheet
846
// This ensures they can be easily overridden with developer styles
847
var cssHtml = '<style>'+
848
'.file-input-wrapper { overflow: hidden; position: relative; cursor: pointer; z-index: 1; }'+
849
'.file-input-wrapper input[type=file], .file-input-wrapper input[type=file]:focus, .file-input-wrapper input[type=file]:hover { position: absolute; top: 0; left: 0; cursor: pointer; opacity: 0; filter: alpha(opacity=0); z-index: 99; outline: 0; }'+
850
'.file-input-name { margin-left: 8px; }'+
851
'</style>';
852
$('link[rel=stylesheet]').eq(0).before(cssHtml);
853
854
});
855
856
857
858
859
/* Scroll Monitor */
860
(function( factory ) {
861
if (typeof define !== 'undefined' && define.amd) {
862
define(['jquery'], factory);
863
} else if (typeof module !== 'undefined' && module.exports) {
864
var $ = require('jquery');
865
module.exports = factory( $ );
866
} else {
867
window.scrollMonitor = factory( jQuery );
868
}
869
})(function( $ ) {
870
871
var exports = {};
872
873
var $window = $(window);
874
var $document = $(document);
875
876
var watchers = [];
877
878
var VISIBILITYCHANGE = 'visibilityChange';
879
var ENTERVIEWPORT = 'enterViewport';
880
var FULLYENTERVIEWPORT = 'fullyEnterViewport';
881
var EXITVIEWPORT = 'exitViewport';
882
var PARTIALLYEXITVIEWPORT = 'partiallyExitViewport';
883
var LOCATIONCHANGE = 'locationChange';
884
var STATECHANGE = 'stateChange';
885
886
var eventTypes = [
887
VISIBILITYCHANGE,
888
ENTERVIEWPORT,
889
FULLYENTERVIEWPORT,
890
EXITVIEWPORT,
891
PARTIALLYEXITVIEWPORT,
892
LOCATIONCHANGE,
893
STATECHANGE
894
];
895
896
var defaultOffsets = {top: 0, bottom: 0};
897
898
exports.viewportTop;
899
exports.viewportBottom;
900
exports.documentHeight;
901
exports.viewportHeight = windowHeight();
902
903
var previousDocumentHeight;
904
var latestEvent;
905
906
function windowHeight() {
907
return window.innerHeight || document.documentElement.clientHeight;
908
}
909
910
var calculateViewportI;
911
function calculateViewport() {
912
exports.viewportTop = $window.scrollTop();
913
exports.viewportBottom = exports.viewportTop + exports.viewportHeight;
914
exports.documentHeight = $document.height();
915
if (exports.documentHeight !== previousDocumentHeight) {
916
calculateViewportI = watchers.length;
917
while( calculateViewportI-- ) {
918
watchers[calculateViewportI].recalculateLocation();
919
}
920
previousDocumentHeight = exports.documentHeight;
921
}
922
}
923
924
function recalculateWatchLocationsAndTrigger() {
925
exports.viewportHeight = windowHeight();
926
calculateViewport();
927
updateAndTriggerWatchers();
928
}
929
930
var recalculateAndTriggerTimer;
931
function debouncedRecalcuateAndTrigger() {
932
clearTimeout(recalculateAndTriggerTimer);
933
recalculateAndTriggerTimer = setTimeout( recalculateWatchLocationsAndTrigger, 100 );
934
}
935
936
var updateAndTriggerWatchersI;
937
function updateAndTriggerWatchers() {
938
// update all watchers then trigger the events so one can rely on another being up to date.
939
updateAndTriggerWatchersI = watchers.length;
940
while( updateAndTriggerWatchersI-- ) {
941
watchers[updateAndTriggerWatchersI].update();
942
}
943
944
updateAndTriggerWatchersI = watchers.length;
945
while( updateAndTriggerWatchersI-- ) {
946
watchers[updateAndTriggerWatchersI].triggerCallbacks();
947
}
948
949
}
950
951
function ElementWatcher( watchItem, offsets ) {
952
var self = this;
953
954
this.watchItem = watchItem;
955
956
if (!offsets) {
957
this.offsets = defaultOffsets;
958
} else if (offsets === +offsets) {
959
this.offsets = {top: offsets, bottom: offsets};
960
} else {
961
this.offsets = $.extend({}, defaultOffsets, offsets);
962
}
963
964
this.callbacks = {}; // {callback: function, isOne: true }
965
966
for (var i = 0, j = eventTypes.length; i < j; i++) {
967
self.callbacks[eventTypes[i]] = [];
968
}
969
970
this.locked = false;
971
972
var wasInViewport;
973
var wasFullyInViewport;
974
var wasAboveViewport;
975
var wasBelowViewport;
976
977
var listenerToTriggerListI;
978
var listener;
979
function triggerCallbackArray( listeners ) {
980
if (listeners.length === 0) {
981
return;
982
}
983
listenerToTriggerListI = listeners.length;
984
while( listenerToTriggerListI-- ) {
985
listener = listeners[listenerToTriggerListI];
986
listener.callback.call( self, latestEvent );
987
if (listener.isOne) {
988
listeners.splice(listenerToTriggerListI, 1);
989
}
990
}
991
}
992
this.triggerCallbacks = function triggerCallbacks() {
993
994
if (this.isInViewport && !wasInViewport) {
995
triggerCallbackArray( this.callbacks[ENTERVIEWPORT] );
996
}
997
if (this.isFullyInViewport && !wasFullyInViewport) {
998
triggerCallbackArray( this.callbacks[FULLYENTERVIEWPORT] );
999
}
1000
1001
1002
if (this.isAboveViewport !== wasAboveViewport &&
1003
this.isBelowViewport !== wasBelowViewport) {
1004
1005
triggerCallbackArray( this.callbacks[VISIBILITYCHANGE] );
1006
1007
// if you skip completely past this element
1008
if (!wasFullyInViewport && !this.isFullyInViewport) {
1009
triggerCallbackArray( this.callbacks[FULLYENTERVIEWPORT] );
1010
triggerCallbackArray( this.callbacks[PARTIALLYEXITVIEWPORT] );
1011
}
1012
if (!wasInViewport && !this.isInViewport) {
1013
triggerCallbackArray( this.callbacks[ENTERVIEWPORT] );
1014
triggerCallbackArray( this.callbacks[EXITVIEWPORT] );
1015
}
1016
}
1017
1018
if (!this.isFullyInViewport && wasFullyInViewport) {
1019
triggerCallbackArray( this.callbacks[PARTIALLYEXITVIEWPORT] );
1020
}
1021
if (!this.isInViewport && wasInViewport) {
1022
triggerCallbackArray( this.callbacks[EXITVIEWPORT] );
1023
}
1024
if (this.isInViewport !== wasInViewport) {
1025
triggerCallbackArray( this.callbacks[VISIBILITYCHANGE] );
1026
}
1027
switch( true ) {
1028
case wasInViewport !== this.isInViewport:
1029
case wasFullyInViewport !== this.isFullyInViewport:
1030
case wasAboveViewport !== this.isAboveViewport:
1031
case wasBelowViewport !== this.isBelowViewport:
1032
triggerCallbackArray( this.callbacks[STATECHANGE] );
1033
}
1034
1035
wasInViewport = this.isInViewport;
1036
wasFullyInViewport = this.isFullyInViewport;
1037
wasAboveViewport = this.isAboveViewport;
1038
wasBelowViewport = this.isBelowViewport;
1039
1040
};
1041
1042
this.recalculateLocation = function() {
1043
if (this.locked) {
1044
return;
1045
}
1046
var previousTop = this.top;
1047
var previousBottom = this.bottom;
1048
if (this.watchItem.nodeName) { // a dom element
1049
var cachedDisplay = this.watchItem.style.display;
1050
if (cachedDisplay === 'none') {
1051
this.watchItem.style.display = '';
1052
}
1053
1054
var elementLocation = $(this.watchItem).offset();
1055
this.top = elementLocation.top;
1056
this.bottom = elementLocation.top + this.watchItem.offsetHeight;
1057
1058
if (cachedDisplay === 'none') {
1059
this.watchItem.style.display = cachedDisplay;
1060
}
1061
1062
} else if (this.watchItem === +this.watchItem) { // number
1063
if (this.watchItem > 0) {
1064
this.top = this.bottom = this.watchItem;
1065
} else {
1066
this.top = this.bottom = exports.documentHeight - this.watchItem;
1067
}
1068
1069
} else { // an object with a top and bottom property
1070
this.top = this.watchItem.top;
1071
this.bottom = this.watchItem.bottom;
1072
}
1073
1074
this.top -= this.offsets.top;
1075
this.bottom += this.offsets.bottom;
1076
this.height = this.bottom - this.top;
1077
1078
if ( (previousTop !== undefined || previousBottom !== undefined) && (this.top !== previousTop || this.bottom !== previousBottom) ) {
1079
triggerCallbackArray( this.callbacks[LOCATIONCHANGE] );
1080
}
1081
};
1082
1083
this.recalculateLocation();
1084
this.update();
1085
1086
wasInViewport = this.isInViewport;
1087
wasFullyInViewport = this.isFullyInViewport;
1088
wasAboveViewport = this.isAboveViewport;
1089
wasBelowViewport = this.isBelowViewport;
1090
}
1091
1092
ElementWatcher.prototype = {
1093
on: function( event, callback, isOne ) {
1094
1095
// trigger the event if it applies to the element right now.
1096
switch( true ) {
1097
case event === VISIBILITYCHANGE && !this.isInViewport && this.isAboveViewport:
1098
case event === ENTERVIEWPORT && this.isInViewport:
1099
case event === FULLYENTERVIEWPORT && this.isFullyInViewport:
1100
case event === EXITVIEWPORT && this.isAboveViewport && !this.isInViewport:
1101
case event === PARTIALLYEXITVIEWPORT && this.isAboveViewport:
1102
callback();
1103
if (isOne) {
1104
return;
1105
}
1106
}
1107
1108
if (this.callbacks[event]) {
1109
this.callbacks[event].push({callback: callback, isOne: isOne});
1110
} else {
1111
throw new Error('Tried to add a scroll monitor listener of type '+event+'. Your options are: '+eventTypes.join(', '));
1112
}
1113
},
1114
off: function( event, callback ) {
1115
if (this.callbacks[event]) {
1116
for (var i = 0, item; item = this.callbacks[event][i]; i++) {
1117
if (item.callback === callback) {
1118
this.callbacks[event].splice(i, 1);
1119
break;
1120
}
1121
}
1122
} else {
1123
throw new Error('Tried to remove a scroll monitor listener of type '+event+'. Your options are: '+eventTypes.join(', '));
1124
}
1125
},
1126
one: function( event, callback ) {
1127
this.on( event, callback, true);
1128
},
1129
recalculateSize: function() {
1130
this.height = this.watchItem.offsetHeight + this.offsets.top + this.offsets.bottom;
1131
this.bottom = this.top + this.height;
1132
},
1133
update: function() {
1134
this.isAboveViewport = this.top < exports.viewportTop;
1135
this.isBelowViewport = this.bottom > exports.viewportBottom;
1136
1137
this.isInViewport = (this.top <= exports.viewportBottom && this.bottom >= exports.viewportTop);
1138
this.isFullyInViewport = (this.top >= exports.viewportTop && this.bottom <= exports.viewportBottom) ||
1139
(this.isAboveViewport && this.isBelowViewport);
1140
1141
},
1142
destroy: function() {
1143
var index = watchers.indexOf(this),
1144
self = this;
1145
watchers.splice(index, 1);
1146
for (var i = 0, j = eventTypes.length; i < j; i++) {
1147
self.callbacks[eventTypes[i]].length = 0;
1148
}
1149
},
1150
// prevent recalculating the element location
1151
lock: function() {
1152
this.locked = true;
1153
},
1154
unlock: function() {
1155
this.locked = false;
1156
}
1157
};
1158
1159
var eventHandlerFactory = function (type) {
1160
return function( callback, isOne ) {
1161
this.on.call(this, type, callback, isOne);
1162
};
1163
};
1164
1165
for (var i = 0, j = eventTypes.length; i < j; i++) {
1166
var type = eventTypes[i];
1167
ElementWatcher.prototype[type] = eventHandlerFactory(type);
1168
}
1169
1170
try {
1171
calculateViewport();
1172
} catch (e) {
1173
$(calculateViewport);
1174
}
1175
1176
function scrollMonitorListener(event) {
1177
latestEvent = event;
1178
calculateViewport();
1179
updateAndTriggerWatchers();
1180
}
1181
1182
$window.on('scroll', scrollMonitorListener);
1183
$window.on('resize', debouncedRecalcuateAndTrigger);
1184
1185
exports.beget = exports.create = function( element, offsets ) {
1186
if (typeof element === 'string') {
1187
element = $(element)[0];
1188
}
1189
if (element instanceof $) {
1190
element = element[0];
1191
}
1192
var watcher = new ElementWatcher( element, offsets );
1193
watchers.push(watcher);
1194
watcher.update();
1195
return watcher;
1196
};
1197
1198
exports.update = function() {
1199
latestEvent = null;
1200
calculateViewport();
1201
updateAndTriggerWatchers();
1202
};
1203
exports.recalculateLocations = function() {
1204
exports.documentHeight = 0;
1205
exports.update();
1206
};
1207
1208
return exports;
1209
});
1210
1211
1212
1213
1214
/* jquery.nicescroll 3.5.4 InuYaksa*2013 MIT http://areaaperta.com/nicescroll */(function(e){"function"===typeof define&&define.amd?define(["jquery"],e):e(jQuery)})(function(e){var y=!1,C=!1,J=5E3,K=2E3,x=0,F=["ms","moz","webkit","o"],s=window.requestAnimationFrame||!1,v=window.cancelAnimationFrame||!1;if(!s)for(var L in F){var D=F[L];s||(s=window[D+"RequestAnimationFrame"]);v||(v=window[D+"CancelAnimationFrame"]||window[D+"CancelRequestAnimationFrame"])}var z=window.MutationObserver||window.WebKitMutationObserver||!1,G={zindex:"auto",cursoropacitymin:0,cursoropacitymax:1,cursorcolor:"#424242",
1215
cursorwidth:"5px",cursorborder:"1px solid #fff",cursorborderradius:"5px",scrollspeed:60,mousescrollstep:24,touchbehavior:!1,hwacceleration:!0,usetransition:!0,boxzoom:!1,dblclickzoom:!0,gesturezoom:!0,grabcursorenabled:!0,autohidemode:!0,background:"",iframeautoresize:!0,cursorminheight:32,preservenativescrolling:!0,railoffset:!1,bouncescroll:!0,spacebarenabled:!0,railpadding:{top:0,right:0,left:0,bottom:0},disableoutline:!0,horizrailenabled:!0,railalign:"right",railvalign:"bottom",enabletranslate3d:!0,
1216
enablemousewheel:!0,enablekeyboard:!0,smoothscroll:!0,sensitiverail:!0,enablemouselockapi:!0,cursorfixedheight:!1,directionlockdeadzone:6,hidecursordelay:400,nativeparentscrolling:!0,enablescrollonselection:!0,overflowx:!0,overflowy:!0,cursordragspeed:0.3,rtlmode:"auto",cursordragontouch:!1,oneaxismousemode:"auto",scriptpath:function(){var e=document.getElementsByTagName("script"),e=e[e.length-1].src.split("?")[0];return 0<e.split("/").length?e.split("/").slice(0,-1).join("/")+"/":""}()},E=!1,M=function(){if(E)return E;
1217
var e=document.createElement("DIV"),b={haspointerlock:"pointerLockElement"in document||"mozPointerLockElement"in document||"webkitPointerLockElement"in document};b.isopera="opera"in window;b.isopera12=b.isopera&&"getUserMedia"in navigator;b.isoperamini="[object OperaMini]"===Object.prototype.toString.call(window.operamini);b.isie="all"in document&&"attachEvent"in e&&!b.isopera;b.isieold=b.isie&&!("msInterpolationMode"in e.style);b.isie7=b.isie&&!b.isieold&&(!("documentMode"in document)||7==document.documentMode);
1218
b.isie8=b.isie&&"documentMode"in document&&8==document.documentMode;b.isie9=b.isie&&"performance"in window&&9<=document.documentMode;b.isie10=b.isie&&"performance"in window&&10<=document.documentMode;b.isie9mobile=/iemobile.9/i.test(navigator.userAgent);b.isie9mobile&&(b.isie9=!1);b.isie7mobile=!b.isie9mobile&&b.isie7&&/iemobile/i.test(navigator.userAgent);b.ismozilla="MozAppearance"in e.style;b.iswebkit="WebkitAppearance"in e.style;b.ischrome="chrome"in window;b.ischrome22=b.ischrome&&b.haspointerlock;
1219
b.ischrome26=b.ischrome&&"transition"in e.style;b.cantouch="ontouchstart"in document.documentElement||"ontouchstart"in window;b.hasmstouch=window.navigator.msPointerEnabled||!1;b.ismac=/^mac$/i.test(navigator.platform);b.isios=b.cantouch&&/iphone|ipad|ipod/i.test(navigator.platform);b.isios4=b.isios&&!("seal"in Object);b.isandroid=/android/i.test(navigator.userAgent);b.trstyle=!1;b.hastransform=!1;b.hastranslate3d=!1;b.transitionstyle=!1;b.hastransition=!1;b.transitionend=!1;for(var h=["transform",
1220
"msTransform","webkitTransform","MozTransform","OTransform"],k=0;k<h.length;k++)if("undefined"!=typeof e.style[h[k]]){b.trstyle=h[k];break}b.hastransform=!1!=b.trstyle;b.hastransform&&(e.style[b.trstyle]="translate3d(1px,2px,3px)",b.hastranslate3d=/translate3d/.test(e.style[b.trstyle]));b.transitionstyle=!1;b.prefixstyle="";b.transitionend=!1;for(var h="transition webkitTransition MozTransition OTransition OTransition msTransition KhtmlTransition".split(" "),l=" -webkit- -moz- -o- -o -ms- -khtml-".split(" "),
1221
q="transitionend webkitTransitionEnd transitionend otransitionend oTransitionEnd msTransitionEnd KhtmlTransitionEnd".split(" "),k=0;k<h.length;k++)if(h[k]in e.style){b.transitionstyle=h[k];b.prefixstyle=l[k];b.transitionend=q[k];break}b.ischrome26&&(b.prefixstyle=l[1]);b.hastransition=b.transitionstyle;a:{h=["-moz-grab","-webkit-grab","grab"];if(b.ischrome&&!b.ischrome22||b.isie)h=[];for(k=0;k<h.length;k++)if(l=h[k],e.style.cursor=l,e.style.cursor==l){h=l;break a}h="url(http://www.google.com/intl/en_ALL/mapfiles/openhand.cur),n-resize"}b.cursorgrabvalue=
1222
h;b.hasmousecapture="setCapture"in e;b.hasMutationObserver=!1!==z;return E=b},N=function(g,b){function h(){var c=a.win;if("zIndex"in c)return c.zIndex();for(;0<c.length&&9!=c[0].nodeType;){var b=c.css("zIndex");if(!isNaN(b)&&0!=b)return parseInt(b);c=c.parent()}return!1}function k(c,b,f){b=c.css(b);c=parseFloat(b);return isNaN(c)?(c=w[b]||0,f=3==c?f?a.win.outerHeight()-a.win.innerHeight():a.win.outerWidth()-a.win.innerWidth():1,a.isie8&&c&&(c+=1),f?c:0):c}function l(c,b,f,e){a._bind(c,b,function(a){a=
1223
a?a:window.event;var e={original:a,target:a.target||a.srcElement,type:"wheel",deltaMode:"MozMousePixelScroll"==a.type?0:1,deltaX:0,deltaZ:0,preventDefault:function(){a.preventDefault?a.preventDefault():a.returnValue=!1;return!1},stopImmediatePropagation:function(){a.stopImmediatePropagation?a.stopImmediatePropagation():a.cancelBubble=!0}};"mousewheel"==b?(e.deltaY=-0.025*a.wheelDelta,a.wheelDeltaX&&(e.deltaX=-0.025*a.wheelDeltaX)):e.deltaY=a.detail;return f.call(c,e)},e)}function q(c,b,f){var e,d;
1224
0==c.deltaMode?(e=-Math.floor(c.deltaX*(a.opt.mousescrollstep/54)),d=-Math.floor(c.deltaY*(a.opt.mousescrollstep/54))):1==c.deltaMode&&(e=-Math.floor(c.deltaX*a.opt.mousescrollstep),d=-Math.floor(c.deltaY*a.opt.mousescrollstep));b&&(a.opt.oneaxismousemode&&0==e&&d)&&(e=d,d=0);e&&(a.scrollmom&&a.scrollmom.stop(),a.lastdeltax+=e,a.debounced("mousewheelx",function(){var c=a.lastdeltax;a.lastdeltax=0;a.rail.drag||a.doScrollLeftBy(c)},15));if(d){if(a.opt.nativeparentscrolling&&f&&!a.ispage&&!a.zoomactive)if(0>
1225
d){if(a.getScrollTop()>=a.page.maxh)return!0}else if(0>=a.getScrollTop())return!0;a.scrollmom&&a.scrollmom.stop();a.lastdeltay+=d;a.debounced("mousewheely",function(){var c=a.lastdeltay;a.lastdeltay=0;a.rail.drag||a.doScrollBy(c)},15)}c.stopImmediatePropagation();return c.preventDefault()}var a=this;this.version="3.5.4";this.name="nicescroll";this.me=b;this.opt={doc:e("body"),win:!1};e.extend(this.opt,G);this.opt.snapbackspeed=80;if(g)for(var p in a.opt)"undefined"!=typeof g[p]&&(a.opt[p]=g[p]);this.iddoc=
1226
(this.doc=a.opt.doc)&&this.doc[0]?this.doc[0].id||"":"";this.ispage=/^BODY|HTML/.test(a.opt.win?a.opt.win[0].nodeName:this.doc[0].nodeName);this.haswrapper=!1!==a.opt.win;this.win=a.opt.win||(this.ispage?e(window):this.doc);this.docscroll=this.ispage&&!this.haswrapper?e(window):this.win;this.body=e("body");this.iframe=this.isfixed=this.viewport=!1;this.isiframe="IFRAME"==this.doc[0].nodeName&&"IFRAME"==this.win[0].nodeName;this.istextarea="TEXTAREA"==this.win[0].nodeName;this.forcescreen=!1;this.canshowonmouseevent=
1227
"scroll"!=a.opt.autohidemode;this.page=this.view=this.onzoomout=this.onzoomin=this.onscrollcancel=this.onscrollend=this.onscrollstart=this.onclick=this.ongesturezoom=this.onkeypress=this.onmousewheel=this.onmousemove=this.onmouseup=this.onmousedown=!1;this.scroll={x:0,y:0};this.scrollratio={x:0,y:0};this.cursorheight=20;this.scrollvaluemax=0;this.observerremover=this.observer=this.scrollmom=this.scrollrunning=this.isrtlmode=!1;do this.id="ascrail"+K++;while(document.getElementById(this.id));this.hasmousefocus=
1228
this.hasfocus=this.zoomactive=this.zoom=this.selectiondrag=this.cursorfreezed=this.cursor=this.rail=!1;this.visibility=!0;this.hidden=this.locked=!1;this.cursoractive=!0;this.wheelprevented=!1;this.overflowx=a.opt.overflowx;this.overflowy=a.opt.overflowy;this.nativescrollingarea=!1;this.checkarea=0;this.events=[];this.saved={};this.delaylist={};this.synclist={};this.lastdeltay=this.lastdeltax=0;this.detected=M();var d=e.extend({},this.detected);this.ishwscroll=(this.canhwscroll=d.hastransform&&a.opt.hwacceleration)&&
1229
a.haswrapper;this.istouchcapable=!1;d.cantouch&&(d.ischrome&&!d.isios&&!d.isandroid)&&(this.istouchcapable=!0,d.cantouch=!1);d.cantouch&&(d.ismozilla&&!d.isios&&!d.isandroid)&&(this.istouchcapable=!0,d.cantouch=!1);a.opt.enablemouselockapi||(d.hasmousecapture=!1,d.haspointerlock=!1);this.delayed=function(c,b,f,e){var d=a.delaylist[c],h=(new Date).getTime();if(!e&&d&&d.tt)return!1;d&&d.tt&&clearTimeout(d.tt);if(d&&d.last+f>h&&!d.tt)a.delaylist[c]={last:h+f,tt:setTimeout(function(){a&&(a.delaylist[c].tt=
1230
0,b.call())},f)};else if(!d||!d.tt)a.delaylist[c]={last:h,tt:0},setTimeout(function(){b.call()},0)};this.debounced=function(c,b,f){var d=a.delaylist[c];(new Date).getTime();a.delaylist[c]=b;d||setTimeout(function(){var b=a.delaylist[c];a.delaylist[c]=!1;b.call()},f)};var r=!1;this.synched=function(c,b){a.synclist[c]=b;(function(){r||(s(function(){r=!1;for(c in a.synclist){var b=a.synclist[c];b&&b.call(a);a.synclist[c]=!1}}),r=!0)})();return c};this.unsynched=function(c){a.synclist[c]&&(a.synclist[c]=
1231
!1)};this.css=function(c,b){for(var f in b)a.saved.css.push([c,f,c.css(f)]),c.css(f,b[f])};this.scrollTop=function(c){return"undefined"==typeof c?a.getScrollTop():a.setScrollTop(c)};this.scrollLeft=function(c){return"undefined"==typeof c?a.getScrollLeft():a.setScrollLeft(c)};BezierClass=function(a,b,f,d,e,h,k){this.st=a;this.ed=b;this.spd=f;this.p1=d||0;this.p2=e||1;this.p3=h||0;this.p4=k||1;this.ts=(new Date).getTime();this.df=this.ed-this.st};BezierClass.prototype={B2:function(a){return 3*a*a*(1-
1232
a)},B3:function(a){return 3*a*(1-a)*(1-a)},B4:function(a){return(1-a)*(1-a)*(1-a)},getNow:function(){var a=1-((new Date).getTime()-this.ts)/this.spd,b=this.B2(a)+this.B3(a)+this.B4(a);return 0>a?this.ed:this.st+Math.round(this.df*b)},update:function(a,b){this.st=this.getNow();this.ed=a;this.spd=b;this.ts=(new Date).getTime();this.df=this.ed-this.st;return this}};if(this.ishwscroll){this.doc.translate={x:0,y:0,tx:"0px",ty:"0px"};d.hastranslate3d&&d.isios&&this.doc.css("-webkit-backface-visibility",
1233
"hidden");var t=function(){var c=a.doc.css(d.trstyle);return c&&"matrix"==c.substr(0,6)?c.replace(/^.*\((.*)\)$/g,"$1").replace(/px/g,"").split(/, +/):!1};this.getScrollTop=function(c){if(!c){if(c=t())return 16==c.length?-c[13]:-c[5];if(a.timerscroll&&a.timerscroll.bz)return a.timerscroll.bz.getNow()}return a.doc.translate.y};this.getScrollLeft=function(c){if(!c){if(c=t())return 16==c.length?-c[12]:-c[4];if(a.timerscroll&&a.timerscroll.bh)return a.timerscroll.bh.getNow()}return a.doc.translate.x};
1234
this.notifyScrollEvent=document.createEvent?function(a){var b=document.createEvent("UIEvents");b.initUIEvent("scroll",!1,!0,window,1);a.dispatchEvent(b)}:document.fireEvent?function(a){var b=document.createEventObject();a.fireEvent("onscroll");b.cancelBubble=!0}:function(a,b){};d.hastranslate3d&&a.opt.enabletranslate3d?(this.setScrollTop=function(c,b){a.doc.translate.y=c;a.doc.translate.ty=-1*c+"px";a.doc.css(d.trstyle,"translate3d("+a.doc.translate.tx+","+a.doc.translate.ty+",0px)");b||a.notifyScrollEvent(a.win[0])},
1235
this.setScrollLeft=function(c,b){a.doc.translate.x=c;a.doc.translate.tx=-1*c+"px";a.doc.css(d.trstyle,"translate3d("+a.doc.translate.tx+","+a.doc.translate.ty+",0px)");b||a.notifyScrollEvent(a.win[0])}):(this.setScrollTop=function(c,b){a.doc.translate.y=c;a.doc.translate.ty=-1*c+"px";a.doc.css(d.trstyle,"translate("+a.doc.translate.tx+","+a.doc.translate.ty+")");b||a.notifyScrollEvent(a.win[0])},this.setScrollLeft=function(c,b){a.doc.translate.x=c;a.doc.translate.tx=-1*c+"px";a.doc.css(d.trstyle,
1236
"translate("+a.doc.translate.tx+","+a.doc.translate.ty+")");b||a.notifyScrollEvent(a.win[0])})}else this.getScrollTop=function(){return a.docscroll.scrollTop()},this.setScrollTop=function(c){return a.docscroll.scrollTop(c)},this.getScrollLeft=function(){return a.docscroll.scrollLeft()},this.setScrollLeft=function(c){return a.docscroll.scrollLeft(c)};this.getTarget=function(a){return!a?!1:a.target?a.target:a.srcElement?a.srcElement:!1};this.hasParent=function(a,b){if(!a)return!1;for(var f=a.target||
1237
a.srcElement||a||!1;f&&f.id!=b;)f=f.parentNode||!1;return!1!==f};var w={thin:1,medium:3,thick:5};this.getOffset=function(){if(a.isfixed)return{top:parseFloat(a.win.css("top")),left:parseFloat(a.win.css("left"))};if(!a.viewport)return a.win.offset();var c=a.win.offset(),b=a.viewport.offset();return{top:c.top-b.top+a.viewport.scrollTop(),left:c.left-b.left+a.viewport.scrollLeft()}};this.updateScrollBar=function(c){if(a.ishwscroll)a.rail.css({height:a.win.innerHeight()}),a.railh&&a.railh.css({width:a.win.innerWidth()});
1238
else{var b=a.getOffset(),f=b.top,d=b.left,f=f+k(a.win,"border-top-width",!0);a.win.outerWidth();a.win.innerWidth();var d=d+(a.rail.align?a.win.outerWidth()-k(a.win,"border-right-width")-a.rail.width:k(a.win,"border-left-width")),e=a.opt.railoffset;e&&(e.top&&(f+=e.top),a.rail.align&&e.left&&(d+=e.left));a.locked||a.rail.css({top:f,left:d,height:c?c.h:a.win.innerHeight()});a.zoom&&a.zoom.css({top:f+1,left:1==a.rail.align?d-20:d+a.rail.width+4});a.railh&&!a.locked&&(f=b.top,d=b.left,c=a.railh.align?
1239
f+k(a.win,"border-top-width",!0)+a.win.innerHeight()-a.railh.height:f+k(a.win,"border-top-width",!0),d+=k(a.win,"border-left-width"),a.railh.css({top:c,left:d,width:a.railh.width}))}};this.doRailClick=function(c,b,f){var d;a.locked||(a.cancelEvent(c),b?(b=f?a.doScrollLeft:a.doScrollTop,d=f?(c.pageX-a.railh.offset().left-a.cursorwidth/2)*a.scrollratio.x:(c.pageY-a.rail.offset().top-a.cursorheight/2)*a.scrollratio.y,b(d)):(b=f?a.doScrollLeftBy:a.doScrollBy,d=f?a.scroll.x:a.scroll.y,c=f?c.pageX-a.railh.offset().left:
1240
c.pageY-a.rail.offset().top,f=f?a.view.w:a.view.h,d>=c?b(f):b(-f)))};a.hasanimationframe=s;a.hascancelanimationframe=v;a.hasanimationframe?a.hascancelanimationframe||(v=function(){a.cancelAnimationFrame=!0}):(s=function(a){return setTimeout(a,15-Math.floor(+new Date/1E3)%16)},v=clearInterval);this.init=function(){a.saved.css=[];if(d.isie7mobile||d.isoperamini)return!0;d.hasmstouch&&a.css(a.ispage?e("html"):a.win,{"-ms-touch-action":"none"});a.zindex="auto";a.zindex=!a.ispage&&"auto"==a.opt.zindex?
1241
h()||"auto":a.opt.zindex;!a.ispage&&"auto"!=a.zindex&&a.zindex>x&&(x=a.zindex);a.isie&&(0==a.zindex&&"auto"==a.opt.zindex)&&(a.zindex="auto");if(!a.ispage||!d.cantouch&&!d.isieold&&!d.isie9mobile){var c=a.docscroll;a.ispage&&(c=a.haswrapper?a.win:a.doc);d.isie9mobile||a.css(c,{"overflow-y":"hidden"});a.ispage&&d.isie7&&("BODY"==a.doc[0].nodeName?a.css(e("html"),{"overflow-y":"hidden"}):"HTML"==a.doc[0].nodeName&&a.css(e("body"),{"overflow-y":"hidden"}));d.isios&&(!a.ispage&&!a.haswrapper)&&a.css(e("body"),
1242
{"-webkit-overflow-scrolling":"touch"});var b=e(document.createElement("div"));b.css({position:"relative",top:0,"float":"right",width:a.opt.cursorwidth,height:"0px","background-color":a.opt.cursorcolor,border:a.opt.cursorborder,"background-clip":"padding-box","-webkit-border-radius":a.opt.cursorborderradius,"-moz-border-radius":a.opt.cursorborderradius,"border-radius":a.opt.cursorborderradius});b.hborder=parseFloat(b.outerHeight()-b.innerHeight());a.cursor=b;var f=e(document.createElement("div"));
1243
f.attr("id",a.id);f.addClass("nicescroll-rails");var u,k,g=["left","right"],l;for(l in g)k=g[l],(u=a.opt.railpadding[k])?f.css("padding-"+k,u+"px"):a.opt.railpadding[k]=0;f.append(b);f.width=Math.max(parseFloat(a.opt.cursorwidth),b.outerWidth())+a.opt.railpadding.left+a.opt.railpadding.right;f.css({width:f.width+"px",zIndex:a.zindex,background:a.opt.background,cursor:"default"});f.visibility=!0;f.scrollable=!0;f.align="left"==a.opt.railalign?0:1;a.rail=f;b=a.rail.drag=!1;a.opt.boxzoom&&(!a.ispage&&
1244
!d.isieold)&&(b=document.createElement("div"),a.bind(b,"click",a.doZoom),a.zoom=e(b),a.zoom.css({cursor:"pointer","z-index":a.zindex,backgroundImage:"url("+a.opt.scriptpath+"zoomico.png)",height:18,width:18,backgroundPosition:"0px 0px"}),a.opt.dblclickzoom&&a.bind(a.win,"dblclick",a.doZoom),d.cantouch&&a.opt.gesturezoom&&(a.ongesturezoom=function(c){1.5<c.scale&&a.doZoomIn(c);0.8>c.scale&&a.doZoomOut(c);return a.cancelEvent(c)},a.bind(a.win,"gestureend",a.ongesturezoom)));a.railh=!1;if(a.opt.horizrailenabled){a.css(c,
1245
{"overflow-x":"hidden"});b=e(document.createElement("div"));b.css({position:"relative",top:0,height:a.opt.cursorwidth,width:"0px","background-color":a.opt.cursorcolor,border:a.opt.cursorborder,"background-clip":"padding-box","-webkit-border-radius":a.opt.cursorborderradius,"-moz-border-radius":a.opt.cursorborderradius,"border-radius":a.opt.cursorborderradius});b.wborder=parseFloat(b.outerWidth()-b.innerWidth());a.cursorh=b;var m=e(document.createElement("div"));m.attr("id",a.id+"-hr");m.addClass("nicescroll-rails");
1246
m.height=Math.max(parseFloat(a.opt.cursorwidth),b.outerHeight());m.css({height:m.height+"px",zIndex:a.zindex,background:a.opt.background});m.append(b);m.visibility=!0;m.scrollable=!0;m.align="top"==a.opt.railvalign?0:1;a.railh=m;a.railh.drag=!1}a.ispage?(f.css({position:"fixed",top:"0px",height:"100%"}),f.align?f.css({right:"0px"}):f.css({left:"0px"}),a.body.append(f),a.railh&&(m.css({position:"fixed",left:"0px",width:"100%"}),m.align?m.css({bottom:"0px"}):m.css({top:"0px"}),a.body.append(m))):(a.ishwscroll?
1247
("static"==a.win.css("position")&&a.css(a.win,{position:"relative"}),c="HTML"==a.win[0].nodeName?a.body:a.win,a.zoom&&(a.zoom.css({position:"absolute",top:1,right:0,"margin-right":f.width+4}),c.append(a.zoom)),f.css({position:"absolute",top:0}),f.align?f.css({right:0}):f.css({left:0}),c.append(f),m&&(m.css({position:"absolute",left:0,bottom:0}),m.align?m.css({bottom:0}):m.css({top:0}),c.append(m))):(a.isfixed="fixed"==a.win.css("position"),c=a.isfixed?"fixed":"absolute",a.isfixed||(a.viewport=a.getViewport(a.win[0])),
1248
a.viewport&&(a.body=a.viewport,!1==/fixed|relative|absolute/.test(a.viewport.css("position"))&&a.css(a.viewport,{position:"relative"})),f.css({position:c}),a.zoom&&a.zoom.css({position:c}),a.updateScrollBar(),a.body.append(f),a.zoom&&a.body.append(a.zoom),a.railh&&(m.css({position:c}),a.body.append(m))),d.isios&&a.css(a.win,{"-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none"}),d.isie&&a.opt.disableoutline&&a.win.attr("hideFocus","true"),d.iswebkit&&a.opt.disableoutline&&
1249
a.win.css({outline:"none"}));!1===a.opt.autohidemode?(a.autohidedom=!1,a.rail.css({opacity:a.opt.cursoropacitymax}),a.railh&&a.railh.css({opacity:a.opt.cursoropacitymax})):!0===a.opt.autohidemode||"leave"===a.opt.autohidemode?(a.autohidedom=e().add(a.rail),d.isie8&&(a.autohidedom=a.autohidedom.add(a.cursor)),a.railh&&(a.autohidedom=a.autohidedom.add(a.railh)),a.railh&&d.isie8&&(a.autohidedom=a.autohidedom.add(a.cursorh))):"scroll"==a.opt.autohidemode?(a.autohidedom=e().add(a.rail),a.railh&&(a.autohidedom=
1250
a.autohidedom.add(a.railh))):"cursor"==a.opt.autohidemode?(a.autohidedom=e().add(a.cursor),a.railh&&(a.autohidedom=a.autohidedom.add(a.cursorh))):"hidden"==a.opt.autohidemode&&(a.autohidedom=!1,a.hide(),a.locked=!1);if(d.isie9mobile)a.scrollmom=new H(a),a.onmangotouch=function(c){c=a.getScrollTop();var b=a.getScrollLeft();if(c==a.scrollmom.lastscrolly&&b==a.scrollmom.lastscrollx)return!0;var f=c-a.mangotouch.sy,d=b-a.mangotouch.sx;if(0!=Math.round(Math.sqrt(Math.pow(d,2)+Math.pow(f,2)))){var n=0>
1251
f?-1:1,e=0>d?-1:1,h=+new Date;a.mangotouch.lazy&&clearTimeout(a.mangotouch.lazy);80<h-a.mangotouch.tm||a.mangotouch.dry!=n||a.mangotouch.drx!=e?(a.scrollmom.stop(),a.scrollmom.reset(b,c),a.mangotouch.sy=c,a.mangotouch.ly=c,a.mangotouch.sx=b,a.mangotouch.lx=b,a.mangotouch.dry=n,a.mangotouch.drx=e,a.mangotouch.tm=h):(a.scrollmom.stop(),a.scrollmom.update(a.mangotouch.sx-d,a.mangotouch.sy-f),a.mangotouch.tm=h,f=Math.max(Math.abs(a.mangotouch.ly-c),Math.abs(a.mangotouch.lx-b)),a.mangotouch.ly=c,a.mangotouch.lx=
1252
b,2<f&&(a.mangotouch.lazy=setTimeout(function(){a.mangotouch.lazy=!1;a.mangotouch.dry=0;a.mangotouch.drx=0;a.mangotouch.tm=0;a.scrollmom.doMomentum(30)},100)))}},f=a.getScrollTop(),m=a.getScrollLeft(),a.mangotouch={sy:f,ly:f,dry:0,sx:m,lx:m,drx:0,lazy:!1,tm:0},a.bind(a.docscroll,"scroll",a.onmangotouch);else{if(d.cantouch||a.istouchcapable||a.opt.touchbehavior||d.hasmstouch){a.scrollmom=new H(a);a.ontouchstart=function(c){if(c.pointerType&&2!=c.pointerType)return!1;a.hasmoving=!1;if(!a.locked){if(d.hasmstouch)for(var b=
1253
c.target?c.target:!1;b;){var f=e(b).getNiceScroll();if(0<f.length&&f[0].me==a.me)break;if(0<f.length)return!1;if("DIV"==b.nodeName&&b.id==a.id)break;b=b.parentNode?b.parentNode:!1}a.cancelScroll();if((b=a.getTarget(c))&&/INPUT/i.test(b.nodeName)&&/range/i.test(b.type))return a.stopPropagation(c);!("clientX"in c)&&"changedTouches"in c&&(c.clientX=c.changedTouches[0].clientX,c.clientY=c.changedTouches[0].clientY);a.forcescreen&&(f=c,c={original:c.original?c.original:c},c.clientX=f.screenX,c.clientY=
1254
f.screenY);a.rail.drag={x:c.clientX,y:c.clientY,sx:a.scroll.x,sy:a.scroll.y,st:a.getScrollTop(),sl:a.getScrollLeft(),pt:2,dl:!1};if(a.ispage||!a.opt.directionlockdeadzone)a.rail.drag.dl="f";else{var f=e(window).width(),n=e(window).height(),h=Math.max(document.body.scrollWidth,document.documentElement.scrollWidth),k=Math.max(document.body.scrollHeight,document.documentElement.scrollHeight),n=Math.max(0,k-n),f=Math.max(0,h-f);a.rail.drag.ck=!a.rail.scrollable&&a.railh.scrollable?0<n?"v":!1:a.rail.scrollable&&
1255
!a.railh.scrollable?0<f?"h":!1:!1;a.rail.drag.ck||(a.rail.drag.dl="f")}a.opt.touchbehavior&&(a.isiframe&&d.isie)&&(f=a.win.position(),a.rail.drag.x+=f.left,a.rail.drag.y+=f.top);a.hasmoving=!1;a.lastmouseup=!1;a.scrollmom.reset(c.clientX,c.clientY);if(!d.cantouch&&!this.istouchcapable&&!d.hasmstouch){if(!b||!/INPUT|SELECT|TEXTAREA/i.test(b.nodeName))return!a.ispage&&d.hasmousecapture&&b.setCapture(),a.opt.touchbehavior?(b.onclick&&!b._onclick&&(b._onclick=b.onclick,b.onclick=function(c){if(a.hasmoving)return!1;
1256
b._onclick.call(this,c)}),a.cancelEvent(c)):a.stopPropagation(c);/SUBMIT|CANCEL|BUTTON/i.test(e(b).attr("type"))&&(pc={tg:b,click:!1},a.preventclick=pc)}}};a.ontouchend=function(c){if(c.pointerType&&2!=c.pointerType)return!1;if(a.rail.drag&&2==a.rail.drag.pt&&(a.scrollmom.doMomentum(),a.rail.drag=!1,a.hasmoving&&(a.lastmouseup=!0,a.hideCursor(),d.hasmousecapture&&document.releaseCapture(),!d.cantouch)))return a.cancelEvent(c)};var q=a.opt.touchbehavior&&a.isiframe&&!d.hasmousecapture;a.ontouchmove=
1257
function(c,b){if(c.pointerType&&2!=c.pointerType)return!1;if(a.rail.drag&&2==a.rail.drag.pt){if(d.cantouch&&"undefined"==typeof c.original)return!0;a.hasmoving=!0;a.preventclick&&!a.preventclick.click&&(a.preventclick.click=a.preventclick.tg.onclick||!1,a.preventclick.tg.onclick=a.onpreventclick);c=e.extend({original:c},c);"changedTouches"in c&&(c.clientX=c.changedTouches[0].clientX,c.clientY=c.changedTouches[0].clientY);if(a.forcescreen){var f=c;c={original:c.original?c.original:c};c.clientX=f.screenX;
1258
c.clientY=f.screenY}f=ofy=0;if(q&&!b){var n=a.win.position(),f=-n.left;ofy=-n.top}var h=c.clientY+ofy,n=h-a.rail.drag.y,k=c.clientX+f,u=k-a.rail.drag.x,g=a.rail.drag.st-n;a.ishwscroll&&a.opt.bouncescroll?0>g?g=Math.round(g/2):g>a.page.maxh&&(g=a.page.maxh+Math.round((g-a.page.maxh)/2)):(0>g&&(h=g=0),g>a.page.maxh&&(g=a.page.maxh,h=0));if(a.railh&&a.railh.scrollable){var l=a.rail.drag.sl-u;a.ishwscroll&&a.opt.bouncescroll?0>l?l=Math.round(l/2):l>a.page.maxw&&(l=a.page.maxw+Math.round((l-a.page.maxw)/
1259
2)):(0>l&&(k=l=0),l>a.page.maxw&&(l=a.page.maxw,k=0))}f=!1;if(a.rail.drag.dl)f=!0,"v"==a.rail.drag.dl?l=a.rail.drag.sl:"h"==a.rail.drag.dl&&(g=a.rail.drag.st);else{var n=Math.abs(n),u=Math.abs(u),m=a.opt.directionlockdeadzone;if("v"==a.rail.drag.ck){if(n>m&&u<=0.3*n)return a.rail.drag=!1,!0;u>m&&(a.rail.drag.dl="f",e("body").scrollTop(e("body").scrollTop()))}else if("h"==a.rail.drag.ck){if(u>m&&n<=0.3*u)return a.rail.drag=!1,!0;n>m&&(a.rail.drag.dl="f",e("body").scrollLeft(e("body").scrollLeft()))}}a.synched("touchmove",
1260
function(){a.rail.drag&&2==a.rail.drag.pt&&(a.prepareTransition&&a.prepareTransition(0),a.rail.scrollable&&a.setScrollTop(g),a.scrollmom.update(k,h),a.railh&&a.railh.scrollable?(a.setScrollLeft(l),a.showCursor(g,l)):a.showCursor(g),d.isie10&&document.selection.clear())});d.ischrome&&a.istouchcapable&&(f=!1);if(f)return a.cancelEvent(c)}}}a.onmousedown=function(c,b){if(!(a.rail.drag&&1!=a.rail.drag.pt)){if(a.locked)return a.cancelEvent(c);a.cancelScroll();a.rail.drag={x:c.clientX,y:c.clientY,sx:a.scroll.x,
1261
sy:a.scroll.y,pt:1,hr:!!b};var f=a.getTarget(c);!a.ispage&&d.hasmousecapture&&f.setCapture();a.isiframe&&!d.hasmousecapture&&(a.saved.csspointerevents=a.doc.css("pointer-events"),a.css(a.doc,{"pointer-events":"none"}));a.hasmoving=!1;return a.cancelEvent(c)}};a.onmouseup=function(c){if(a.rail.drag&&(d.hasmousecapture&&document.releaseCapture(),a.isiframe&&!d.hasmousecapture&&a.doc.css("pointer-events",a.saved.csspointerevents),1==a.rail.drag.pt))return a.rail.drag=!1,a.hasmoving&&a.triggerScrollEnd(),
1262
a.cancelEvent(c)};a.onmousemove=function(c){if(a.rail.drag&&1==a.rail.drag.pt){if(d.ischrome&&0==c.which)return a.onmouseup(c);a.cursorfreezed=!0;a.hasmoving=!0;if(a.rail.drag.hr){a.scroll.x=a.rail.drag.sx+(c.clientX-a.rail.drag.x);0>a.scroll.x&&(a.scroll.x=0);var b=a.scrollvaluemaxw;a.scroll.x>b&&(a.scroll.x=b)}else a.scroll.y=a.rail.drag.sy+(c.clientY-a.rail.drag.y),0>a.scroll.y&&(a.scroll.y=0),b=a.scrollvaluemax,a.scroll.y>b&&(a.scroll.y=b);a.synched("mousemove",function(){a.rail.drag&&1==a.rail.drag.pt&&
1263
(a.showCursor(),a.rail.drag.hr?a.doScrollLeft(Math.round(a.scroll.x*a.scrollratio.x),a.opt.cursordragspeed):a.doScrollTop(Math.round(a.scroll.y*a.scrollratio.y),a.opt.cursordragspeed))});return a.cancelEvent(c)}};if(d.cantouch||a.opt.touchbehavior)a.onpreventclick=function(c){if(a.preventclick)return a.preventclick.tg.onclick=a.preventclick.click,a.preventclick=!1,a.cancelEvent(c)},a.bind(a.win,"mousedown",a.ontouchstart),a.onclick=d.isios?!1:function(c){return a.lastmouseup?(a.lastmouseup=!1,a.cancelEvent(c)):
1264
!0},a.opt.grabcursorenabled&&d.cursorgrabvalue&&(a.css(a.ispage?a.doc:a.win,{cursor:d.cursorgrabvalue}),a.css(a.rail,{cursor:d.cursorgrabvalue}));else{var p=function(c){if(a.selectiondrag){if(c){var b=a.win.outerHeight();c=c.pageY-a.selectiondrag.top;0<c&&c<b&&(c=0);c>=b&&(c-=b);a.selectiondrag.df=c}0!=a.selectiondrag.df&&(a.doScrollBy(2*-Math.floor(a.selectiondrag.df/6)),a.debounced("doselectionscroll",function(){p()},50))}};a.hasTextSelected="getSelection"in document?function(){return 0<document.getSelection().rangeCount}:
1265
"selection"in document?function(){return"None"!=document.selection.type}:function(){return!1};a.onselectionstart=function(c){a.ispage||(a.selectiondrag=a.win.offset())};a.onselectionend=function(c){a.selectiondrag=!1};a.onselectiondrag=function(c){a.selectiondrag&&a.hasTextSelected()&&a.debounced("selectionscroll",function(){p(c)},250)}}d.hasmstouch&&(a.css(a.rail,{"-ms-touch-action":"none"}),a.css(a.cursor,{"-ms-touch-action":"none"}),a.bind(a.win,"MSPointerDown",a.ontouchstart),a.bind(document,
1266
"MSPointerUp",a.ontouchend),a.bind(document,"MSPointerMove",a.ontouchmove),a.bind(a.cursor,"MSGestureHold",function(a){a.preventDefault()}),a.bind(a.cursor,"contextmenu",function(a){a.preventDefault()}));this.istouchcapable&&(a.bind(a.win,"touchstart",a.ontouchstart),a.bind(document,"touchend",a.ontouchend),a.bind(document,"touchcancel",a.ontouchend),a.bind(document,"touchmove",a.ontouchmove));a.bind(a.cursor,"mousedown",a.onmousedown);a.bind(a.cursor,"mouseup",a.onmouseup);a.railh&&(a.bind(a.cursorh,
1267
"mousedown",function(c){a.onmousedown(c,!0)}),a.bind(a.cursorh,"mouseup",a.onmouseup));if(a.opt.cursordragontouch||!d.cantouch&&!a.opt.touchbehavior)a.rail.css({cursor:"default"}),a.railh&&a.railh.css({cursor:"default"}),a.jqbind(a.rail,"mouseenter",function(){if(!a.win.is(":visible"))return!1;a.canshowonmouseevent&&a.showCursor();a.rail.active=!0}),a.jqbind(a.rail,"mouseleave",function(){a.rail.active=!1;a.rail.drag||a.hideCursor()}),a.opt.sensitiverail&&(a.bind(a.rail,"click",function(c){a.doRailClick(c,
1268
!1,!1)}),a.bind(a.rail,"dblclick",function(c){a.doRailClick(c,!0,!1)}),a.bind(a.cursor,"click",function(c){a.cancelEvent(c)}),a.bind(a.cursor,"dblclick",function(c){a.cancelEvent(c)})),a.railh&&(a.jqbind(a.railh,"mouseenter",function(){if(!a.win.is(":visible"))return!1;a.canshowonmouseevent&&a.showCursor();a.rail.active=!0}),a.jqbind(a.railh,"mouseleave",function(){a.rail.active=!1;a.rail.drag||a.hideCursor()}),a.opt.sensitiverail&&(a.bind(a.railh,"click",function(c){a.doRailClick(c,!1,!0)}),a.bind(a.railh,
1269
"dblclick",function(c){a.doRailClick(c,!0,!0)}),a.bind(a.cursorh,"click",function(c){a.cancelEvent(c)}),a.bind(a.cursorh,"dblclick",function(c){a.cancelEvent(c)})));!d.cantouch&&!a.opt.touchbehavior?(a.bind(d.hasmousecapture?a.win:document,"mouseup",a.onmouseup),a.bind(document,"mousemove",a.onmousemove),a.onclick&&a.bind(document,"click",a.onclick),!a.ispage&&a.opt.enablescrollonselection&&(a.bind(a.win[0],"mousedown",a.onselectionstart),a.bind(document,"mouseup",a.onselectionend),a.bind(a.cursor,
1270
"mouseup",a.onselectionend),a.cursorh&&a.bind(a.cursorh,"mouseup",a.onselectionend),a.bind(document,"mousemove",a.onselectiondrag)),a.zoom&&(a.jqbind(a.zoom,"mouseenter",function(){a.canshowonmouseevent&&a.showCursor();a.rail.active=!0}),a.jqbind(a.zoom,"mouseleave",function(){a.rail.active=!1;a.rail.drag||a.hideCursor()}))):(a.bind(d.hasmousecapture?a.win:document,"mouseup",a.ontouchend),a.bind(document,"mousemove",a.ontouchmove),a.onclick&&a.bind(document,"click",a.onclick),a.opt.cursordragontouch&&
1271
(a.bind(a.cursor,"mousedown",a.onmousedown),a.bind(a.cursor,"mousemove",a.onmousemove),a.cursorh&&a.bind(a.cursorh,"mousedown",function(c){a.onmousedown(c,!0)}),a.cursorh&&a.bind(a.cursorh,"mousemove",a.onmousemove)));a.opt.enablemousewheel&&(a.isiframe||a.bind(d.isie&&a.ispage?document:a.win,"mousewheel",a.onmousewheel),a.bind(a.rail,"mousewheel",a.onmousewheel),a.railh&&a.bind(a.railh,"mousewheel",a.onmousewheelhr));!a.ispage&&(!d.cantouch&&!/HTML|^BODY/.test(a.win[0].nodeName))&&(a.win.attr("tabindex")||
1272
a.win.attr({tabindex:J++}),a.jqbind(a.win,"focus",function(c){y=a.getTarget(c).id||!0;a.hasfocus=!0;a.canshowonmouseevent&&a.noticeCursor()}),a.jqbind(a.win,"blur",function(c){y=!1;a.hasfocus=!1}),a.jqbind(a.win,"mouseenter",function(c){C=a.getTarget(c).id||!0;a.hasmousefocus=!0;a.canshowonmouseevent&&a.noticeCursor()}),a.jqbind(a.win,"mouseleave",function(){C=!1;a.hasmousefocus=!1;a.rail.drag||a.hideCursor()}))}a.onkeypress=function(c){if(a.locked&&0==a.page.maxh)return!0;c=c?c:window.e;var b=a.getTarget(c);
1273
if(b&&/INPUT|TEXTAREA|SELECT|OPTION/.test(b.nodeName)&&(!b.getAttribute("type")&&!b.type||!/submit|button|cancel/i.tp)||e(b).attr("contenteditable"))return!0;if(a.hasfocus||a.hasmousefocus&&!y||a.ispage&&!y&&!C){b=c.keyCode;if(a.locked&&27!=b)return a.cancelEvent(c);var f=c.ctrlKey||!1,n=c.shiftKey||!1,d=!1;switch(b){case 38:case 63233:a.doScrollBy(72);d=!0;break;case 40:case 63235:a.doScrollBy(-72);d=!0;break;case 37:case 63232:a.railh&&(f?a.doScrollLeft(0):a.doScrollLeftBy(72),d=!0);break;case 39:case 63234:a.railh&&
1274
(f?a.doScrollLeft(a.page.maxw):a.doScrollLeftBy(-72),d=!0);break;case 33:case 63276:a.doScrollBy(a.view.h);d=!0;break;case 34:case 63277:a.doScrollBy(-a.view.h);d=!0;break;case 36:case 63273:a.railh&&f?a.doScrollPos(0,0):a.doScrollTo(0);d=!0;break;case 35:case 63275:a.railh&&f?a.doScrollPos(a.page.maxw,a.page.maxh):a.doScrollTo(a.page.maxh);d=!0;break;case 32:a.opt.spacebarenabled&&(n?a.doScrollBy(a.view.h):a.doScrollBy(-a.view.h),d=!0);break;case 27:a.zoomactive&&(a.doZoom(),d=!0)}if(d)return a.cancelEvent(c)}};
1275
a.opt.enablekeyboard&&a.bind(document,d.isopera&&!d.isopera12?"keypress":"keydown",a.onkeypress);a.bind(document,"keydown",function(c){c.ctrlKey&&(a.wheelprevented=!0)});a.bind(document,"keyup",function(c){c.ctrlKey||(a.wheelprevented=!1)});a.bind(window,"resize",a.lazyResize);a.bind(window,"orientationchange",a.lazyResize);a.bind(window,"load",a.lazyResize);if(d.ischrome&&!a.ispage&&!a.haswrapper){var r=a.win.attr("style"),f=parseFloat(a.win.css("width"))+1;a.win.css("width",f);a.synched("chromefix",
1276
function(){a.win.attr("style",r)})}a.onAttributeChange=function(c){a.lazyResize(250)};!a.ispage&&!a.haswrapper&&(!1!==z?(a.observer=new z(function(c){c.forEach(a.onAttributeChange)}),a.observer.observe(a.win[0],{childList:!0,characterData:!1,attributes:!0,subtree:!1}),a.observerremover=new z(function(c){c.forEach(function(c){if(0<c.removedNodes.length)for(var b in c.removedNodes)if(c.removedNodes[b]==a.win[0])return a.remove()})}),a.observerremover.observe(a.win[0].parentNode,{childList:!0,characterData:!1,
1277
attributes:!1,subtree:!1})):(a.bind(a.win,d.isie&&!d.isie9?"propertychange":"DOMAttrModified",a.onAttributeChange),d.isie9&&a.win[0].attachEvent("onpropertychange",a.onAttributeChange),a.bind(a.win,"DOMNodeRemoved",function(c){c.target==a.win[0]&&a.remove()})));!a.ispage&&a.opt.boxzoom&&a.bind(window,"resize",a.resizeZoom);a.istextarea&&a.bind(a.win,"mouseup",a.lazyResize);a.lazyResize(30)}if("IFRAME"==this.doc[0].nodeName){var I=function(c){a.iframexd=!1;try{var b="contentDocument"in this?this.contentDocument:
1278
this.contentWindow.document}catch(f){a.iframexd=!0,b=!1}if(a.iframexd)return"console"in window&&console.log("NiceScroll error: policy restriced iframe"),!0;a.forcescreen=!0;a.isiframe&&(a.iframe={doc:e(b),html:a.doc.contents().find("html")[0],body:a.doc.contents().find("body")[0]},a.getContentSize=function(){return{w:Math.max(a.iframe.html.scrollWidth,a.iframe.body.scrollWidth),h:Math.max(a.iframe.html.scrollHeight,a.iframe.body.scrollHeight)}},a.docscroll=e(a.iframe.body));!d.isios&&(a.opt.iframeautoresize&&
1279
!a.isiframe)&&(a.win.scrollTop(0),a.doc.height(""),c=Math.max(b.getElementsByTagName("html")[0].scrollHeight,b.body.scrollHeight),a.doc.height(c));a.lazyResize(30);d.isie7&&a.css(e(a.iframe.html),{"overflow-y":"hidden"});a.css(e(a.iframe.body),{"overflow-y":"hidden"});d.isios&&a.haswrapper&&a.css(e(b.body),{"-webkit-transform":"translate3d(0,0,0)"});"contentWindow"in this?a.bind(this.contentWindow,"scroll",a.onscroll):a.bind(b,"scroll",a.onscroll);a.opt.enablemousewheel&&a.bind(b,"mousewheel",a.onmousewheel);
1280
a.opt.enablekeyboard&&a.bind(b,d.isopera?"keypress":"keydown",a.onkeypress);if(d.cantouch||a.opt.touchbehavior)a.bind(b,"mousedown",a.ontouchstart),a.bind(b,"mousemove",function(c){a.ontouchmove(c,!0)}),a.opt.grabcursorenabled&&d.cursorgrabvalue&&a.css(e(b.body),{cursor:d.cursorgrabvalue});a.bind(b,"mouseup",a.ontouchend);a.zoom&&(a.opt.dblclickzoom&&a.bind(b,"dblclick",a.doZoom),a.ongesturezoom&&a.bind(b,"gestureend",a.ongesturezoom))};this.doc[0].readyState&&"complete"==this.doc[0].readyState&&
1281
setTimeout(function(){I.call(a.doc[0],!1)},500);a.bind(this.doc,"load",I)}};this.showCursor=function(c,b){a.cursortimeout&&(clearTimeout(a.cursortimeout),a.cursortimeout=0);if(a.rail){a.autohidedom&&(a.autohidedom.stop().css({opacity:a.opt.cursoropacitymax}),a.cursoractive=!0);if(!a.rail.drag||1!=a.rail.drag.pt)"undefined"!=typeof c&&!1!==c&&(a.scroll.y=Math.round(1*c/a.scrollratio.y)),"undefined"!=typeof b&&(a.scroll.x=Math.round(1*b/a.scrollratio.x));a.cursor.css({height:a.cursorheight,top:a.scroll.y});
1282
a.cursorh&&(!a.rail.align&&a.rail.visibility?a.cursorh.css({width:a.cursorwidth,left:a.scroll.x+a.rail.width}):a.cursorh.css({width:a.cursorwidth,left:a.scroll.x}),a.cursoractive=!0);a.zoom&&a.zoom.stop().css({opacity:a.opt.cursoropacitymax})}};this.hideCursor=function(c){!a.cursortimeout&&(a.rail&&a.autohidedom&&!(a.hasmousefocus&&"leave"==a.opt.autohidemode))&&(a.cursortimeout=setTimeout(function(){if(!a.rail.active||!a.showonmouseevent)a.autohidedom.stop().animate({opacity:a.opt.cursoropacitymin}),
1283
a.zoom&&a.zoom.stop().animate({opacity:a.opt.cursoropacitymin}),a.cursoractive=!1;a.cursortimeout=0},c||a.opt.hidecursordelay))};this.noticeCursor=function(c,b,f){a.showCursor(b,f);a.rail.active||a.hideCursor(c)};this.getContentSize=a.ispage?function(){return{w:Math.max(document.body.scrollWidth,document.documentElement.scrollWidth),h:Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)}}:a.haswrapper?function(){return{w:a.doc.outerWidth()+parseInt(a.win.css("paddingLeft"))+
1284
parseInt(a.win.css("paddingRight")),h:a.doc.outerHeight()+parseInt(a.win.css("paddingTop"))+parseInt(a.win.css("paddingBottom"))}}:function(){return{w:a.docscroll[0].scrollWidth,h:a.docscroll[0].scrollHeight}};this.onResize=function(c,b){if(!a||!a.win)return!1;if(!a.haswrapper&&!a.ispage){if("none"==a.win.css("display"))return a.visibility&&a.hideRail().hideRailHr(),!1;!a.hidden&&!a.visibility&&a.showRail().showRailHr()}var f=a.page.maxh,d=a.page.maxw,e=a.view.w;a.view={w:a.ispage?a.win.width():parseInt(a.win[0].clientWidth),
1285
h:a.ispage?a.win.height():parseInt(a.win[0].clientHeight)};a.page=b?b:a.getContentSize();a.page.maxh=Math.max(0,a.page.h-a.view.h);a.page.maxw=Math.max(0,a.page.w-a.view.w);if(a.page.maxh==f&&a.page.maxw==d&&a.view.w==e){if(a.ispage)return a;f=a.win.offset();if(a.lastposition&&(d=a.lastposition,d.top==f.top&&d.left==f.left))return a;a.lastposition=f}0==a.page.maxh?(a.hideRail(),a.scrollvaluemax=0,a.scroll.y=0,a.scrollratio.y=0,a.cursorheight=0,a.setScrollTop(0),a.rail.scrollable=!1):a.rail.scrollable=
1286
!0;0==a.page.maxw?(a.hideRailHr(),a.scrollvaluemaxw=0,a.scroll.x=0,a.scrollratio.x=0,a.cursorwidth=0,a.setScrollLeft(0),a.railh.scrollable=!1):a.railh.scrollable=!0;a.locked=0==a.page.maxh&&0==a.page.maxw;if(a.locked)return a.ispage||a.updateScrollBar(a.view),!1;!a.hidden&&!a.visibility?a.showRail().showRailHr():!a.hidden&&!a.railh.visibility&&a.showRailHr();a.istextarea&&(a.win.css("resize")&&"none"!=a.win.css("resize"))&&(a.view.h-=20);a.cursorheight=Math.min(a.view.h,Math.round(a.view.h*(a.view.h/
1287
a.page.h)));a.cursorheight=a.opt.cursorfixedheight?a.opt.cursorfixedheight:Math.max(a.opt.cursorminheight,a.cursorheight);a.cursorwidth=Math.min(a.view.w,Math.round(a.view.w*(a.view.w/a.page.w)));a.cursorwidth=a.opt.cursorfixedheight?a.opt.cursorfixedheight:Math.max(a.opt.cursorminheight,a.cursorwidth);a.scrollvaluemax=a.view.h-a.cursorheight-a.cursor.hborder;a.railh&&(a.railh.width=0<a.page.maxh?a.view.w-a.rail.width:a.view.w,a.scrollvaluemaxw=a.railh.width-a.cursorwidth-a.cursorh.wborder);a.ispage||
1288
a.updateScrollBar(a.view);a.scrollratio={x:a.page.maxw/a.scrollvaluemaxw,y:a.page.maxh/a.scrollvaluemax};a.getScrollTop()>a.page.maxh?a.doScrollTop(a.page.maxh):(a.scroll.y=Math.round(a.getScrollTop()*(1/a.scrollratio.y)),a.scroll.x=Math.round(a.getScrollLeft()*(1/a.scrollratio.x)),a.cursoractive&&a.noticeCursor());a.scroll.y&&0==a.getScrollTop()&&a.doScrollTo(Math.floor(a.scroll.y*a.scrollratio.y));return a};this.resize=a.onResize;this.lazyResize=function(c){c=isNaN(c)?30:c;a.delayed("resize",a.resize,
1289
c);return a};this._bind=function(c,b,f,d){a.events.push({e:c,n:b,f:f,b:d,q:!1});c.addEventListener?c.addEventListener(b,f,d||!1):c.attachEvent?c.attachEvent("on"+b,f):c["on"+b]=f};this.jqbind=function(c,b,f){a.events.push({e:c,n:b,f:f,q:!0});e(c).bind(b,f)};this.bind=function(c,b,f,e){var h="jquery"in c?c[0]:c;"mousewheel"==b?"onwheel"in a.win?a._bind(h,"wheel",f,e||!1):(c="undefined"!=typeof document.onmousewheel?"mousewheel":"DOMMouseScroll",l(h,c,f,e||!1),"DOMMouseScroll"==c&&l(h,"MozMousePixelScroll",
1290
f,e||!1)):h.addEventListener?(d.cantouch&&/mouseup|mousedown|mousemove/.test(b)&&a._bind(h,"mousedown"==b?"touchstart":"mouseup"==b?"touchend":"touchmove",function(a){if(a.touches){if(2>a.touches.length){var c=a.touches.length?a.touches[0]:a;c.original=a;f.call(this,c)}}else a.changedTouches&&(c=a.changedTouches[0],c.original=a,f.call(this,c))},e||!1),a._bind(h,b,f,e||!1),d.cantouch&&"mouseup"==b&&a._bind(h,"touchcancel",f,e||!1)):a._bind(h,b,function(c){if((c=c||window.event||!1)&&c.srcElement)c.target=
1291
c.srcElement;"pageY"in c||(c.pageX=c.clientX+document.documentElement.scrollLeft,c.pageY=c.clientY+document.documentElement.scrollTop);return!1===f.call(h,c)||!1===e?a.cancelEvent(c):!0})};this._unbind=function(a,b,f,d){a.removeEventListener?a.removeEventListener(b,f,d):a.detachEvent?a.detachEvent("on"+b,f):a["on"+b]=!1};this.unbindAll=function(){for(var c=0;c<a.events.length;c++){var b=a.events[c];b.q?b.e.unbind(b.n,b.f):a._unbind(b.e,b.n,b.f,b.b)}};this.cancelEvent=function(a){a=a.original?a.original:
1292
a?a:window.event||!1;if(!a)return!1;a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();a.preventManipulation&&a.preventManipulation();a.cancelBubble=!0;a.cancel=!0;return a.returnValue=!1};this.stopPropagation=function(a){a=a.original?a.original:a?a:window.event||!1;if(!a)return!1;if(a.stopPropagation)return a.stopPropagation();a.cancelBubble&&(a.cancelBubble=!0);return!1};this.showRail=function(){if(0!=a.page.maxh&&(a.ispage||"none"!=a.win.css("display")))a.visibility=!0,
1293
a.rail.visibility=!0,a.rail.css("display","block");return a};this.showRailHr=function(){if(!a.railh)return a;if(0!=a.page.maxw&&(a.ispage||"none"!=a.win.css("display")))a.railh.visibility=!0,a.railh.css("display","block");return a};this.hideRail=function(){a.visibility=!1;a.rail.visibility=!1;a.rail.css("display","none");return a};this.hideRailHr=function(){if(!a.railh)return a;a.railh.visibility=!1;a.railh.css("display","none");return a};this.show=function(){a.hidden=!1;a.locked=!1;return a.showRail().showRailHr()};
1294
this.hide=function(){a.hidden=!0;a.locked=!0;return a.hideRail().hideRailHr()};this.toggle=function(){return a.hidden?a.show():a.hide()};this.remove=function(){a.stop();a.cursortimeout&&clearTimeout(a.cursortimeout);a.doZoomOut();a.unbindAll();d.isie9&&a.win[0].detachEvent("onpropertychange",a.onAttributeChange);!1!==a.observer&&a.observer.disconnect();!1!==a.observerremover&&a.observerremover.disconnect();a.events=null;a.cursor&&a.cursor.remove();a.cursorh&&a.cursorh.remove();a.rail&&a.rail.remove();
1295
a.railh&&a.railh.remove();a.zoom&&a.zoom.remove();for(var c=0;c<a.saved.css.length;c++){var b=a.saved.css[c];b[0].css(b[1],"undefined"==typeof b[2]?"":b[2])}a.saved=!1;a.me.data("__nicescroll","");var f=e.nicescroll;f.each(function(c){if(this&&this.id===a.id){delete f[c];for(var b=++c;b<f.length;b++,c++)f[c]=f[b];f.length--;f.length&&delete f[f.length]}});for(var h in a)a[h]=null,delete a[h];a=null};this.scrollstart=function(c){this.onscrollstart=c;return a};this.scrollend=function(c){this.onscrollend=
1296
c;return a};this.scrollcancel=function(c){this.onscrollcancel=c;return a};this.zoomin=function(c){this.onzoomin=c;return a};this.zoomout=function(c){this.onzoomout=c;return a};this.isScrollable=function(a){a=a.target?a.target:a;if("OPTION"==a.nodeName)return!0;for(;a&&1==a.nodeType&&!/^BODY|HTML/.test(a.nodeName);){var b=e(a),b=b.css("overflowY")||b.css("overflowX")||b.css("overflow")||"";if(/scroll|auto/.test(b))return a.clientHeight!=a.scrollHeight;a=a.parentNode?a.parentNode:!1}return!1};this.getViewport=
1297
function(a){for(a=a&&a.parentNode?a.parentNode:!1;a&&1==a.nodeType&&!/^BODY|HTML/.test(a.nodeName);){var b=e(a);if(/fixed|absolute/.test(b.css("position")))return b;var f=b.css("overflowY")||b.css("overflowX")||b.css("overflow")||"";if(/scroll|auto/.test(f)&&a.clientHeight!=a.scrollHeight||0<b.getNiceScroll().length)return b;a=a.parentNode?a.parentNode:!1}return a?e(a):!1};this.triggerScrollEnd=function(){if(a.onscrollend){var c=a.getScrollLeft(),b=a.getScrollTop();a.onscrollend.call(a,{type:"scrollend",
1298
current:{x:c,y:b},end:{x:c,y:b}})}};this.onmousewheel=function(c){if(!a.wheelprevented){if(a.locked)return a.debounced("checkunlock",a.resize,250),!0;if(a.rail.drag)return a.cancelEvent(c);"auto"==a.opt.oneaxismousemode&&0!=c.deltaX&&(a.opt.oneaxismousemode=!1);if(a.opt.oneaxismousemode&&0==c.deltaX&&!a.rail.scrollable)return a.railh&&a.railh.scrollable?a.onmousewheelhr(c):!0;var b=+new Date,f=!1;a.opt.preservenativescrolling&&a.checkarea+600<b&&(a.nativescrollingarea=a.isScrollable(c),f=!0);a.checkarea=
1299
b;if(a.nativescrollingarea)return!0;if(c=q(c,!1,f))a.checkarea=0;return c}};this.onmousewheelhr=function(c){if(!a.wheelprevented){if(a.locked||!a.railh.scrollable)return!0;if(a.rail.drag)return a.cancelEvent(c);var b=+new Date,f=!1;a.opt.preservenativescrolling&&a.checkarea+600<b&&(a.nativescrollingarea=a.isScrollable(c),f=!0);a.checkarea=b;return a.nativescrollingarea?!0:a.locked?a.cancelEvent(c):q(c,!0,f)}};this.stop=function(){a.cancelScroll();a.scrollmon&&a.scrollmon.stop();a.cursorfreezed=!1;
1300
a.scroll.y=Math.round(a.getScrollTop()*(1/a.scrollratio.y));a.noticeCursor();return a};this.getTransitionSpeed=function(b){var d=Math.round(10*a.opt.scrollspeed);b=Math.min(d,Math.round(b/20*a.opt.scrollspeed));return 20<b?b:0};a.opt.smoothscroll?a.ishwscroll&&d.hastransition&&a.opt.usetransition?(this.prepareTransition=function(b,e){var f=e?20<b?b:0:a.getTransitionSpeed(b),h=f?d.prefixstyle+"transform "+f+"ms ease-out":"";if(!a.lasttransitionstyle||a.lasttransitionstyle!=h)a.lasttransitionstyle=
1301
h,a.doc.css(d.transitionstyle,h);return f},this.doScrollLeft=function(b,d){var f=a.scrollrunning?a.newscrolly:a.getScrollTop();a.doScrollPos(b,f,d)},this.doScrollTop=function(b,d){var f=a.scrollrunning?a.newscrollx:a.getScrollLeft();a.doScrollPos(f,b,d)},this.doScrollPos=function(b,e,f){var h=a.getScrollTop(),g=a.getScrollLeft();(0>(a.newscrolly-h)*(e-h)||0>(a.newscrollx-g)*(b-g))&&a.cancelScroll();!1==a.opt.bouncescroll&&(0>e?e=0:e>a.page.maxh&&(e=a.page.maxh),0>b?b=0:b>a.page.maxw&&(b=a.page.maxw));
1302
if(a.scrollrunning&&b==a.newscrollx&&e==a.newscrolly)return!1;a.newscrolly=e;a.newscrollx=b;a.newscrollspeed=f||!1;if(a.timer)return!1;a.timer=setTimeout(function(){var f=a.getScrollTop(),h=a.getScrollLeft(),g,k;g=b-h;k=e-f;g=Math.round(Math.sqrt(Math.pow(g,2)+Math.pow(k,2)));g=a.newscrollspeed&&1<a.newscrollspeed?a.newscrollspeed:a.getTransitionSpeed(g);a.newscrollspeed&&1>=a.newscrollspeed&&(g*=a.newscrollspeed);a.prepareTransition(g,!0);a.timerscroll&&a.timerscroll.tm&&clearInterval(a.timerscroll.tm);
1303
0<g&&(!a.scrollrunning&&a.onscrollstart&&a.onscrollstart.call(a,{type:"scrollstart",current:{x:h,y:f},request:{x:b,y:e},end:{x:a.newscrollx,y:a.newscrolly},speed:g}),d.transitionend?a.scrollendtrapped||(a.scrollendtrapped=!0,a.bind(a.doc,d.transitionend,a.onScrollTransitionEnd,!1)):(a.scrollendtrapped&&clearTimeout(a.scrollendtrapped),a.scrollendtrapped=setTimeout(a.onScrollTransitionEnd,g)),a.timerscroll={bz:new BezierClass(f,a.newscrolly,g,0,0,0.58,1),bh:new BezierClass(h,a.newscrollx,g,0,0,0.58,
1304
1)},a.cursorfreezed||(a.timerscroll.tm=setInterval(function(){a.showCursor(a.getScrollTop(),a.getScrollLeft())},60)));a.synched("doScroll-set",function(){a.timer=0;a.scrollendtrapped&&(a.scrollrunning=!0);a.setScrollTop(a.newscrolly);a.setScrollLeft(a.newscrollx);if(!a.scrollendtrapped)a.onScrollTransitionEnd()})},50)},this.cancelScroll=function(){if(!a.scrollendtrapped)return!0;var b=a.getScrollTop(),e=a.getScrollLeft();a.scrollrunning=!1;d.transitionend||clearTimeout(d.transitionend);a.scrollendtrapped=
1305
!1;a._unbind(a.doc,d.transitionend,a.onScrollTransitionEnd);a.prepareTransition(0);a.setScrollTop(b);a.railh&&a.setScrollLeft(e);a.timerscroll&&a.timerscroll.tm&&clearInterval(a.timerscroll.tm);a.timerscroll=!1;a.cursorfreezed=!1;a.showCursor(b,e);return a},this.onScrollTransitionEnd=function(){a.scrollendtrapped&&a._unbind(a.doc,d.transitionend,a.onScrollTransitionEnd);a.scrollendtrapped=!1;a.prepareTransition(0);a.timerscroll&&a.timerscroll.tm&&clearInterval(a.timerscroll.tm);a.timerscroll=!1;var b=
1306
a.getScrollTop(),e=a.getScrollLeft();a.setScrollTop(b);a.railh&&a.setScrollLeft(e);a.noticeCursor(!1,b,e);a.cursorfreezed=!1;0>b?b=0:b>a.page.maxh&&(b=a.page.maxh);0>e?e=0:e>a.page.maxw&&(e=a.page.maxw);if(b!=a.newscrolly||e!=a.newscrollx)return a.doScrollPos(e,b,a.opt.snapbackspeed);a.onscrollend&&a.scrollrunning&&a.triggerScrollEnd();a.scrollrunning=!1}):(this.doScrollLeft=function(b,d){var f=a.scrollrunning?a.newscrolly:a.getScrollTop();a.doScrollPos(b,f,d)},this.doScrollTop=function(b,d){var f=
1307
a.scrollrunning?a.newscrollx:a.getScrollLeft();a.doScrollPos(f,b,d)},this.doScrollPos=function(b,d,f){function e(){if(a.cancelAnimationFrame)return!0;a.scrollrunning=!0;if(p=1-p)return a.timer=s(e)||1;var b=0,c=sy=a.getScrollTop();if(a.dst.ay){var c=a.bzscroll?a.dst.py+a.bzscroll.getNow()*a.dst.ay:a.newscrolly,f=c-sy;if(0>f&&c<a.newscrolly||0<f&&c>a.newscrolly)c=a.newscrolly;a.setScrollTop(c);c==a.newscrolly&&(b=1)}else b=1;var d=sx=a.getScrollLeft();if(a.dst.ax){d=a.bzscroll?a.dst.px+a.bzscroll.getNow()*
1308
a.dst.ax:a.newscrollx;f=d-sx;if(0>f&&d<a.newscrollx||0<f&&d>a.newscrollx)d=a.newscrollx;a.setScrollLeft(d);d==a.newscrollx&&(b+=1)}else b+=1;2==b?(a.timer=0,a.cursorfreezed=!1,a.bzscroll=!1,a.scrollrunning=!1,0>c?c=0:c>a.page.maxh&&(c=a.page.maxh),0>d?d=0:d>a.page.maxw&&(d=a.page.maxw),d!=a.newscrollx||c!=a.newscrolly?a.doScrollPos(d,c):a.onscrollend&&a.triggerScrollEnd()):a.timer=s(e)||1}d="undefined"==typeof d||!1===d?a.getScrollTop(!0):d;if(a.timer&&a.newscrolly==d&&a.newscrollx==b)return!0;a.timer&&
1309
v(a.timer);a.timer=0;var h=a.getScrollTop(),g=a.getScrollLeft();(0>(a.newscrolly-h)*(d-h)||0>(a.newscrollx-g)*(b-g))&&a.cancelScroll();a.newscrolly=d;a.newscrollx=b;if(!a.bouncescroll||!a.rail.visibility)0>a.newscrolly?a.newscrolly=0:a.newscrolly>a.page.maxh&&(a.newscrolly=a.page.maxh);if(!a.bouncescroll||!a.railh.visibility)0>a.newscrollx?a.newscrollx=0:a.newscrollx>a.page.maxw&&(a.newscrollx=a.page.maxw);a.dst={};a.dst.x=b-g;a.dst.y=d-h;a.dst.px=g;a.dst.py=h;var k=Math.round(Math.sqrt(Math.pow(a.dst.x,
1310
2)+Math.pow(a.dst.y,2)));a.dst.ax=a.dst.x/k;a.dst.ay=a.dst.y/k;var l=0,q=k;0==a.dst.x?(l=h,q=d,a.dst.ay=1,a.dst.py=0):0==a.dst.y&&(l=g,q=b,a.dst.ax=1,a.dst.px=0);k=a.getTransitionSpeed(k);f&&1>=f&&(k*=f);a.bzscroll=0<k?a.bzscroll?a.bzscroll.update(q,k):new BezierClass(l,q,k,0,1,0,1):!1;if(!a.timer){(h==a.page.maxh&&d>=a.page.maxh||g==a.page.maxw&&b>=a.page.maxw)&&a.checkContentSize();var p=1;a.cancelAnimationFrame=!1;a.timer=1;a.onscrollstart&&!a.scrollrunning&&a.onscrollstart.call(a,{type:"scrollstart",
1311
current:{x:g,y:h},request:{x:b,y:d},end:{x:a.newscrollx,y:a.newscrolly},speed:k});e();(h==a.page.maxh&&d>=h||g==a.page.maxw&&b>=g)&&a.checkContentSize();a.noticeCursor()}},this.cancelScroll=function(){a.timer&&v(a.timer);a.timer=0;a.bzscroll=!1;a.scrollrunning=!1;return a}):(this.doScrollLeft=function(b,d){var f=a.getScrollTop();a.doScrollPos(b,f,d)},this.doScrollTop=function(b,d){var f=a.getScrollLeft();a.doScrollPos(f,b,d)},this.doScrollPos=function(b,d,f){var e=b>a.page.maxw?a.page.maxw:b;0>e&&
1312
(e=0);var h=d>a.page.maxh?a.page.maxh:d;0>h&&(h=0);a.synched("scroll",function(){a.setScrollTop(h);a.setScrollLeft(e)})},this.cancelScroll=function(){});this.doScrollBy=function(b,d){var f=0,f=d?Math.floor((a.scroll.y-b)*a.scrollratio.y):(a.timer?a.newscrolly:a.getScrollTop(!0))-b;if(a.bouncescroll){var e=Math.round(a.view.h/2);f<-e?f=-e:f>a.page.maxh+e&&(f=a.page.maxh+e)}a.cursorfreezed=!1;py=a.getScrollTop(!0);if(0>f&&0>=py)return a.noticeCursor();if(f>a.page.maxh&&py>=a.page.maxh)return a.checkContentSize(),
1313
a.noticeCursor();a.doScrollTop(f)};this.doScrollLeftBy=function(b,d){var f=0,f=d?Math.floor((a.scroll.x-b)*a.scrollratio.x):(a.timer?a.newscrollx:a.getScrollLeft(!0))-b;if(a.bouncescroll){var e=Math.round(a.view.w/2);f<-e?f=-e:f>a.page.maxw+e&&(f=a.page.maxw+e)}a.cursorfreezed=!1;px=a.getScrollLeft(!0);if(0>f&&0>=px||f>a.page.maxw&&px>=a.page.maxw)return a.noticeCursor();a.doScrollLeft(f)};this.doScrollTo=function(b,d){d&&Math.round(b*a.scrollratio.y);a.cursorfreezed=!1;a.doScrollTop(b)};this.checkContentSize=
1314
function(){var b=a.getContentSize();(b.h!=a.page.h||b.w!=a.page.w)&&a.resize(!1,b)};a.onscroll=function(b){a.rail.drag||a.cursorfreezed||a.synched("scroll",function(){a.scroll.y=Math.round(a.getScrollTop()*(1/a.scrollratio.y));a.railh&&(a.scroll.x=Math.round(a.getScrollLeft()*(1/a.scrollratio.x)));a.noticeCursor()})};a.bind(a.docscroll,"scroll",a.onscroll);this.doZoomIn=function(b){if(!a.zoomactive){a.zoomactive=!0;a.zoomrestore={style:{}};var h="position top left zIndex backgroundColor marginTop marginBottom marginLeft marginRight".split(" "),
1315
f=a.win[0].style,g;for(g in h){var k=h[g];a.zoomrestore.style[k]="undefined"!=typeof f[k]?f[k]:""}a.zoomrestore.style.width=a.win.css("width");a.zoomrestore.style.height=a.win.css("height");a.zoomrestore.padding={w:a.win.outerWidth()-a.win.width(),h:a.win.outerHeight()-a.win.height()};d.isios4&&(a.zoomrestore.scrollTop=e(window).scrollTop(),e(window).scrollTop(0));a.win.css({position:d.isios4?"absolute":"fixed",top:0,left:0,"z-index":x+100,margin:"0px"});h=a.win.css("backgroundColor");(""==h||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(h))&&
1316
a.win.css("backgroundColor","#fff");a.rail.css({"z-index":x+101});a.zoom.css({"z-index":x+102});a.zoom.css("backgroundPosition","0px -18px");a.resizeZoom();a.onzoomin&&a.onzoomin.call(a);return a.cancelEvent(b)}};this.doZoomOut=function(b){if(a.zoomactive)return a.zoomactive=!1,a.win.css("margin",""),a.win.css(a.zoomrestore.style),d.isios4&&e(window).scrollTop(a.zoomrestore.scrollTop),a.rail.css({"z-index":a.zindex}),a.zoom.css({"z-index":a.zindex}),a.zoomrestore=!1,a.zoom.css("backgroundPosition",
1317
"0px 0px"),a.onResize(),a.onzoomout&&a.onzoomout.call(a),a.cancelEvent(b)};this.doZoom=function(b){return a.zoomactive?a.doZoomOut(b):a.doZoomIn(b)};this.resizeZoom=function(){if(a.zoomactive){var b=a.getScrollTop();a.win.css({width:e(window).width()-a.zoomrestore.padding.w+"px",height:e(window).height()-a.zoomrestore.padding.h+"px"});a.onResize();a.setScrollTop(Math.min(a.page.maxh,b))}};this.init();e.nicescroll.push(this)},H=function(e){var b=this;this.nc=e;this.steptime=this.lasttime=this.speedy=
1318
this.speedx=this.lasty=this.lastx=0;this.snapy=this.snapx=!1;this.demuly=this.demulx=0;this.lastscrolly=this.lastscrollx=-1;this.timer=this.chky=this.chkx=0;this.time=function(){return+new Date};this.reset=function(e,g){b.stop();var l=b.time();b.steptime=0;b.lasttime=l;b.speedx=0;b.speedy=0;b.lastx=e;b.lasty=g;b.lastscrollx=-1;b.lastscrolly=-1};this.update=function(e,g){var l=b.time();b.steptime=l-b.lasttime;b.lasttime=l;var l=g-b.lasty,q=e-b.lastx,a=b.nc.getScrollTop(),p=b.nc.getScrollLeft(),a=a+
1319
l,p=p+q;b.snapx=0>p||p>b.nc.page.maxw;b.snapy=0>a||a>b.nc.page.maxh;b.speedx=q;b.speedy=l;b.lastx=e;b.lasty=g};this.stop=function(){b.nc.unsynched("domomentum2d");b.timer&&clearTimeout(b.timer);b.timer=0;b.lastscrollx=-1;b.lastscrolly=-1};this.doSnapy=function(e,g){var l=!1;0>g?(g=0,l=!0):g>b.nc.page.maxh&&(g=b.nc.page.maxh,l=!0);0>e?(e=0,l=!0):e>b.nc.page.maxw&&(e=b.nc.page.maxw,l=!0);l?b.nc.doScrollPos(e,g,b.nc.opt.snapbackspeed):b.nc.triggerScrollEnd()};this.doMomentum=function(e){var g=b.time(),
1320
l=e?g+e:b.lasttime;e=b.nc.getScrollLeft();var q=b.nc.getScrollTop(),a=b.nc.page.maxh,p=b.nc.page.maxw;b.speedx=0<p?Math.min(60,b.speedx):0;b.speedy=0<a?Math.min(60,b.speedy):0;l=l&&60>=g-l;if(0>q||q>a||0>e||e>p)l=!1;e=b.speedx&&l?b.speedx:!1;if(b.speedy&&l&&b.speedy||e){var d=Math.max(16,b.steptime);50<d&&(e=d/50,b.speedx*=e,b.speedy*=e,d=50);b.demulxy=0;b.lastscrollx=b.nc.getScrollLeft();b.chkx=b.lastscrollx;b.lastscrolly=b.nc.getScrollTop();b.chky=b.lastscrolly;var r=b.lastscrollx,t=b.lastscrolly,
1321
s=function(){var c=600<b.time()-g?0.04:0.02;if(b.speedx&&(r=Math.floor(b.lastscrollx-b.speedx*(1-b.demulxy)),b.lastscrollx=r,0>r||r>p))c=0.1;if(b.speedy&&(t=Math.floor(b.lastscrolly-b.speedy*(1-b.demulxy)),b.lastscrolly=t,0>t||t>a))c=0.1;b.demulxy=Math.min(1,b.demulxy+c);b.nc.synched("domomentum2d",function(){b.speedx&&(b.nc.getScrollLeft()!=b.chkx&&b.stop(),b.chkx=r,b.nc.setScrollLeft(r));b.speedy&&(b.nc.getScrollTop()!=b.chky&&b.stop(),b.chky=t,b.nc.setScrollTop(t));b.timer||(b.nc.hideCursor(),
1322
b.doSnapy(r,t))});1>b.demulxy?b.timer=setTimeout(s,d):(b.stop(),b.nc.hideCursor(),b.doSnapy(r,t))};s()}else b.doSnapy(b.nc.getScrollLeft(),b.nc.getScrollTop())}},w=e.fn.scrollTop;e.cssHooks.pageYOffset={get:function(g,b,h){return(b=e.data(g,"__nicescroll")||!1)&&b.ishwscroll?b.getScrollTop():w.call(g)},set:function(g,b){var h=e.data(g,"__nicescroll")||!1;h&&h.ishwscroll?h.setScrollTop(parseInt(b)):w.call(g,b);return this}};e.fn.scrollTop=function(g){if("undefined"==typeof g){var b=this[0]?e.data(this[0],
1323
"__nicescroll")||!1:!1;return b&&b.ishwscroll?b.getScrollTop():w.call(this)}return this.each(function(){var b=e.data(this,"__nicescroll")||!1;b&&b.ishwscroll?b.setScrollTop(parseInt(g)):w.call(e(this),g)})};var A=e.fn.scrollLeft;e.cssHooks.pageXOffset={get:function(g,b,h){return(b=e.data(g,"__nicescroll")||!1)&&b.ishwscroll?b.getScrollLeft():A.call(g)},set:function(g,b){var h=e.data(g,"__nicescroll")||!1;h&&h.ishwscroll?h.setScrollLeft(parseInt(b)):A.call(g,b);return this}};e.fn.scrollLeft=function(g){if("undefined"==
1324
typeof g){var b=this[0]?e.data(this[0],"__nicescroll")||!1:!1;return b&&b.ishwscroll?b.getScrollLeft():A.call(this)}return this.each(function(){var b=e.data(this,"__nicescroll")||!1;b&&b.ishwscroll?b.setScrollLeft(parseInt(g)):A.call(e(this),g)})};var B=function(g){var b=this;this.length=0;this.name="nicescrollarray";this.each=function(e){for(var g=0,a=0;g<b.length;g++)e.call(b[g],a++);return b};this.push=function(e){b[b.length]=e;b.length++};this.eq=function(e){return b[e]};if(g)for(var h=0;h<g.length;h++){var k=
1325
e.data(g[h],"__nicescroll")||!1;k&&(this[this.length]=k,this.length++)}return this};(function(e,b,h){for(var k=0;k<b.length;k++)h(e,b[k])})(B.prototype,"show hide toggle onResize resize remove stop doScrollPos".split(" "),function(e,b){e[b]=function(){var e=arguments;return this.each(function(){this[b].apply(this,e)})}});e.fn.getNiceScroll=function(g){return"undefined"==typeof g?new B(this):this[g]&&e.data(this[g],"__nicescroll")||!1};e.extend(e.expr[":"],{nicescroll:function(g){return e.data(g,"__nicescroll")?
1326
!0:!1}});e.fn.niceScroll=function(g,b){"undefined"==typeof b&&("object"==typeof g&&!("jquery"in g))&&(b=g,g=!1);var h=new B;"undefined"==typeof b&&(b={});g&&(b.doc=e(g),b.win=e(this));var k=!("doc"in b);!k&&!("win"in b)&&(b.win=e(this));this.each(function(){var g=e(this).data("__nicescroll")||!1;g||(b.doc=k?e(this):b.doc,g=new N(b,e(this)),e(this).data("__nicescroll",g));h.push(g)});return 1==h.length?h[0]:h};window.NiceScroll={getjQuery:function(){return e}};e.nicescroll||(e.nicescroll=new B,e.nicescroll.options=
1327
G)});
1328
1329
1330
1331
1332
1333
1334
/*! Copyright (c) 2011 Piotr Rochala (http://rocha.la)
1335
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
1336
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
1337
*
1338
* Version: 1.3.0
1339
*
1340
*/
1341
(function(f){jQuery.fn.extend({slimScroll:function(h){var a=f.extend({width:"auto",height:"250px",size:"7px",color:"#000",position:"right",distance:"1px",start:"top",opacity:0.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",railOpacity:0.2,railDraggable:!0,railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,wheelStep:20,touchScrollStep:200,borderRadius:"7px",railBorderRadius:"7px"},h);this.each(function(){function r(d){if(s){d=d||
1342
window.event;var c=0;d.wheelDelta&&(c=-d.wheelDelta/120);d.detail&&(c=d.detail/3);f(d.target||d.srcTarget||d.srcElement).closest("."+a.wrapperClass).is(b.parent())&&m(c,!0);d.preventDefault&&!k&&d.preventDefault();k||(d.returnValue=!1)}}function m(d,f,h){k=!1;var e=d,g=b.outerHeight()-c.outerHeight();f&&(e=parseInt(c.css("top"))+d*parseInt(a.wheelStep)/100*c.outerHeight(),e=Math.min(Math.max(e,0),g),e=0<d?Math.ceil(e):Math.floor(e),c.css({top:e+"px"}));l=parseInt(c.css("top"))/(b.outerHeight()-c.outerHeight());
1343
e=l*(b[0].scrollHeight-b.outerHeight());h&&(e=d,d=e/b[0].scrollHeight*b.outerHeight(),d=Math.min(Math.max(d,0),g),c.css({top:d+"px"}));b.scrollTop(e);b.trigger("slimscrolling",~~e);v();p()}function C(){window.addEventListener?(this.addEventListener("DOMMouseScroll",r,!1),this.addEventListener("mousewheel",r,!1),this.addEventListener("MozMousePixelScroll",r,!1)):document.attachEvent("onmousewheel",r)}function w(){u=Math.max(b.outerHeight()/b[0].scrollHeight*b.outerHeight(),D);c.css({height:u+"px"});
1344
var a=u==b.outerHeight()?"none":"block";c.css({display:a})}function v(){w();clearTimeout(A);l==~~l?(k=a.allowPageScroll,B!=l&&b.trigger("slimscroll",0==~~l?"top":"bottom")):k=!1;B=l;u>=b.outerHeight()?k=!0:(c.stop(!0,!0).fadeIn("fast"),a.railVisible&&g.stop(!0,!0).fadeIn("fast"))}function p(){a.alwaysVisible||(A=setTimeout(function(){a.disableFadeOut&&s||(x||y)||(c.fadeOut("slow"),g.fadeOut("slow"))},1E3))}var s,x,y,A,z,u,l,B,D=30,k=!1,b=f(this);if(b.parent().hasClass(a.wrapperClass)){var n=b.scrollTop(),
1345
c=b.parent().find("."+a.barClass),g=b.parent().find("."+a.railClass);w();if(f.isPlainObject(h)){if("height"in h&&"auto"==h.height){b.parent().css("height","auto");b.css("height","auto");var q=b.parent().parent().height();b.parent().css("height",q);b.css("height",q)}if("scrollTo"in h)n=parseInt(a.scrollTo);else if("scrollBy"in h)n+=parseInt(a.scrollBy);else if("destroy"in h){c.remove();g.remove();b.unwrap();return}m(n,!1,!0)}}else{a.height="auto"==a.height?b.parent().height():a.height;n=f("<div></div>").addClass(a.wrapperClass).css({position:"relative",
1346
overflow:"hidden",width:a.width,height:a.height});b.css({overflow:"hidden",width:a.width,height:a.height});var g=f("<div></div>").addClass(a.railClass).css({width:a.size,height:"100%",position:"absolute",top:0,display:a.alwaysVisible&&a.railVisible?"block":"none","border-radius":a.railBorderRadius,background:a.railColor,opacity:a.railOpacity,zIndex:90}),c=f("<div></div>").addClass(a.barClass).css({background:a.color,width:a.size,position:"absolute",top:0,opacity:a.opacity,display:a.alwaysVisible?
1347
"block":"none","border-radius":a.borderRadius,BorderRadius:a.borderRadius,MozBorderRadius:a.borderRadius,WebkitBorderRadius:a.borderRadius,zIndex:99}),q="right"==a.position?{right:a.distance}:{left:a.distance};g.css(q);c.css(q);b.wrap(n);b.parent().append(c);b.parent().append(g);a.railDraggable&&c.bind("mousedown",function(a){var b=f(document);y=!0;t=parseFloat(c.css("top"));pageY=a.pageY;b.bind("mousemove.slimscroll",function(a){currTop=t+a.pageY-pageY;c.css("top",currTop);m(0,c.position().top,!1)});
1348
b.bind("mouseup.slimscroll",function(a){y=!1;p();b.unbind(".slimscroll")});return!1}).bind("selectstart.slimscroll",function(a){a.stopPropagation();a.preventDefault();return!1});g.hover(function(){v()},function(){p()});c.hover(function(){x=!0},function(){x=!1});b.hover(function(){s=!0;v();p()},function(){s=!1;p()});b.bind("touchstart",function(a,b){a.originalEvent.touches.length&&(z=a.originalEvent.touches[0].pageY)});b.bind("touchmove",function(b){k||b.originalEvent.preventDefault();b.originalEvent.touches.length&&
1349
(m((z-b.originalEvent.touches[0].pageY)/a.touchScrollStep,!0),z=b.originalEvent.touches[0].pageY)});w();"bottom"===a.start?(c.css({top:b.outerHeight()-c.outerHeight()}),m(0,!0)):"top"!==a.start&&(m(f(a.start).position().top,null,!0),a.alwaysVisible||c.hide());C()}});return this}});jQuery.fn.extend({slimscroll:jQuery.fn.slimScroll})})(jQuery);
1350
1351
1352
/*!
1353
* jQuery Transit - CSS3 transitions and transformations
1354
* (c) 2011-2012 Rico Sta. Cruz <[email protected]>
1355
* MIT Licensed.
1356
*
1357
* http://ricostacruz.com/jquery.transit
1358
* http://github.com/rstacruz/jquery.transit
1359
*/
1360
(function(k){k.transit={version:"0.9.9",propertyMap:{marginLeft:"margin",marginRight:"margin",marginBottom:"margin",marginTop:"margin",paddingLeft:"padding",paddingRight:"padding",paddingBottom:"padding",paddingTop:"padding"},enabled:true,useTransitionEnd:false};var d=document.createElement("div");var q={};function b(v){if(v in d.style){return v}var u=["Moz","Webkit","O","ms"];var r=v.charAt(0).toUpperCase()+v.substr(1);if(v in d.style){return v}for(var t=0;t<u.length;++t){var s=u[t]+r;if(s in d.style){return s}}}function e(){d.style[q.transform]="";d.style[q.transform]="rotateY(90deg)";return d.style[q.transform]!==""}var a=navigator.userAgent.toLowerCase().indexOf("chrome")>-1;q.transition=b("transition");q.transitionDelay=b("transitionDelay");q.transform=b("transform");q.transformOrigin=b("transformOrigin");q.transform3d=e();var i={transition:"transitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",WebkitTransition:"webkitTransitionEnd",msTransition:"MSTransitionEnd"};var f=q.transitionEnd=i[q.transition]||null;for(var p in q){if(q.hasOwnProperty(p)&&typeof k.support[p]==="undefined"){k.support[p]=q[p]}}d=null;k.cssEase={_default:"ease","in":"ease-in",out:"ease-out","in-out":"ease-in-out",snap:"cubic-bezier(0,1,.5,1)",easeOutCubic:"cubic-bezier(.215,.61,.355,1)",easeInOutCubic:"cubic-bezier(.645,.045,.355,1)",easeInCirc:"cubic-bezier(.6,.04,.98,.335)",easeOutCirc:"cubic-bezier(.075,.82,.165,1)",easeInOutCirc:"cubic-bezier(.785,.135,.15,.86)",easeInExpo:"cubic-bezier(.95,.05,.795,.035)",easeOutExpo:"cubic-bezier(.19,1,.22,1)",easeInOutExpo:"cubic-bezier(1,0,0,1)",easeInQuad:"cubic-bezier(.55,.085,.68,.53)",easeOutQuad:"cubic-bezier(.25,.46,.45,.94)",easeInOutQuad:"cubic-bezier(.455,.03,.515,.955)",easeInQuart:"cubic-bezier(.895,.03,.685,.22)",easeOutQuart:"cubic-bezier(.165,.84,.44,1)",easeInOutQuart:"cubic-bezier(.77,0,.175,1)",easeInQuint:"cubic-bezier(.755,.05,.855,.06)",easeOutQuint:"cubic-bezier(.23,1,.32,1)",easeInOutQuint:"cubic-bezier(.86,0,.07,1)",easeInSine:"cubic-bezier(.47,0,.745,.715)",easeOutSine:"cubic-bezier(.39,.575,.565,1)",easeInOutSine:"cubic-bezier(.445,.05,.55,.95)",easeInBack:"cubic-bezier(.6,-.28,.735,.045)",easeOutBack:"cubic-bezier(.175, .885,.32,1.275)",easeInOutBack:"cubic-bezier(.68,-.55,.265,1.55)"};k.cssHooks["transit:transform"]={get:function(r){return k(r).data("transform")||new j()},set:function(s,r){var t=r;if(!(t instanceof j)){t=new j(t)}if(q.transform==="WebkitTransform"&&!a){s.style[q.transform]=t.toString(true)}else{s.style[q.transform]=t.toString()}k(s).data("transform",t)}};k.cssHooks.transform={set:k.cssHooks["transit:transform"].set};if(k.fn.jquery<"1.8"){k.cssHooks.transformOrigin={get:function(r){return r.style[q.transformOrigin]},set:function(r,s){r.style[q.transformOrigin]=s}};k.cssHooks.transition={get:function(r){return r.style[q.transition]},set:function(r,s){r.style[q.transition]=s}}}n("scale");n("translate");n("rotate");n("rotateX");n("rotateY");n("rotate3d");n("perspective");n("skewX");n("skewY");n("x",true);n("y",true);function j(r){if(typeof r==="string"){this.parse(r)}return this}j.prototype={setFromString:function(t,s){var r=(typeof s==="string")?s.split(","):(s.constructor===Array)?s:[s];r.unshift(t);j.prototype.set.apply(this,r)},set:function(s){var r=Array.prototype.slice.apply(arguments,[1]);if(this.setter[s]){this.setter[s].apply(this,r)}else{this[s]=r.join(",")}},get:function(r){if(this.getter[r]){return this.getter[r].apply(this)}else{return this[r]||0}},setter:{rotate:function(r){this.rotate=o(r,"deg")},rotateX:function(r){this.rotateX=o(r,"deg")},rotateY:function(r){this.rotateY=o(r,"deg")},scale:function(r,s){if(s===undefined){s=r}this.scale=r+","+s},skewX:function(r){this.skewX=o(r,"deg")},skewY:function(r){this.skewY=o(r,"deg")},perspective:function(r){this.perspective=o(r,"px")},x:function(r){this.set("translate",r,null)},y:function(r){this.set("translate",null,r)},translate:function(r,s){if(this._translateX===undefined){this._translateX=0}if(this._translateY===undefined){this._translateY=0}if(r!==null&&r!==undefined){this._translateX=o(r,"px")}if(s!==null&&s!==undefined){this._translateY=o(s,"px")}this.translate=this._translateX+","+this._translateY}},getter:{x:function(){return this._translateX||0},y:function(){return this._translateY||0},scale:function(){var r=(this.scale||"1,1").split(",");if(r[0]){r[0]=parseFloat(r[0])}if(r[1]){r[1]=parseFloat(r[1])}return(r[0]===r[1])?r[0]:r},rotate3d:function(){var t=(this.rotate3d||"0,0,0,0deg").split(",");for(var r=0;r<=3;++r){if(t[r]){t[r]=parseFloat(t[r])}}if(t[3]){t[3]=o(t[3],"deg")}return t}},parse:function(s){var r=this;s.replace(/([a-zA-Z0-9]+)\((.*?)\)/g,function(t,v,u){r.setFromString(v,u)})},toString:function(t){var s=[];for(var r in this){if(this.hasOwnProperty(r)){if((!q.transform3d)&&((r==="rotateX")||(r==="rotateY")||(r==="perspective")||(r==="transformOrigin"))){continue}if(r[0]!=="_"){if(t&&(r==="scale")){s.push(r+"3d("+this[r]+",1)")}else{if(t&&(r==="translate")){s.push(r+"3d("+this[r]+",0)")}else{s.push(r+"("+this[r]+")")}}}}}return s.join(" ")}};function m(s,r,t){if(r===true){s.queue(t)}else{if(r){s.queue(r,t)}else{t()}}}function h(s){var r=[];k.each(s,function(t){t=k.camelCase(t);t=k.transit.propertyMap[t]||k.cssProps[t]||t;t=c(t);if(k.inArray(t,r)===-1){r.push(t)}});return r}function g(s,v,x,r){var t=h(s);if(k.cssEase[x]){x=k.cssEase[x]}var w=""+l(v)+" "+x;if(parseInt(r,10)>0){w+=" "+l(r)}var u=[];k.each(t,function(z,y){u.push(y+" "+w)});return u.join(", ")}k.fn.transition=k.fn.transit=function(z,s,y,C){var D=this;var u=0;var w=true;if(typeof s==="function"){C=s;s=undefined}if(typeof y==="function"){C=y;y=undefined}if(typeof z.easing!=="undefined"){y=z.easing;delete z.easing}if(typeof z.duration!=="undefined"){s=z.duration;delete z.duration}if(typeof z.complete!=="undefined"){C=z.complete;delete z.complete}if(typeof z.queue!=="undefined"){w=z.queue;delete z.queue}if(typeof z.delay!=="undefined"){u=z.delay;delete z.delay}if(typeof s==="undefined"){s=k.fx.speeds._default}if(typeof y==="undefined"){y=k.cssEase._default}s=l(s);var E=g(z,s,y,u);var B=k.transit.enabled&&q.transition;var t=B?(parseInt(s,10)+parseInt(u,10)):0;if(t===0){var A=function(F){D.css(z);if(C){C.apply(D)}if(F){F()}};m(D,w,A);return D}var x={};var r=function(H){var G=false;var F=function(){if(G){D.unbind(f,F)}if(t>0){D.each(function(){this.style[q.transition]=(x[this]||null)})}if(typeof C==="function"){C.apply(D)}if(typeof H==="function"){H()}};if((t>0)&&(f)&&(k.transit.useTransitionEnd)){G=true;D.bind(f,F)}else{window.setTimeout(F,t)}D.each(function(){if(t>0){this.style[q.transition]=E}k(this).css(z)})};var v=function(F){this.offsetWidth;r(F)};m(D,w,v);return this};function n(s,r){if(!r){k.cssNumber[s]=true}k.transit.propertyMap[s]=q.transform;k.cssHooks[s]={get:function(v){var u=k(v).css("transit:transform");return u.get(s)},set:function(v,w){var u=k(v).css("transit:transform");u.setFromString(s,w);k(v).css({"transit:transform":u})}}}function c(r){return r.replace(/([A-Z])/g,function(s){return"-"+s.toLowerCase()})}function o(s,r){if((typeof s==="string")&&(!s.match(/^[\-0-9\.]+$/))){return s}else{return""+s+r}}function l(s){var r=s;if(k.fx.speeds[r]){r=k.fx.speeds[r]}return o(r,"ms")}k.transit.getTransitionValue=g})(jQuery);
1361
1362
1363
1364
/*
1365
* jQuery UI Touch Punch 0.2.2
1366
*
1367
* Copyright 2011, Dave Furfero
1368
* Dual licensed under the MIT or GPL Version 2 licenses.
1369
*
1370
* Depends:
1371
* jquery.ui.widget.js
1372
* jquery.ui.mouse.js
1373
*/
1374
(function(b){b.support.touch="ontouchend" in document;if(!b.support.touch){return;}var c=b.ui.mouse.prototype,e=c._mouseInit,a;function d(g,h){if(g.originalEvent.touches.length>1){return;}g.preventDefault();var i=g.originalEvent.changedTouches[0],f=document.createEvent("MouseEvents");f.initMouseEvent(h,true,true,window,1,i.screenX,i.screenY,i.clientX,i.clientY,false,false,false,false,0,null);g.target.dispatchEvent(f);}c._touchStart=function(g){var f=this;if(a||!f._mouseCapture(g.originalEvent.changedTouches[0])){return;}a=true;f._touchMoved=false;d(g,"mouseover");d(g,"mousemove");d(g,"mousedown");};c._touchMove=function(f){if(!a){return;}this._touchMoved=true;d(f,"mousemove");};c._touchEnd=function(f){if(!a){return;}d(f,"mouseup");d(f,"mouseout");if(!this._touchMoved){d(f,"click");}a=false;};c._mouseInit=function(){var f=this;f.element.bind("touchstart",b.proxy(f,"_touchStart")).bind("touchmove",b.proxy(f,"_touchMove")).bind("touchend",b.proxy(f,"_touchEnd"));e.call(f);};})(jQuery);
1375
1376
1377
1378
})(jQuery, window);
1379
1380
1381
1382
1383
1384
1385
/**
1386
* @preserve Copyright 2012 Twitter, Inc.
1387
* @license http://www.apache.org/licenses/LICENSE-2.0.txt
1388
*/
1389
var Hogan={};(function(a,b){function i(a){return String(a===null||a===undefined?"":a)}function j(a){return a=i(a),h.test(a)?a.replace(c,"&amp;").replace(d,"&lt;").replace(e,"&gt;").replace(f,"&#39;").replace(g,"&quot;"):a}a.Template=function(a,c,d,e){this.r=a||this.r,this.c=d,this.options=e,this.text=c||"",this.buf=b?[]:""},a.Template.prototype={r:function(a,b,c){return""},v:j,t:i,render:function(b,c,d){return this.ri([b],c||{},d)},ri:function(a,b,c){return this.r(a,b,c)},rp:function(a,b,c,d){var e=c[a];return e?(this.c&&typeof e=="string"&&(e=this.c.compile(e,this.options)),e.ri(b,c,d)):""},rs:function(a,b,c){var d=a[a.length-1];if(!k(d)){c(a,b,this);return}for(var e=0;e<d.length;e++)a.push(d[e]),c(a,b,this),a.pop()},s:function(a,b,c,d,e,f,g){var h;return k(a)&&a.length===0?!1:(typeof a=="function"&&(a=this.ls(a,b,c,d,e,f,g)),h=a===""||!!a,!d&&h&&b&&b.push(typeof a=="object"?a:b[b.length-1]),h)},d:function(a,b,c,d){var e=a.split("."),f=this.f(e[0],b,c,d),g=null;if(a==="."&&k(b[b.length-2]))return b[b.length-1];for(var h=1;h<e.length;h++)f&&typeof f=="object"&&e[h]in f?(g=f,f=f[e[h]]):f="";return d&&!f?!1:(!d&&typeof f=="function"&&(b.push(g),f=this.lv(f,b,c),b.pop()),f)},f:function(a,b,c,d){var e=!1,f=null,g=!1;for(var h=b.length-1;h>=0;h--){f=b[h];if(f&&typeof f=="object"&&a in f){e=f[a],g=!0;break}}return g?(!d&&typeof e=="function"&&(e=this.lv(e,b,c)),e):d?!1:""},ho:function(a,b,c,d,e){var f=this.c,g=this.options;g.delimiters=e;var d=a.call(b,d);return d=d==null?String(d):d.toString(),this.b(f.compile(d,g).render(b,c)),!1},b:b?function(a){this.buf.push(a)}:function(a){this.buf+=a},fl:b?function(){var a=this.buf.join("");return this.buf=[],a}:function(){var a=this.buf;return this.buf="",a},ls:function(a,b,c,d,e,f,g){var h=b[b.length-1],i=null;if(!d&&this.c&&a.length>0)return this.ho(a,h,c,this.text.substring(e,f),g);i=a.call(h);if(typeof i=="function"){if(d)return!0;if(this.c)return this.ho(i,h,c,this.text.substring(e,f),g)}return i},lv:function(a,b,c){var d=b[b.length-1],e=a.call(d);if(typeof e=="function"){e=i(e.call(d));if(this.c&&~e.indexOf("{{"))return this.c.compile(e,this.options).render(d,c)}return i(e)}};var c=/&/g,d=/</g,e=/>/g,f=/\'/g,g=/\"/g,h=/[&<>\"\']/,k=Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"}})(typeof exports!="undefined"?exports:Hogan),function(a){function h(a){a.n.substr(a.n.length-1)==="}"&&(a.n=a.n.substring(0,a.n.length-1))}function i(a){return a.trim?a.trim():a.replace(/^\s*|\s*$/g,"")}function j(a,b,c){if(b.charAt(c)!=a.charAt(0))return!1;for(var d=1,e=a.length;d<e;d++)if(b.charAt(c+d)!=a.charAt(d))return!1;return!0}function k(a,b,c,d){var e=[],f=null,g=null;while(a.length>0){g=a.shift();if(g.tag=="#"||g.tag=="^"||l(g,d))c.push(g),g.nodes=k(a,g.tag,c,d),e.push(g);else{if(g.tag=="/"){if(c.length===0)throw new Error("Closing tag without opener: /"+g.n);f=c.pop();if(g.n!=f.n&&!m(g.n,f.n,d))throw new Error("Nesting error: "+f.n+" vs. "+g.n);return f.end=g.i,e}e.push(g)}}if(c.length>0)throw new Error("missing closing tag: "+c.pop().n);return e}function l(a,b){for(var c=0,d=b.length;c<d;c++)if(b[c].o==a.n)return a.tag="#",!0}function m(a,b,c){for(var d=0,e=c.length;d<e;d++)if(c[d].c==a&&c[d].o==b)return!0}function n(a){return a.replace(f,"\\\\").replace(c,'\\"').replace(d,"\\n").replace(e,"\\r")}function o(a){return~a.indexOf(".")?"d":"f"}function p(a){var b="";for(var c=0,d=a.length;c<d;c++){var e=a[c].tag;e=="#"?b+=q(a[c].nodes,a[c].n,o(a[c].n),a[c].i,a[c].end,a[c].otag+" "+a[c].ctag):e=="^"?b+=r(a[c].nodes,a[c].n,o(a[c].n)):e=="<"||e==">"?b+=s(a[c]):e=="{"||e=="&"?b+=t(a[c].n,o(a[c].n)):e=="\n"?b+=v('"\\n"'+(a.length-1==c?"":" + i")):e=="_v"?b+=u(a[c].n,o(a[c].n)):e===undefined&&(b+=v('"'+n(a[c])+'"'))}return b}function q(a,b,c,d,e,f){return"if(_.s(_."+c+'("'+n(b)+'",c,p,1),'+"c,p,0,"+d+","+e+',"'+f+'")){'+"_.rs(c,p,"+"function(c,p,_){"+p(a)+"});c.pop();}"}function r(a,b,c){return"if(!_.s(_."+c+'("'+n(b)+'",c,p,1),c,p,1,0,0,"")){'+p(a)+"};"}function s(a){return'_.b(_.rp("'+n(a.n)+'",c,p,"'+(a.indent||"")+'"));'}function t(a,b){return"_.b(_.t(_."+b+'("'+n(a)+'",c,p,0)));'}function u(a,b){return"_.b(_.v(_."+b+'("'+n(a)+'",c,p,0)));'}function v(a){return"_.b("+a+");"}var b=/\S/,c=/\"/g,d=/\n/g,e=/\r/g,f=/\\/g,g={"#":1,"^":2,"/":3,"!":4,">":5,"<":6,"=":7,_v:8,"{":9,"&":10};a.scan=function(c,d){function w(){p.length>0&&(q.push(new String(p)),p="")}function x(){var a=!0;for(var c=t;c<q.length;c++){a=q[c].tag&&g[q[c].tag]<g._v||!q[c].tag&&q[c].match(b)===null;if(!a)return!1}return a}function y(a,b){w();if(a&&x())for(var c=t,d;c<q.length;c++)q[c].tag||((d=q[c+1])&&d.tag==">"&&(d.indent=q[c].toString()),q.splice(c,1));else b||q.push({tag:"\n"});r=!1,t=q.length}function z(a,b){var c="="+v,d=a.indexOf(c,b),e=i(a.substring(a.indexOf("=",b)+1,d)).split(" ");return u=e[0],v=e[1],d+c.length-1}var e=c.length,f=0,k=1,l=2,m=f,n=null,o=null,p="",q=[],r=!1,s=0,t=0,u="{{",v="}}";d&&(d=d.split(" "),u=d[0],v=d[1]);for(s=0;s<e;s++)m==f?j(u,c,s)?(--s,w(),m=k):c.charAt(s)=="\n"?y(r):p+=c.charAt(s):m==k?(s+=u.length-1,o=g[c.charAt(s+1)],n=o?c.charAt(s+1):"_v",n=="="?(s=z(c,s),m=f):(o&&s++,m=l),r=s):j(v,c,s)?(q.push({tag:n,n:i(p),otag:u,ctag:v,i:n=="/"?r-v.length:s+u.length}),p="",s+=v.length-1,m=f,n=="{"&&(v=="}}"?s++:h(q[q.length-1]))):p+=c.charAt(s);return y(r,!0),q},a.generate=function(b,c,d){var e='var _=this;_.b(i=i||"");'+p(b)+"return _.fl();";return d.asString?"function(c,p,i){"+e+";}":new a.Template(new Function("c","p","i",e),c,a,d)},a.parse=function(a,b,c){return c=c||{},k(a,"",[],c.sectionTags||[])},a.cache={},a.compile=function(a,b){b=b||{};var c=a+"||"+!!b.asString,d=this.cache[c];return d?d:(d=this.generate(this.parse(this.scan(a,b.delimiters),a,b),a,b),this.cache[c]=d)}}(typeof exports!="undefined"?exports:Hogan);
1390
1391
1392
1393
1394
1395
1396
/* Copyright (c) 2012, 2014 Hyunje Alex Jun and other contributors
1397
* Licensed under the MIT License
1398
*/
1399
(function (factory) {
1400
'use strict';
1401
1402
if (typeof define === 'function' && define.amd) {
1403
// AMD. Register as an anonymous module.
1404
define(['jquery'], factory);
1405
} else if (typeof exports === 'object') {
1406
// Node/CommonJS
1407
factory(require('jquery'));
1408
} else {
1409
// Browser globals
1410
factory(jQuery);
1411
}
1412
})(function ($) {
1413
'use strict';
1414
1415
function getInt(x) {
1416
if (typeof x === 'string') {
1417
return parseInt(x, 10);
1418
} else {
1419
return ~~x;
1420
}
1421
}
1422
1423
var defaultSettings = {
1424
wheelSpeed: 1,
1425
wheelPropagation: false,
1426
swipePropagation: true,
1427
minScrollbarLength: null,
1428
maxScrollbarLength: null,
1429
useBothWheelAxes: false,
1430
useKeyboard: true,
1431
suppressScrollX: false,
1432
suppressScrollY: false,
1433
scrollXMarginOffset: 0,
1434
scrollYMarginOffset: 0,
1435
includePadding: false
1436
};
1437
1438
var incrementingId = 0;
1439
var eventClassFactory = function () {
1440
var id = incrementingId++;
1441
return function (eventName) {
1442
var className = '.perfect-scrollbar-' + id;
1443
if (typeof eventName === 'undefined') {
1444
return className;
1445
} else {
1446
return eventName + className;
1447
}
1448
};
1449
};
1450
1451
var isWebkit = 'WebkitAppearance' in document.documentElement.style;
1452
1453
$.fn.perfectScrollbar = function (suppliedSettings, option) {
1454
1455
return this.each(function () {
1456
var settings = $.extend(true, {}, defaultSettings);
1457
var $this = $(this);
1458
var isPluginAlive = function () { return !!$this; };
1459
1460
if (typeof suppliedSettings === "object") {
1461
// Override default settings with any supplied
1462
$.extend(true, settings, suppliedSettings);
1463
} else {
1464
// If no setting was supplied, then the first param must be the option
1465
option = suppliedSettings;
1466
}
1467
1468
// Catch options
1469
if (option === 'update') {
1470
if ($this.data('perfect-scrollbar-update')) {
1471
$this.data('perfect-scrollbar-update')();
1472
}
1473
return $this;
1474
}
1475
else if (option === 'destroy') {
1476
if ($this.data('perfect-scrollbar-destroy')) {
1477
$this.data('perfect-scrollbar-destroy')();
1478
}
1479
return $this;
1480
}
1481
1482
if ($this.data('perfect-scrollbar')) {
1483
// if there's already perfect-scrollbar
1484
return $this.data('perfect-scrollbar');
1485
}
1486
1487
1488
// Or generate new perfectScrollbar
1489
1490
$this.addClass('ps-container');
1491
1492
var containerWidth;
1493
var containerHeight;
1494
var contentWidth;
1495
var contentHeight;
1496
1497
var isRtl = $this.css('direction') === "rtl";
1498
var eventClass = eventClassFactory();
1499
var ownerDocument = this.ownerDocument || document;
1500
1501
var $scrollbarXRail = $("<div class='ps-scrollbar-x-rail'>").appendTo($this);
1502
var $scrollbarX = $("<div class='ps-scrollbar-x'>").appendTo($scrollbarXRail);
1503
var scrollbarXActive;
1504
var scrollbarXWidth;
1505
var scrollbarXLeft;
1506
var scrollbarXBottom = getInt($scrollbarXRail.css('bottom'));
1507
var isScrollbarXUsingBottom = scrollbarXBottom === scrollbarXBottom; // !isNaN
1508
var scrollbarXTop = isScrollbarXUsingBottom ? null : getInt($scrollbarXRail.css('top'));
1509
var railBorderXWidth = getInt($scrollbarXRail.css('borderLeftWidth')) + getInt($scrollbarXRail.css('borderRightWidth'));
1510
var railXMarginWidth = getInt($scrollbarXRail.css('marginLeft')) + getInt($scrollbarXRail.css('marginRight'));
1511
var railXWidth;
1512
1513
var $scrollbarYRail = $("<div class='ps-scrollbar-y-rail'>").appendTo($this);
1514
var $scrollbarY = $("<div class='ps-scrollbar-y'>").appendTo($scrollbarYRail);
1515
var scrollbarYActive;
1516
var scrollbarYHeight;
1517
var scrollbarYTop;
1518
var scrollbarYRight = getInt($scrollbarYRail.css('right'));
1519
var isScrollbarYUsingRight = scrollbarYRight === scrollbarYRight; // !isNaN
1520
var scrollbarYLeft = isScrollbarYUsingRight ? null : getInt($scrollbarYRail.css('left'));
1521
var railBorderYWidth = getInt($scrollbarYRail.css('borderTopWidth')) + getInt($scrollbarYRail.css('borderBottomWidth'));
1522
var railYMarginHeight = getInt($scrollbarYRail.css('marginTop')) + getInt($scrollbarYRail.css('marginBottom'));
1523
var railYHeight;
1524
1525
function updateScrollTop(currentTop, deltaY) {
1526
var newTop = currentTop + deltaY;
1527
var maxTop = containerHeight - scrollbarYHeight;
1528
1529
if (newTop < 0) {
1530
scrollbarYTop = 0;
1531
} else if (newTop > maxTop) {
1532
scrollbarYTop = maxTop;
1533
} else {
1534
scrollbarYTop = newTop;
1535
}
1536
1537
var scrollTop = getInt(scrollbarYTop * (contentHeight - containerHeight) / (containerHeight - scrollbarYHeight));
1538
$this.scrollTop(scrollTop);
1539
}
1540
1541
function updateScrollLeft(currentLeft, deltaX) {
1542
var newLeft = currentLeft + deltaX;
1543
var maxLeft = containerWidth - scrollbarXWidth;
1544
1545
if (newLeft < 0) {
1546
scrollbarXLeft = 0;
1547
} else if (newLeft > maxLeft) {
1548
scrollbarXLeft = maxLeft;
1549
} else {
1550
scrollbarXLeft = newLeft;
1551
}
1552
1553
var scrollLeft = getInt(scrollbarXLeft * (contentWidth - containerWidth) / (containerWidth - scrollbarXWidth));
1554
$this.scrollLeft(scrollLeft);
1555
}
1556
1557
function getThumbSize(thumbSize) {
1558
if (settings.minScrollbarLength) {
1559
thumbSize = Math.max(thumbSize, settings.minScrollbarLength);
1560
}
1561
if (settings.maxScrollbarLength) {
1562
thumbSize = Math.min(thumbSize, settings.maxScrollbarLength);
1563
}
1564
return thumbSize;
1565
}
1566
1567
function updateCss() {
1568
var xRailOffset = {width: railXWidth};
1569
if (isRtl) {
1570
xRailOffset.left = $this.scrollLeft() + containerWidth - contentWidth;
1571
} else {
1572
xRailOffset.left = $this.scrollLeft();
1573
}
1574
if (isScrollbarXUsingBottom) {
1575
xRailOffset.bottom = scrollbarXBottom - $this.scrollTop();
1576
} else {
1577
xRailOffset.top = scrollbarXTop + $this.scrollTop();
1578
}
1579
$scrollbarXRail.css(xRailOffset);
1580
1581
var railYOffset = {top: $this.scrollTop(), height: railYHeight};
1582
1583
if (isScrollbarYUsingRight) {
1584
if (isRtl) {
1585
railYOffset.right = contentWidth - $this.scrollLeft() - scrollbarYRight - $scrollbarY.outerWidth();
1586
} else {
1587
railYOffset.right = scrollbarYRight - $this.scrollLeft();
1588
}
1589
} else {
1590
if (isRtl) {
1591
railYOffset.left = $this.scrollLeft() + containerWidth * 2 - contentWidth - scrollbarYLeft - $scrollbarY.outerWidth();
1592
} else {
1593
railYOffset.left = scrollbarYLeft + $this.scrollLeft();
1594
}
1595
}
1596
$scrollbarYRail.css(railYOffset);
1597
1598
$scrollbarX.css({left: scrollbarXLeft, width: scrollbarXWidth - railBorderXWidth});
1599
$scrollbarY.css({top: scrollbarYTop, height: scrollbarYHeight - railBorderYWidth});
1600
}
1601
1602
function updateGeometry() {
1603
// Hide scrollbars not to affect scrollWidth and scrollHeight
1604
$this.removeClass('ps-active-x');
1605
$this.removeClass('ps-active-y');
1606
1607
containerWidth = settings.includePadding ? $this.innerWidth() : $this.width();
1608
containerHeight = settings.includePadding ? $this.innerHeight() : $this.height();
1609
contentWidth = $this.prop('scrollWidth');
1610
contentHeight = $this.prop('scrollHeight');
1611
1612
if (!settings.suppressScrollX && containerWidth + settings.scrollXMarginOffset < contentWidth) {
1613
scrollbarXActive = true;
1614
railXWidth = containerWidth - railXMarginWidth;
1615
scrollbarXWidth = getThumbSize(getInt(railXWidth * containerWidth / contentWidth));
1616
scrollbarXLeft = getInt($this.scrollLeft() * (railXWidth - scrollbarXWidth) / (contentWidth - containerWidth));
1617
} else {
1618
scrollbarXActive = false;
1619
scrollbarXWidth = 0;
1620
scrollbarXLeft = 0;
1621
$this.scrollLeft(0);
1622
}
1623
1624
if (!settings.suppressScrollY && containerHeight + settings.scrollYMarginOffset < contentHeight) {
1625
scrollbarYActive = true;
1626
railYHeight = containerHeight - railYMarginHeight;
1627
scrollbarYHeight = getThumbSize(getInt(railYHeight * containerHeight / contentHeight));
1628
scrollbarYTop = getInt($this.scrollTop() * (railYHeight - scrollbarYHeight) / (contentHeight - containerHeight));
1629
} else {
1630
scrollbarYActive = false;
1631
scrollbarYHeight = 0;
1632
scrollbarYTop = 0;
1633
$this.scrollTop(0);
1634
}
1635
1636
if (scrollbarXLeft >= railXWidth - scrollbarXWidth) {
1637
scrollbarXLeft = railXWidth - scrollbarXWidth;
1638
}
1639
if (scrollbarYTop >= railYHeight - scrollbarYHeight) {
1640
scrollbarYTop = railYHeight - scrollbarYHeight;
1641
}
1642
1643
updateCss();
1644
1645
if (scrollbarXActive) {
1646
$this.addClass('ps-active-x');
1647
}
1648
if (scrollbarYActive) {
1649
$this.addClass('ps-active-y');
1650
}
1651
}
1652
1653
function bindMouseScrollXHandler() {
1654
var currentLeft;
1655
var currentPageX;
1656
1657
var mouseMoveHandler = function (e) {
1658
updateScrollLeft(currentLeft, e.pageX - currentPageX);
1659
updateGeometry();
1660
e.stopPropagation();
1661
e.preventDefault();
1662
};
1663
1664
var mouseUpHandler = function (e) {
1665
$scrollbarXRail.removeClass('in-scrolling');
1666
$(ownerDocument).unbind(eventClass('mousemove'), mouseMoveHandler);
1667
};
1668
1669
$scrollbarX.bind(eventClass('mousedown'), function (e) {
1670
currentPageX = e.pageX;
1671
currentLeft = $scrollbarX.position().left;
1672
$scrollbarXRail.addClass('in-scrolling');
1673
1674
$(ownerDocument).bind(eventClass('mousemove'), mouseMoveHandler);
1675
$(ownerDocument).one(eventClass('mouseup'), mouseUpHandler);
1676
1677
e.stopPropagation();
1678
e.preventDefault();
1679
});
1680
1681
currentLeft =
1682
currentPageX = null;
1683
}
1684
1685
function bindMouseScrollYHandler() {
1686
var currentTop;
1687
var currentPageY;
1688
1689
var mouseMoveHandler = function (e) {
1690
updateScrollTop(currentTop, e.pageY - currentPageY);
1691
updateGeometry();
1692
e.stopPropagation();
1693
e.preventDefault();
1694
};
1695
1696
var mouseUpHandler = function (e) {
1697
$scrollbarYRail.removeClass('in-scrolling');
1698
$(ownerDocument).unbind(eventClass('mousemove'), mouseMoveHandler);
1699
};
1700
1701
$scrollbarY.bind(eventClass('mousedown'), function (e) {
1702
currentPageY = e.pageY;
1703
currentTop = $scrollbarY.position().top;
1704
$scrollbarYRail.addClass('in-scrolling');
1705
1706
$(ownerDocument).bind(eventClass('mousemove'), mouseMoveHandler);
1707
$(ownerDocument).one(eventClass('mouseup'), mouseUpHandler);
1708
1709
e.stopPropagation();
1710
e.preventDefault();
1711
});
1712
1713
currentTop =
1714
currentPageY = null;
1715
}
1716
1717
function shouldPreventWheel(deltaX, deltaY) {
1718
var scrollTop = $this.scrollTop();
1719
if (deltaX === 0) {
1720
if (!scrollbarYActive) {
1721
return false;
1722
}
1723
if ((scrollTop === 0 && deltaY > 0) || (scrollTop >= contentHeight - containerHeight && deltaY < 0)) {
1724
return !settings.wheelPropagation;
1725
}
1726
}
1727
1728
var scrollLeft = $this.scrollLeft();
1729
if (deltaY === 0) {
1730
if (!scrollbarXActive) {
1731
return false;
1732
}
1733
if ((scrollLeft === 0 && deltaX < 0) || (scrollLeft >= contentWidth - containerWidth && deltaX > 0)) {
1734
return !settings.wheelPropagation;
1735
}
1736
}
1737
return true;
1738
}
1739
1740
function shouldPreventSwipe(deltaX, deltaY) {
1741
var scrollTop = $this.scrollTop();
1742
var scrollLeft = $this.scrollLeft();
1743
var magnitudeX = Math.abs(deltaX);
1744
var magnitudeY = Math.abs(deltaY);
1745
1746
if (magnitudeY > magnitudeX) {
1747
// user is perhaps trying to swipe up/down the page
1748
1749
if (((deltaY < 0) && (scrollTop === contentHeight - containerHeight)) ||
1750
((deltaY > 0) && (scrollTop === 0))) {
1751
return !settings.swipePropagation;
1752
}
1753
} else if (magnitudeX > magnitudeY) {
1754
// user is perhaps trying to swipe left/right across the page
1755
1756
if (((deltaX < 0) && (scrollLeft === contentWidth - containerWidth)) ||
1757
((deltaX > 0) && (scrollLeft === 0))) {
1758
return !settings.swipePropagation;
1759
}
1760
}
1761
1762
return true;
1763
}
1764
1765
function bindMouseWheelHandler() {
1766
var shouldPrevent = false;
1767
1768
function getDeltaFromEvent(e) {
1769
var deltaX = e.originalEvent.deltaX;
1770
var deltaY = -1 * e.originalEvent.deltaY;
1771
1772
if (typeof deltaX === "undefined" || typeof deltaY === "undefined") {
1773
// OS X Safari
1774
deltaX = -1 * e.originalEvent.wheelDeltaX / 6;
1775
deltaY = e.originalEvent.wheelDeltaY / 6;
1776
}
1777
1778
if (e.originalEvent.deltaMode && e.originalEvent.deltaMode === 1) {
1779
// Firefox in deltaMode 1: Line scrolling
1780
deltaX *= 10;
1781
deltaY *= 10;
1782
}
1783
1784
if (deltaX !== deltaX && deltaY !== deltaY/* NaN checks */) {
1785
// IE in some mouse drivers
1786
deltaX = 0;
1787
deltaY = e.originalEvent.wheelDelta;
1788
}
1789
1790
return [deltaX, deltaY];
1791
}
1792
1793
function mousewheelHandler(e) {
1794
// FIXME: this is a quick fix for the select problem in FF and IE.
1795
// If there comes an effective way to deal with the problem,
1796
// this lines should be removed.
1797
if (!isWebkit && $this.find('select:focus').length > 0) {
1798
return;
1799
}
1800
1801
var delta = getDeltaFromEvent(e);
1802
1803
var deltaX = delta[0];
1804
var deltaY = delta[1];
1805
1806
shouldPrevent = false;
1807
if (!settings.useBothWheelAxes) {
1808
// deltaX will only be used for horizontal scrolling and deltaY will
1809
// only be used for vertical scrolling - this is the default
1810
$this.scrollTop($this.scrollTop() - (deltaY * settings.wheelSpeed));
1811
$this.scrollLeft($this.scrollLeft() + (deltaX * settings.wheelSpeed));
1812
} else if (scrollbarYActive && !scrollbarXActive) {
1813
// only vertical scrollbar is active and useBothWheelAxes option is
1814
// active, so let's scroll vertical bar using both mouse wheel axes
1815
if (deltaY) {
1816
$this.scrollTop($this.scrollTop() - (deltaY * settings.wheelSpeed));
1817
} else {
1818
$this.scrollTop($this.scrollTop() + (deltaX * settings.wheelSpeed));
1819
}
1820
shouldPrevent = true;
1821
} else if (scrollbarXActive && !scrollbarYActive) {
1822
// useBothWheelAxes and only horizontal bar is active, so use both
1823
// wheel axes for horizontal bar
1824
if (deltaX) {
1825
$this.scrollLeft($this.scrollLeft() + (deltaX * settings.wheelSpeed));
1826
} else {
1827
$this.scrollLeft($this.scrollLeft() - (deltaY * settings.wheelSpeed));
1828
}
1829
shouldPrevent = true;
1830
}
1831
1832
updateGeometry();
1833
1834
shouldPrevent = (shouldPrevent || shouldPreventWheel(deltaX, deltaY));
1835
if (shouldPrevent) {
1836
e.stopPropagation();
1837
e.preventDefault();
1838
}
1839
}
1840
1841
if (typeof window.onwheel !== "undefined") {
1842
$this.bind(eventClass('wheel'), mousewheelHandler);
1843
} else if (typeof window.onmousewheel !== "undefined") {
1844
$this.bind(eventClass('mousewheel'), mousewheelHandler);
1845
}
1846
}
1847
1848
function bindKeyboardHandler() {
1849
var hovered = false;
1850
$this.bind(eventClass('mouseenter'), function (e) {
1851
hovered = true;
1852
});
1853
$this.bind(eventClass('mouseleave'), function (e) {
1854
hovered = false;
1855
});
1856
1857
var shouldPrevent = false;
1858
$(ownerDocument).bind(eventClass('keydown'), function (e) {
1859
if (e.isDefaultPrevented && e.isDefaultPrevented()) {
1860
return;
1861
}
1862
1863
if (!hovered) {
1864
return;
1865
}
1866
1867
var activeElement = document.activeElement ? document.activeElement : ownerDocument.activeElement;
1868
// go deeper if element is a webcomponent
1869
while (activeElement.shadowRoot) {
1870
activeElement = activeElement.shadowRoot.activeElement;
1871
}
1872
if ($(activeElement).is(":input,[contenteditable]")) {
1873
return;
1874
}
1875
1876
var deltaX = 0;
1877
var deltaY = 0;
1878
1879
switch (e.which) {
1880
case 37: // left
1881
deltaX = -30;
1882
break;
1883
case 38: // up
1884
deltaY = 30;
1885
break;
1886
case 39: // right
1887
deltaX = 30;
1888
break;
1889
case 40: // down
1890
deltaY = -30;
1891
break;
1892
case 33: // page up
1893
deltaY = 90;
1894
break;
1895
case 32: // space bar
1896
case 34: // page down
1897
deltaY = -90;
1898
break;
1899
case 35: // end
1900
if (e.ctrlKey) {
1901
deltaY = -contentHeight;
1902
} else {
1903
deltaY = -containerHeight;
1904
}
1905
break;
1906
case 36: // home
1907
if (e.ctrlKey) {
1908
deltaY = $this.scrollTop();
1909
} else {
1910
deltaY = containerHeight;
1911
}
1912
break;
1913
default:
1914
return;
1915
}
1916
1917
$this.scrollTop($this.scrollTop() - deltaY);
1918
$this.scrollLeft($this.scrollLeft() + deltaX);
1919
1920
shouldPrevent = shouldPreventWheel(deltaX, deltaY);
1921
if (shouldPrevent) {
1922
e.preventDefault();
1923
}
1924
});
1925
}
1926
1927
function bindRailClickHandler() {
1928
function stopPropagation(e) { e.stopPropagation(); }
1929
1930
$scrollbarY.bind(eventClass('click'), stopPropagation);
1931
$scrollbarYRail.bind(eventClass('click'), function (e) {
1932
var halfOfScrollbarLength = getInt(scrollbarYHeight / 2);
1933
var positionTop = e.pageY - $scrollbarYRail.offset().top - halfOfScrollbarLength;
1934
var maxPositionTop = containerHeight - scrollbarYHeight;
1935
var positionRatio = positionTop / maxPositionTop;
1936
1937
if (positionRatio < 0) {
1938
positionRatio = 0;
1939
} else if (positionRatio > 1) {
1940
positionRatio = 1;
1941
}
1942
1943
$this.scrollTop((contentHeight - containerHeight) * positionRatio);
1944
});
1945
1946
$scrollbarX.bind(eventClass('click'), stopPropagation);
1947
$scrollbarXRail.bind(eventClass('click'), function (e) {
1948
var halfOfScrollbarLength = getInt(scrollbarXWidth / 2);
1949
var positionLeft = e.pageX - $scrollbarXRail.offset().left - halfOfScrollbarLength;
1950
var maxPositionLeft = containerWidth - scrollbarXWidth;
1951
var positionRatio = positionLeft / maxPositionLeft;
1952
1953
if (positionRatio < 0) {
1954
positionRatio = 0;
1955
} else if (positionRatio > 1) {
1956
positionRatio = 1;
1957
}
1958
1959
$this.scrollLeft((contentWidth - containerWidth) * positionRatio);
1960
});
1961
}
1962
1963
function bindSelectionHandler() {
1964
function getRangeNode() {
1965
var selection = window.getSelection ? window.getSelection() :
1966
document.getSlection ? document.getSlection() : {rangeCount: 0};
1967
if (selection.rangeCount === 0) {
1968
return null;
1969
} else {
1970
return selection.getRangeAt(0).commonAncestorContainer;
1971
}
1972
}
1973
1974
var scrollingLoop = null;
1975
var scrollDiff = {top: 0, left: 0};
1976
function startScrolling() {
1977
if (!scrollingLoop) {
1978
scrollingLoop = setInterval(function () {
1979
if (!isPluginAlive()) {
1980
clearInterval(scrollingLoop);
1981
return;
1982
}
1983
1984
$this.scrollTop($this.scrollTop() + scrollDiff.top);
1985
$this.scrollLeft($this.scrollLeft() + scrollDiff.left);
1986
updateGeometry();
1987
}, 50); // every .1 sec
1988
}
1989
}
1990
function stopScrolling() {
1991
if (scrollingLoop) {
1992
clearInterval(scrollingLoop);
1993
scrollingLoop = null;
1994
}
1995
$scrollbarXRail.removeClass('in-scrolling');
1996
$scrollbarYRail.removeClass('in-scrolling');
1997
}
1998
1999
var isSelected = false;
2000
$(ownerDocument).bind(eventClass('selectionchange'), function (e) {
2001
if ($.contains($this[0], getRangeNode())) {
2002
isSelected = true;
2003
} else {
2004
isSelected = false;
2005
stopScrolling();
2006
}
2007
});
2008
$(window).bind(eventClass('mouseup'), function (e) {
2009
if (isSelected) {
2010
isSelected = false;
2011
stopScrolling();
2012
}
2013
});
2014
2015
$(window).bind(eventClass('mousemove'), function (e) {
2016
if (isSelected) {
2017
var mousePosition = {x: e.pageX, y: e.pageY};
2018
var containerOffset = $this.offset();
2019
var containerGeometry = {
2020
left: containerOffset.left,
2021
right: containerOffset.left + $this.outerWidth(),
2022
top: containerOffset.top,
2023
bottom: containerOffset.top + $this.outerHeight()
2024
};
2025
2026
if (mousePosition.x < containerGeometry.left + 3) {
2027
scrollDiff.left = -5;
2028
$scrollbarXRail.addClass('in-scrolling');
2029
} else if (mousePosition.x > containerGeometry.right - 3) {
2030
scrollDiff.left = 5;
2031
$scrollbarXRail.addClass('in-scrolling');
2032
} else {
2033
scrollDiff.left = 0;
2034
}
2035
2036
if (mousePosition.y < containerGeometry.top + 3) {
2037
if (containerGeometry.top + 3 - mousePosition.y < 5) {
2038
scrollDiff.top = -5;
2039
} else {
2040
scrollDiff.top = -20;
2041
}
2042
$scrollbarYRail.addClass('in-scrolling');
2043
} else if (mousePosition.y > containerGeometry.bottom - 3) {
2044
if (mousePosition.y - containerGeometry.bottom + 3 < 5) {
2045
scrollDiff.top = 5;
2046
} else {
2047
scrollDiff.top = 20;
2048
}
2049
$scrollbarYRail.addClass('in-scrolling');
2050
} else {
2051
scrollDiff.top = 0;
2052
}
2053
2054
if (scrollDiff.top === 0 && scrollDiff.left === 0) {
2055
stopScrolling();
2056
} else {
2057
startScrolling();
2058
}
2059
}
2060
});
2061
}
2062
2063
function bindTouchHandler(supportsTouch, supportsIePointer) {
2064
function applyTouchMove(differenceX, differenceY) {
2065
$this.scrollTop($this.scrollTop() - differenceY);
2066
$this.scrollLeft($this.scrollLeft() - differenceX);
2067
2068
updateGeometry();
2069
}
2070
2071
var startOffset = {};
2072
var startTime = 0;
2073
var speed = {};
2074
var easingLoop = null;
2075
var inGlobalTouch = false;
2076
var inLocalTouch = false;
2077
2078
function globalTouchStart(e) {
2079
inGlobalTouch = true;
2080
}
2081
function globalTouchEnd(e) {
2082
inGlobalTouch = false;
2083
}
2084
2085
function getTouch(e) {
2086
if (e.originalEvent.targetTouches) {
2087
return e.originalEvent.targetTouches[0];
2088
} else {
2089
// Maybe IE pointer
2090
return e.originalEvent;
2091
}
2092
}
2093
function shouldHandle(e) {
2094
var event = e.originalEvent;
2095
if (event.targetTouches && event.targetTouches.length === 1) {
2096
return true;
2097
}
2098
if (event.pointerType && event.pointerType !== 'mouse' && event.pointerType !== event.MSPOINTER_TYPE_MOUSE) {
2099
return true;
2100
}
2101
return false;
2102
}
2103
function touchStart(e) {
2104
if (shouldHandle(e)) {
2105
inLocalTouch = true;
2106
2107
var touch = getTouch(e);
2108
2109
startOffset.pageX = touch.pageX;
2110
startOffset.pageY = touch.pageY;
2111
2112
startTime = (new Date()).getTime();
2113
2114
if (easingLoop !== null) {
2115
clearInterval(easingLoop);
2116
}
2117
2118
e.stopPropagation();
2119
}
2120
}
2121
function touchMove(e) {
2122
if (!inGlobalTouch && inLocalTouch && shouldHandle(e)) {
2123
var touch = getTouch(e);
2124
2125
var currentOffset = {pageX: touch.pageX, pageY: touch.pageY};
2126
2127
var differenceX = currentOffset.pageX - startOffset.pageX;
2128
var differenceY = currentOffset.pageY - startOffset.pageY;
2129
2130
applyTouchMove(differenceX, differenceY);
2131
startOffset = currentOffset;
2132
2133
var currentTime = (new Date()).getTime();
2134
2135
var timeGap = currentTime - startTime;
2136
if (timeGap > 0) {
2137
speed.x = differenceX / timeGap;
2138
speed.y = differenceY / timeGap;
2139
startTime = currentTime;
2140
}
2141
2142
if (shouldPreventSwipe(differenceX, differenceY)) {
2143
e.stopPropagation();
2144
e.preventDefault();
2145
}
2146
}
2147
}
2148
function touchEnd(e) {
2149
if (!inGlobalTouch && inLocalTouch) {
2150
inLocalTouch = false;
2151
2152
clearInterval(easingLoop);
2153
easingLoop = setInterval(function () {
2154
if (!isPluginAlive()) {
2155
clearInterval(easingLoop);
2156
return;
2157
}
2158
2159
if (Math.abs(speed.x) < 0.01 && Math.abs(speed.y) < 0.01) {
2160
clearInterval(easingLoop);
2161
return;
2162
}
2163
2164
applyTouchMove(speed.x * 30, speed.y * 30);
2165
2166
speed.x *= 0.8;
2167
speed.y *= 0.8;
2168
}, 10);
2169
}
2170
}
2171
2172
if (supportsTouch) {
2173
$(window).bind(eventClass("touchstart"), globalTouchStart);
2174
$(window).bind(eventClass("touchend"), globalTouchEnd);
2175
$this.bind(eventClass("touchstart"), touchStart);
2176
$this.bind(eventClass("touchmove"), touchMove);
2177
$this.bind(eventClass("touchend"), touchEnd);
2178
}
2179
2180
if (supportsIePointer) {
2181
if (window.PointerEvent) {
2182
$(window).bind(eventClass("pointerdown"), globalTouchStart);
2183
$(window).bind(eventClass("pointerup"), globalTouchEnd);
2184
$this.bind(eventClass("pointerdown"), touchStart);
2185
$this.bind(eventClass("pointermove"), touchMove);
2186
$this.bind(eventClass("pointerup"), touchEnd);
2187
} else if (window.MSPointerEvent) {
2188
$(window).bind(eventClass("MSPointerDown"), globalTouchStart);
2189
$(window).bind(eventClass("MSPointerUp"), globalTouchEnd);
2190
$this.bind(eventClass("MSPointerDown"), touchStart);
2191
$this.bind(eventClass("MSPointerMove"), touchMove);
2192
$this.bind(eventClass("MSPointerUp"), touchEnd);
2193
}
2194
}
2195
}
2196
2197
function bindScrollHandler() {
2198
$this.bind(eventClass('scroll'), function (e) {
2199
updateGeometry();
2200
});
2201
}
2202
2203
function destroy() {
2204
$this.unbind(eventClass());
2205
$(window).unbind(eventClass());
2206
$(ownerDocument).unbind(eventClass());
2207
$this.data('perfect-scrollbar', null);
2208
$this.data('perfect-scrollbar-update', null);
2209
$this.data('perfect-scrollbar-destroy', null);
2210
$scrollbarX.remove();
2211
$scrollbarY.remove();
2212
$scrollbarXRail.remove();
2213
$scrollbarYRail.remove();
2214
2215
// clean all variables
2216
$this =
2217
$scrollbarXRail =
2218
$scrollbarYRail =
2219
$scrollbarX =
2220
$scrollbarY =
2221
scrollbarXActive =
2222
scrollbarYActive =
2223
containerWidth =
2224
containerHeight =
2225
contentWidth =
2226
contentHeight =
2227
scrollbarXWidth =
2228
scrollbarXLeft =
2229
scrollbarXBottom =
2230
isScrollbarXUsingBottom =
2231
scrollbarXTop =
2232
scrollbarYHeight =
2233
scrollbarYTop =
2234
scrollbarYRight =
2235
isScrollbarYUsingRight =
2236
scrollbarYLeft =
2237
isRtl =
2238
eventClass = null;
2239
}
2240
2241
var supportsTouch = (('ontouchstart' in window) || window.DocumentTouch && document instanceof window.DocumentTouch);
2242
var supportsIePointer = window.navigator.msMaxTouchPoints !== null;
2243
2244
function initialize() {
2245
updateGeometry();
2246
bindScrollHandler();
2247
bindMouseScrollXHandler();
2248
bindMouseScrollYHandler();
2249
bindRailClickHandler();
2250
bindSelectionHandler();
2251
bindMouseWheelHandler();
2252
2253
if (supportsTouch || supportsIePointer) {
2254
bindTouchHandler(supportsTouch, supportsIePointer);
2255
}
2256
if (settings.useKeyboard) {
2257
bindKeyboardHandler();
2258
}
2259
$this.data('perfect-scrollbar', $this);
2260
$this.data('perfect-scrollbar-update', updateGeometry);
2261
$this.data('perfect-scrollbar-destroy', destroy);
2262
}
2263
2264
initialize();
2265
2266
return $this;
2267
});
2268
};
2269
});
2270
2271
2272
2273
2274
// Unique ID
2275
jQuery.fn.extend({
2276
2277
uniqueId: (function() {
2278
var uuid = 0;
2279
2280
return function() {
2281
return this.each(function() {
2282
if ( !this.id ) {
2283
this.id = "ui-id-" + ( ++uuid );
2284
}
2285
});
2286
};
2287
})(),
2288
});
2289