Replace js libs with compressed variants.
This commit is contained in:
parent
5d584ed2b6
commit
6cd3cf0cb5
16 changed files with 52 additions and 20290 deletions
9190
src/_h5ai/client/js/lib/jquery-2.1.1.js
vendored
9190
src/_h5ai/client/js/lib/jquery-2.1.1.js
vendored
File diff suppressed because it is too large
Load diff
4
src/_h5ai/client/js/lib/jquery-2.1.1.min.js
vendored
Normal file
4
src/_h5ai/client/js/lib/jquery-2.1.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -1,221 +0,0 @@
|
|||
/*! Copyright (c) 2013 Brandon Aaron (http://brandon.aaron.sh)
|
||||
* Licensed under the MIT License (LICENSE.txt).
|
||||
*
|
||||
* Version: 3.1.12
|
||||
*
|
||||
* Requires: jQuery 1.2.2+
|
||||
*/
|
||||
|
||||
(function (factory) {
|
||||
if ( typeof define === 'function' && define.amd ) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['jquery'], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
// Node/CommonJS style for Browserify
|
||||
module.exports = factory;
|
||||
} else {
|
||||
// Browser globals
|
||||
factory(jQuery);
|
||||
}
|
||||
}(function ($) {
|
||||
|
||||
var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'],
|
||||
toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ?
|
||||
['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],
|
||||
slice = Array.prototype.slice,
|
||||
nullLowestDeltaTimeout, lowestDelta;
|
||||
|
||||
if ( $.event.fixHooks ) {
|
||||
for ( var i = toFix.length; i; ) {
|
||||
$.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks;
|
||||
}
|
||||
}
|
||||
|
||||
var special = $.event.special.mousewheel = {
|
||||
version: '3.1.12',
|
||||
|
||||
setup: function() {
|
||||
if ( this.addEventListener ) {
|
||||
for ( var i = toBind.length; i; ) {
|
||||
this.addEventListener( toBind[--i], handler, false );
|
||||
}
|
||||
} else {
|
||||
this.onmousewheel = handler;
|
||||
}
|
||||
// Store the line height and page height for this particular element
|
||||
$.data(this, 'mousewheel-line-height', special.getLineHeight(this));
|
||||
$.data(this, 'mousewheel-page-height', special.getPageHeight(this));
|
||||
},
|
||||
|
||||
teardown: function() {
|
||||
if ( this.removeEventListener ) {
|
||||
for ( var i = toBind.length; i; ) {
|
||||
this.removeEventListener( toBind[--i], handler, false );
|
||||
}
|
||||
} else {
|
||||
this.onmousewheel = null;
|
||||
}
|
||||
// Clean up the data we added to the element
|
||||
$.removeData(this, 'mousewheel-line-height');
|
||||
$.removeData(this, 'mousewheel-page-height');
|
||||
},
|
||||
|
||||
getLineHeight: function(elem) {
|
||||
var $elem = $(elem),
|
||||
$parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent']();
|
||||
if (!$parent.length) {
|
||||
$parent = $('body');
|
||||
}
|
||||
return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16;
|
||||
},
|
||||
|
||||
getPageHeight: function(elem) {
|
||||
return $(elem).height();
|
||||
},
|
||||
|
||||
settings: {
|
||||
adjustOldDeltas: true, // see shouldAdjustOldDeltas() below
|
||||
normalizeOffset: true // calls getBoundingClientRect for each event
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.extend({
|
||||
mousewheel: function(fn) {
|
||||
return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel');
|
||||
},
|
||||
|
||||
unmousewheel: function(fn) {
|
||||
return this.unbind('mousewheel', fn);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function handler(event) {
|
||||
var orgEvent = event || window.event,
|
||||
args = slice.call(arguments, 1),
|
||||
delta = 0,
|
||||
deltaX = 0,
|
||||
deltaY = 0,
|
||||
absDelta = 0,
|
||||
offsetX = 0,
|
||||
offsetY = 0;
|
||||
event = $.event.fix(orgEvent);
|
||||
event.type = 'mousewheel';
|
||||
|
||||
// Old school scrollwheel delta
|
||||
if ( 'detail' in orgEvent ) { deltaY = orgEvent.detail * -1; }
|
||||
if ( 'wheelDelta' in orgEvent ) { deltaY = orgEvent.wheelDelta; }
|
||||
if ( 'wheelDeltaY' in orgEvent ) { deltaY = orgEvent.wheelDeltaY; }
|
||||
if ( 'wheelDeltaX' in orgEvent ) { deltaX = orgEvent.wheelDeltaX * -1; }
|
||||
|
||||
// Firefox < 17 horizontal scrolling related to DOMMouseScroll event
|
||||
if ( 'axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
|
||||
deltaX = deltaY * -1;
|
||||
deltaY = 0;
|
||||
}
|
||||
|
||||
// Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy
|
||||
delta = deltaY === 0 ? deltaX : deltaY;
|
||||
|
||||
// New school wheel delta (wheel event)
|
||||
if ( 'deltaY' in orgEvent ) {
|
||||
deltaY = orgEvent.deltaY * -1;
|
||||
delta = deltaY;
|
||||
}
|
||||
if ( 'deltaX' in orgEvent ) {
|
||||
deltaX = orgEvent.deltaX;
|
||||
if ( deltaY === 0 ) { delta = deltaX * -1; }
|
||||
}
|
||||
|
||||
// No change actually happened, no reason to go any further
|
||||
if ( deltaY === 0 && deltaX === 0 ) { return; }
|
||||
|
||||
// Need to convert lines and pages to pixels if we aren't already in pixels
|
||||
// There are three delta modes:
|
||||
// * deltaMode 0 is by pixels, nothing to do
|
||||
// * deltaMode 1 is by lines
|
||||
// * deltaMode 2 is by pages
|
||||
if ( orgEvent.deltaMode === 1 ) {
|
||||
var lineHeight = $.data(this, 'mousewheel-line-height');
|
||||
delta *= lineHeight;
|
||||
deltaY *= lineHeight;
|
||||
deltaX *= lineHeight;
|
||||
} else if ( orgEvent.deltaMode === 2 ) {
|
||||
var pageHeight = $.data(this, 'mousewheel-page-height');
|
||||
delta *= pageHeight;
|
||||
deltaY *= pageHeight;
|
||||
deltaX *= pageHeight;
|
||||
}
|
||||
|
||||
// Store lowest absolute delta to normalize the delta values
|
||||
absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) );
|
||||
|
||||
if ( !lowestDelta || absDelta < lowestDelta ) {
|
||||
lowestDelta = absDelta;
|
||||
|
||||
// Adjust older deltas if necessary
|
||||
if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
|
||||
lowestDelta /= 40;
|
||||
}
|
||||
}
|
||||
|
||||
// Adjust older deltas if necessary
|
||||
if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
|
||||
// Divide all the things by 40!
|
||||
delta /= 40;
|
||||
deltaX /= 40;
|
||||
deltaY /= 40;
|
||||
}
|
||||
|
||||
// Get a whole, normalized value for the deltas
|
||||
delta = Math[ delta >= 1 ? 'floor' : 'ceil' ](delta / lowestDelta);
|
||||
deltaX = Math[ deltaX >= 1 ? 'floor' : 'ceil' ](deltaX / lowestDelta);
|
||||
deltaY = Math[ deltaY >= 1 ? 'floor' : 'ceil' ](deltaY / lowestDelta);
|
||||
|
||||
// Normalise offsetX and offsetY properties
|
||||
if ( special.settings.normalizeOffset && this.getBoundingClientRect ) {
|
||||
var boundingRect = this.getBoundingClientRect();
|
||||
offsetX = event.clientX - boundingRect.left;
|
||||
offsetY = event.clientY - boundingRect.top;
|
||||
}
|
||||
|
||||
// Add information to the event object
|
||||
event.deltaX = deltaX;
|
||||
event.deltaY = deltaY;
|
||||
event.deltaFactor = lowestDelta;
|
||||
event.offsetX = offsetX;
|
||||
event.offsetY = offsetY;
|
||||
// Go ahead and set deltaMode to 0 since we converted to pixels
|
||||
// Although this is a little odd since we overwrite the deltaX/Y
|
||||
// properties with normalized deltas.
|
||||
event.deltaMode = 0;
|
||||
|
||||
// Add event and delta to the front of the arguments
|
||||
args.unshift(event, delta, deltaX, deltaY);
|
||||
|
||||
// Clearout lowestDelta after sometime to better
|
||||
// handle multiple device types that give different
|
||||
// a different lowestDelta
|
||||
// Ex: trackpad = 3 and mouse wheel = 120
|
||||
if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); }
|
||||
nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200);
|
||||
|
||||
return ($.event.dispatch || $.event.handle).apply(this, args);
|
||||
}
|
||||
|
||||
function nullLowestDelta() {
|
||||
lowestDelta = null;
|
||||
}
|
||||
|
||||
function shouldAdjustOldDeltas(orgEvent, absDelta) {
|
||||
// If this is an older event and the delta is divisable by 120,
|
||||
// then we are assuming that the browser is treating this as an
|
||||
// older mouse wheel event and that we should divide the deltas
|
||||
// by 40 to try and get a more usable deltaFactor.
|
||||
// Side note, this actually impacts the reported scroll distance
|
||||
// in older browsers and can cause scrolling to be slower than native.
|
||||
// Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false.
|
||||
return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0;
|
||||
}
|
||||
|
||||
}));
|
8
src/_h5ai/client/js/lib/jquery.mousewheel-3.1.12.min.js
vendored
Normal file
8
src/_h5ai/client/js/lib/jquery.mousewheel-3.1.12.min.js
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
/*! Copyright (c) 2013 Brandon Aaron (http://brandon.aaron.sh)
|
||||
* Licensed under the MIT License (LICENSE.txt).
|
||||
*
|
||||
* Version: 3.1.12
|
||||
*
|
||||
* Requires: jQuery 1.2.2+
|
||||
*/
|
||||
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a:a(jQuery)}(function(a){function b(b){var g=b||window.event,h=i.call(arguments,1),j=0,l=0,m=0,n=0,o=0,p=0;if(b=a.event.fix(g),b.type="mousewheel","detail"in g&&(m=-1*g.detail),"wheelDelta"in g&&(m=g.wheelDelta),"wheelDeltaY"in g&&(m=g.wheelDeltaY),"wheelDeltaX"in g&&(l=-1*g.wheelDeltaX),"axis"in g&&g.axis===g.HORIZONTAL_AXIS&&(l=-1*m,m=0),j=0===m?l:m,"deltaY"in g&&(m=-1*g.deltaY,j=m),"deltaX"in g&&(l=g.deltaX,0===m&&(j=-1*l)),0!==m||0!==l){if(1===g.deltaMode){var q=a.data(this,"mousewheel-line-height");j*=q,m*=q,l*=q}else if(2===g.deltaMode){var r=a.data(this,"mousewheel-page-height");j*=r,m*=r,l*=r}if(n=Math.max(Math.abs(m),Math.abs(l)),(!f||f>n)&&(f=n,d(g,n)&&(f/=40)),d(g,n)&&(j/=40,l/=40,m/=40),j=Math[j>=1?"floor":"ceil"](j/f),l=Math[l>=1?"floor":"ceil"](l/f),m=Math[m>=1?"floor":"ceil"](m/f),k.settings.normalizeOffset&&this.getBoundingClientRect){var s=this.getBoundingClientRect();o=b.clientX-s.left,p=b.clientY-s.top}return b.deltaX=l,b.deltaY=m,b.deltaFactor=f,b.offsetX=o,b.offsetY=p,b.deltaMode=0,h.unshift(b,j,l,m),e&&clearTimeout(e),e=setTimeout(c,200),(a.event.dispatch||a.event.handle).apply(this,h)}}function c(){f=null}function d(a,b){return k.settings.adjustOldDeltas&&"mousewheel"===a.type&&b%120===0}var e,f,g=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],h="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],i=Array.prototype.slice;if(a.event.fixHooks)for(var j=g.length;j;)a.event.fixHooks[g[--j]]=a.event.mouseHooks;var k=a.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var c=h.length;c;)this.addEventListener(h[--c],b,!1);else this.onmousewheel=b;a.data(this,"mousewheel-line-height",k.getLineHeight(this)),a.data(this,"mousewheel-page-height",k.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var c=h.length;c;)this.removeEventListener(h[--c],b,!1);else this.onmousewheel=null;a.removeData(this,"mousewheel-line-height"),a.removeData(this,"mousewheel-page-height")},getLineHeight:function(b){var c=a(b),d=c["offsetParent"in a.fn?"offsetParent":"parent"]();return d.length||(d=a("body")),parseInt(d.css("fontSize"),10)||parseInt(c.css("fontSize"),10)||16},getPageHeight:function(b){return a(b).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})});
|
File diff suppressed because it is too large
Load diff
2
src/_h5ai/client/js/lib/jquery.qrcode-0.10.1.min.js
vendored
Normal file
2
src/_h5ai/client/js/lib/jquery.qrcode-0.10.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -1,245 +0,0 @@
|
|||
/* jQuery.scrollpanel 0.4.0 - http://larsjung.de/jquery-scrollpanel/ */
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var $ = jQuery;
|
||||
var $window = $(window);
|
||||
|
||||
var name = 'scrollpanel';
|
||||
|
||||
var defaults = {
|
||||
prefix: 'sp-'
|
||||
};
|
||||
|
||||
|
||||
// Scrollpanel
|
||||
// ===========
|
||||
function ScrollPanel(element, options) {
|
||||
|
||||
var self = this;
|
||||
|
||||
// Main reference.
|
||||
self.$el = $(element);
|
||||
|
||||
self.settings = $.extend({}, defaults, options);
|
||||
var prefix = self.settings.prefix;
|
||||
|
||||
// Mouse offset on drag start.
|
||||
self.mouseOffsetY = 0;
|
||||
// Interval ID for automatic scrollbar updates.
|
||||
self.updateId = 0;
|
||||
|
||||
// Proxy to easily bind and unbind this method.
|
||||
self.scrollProxy = $.proxy(self.scroll, self);
|
||||
|
||||
// Make content space relative, if not already.
|
||||
if (!self.$el.css('position') || self.$el.css('position') === 'static') {
|
||||
self.$el.css('position', 'relative');
|
||||
}
|
||||
|
||||
|
||||
// Create scrollbar.
|
||||
self.$scrollbar = $('<div class="' + prefix + 'scrollbar" />');
|
||||
self.$thumb = $('<div class="' + prefix + 'thumb" />').appendTo(self.$scrollbar);
|
||||
|
||||
// Wrap element's content and add scrollbar.
|
||||
self.$el
|
||||
.addClass(prefix + 'host')
|
||||
.wrapInner('<div class="' + prefix + 'viewport"><div class="' + prefix + 'container" /></div>')
|
||||
.append(self.$scrollbar);
|
||||
|
||||
// // Get references.
|
||||
self.$viewport = self.$el.find('> .' + prefix + 'viewport');
|
||||
self.$container = self.$viewport.find('> .' + prefix + 'container');
|
||||
|
||||
|
||||
// Host
|
||||
// ----
|
||||
self.$el
|
||||
|
||||
// Handle mouse wheel.
|
||||
.on('mousewheel', function (event, delta, deltaX, deltaY) {
|
||||
|
||||
self.$viewport.scrollTop(self.$viewport.scrollTop() - 50 * deltaY);
|
||||
self.update();
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
})
|
||||
|
||||
// Handle scrolling.
|
||||
.on('scroll', function () {
|
||||
|
||||
self.update();
|
||||
});
|
||||
|
||||
|
||||
// Viewport
|
||||
// --------
|
||||
self.$viewport
|
||||
|
||||
// Basic styling.
|
||||
.css({
|
||||
paddingRight: self.$scrollbar.outerWidth(true),
|
||||
height: self.$el.height(),
|
||||
overflow: 'hidden'
|
||||
});
|
||||
|
||||
|
||||
// Container
|
||||
// ---------
|
||||
self.$container
|
||||
|
||||
// Basic styling.
|
||||
.css({
|
||||
overflow: 'hidden'
|
||||
});
|
||||
|
||||
|
||||
// Srollbar
|
||||
// --------
|
||||
self.$scrollbar
|
||||
|
||||
// Basic styling.
|
||||
.css({
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
right: 0,
|
||||
overflow: 'hidden'
|
||||
})
|
||||
|
||||
// Handle mouse buttons.
|
||||
.on('mousedown', function (event) {
|
||||
|
||||
self.mouseOffsetY = self.$thumb.outerHeight() / 2;
|
||||
self.onMousedown(event);
|
||||
})
|
||||
|
||||
// Disable selection.
|
||||
.each(function () {
|
||||
|
||||
self.onselectstart = function () {
|
||||
|
||||
return false;
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
// Scrollbar Thumb
|
||||
// ---------------
|
||||
self.$thumb
|
||||
|
||||
// Basic styling.
|
||||
.css({
|
||||
position: 'absolute',
|
||||
left: 0,
|
||||
width: '100%'
|
||||
})
|
||||
|
||||
// Handle mouse buttons.
|
||||
.on('mousedown', function (event) {
|
||||
|
||||
self.mouseOffsetY = event.pageY - self.$thumb.offset().top;
|
||||
self.onMousedown(event);
|
||||
});
|
||||
|
||||
// Initial update.
|
||||
self.update();
|
||||
}
|
||||
|
||||
|
||||
// Scrollpanel methods
|
||||
// ===================
|
||||
$.extend(ScrollPanel.prototype, {
|
||||
|
||||
// Rerender scrollbar.
|
||||
update: function (repeat) {
|
||||
|
||||
var self = this;
|
||||
|
||||
if (self.updateId && !repeat) {
|
||||
clearInterval(self.updateId);
|
||||
self.updateId = 0;
|
||||
} else if (!self.updateId && repeat) {
|
||||
self.updateId = setInterval(function() {
|
||||
self.update(true);
|
||||
}, 50);
|
||||
}
|
||||
|
||||
self.$viewport.css('height', self.$el.height());
|
||||
|
||||
var visibleHeight = self.$el.height(),
|
||||
contentHeight = self.$container.outerHeight(),
|
||||
scrollTop = self.$viewport.scrollTop(),
|
||||
scrollTopFrac = scrollTop / contentHeight,
|
||||
visVertFrac = Math.min(visibleHeight / contentHeight, 1),
|
||||
scrollbarHeight = self.$scrollbar.height();
|
||||
|
||||
if (visVertFrac < 1) {
|
||||
self.$scrollbar
|
||||
.css({
|
||||
height: self.$el.innerHeight() + scrollbarHeight - self.$scrollbar.outerHeight(true)
|
||||
})
|
||||
.fadeIn(50);
|
||||
self.$thumb
|
||||
.css({
|
||||
top: scrollbarHeight * scrollTopFrac,
|
||||
height: scrollbarHeight * visVertFrac
|
||||
});
|
||||
} else {
|
||||
self.$scrollbar.fadeOut(50);
|
||||
}
|
||||
},
|
||||
|
||||
// Scroll content according to mouse position.
|
||||
scroll: function (event) {
|
||||
|
||||
var self = this,
|
||||
clickFrac = (event.pageY - self.$scrollbar.offset().top - self.mouseOffsetY) / self.$scrollbar.height();
|
||||
|
||||
self.$viewport.scrollTop(self.$container.outerHeight() * clickFrac);
|
||||
self.update();
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
},
|
||||
|
||||
// Handle mousedown events on scrollbar.
|
||||
onMousedown: function (event) {
|
||||
|
||||
var self = this;
|
||||
|
||||
self.scroll(event);
|
||||
self.$scrollbar.addClass('active');
|
||||
$window
|
||||
.on('mousemove', self.scrollProxy)
|
||||
.one('mouseup', function (event) {
|
||||
|
||||
self.$scrollbar.removeClass('active');
|
||||
$window.off('mousemove', self.scrollProxy);
|
||||
self.scroll(event);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Register the plug in
|
||||
// --------------------
|
||||
$.fn[name] = function (options, options2) {
|
||||
|
||||
return this.each(function () {
|
||||
|
||||
var $this = $(this);
|
||||
var scrollpanel = $this.data(name);
|
||||
|
||||
if (!scrollpanel) {
|
||||
scrollpanel = new ScrollPanel(this, options);
|
||||
scrollpanel.update();
|
||||
$this.data(name, scrollpanel);
|
||||
}
|
||||
|
||||
if (options === 'update') {
|
||||
scrollpanel.update(options2);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
}());
|
2
src/_h5ai/client/js/lib/jquery.scrollpanel-0.4.0.min.js
vendored
Normal file
2
src/_h5ai/client/js/lib/jquery.scrollpanel-0.4.0.min.js
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
/* jQuery.scrollpanel 0.4.0 - http://larsjung.de/jquery-scrollpanel/ */
|
||||
!function(){"use strict";function o(o,t){var s=this;s.$el=e(o),s.settings=e.extend({},r,t);var n=s.settings.prefix;s.mouseOffsetY=0,s.updateId=0,s.scrollProxy=e.proxy(s.scroll,s),s.$el.css("position")&&"static"!==s.$el.css("position")||s.$el.css("position","relative"),s.$scrollbar=e('<div class="'+n+'scrollbar" />'),s.$thumb=e('<div class="'+n+'thumb" />').appendTo(s.$scrollbar),s.$el.addClass(n+"host").wrapInner('<div class="'+n+'viewport"><div class="'+n+'container" /></div>').append(s.$scrollbar),s.$viewport=s.$el.find("> ."+n+"viewport"),s.$container=s.$viewport.find("> ."+n+"container"),s.$el.on("mousewheel",function(o,e,t,r){s.$viewport.scrollTop(s.$viewport.scrollTop()-50*r),s.update(),o.preventDefault(),o.stopPropagation()}).on("scroll",function(){s.update()}),s.$viewport.css({paddingRight:s.$scrollbar.outerWidth(!0),height:s.$el.height(),overflow:"hidden"}),s.$container.css({overflow:"hidden"}),s.$scrollbar.css({position:"absolute",top:0,right:0,overflow:"hidden"}).on("mousedown",function(o){s.mouseOffsetY=s.$thumb.outerHeight()/2,s.onMousedown(o)}).each(function(){s.onselectstart=function(){return!1}}),s.$thumb.css({position:"absolute",left:0,width:"100%"}).on("mousedown",function(o){s.mouseOffsetY=o.pageY-s.$thumb.offset().top,s.onMousedown(o)}),s.update()}var e=jQuery,t=e(window),s="scrollpanel",r={prefix:"sp-"};e.extend(o.prototype,{update:function(o){var e=this;e.updateId&&!o?(clearInterval(e.updateId),e.updateId=0):!e.updateId&&o&&(e.updateId=setInterval(function(){e.update(!0)},50)),e.$viewport.css("height",e.$el.height());var t=e.$el.height(),s=e.$container.outerHeight(),r=e.$viewport.scrollTop(),n=r/s,i=Math.min(t/s,1),l=e.$scrollbar.height();1>i?(e.$scrollbar.css({height:e.$el.innerHeight()+l-e.$scrollbar.outerHeight(!0)}).fadeIn(50),e.$thumb.css({top:l*n,height:l*i})):e.$scrollbar.fadeOut(50)},scroll:function(o){var e=this,t=(o.pageY-e.$scrollbar.offset().top-e.mouseOffsetY)/e.$scrollbar.height();e.$viewport.scrollTop(e.$container.outerHeight()*t),e.update(),o.preventDefault(),o.stopPropagation()},onMousedown:function(o){var e=this;e.scroll(o),e.$scrollbar.addClass("active"),t.on("mousemove",e.scrollProxy).one("mouseup",function(o){e.$scrollbar.removeClass("active"),t.off("mousemove",e.scrollProxy),e.scroll(o)})}}),e.fn[s]=function(t,r){return this.each(function(){var n=e(this),i=n.data(s);i||(i=new o(this,t),i.update(),n.data(s,i)),"update"===t&&i.update(r)})}}();
|
File diff suppressed because it is too large
Load diff
28
src/_h5ai/client/js/lib/lodash-custom-2.4.1.min.js
vendored
Normal file
28
src/_h5ai/client/js/lib/lodash-custom-2.4.1.min.js
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
/**
|
||||
* @license
|
||||
* Lo-Dash 2.4.1 (Custom Build) lodash.com/license | Underscore.js 1.5.2 underscorejs.org/LICENSE
|
||||
* Build: `lodash exports="global" include="compact,contains,difference,each,extend,filter,indexOf,intersection,isFunction,isNumber,isString,keys,map,pluck,sortBy,values,without"`
|
||||
*/
|
||||
;(function(){function D(a,b,d){d=(d||0)-1;for(var c=a?a.length:0;++d<c;)if(a[d]===b)return d;return-1}function Y(a,b){var d=typeof b;a=a.l;if("boolean"==d||null==b)return a[b]?0:-1;"number"!=d&&"string"!=d&&(d="object");var c="number"==d?b:oa+b;a=(a=a[d])&&a[c];return"object"==d?a&&-1<D(a,b)?0:-1:a?0:-1}function Ma(a){var b=this.l,d=typeof a;if("boolean"==d||null==a)b[a]=true;else{"number"!=d&&"string"!=d&&(d="object");var c="number"==d?a:oa+a,b=b[d]||(b[d]={});"object"==d?(b[c]||(b[c]=[])).push(a):
|
||||
b[c]=true}}function Na(a,b){for(var d=a.m,c=b.m,e=-1,h=d.length;++e<h;){var g=d[e],l=c[e];if(g!==l){if(g>l||typeof g=="undefined")return 1;if(g<l||typeof l=="undefined")return-1}}return a.n-b.n}function pa(a){var b=-1,d=a.length,c=a[0],e=a[d/2|0],h=a[d-1];if(c&&typeof c=="object"&&e&&typeof e=="object"&&h&&typeof h=="object")return false;c=Z();c["false"]=c["null"]=c["true"]=c.undefined=false;e=Z();e.k=a;e.l=c;for(e.push=Ma;++b<d;)e.push(a[b]);return e}function E(){return $.pop()||[]}function Z(){return aa.pop()||
|
||||
{k:null,l:null,m:null,"false":false,n:0,"null":false,number:null,object:null,push:null,string:null,"true":false,undefined:false,o:null}}function F(a){a.length=0;$.length<qa&&$.push(a)}function L(a){var b=a.l;b&&L(b);a.k=a.l=a.m=a.object=a.number=a.string=a.o=null;aa.length<qa&&aa.push(a)}function y(a,b){var d;b||(b=0);typeof d=="undefined"&&(d=a?a.length:0);var c=-1;d=d-b||0;for(var e=Array(0>d?0:d);++c<d;)e[c]=a[b+c];return e}function f(){}function Oa(a){function b(){if(c){var a=y(c);M.apply(a,arguments)}if(this instanceof
|
||||
b){var g=ba(d.prototype),a=d.apply(g,a||arguments);return A(a)?a:g}return d.apply(e,a||arguments)}var d=a[0],c=a[2],e=a[4];ca(b,a);return b}function ba(a){return A(a)?N(a):{}}function ra(a,b,d){if(typeof a!="function")return da;if(typeof b=="undefined"||!("prototype"in a))return a;var c=a.__bindData__;if(typeof c=="undefined"&&(n.funcNames&&(c=!a.name),c=c||!n.funcDecomp,!c)){var e=Pa.call(a);n.funcNames||(c=!Qa.test(e));c||(c=sa.test(e),ca(a,c))}if(false===c||true!==c&&c[1]&1)return a;switch(d){case 1:return function(c){return a.call(b,
|
||||
c)};case 2:return function(c,d){return a.call(b,c,d)};case 3:return function(c,d,e){return a.call(b,c,d,e)};case 4:return function(c,d,e,f){return a.call(b,c,d,e,f)}}return ta(a,b)}function ua(a){function b(){var a=f?g:this;if(e){var s=y(e);M.apply(s,arguments)}if(h||m)if(s||(s=y(arguments)),h&&M.apply(s,h),m&&s.length<l)return c|=16,ua([d,n?c:c&-4,s,null,g,l]);s||(s=arguments);p&&(d=a[r]);return this instanceof b?(a=ba(d.prototype),s=d.apply(a,s),A(s)?s:a):d.apply(a,s)}var d=a[0],c=a[1],e=a[2],h=
|
||||
a[3],g=a[4],l=a[5],f=c&1,p=c&2,m=c&4,n=c&8,r=d;ca(b,a);return b}function va(a,b){var d=-1,c=ea(),e=a?a.length:0,h=e>=wa&&c===D,g=[];if(h){var l=pa(b);l?(c=Y,b=l):h=false}for(;++d<e;)l=a[d],0>c(b,l)&&g.push(l);h&&L(b);return g}function xa(a,b,d,c){c=(c||0)-1;for(var e=a?a.length:0,h=[];++c<e;){var g=a[c];if(g&&typeof g=="object"&&typeof g.length=="number"&&(w(g)||z(g))){b||(g=xa(g,b,d));var l=-1,f=g.length,p=h.length;for(h.length+=f;++l<f;)h[p++]=g[l]}else d||h.push(g)}return h}function G(a,b,d,c,e,h){if(d){var g=
|
||||
d(a,b);if(typeof g!="undefined")return!!g}if(a===b)return 0!==a||1/a==1/b;if(a===a&&!(a&&B[typeof a]||b&&B[typeof b]))return false;if(null==a||null==b)return a===b;var l=u.call(a),f=u.call(b);l==O&&(l=P);f==O&&(f=P);if(l!=f)return false;switch(l){case ya:case za:return+a==+b;case fa:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case Aa:case Q:return a==String(b)}f=l==ga;if(!f){var p=x.call(a,"__wrapped__"),m=x.call(b,"__wrapped__");if(p||m)return G(p?a.__wrapped__:a,m?b.__wrapped__:b,d,c,e,h);if(l!=P)return false;l=
|
||||
!n.argsObject&&z(a)?Object:a.constructor;p=!n.argsObject&&z(b)?Object:b.constructor;if(l!=p&&!(C(l)&&l instanceof l&&C(p)&&p instanceof p)&&"constructor"in a&&"constructor"in b)return false}l=!e;e||(e=E());h||(h=E());for(p=e.length;p--;)if(e[p]==a)return h[p]==b;var q=0,g=true;e.push(a);h.push(b);if(f){if(p=a.length,q=b.length,(g=q==p)||c)for(;q--;)if(f=p,m=b[q],c)for(;f--&&!(g=G(a[f],m,d,c,e,h)););else if(!(g=G(a[q],m,d,c,e,h)))break}else ha(b,function(b,l,f){if(x.call(f,l))return q++,g=x.call(a,l)&&G(a[l],
|
||||
b,d,c,e,h)}),g&&!c&&ha(a,function(a,b,c){if(x.call(c,b))return g=-1<--q});e.pop();h.pop();l&&(F(e),F(h));return g}function ia(a,b,d,c,e,h){var g=b&1,l=b&4,f=b&16,p=b&32;if(!(b&2||C(a)))throw new TypeError;f&&!d.length&&(b&=-17,f=d=false);p&&!c.length&&(b&=-33,p=c=false);var m=a&&a.__bindData__;return m&&true!==m?(m=y(m),m[2]&&(m[2]=y(m[2])),m[3]&&(m[3]=y(m[3])),!g||m[1]&1||(m[4]=e),!g&&m[1]&1&&(b|=8),!l||m[1]&4||(m[5]=h),f&&M.apply(m[2]||(m[2]=[]),d),p&&Ra.apply(m[3]||(m[3]=[]),c),m[1]|=b,ia.apply(null,m)):
|
||||
(1==b||17===b?Oa:ua)([a,b,d,c,e,h])}function R(){t.h=ja;t.b=t.c=t.g=t.i="";t.e="t";t.j=true;for(var a,b=0;a=arguments[b];b++)for(var d in a)t[d]=a[d];b=t.a;t.d=/^[^,]+/.exec(b)[0];a=Function;b="return function("+b+"){";d=t;var c="var n,t="+d.d+",E="+d.e+";if(!t)return E;"+d.i+";";d.b?(c+="var u=t.length;n=-1;if("+d.b+"){",n.unindexedChars&&(c+="if(s(t)){t=t.split('')}"),c+="while(++n<u){"+d.g+";}}else{"):n.nonEnumArgs&&(c+="var u=t.length;n=-1;if(u&&p(t)){while(++n<u){n+='';"+d.g+";}}else{");n.enumPrototypes&&
|
||||
(c+="var G=typeof t=='function';");n.enumErrorProps&&(c+="var F=t===k||t instanceof Error;");var e=[];n.enumPrototypes&&e.push('!(G&&n=="prototype")');n.enumErrorProps&&e.push('!(F&&(n=="message"||n=="name"))');if(d.j&&d.f)c+="var C=-1,D=B[typeof t]&&v(t),u=D?D.length:0;while(++C<u){n=D[C];",e.length&&(c+="if("+e.join("&&")+"){"),c+=d.g+";",e.length&&(c+="}"),c+="}";else if(c+="for(n in t){",d.j&&e.push("m.call(t, n)"),e.length&&(c+="if("+e.join("&&")+"){"),c+=d.g+";",e.length&&(c+="}"),c+="}",n.nonEnumShadows){c+=
|
||||
"if(t!==A){var i=t.constructor,r=t===(i&&i.prototype),f=t===J?I:t===k?j:L.call(t),x=y[f];";for(k=0;7>k;k++)c+="n='"+d.h[k]+"';if((!(r&&x[n])&&m.call(t,n))",d.j||(c+="||(!x[n]&&t[n]!==A[n])"),c+="){"+d.g+"}";c+="}"}if(d.b||n.nonEnumArgs)c+="}";c+=d.c+";return E";return a("d,j,k,m,o,p,q,s,v,A,B,y,I,J,L",b+c+"}")(ra,Ba,ka,x,Sa,z,w,la,t.f,S,B,r,Q,Ta,u)}function ea(){var a=(a=f.indexOf)===Ca?D:a;return a}function H(a){return typeof a=="function"&&Ua.test(a)}function z(a){return a&&typeof a=="object"&&typeof a.length=="number"&&u.call(a)==O||false}function C(a){return typeof a=="function"}function A(a){return!(!a||!B[typeof a])}function la(a){return typeof a=="string"||a&&typeof a=="object"&&u.call(a)==Q||false}function Da(a,b,d){var c=-1,e=ea(),f=a?a.length:0,g=false;d=(0>d?Ea(0,f+d):d)||0;w(a)?g=-1<e(a,b,d):typeof f=="number"?g=-1<(la(a)?a.indexOf(b,d):e(a,b,d)):T(a,function(a){if(++c>=d)return!(g=a===b)});return g}function Fa(a,b,d){var c=[];b=f.createCallback(b,d,3);if(w(a)){d=-1;for(var e=a.length;++d<e;){var h=
|
||||
a[d];b(h,d,a)&&c.push(h)}}else T(a,function(a,d,e){b(a,d,e)&&c.push(a)});return c}function ma(a,b,d){if(b&&typeof d=="undefined"&&w(a)){d=-1;for(var c=a.length;++d<c&&false!==b(a[d],d,a););}else T(a,b,d);return a}function U(a,b,d){var c=-1,e=a?a.length:0,h=Array(typeof e=="number"?e:0);b=f.createCallback(b,d,3);if(w(a))for(;++c<e;)h[c]=b(a[c],c,a);else T(a,function(a,d,e){h[++c]=b(a,d,e)});return h}function Ca(a,b,d){if(typeof d=="number"){var c=a?a.length:0;d=0>d?Ea(0,c+d):d||0}else if(d)return d=Ga(a,
|
||||
b),a[d]===b?d:-1;return D(a,b,d)}function Ga(a,b,d,c){var e=0,h=a?a.length:e;d=d?f.createCallback(d,c,1):da;for(b=d(b);e<h;)c=e+h>>>1,d(a[c])<b?e=c+1:h=c;return e}function ta(a,b){return 2<arguments.length?ia(a,17,y(arguments,2),null,b):ia(a,1,null,null,b)}function da(a){return a}function Ha(){}function Ia(a){return function(b){return b[a]}}var $=[],aa=[],Sa={},oa=+new Date+"",wa=75,qa=40,Qa=/^\s*function[ \n\r\t]+\w/,sa=/\bthis\b/,ja="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),
|
||||
O="[object Arguments]",ga="[object Array]",ya="[object Boolean]",za="[object Date]",Ba="[object Error]",fa="[object Number]",P="[object Object]",Aa="[object RegExp]",Q="[object String]",Ja={configurable:false,enumerable:false,value:null,writable:false},t={a:"",b:null,c:"",d:"",e:"",v:null,g:"",h:null,support:null,i:"",j:false},B={"boolean":false,"function":true,object:true,number:false,string:false,undefined:false},V=B[typeof window]&&window||this,v=B[typeof global]&&global;!v||v.global!==v&&v.window!==v||(V=v);var na=[],ka=
|
||||
Error.prototype,S=Object.prototype,Ta=String.prototype,u=S.toString,Ua=RegExp("^"+String(u).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),Pa=Function.prototype.toString,x=S.hasOwnProperty,M=na.push,W=S.propertyIsEnumerable,Ra=na.unshift,Ka=function(){try{var a={},b=H(b=Object.defineProperty)&&b,d=b(a,a,a)&&b}catch(c){}return d}(),N=H(N=Object.create)&&N,I=H(I=Array.isArray)&&I,X=H(X=Object.keys)&&X,Ea=Math.max,r={};r[ga]=r[za]=r[fa]={constructor:true,toLocaleString:true,
|
||||
toString:true,valueOf:true};r[ya]=r[Q]={constructor:true,toString:true,valueOf:true};r[Ba]=r["[object Function]"]=r[Aa]={constructor:true,toString:true};r[P]={constructor:true};(function(){for(var a=ja.length;a--;){var b=ja[a],d;for(d in r)x.call(r,d)&&!x.call(r[d],b)&&(r[d][b]=false)}})();var n=f.support={};(function(){function a(){this.x=1}var b={0:1,length:1},d=[];a.prototype={valueOf:1,y:1};for(var c in new a)d.push(c);for(c in arguments);n.argsClass=u.call(arguments)==O;n.argsObject=arguments.constructor==Object&&
|
||||
!(arguments instanceof Array);n.enumErrorProps=W.call(ka,"message")||W.call(ka,"name");n.enumPrototypes=W.call(a,"prototype");n.funcDecomp=!H(V.p)&&sa.test(function(){return this});n.funcNames=typeof Function.name=="string";n.nonEnumArgs=0!=c;n.nonEnumShadows=!/valueOf/.test(d);n.spliceObjects=(na.splice.call(b,0,1),!b[0]);n.unindexedChars="xx"!="x"[0]+Object("x")[0]})(1);N||(ba=function(){function a(){}return function(b){if(A(b)){a.prototype=b;var d=new a;a.prototype=null}return d||V.Object()}}());
|
||||
var ca=Ka?function(a,b){Ja.value=b;Ka(a,"__bindData__",Ja)}:Ha;n.argsClass||(z=function(a){return a&&typeof a=="object"&&typeof a.length=="number"&&x.call(a,"callee")&&!W.call(a,"callee")||false});var w=I||function(a){return a&&typeof a=="object"&&typeof a.length=="number"&&u.call(a)==ga||false},La=R({a:"z",e:"[]",i:"if(!(B[typeof z]))return E",g:"E.push(n)"}),J=X?function(a){return A(a)?n.enumPrototypes&&typeof a=="function"||n.nonEnumArgs&&a.length&&z(a)?La(a):X(a):[]}:La,v={a:"g,e,K",i:"e=e&&typeof K=='undefined'?e:d(e,K,3)",
|
||||
b:"typeof u=='number'",v:J,g:"if(e(t[n],n,g)===false)return E"},K={a:"z,H,l",i:"var a=arguments,b=0,c=typeof l=='number'?2:a.length;while(++b<c){t=a[b];if(t&&B[typeof t]){",v:J,g:"if(typeof E[n]=='undefined')E[n]=t[n]",c:"}}"},I={i:"if(!B[typeof t])return E;"+v.i,b:false},T=R(v),K=R(K,{i:K.i.replace(";",";if(c>3&&typeof a[c-2]=='function'){var e=d(a[--c-1],a[c--],2)}else if(c>2&&typeof a[c-1]=='function'){e=a[--c]}"),g:"E[n]=e?e(E[n],t[n]):t[n]"}),ha=R(v,I,{j:false});C(/x/)&&(C=function(a){return typeof a=="function"&&"[object Function]"==u.call(a)});f.assign=K;f.bind=ta;f.compact=function(a){for(var b=-1,d=a?a.length:0,c=[];++b<d;){var e=a[b];e&&c.push(e)}return c};f.createCallback=function(a,b,d){var c=typeof a;if(null==a||"function"==c)return ra(a,b,d);if("object"!=c)return Ia(a);var e=J(a),f=e[0],g=a[f];return 1!=e.length||g!==g||A(g)?function(b){for(var c=e.length,d=false;c--&&(d=G(b[e[c]],a[e[c]],null,true)););return d}:function(a){a=a[f];return g===a&&(0!==g||1/g==1/a)}};f.difference=function(a){return va(a,
|
||||
xa(arguments,true,true,1))};f.filter=Fa;f.forEach=ma;f.forIn=ha;f.intersection=function(){for(var a=[],b=-1,d=arguments.length,c=E(),e=ea(),f=e===D,g=E();++b<d;){var l=arguments[b];if(w(l)||z(l))a.push(l),c.push(f&&l.length>=wa&&pa(b?a[b]:g))}var f=a[0],n=-1,p=f?f.length:0,m=[];a:for(;++n<p;){var q=c[0],l=f[n];if(0>(q?Y(q,l):e(g,l))){b=d;for((q||g).push(l);--b;)if(q=c[b],0>(q?Y(q,l):e(a[b],l)))continue a;m.push(l)}}for(;d--;)(q=c[d])&&L(q);F(c);F(g);return m};f.keys=J;f.map=U;f.pluck=U;f.property=Ia;
|
||||
f.sortBy=function(a,b,d){var c=-1,e=w(b),h=a?a.length:0,g=Array(typeof h=="number"?h:0);e||(b=f.createCallback(b,d,3));ma(a,function(a,d,f){var h=g[++c]=Z();e?h.m=U(b,function(b){return a[b]}):(h.m=E())[0]=b(a,d,f);h.n=c;h.o=a});h=g.length;for(g.sort(Na);h--;)a=g[h],g[h]=a.o,e||F(a.m),L(a);return g};f.values=function(a){for(var b=-1,d=J(a),c=d.length,e=Array(c);++b<c;)e[b]=a[d[b]];return e};f.without=function(a){return va(a,y(arguments,1))};f.collect=U;f.each=ma;f.extend=K;f.select=Fa;f.contains=
|
||||
Da;f.identity=da;f.indexOf=Ca;f.isArguments=z;f.isArray=w;f.isFunction=C;f.isNumber=function(a){return typeof a=="number"||a&&typeof a=="object"&&u.call(a)==fa||false};f.isObject=A;f.isString=la;f.noop=Ha;f.sortedIndex=Ga;f.include=Da;f.VERSION="2.4.1";V._=f}.call(this));
|
File diff suppressed because it is too large
Load diff
6
src/_h5ai/client/js/lib/marked-0.3.2.min.js
vendored
Normal file
6
src/_h5ai/client/js/lib/marked-0.3.2.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -1,291 +0,0 @@
|
|||
/* modulejs 1.4.0 - http://larsjung.de/modulejs/ */
|
||||
(function (global) {
|
||||
'use strict';
|
||||
|
||||
var name = 'modulejs';
|
||||
|
||||
// # Util
|
||||
|
||||
// References.
|
||||
var objectPrototype = Object.prototype;
|
||||
var arrayForEach = Array.prototype.forEach;
|
||||
|
||||
// Returns a function that returns `true` if `arg` is of the correct `type`, otherwise `false`.
|
||||
function createIsTypeFn(type) {
|
||||
|
||||
return function (arg) {
|
||||
|
||||
return objectPrototype.toString.call(arg) === '[object ' + type + ']';
|
||||
};
|
||||
}
|
||||
|
||||
// ## isString
|
||||
// Returns `true` if argument is a string, otherwise `false`.
|
||||
var isString = createIsTypeFn('String');
|
||||
|
||||
// ## isFunction
|
||||
// Returns `true` if argument is a function, otherwise `false`.
|
||||
var isFunction = createIsTypeFn('Function');
|
||||
|
||||
// ## isArray
|
||||
// Returns `true` if argument is an array, otherwise `false`.
|
||||
var isArray = Array.isArray || createIsTypeFn('Array');
|
||||
|
||||
// ## isObject
|
||||
// Returns `true` if argument is an object, otherwise `false`.
|
||||
function isObject(arg) {
|
||||
|
||||
return arg === new Object(arg);
|
||||
}
|
||||
|
||||
// ## has
|
||||
// Short cut for `hasOwnProperty`.
|
||||
function has(arg, id) {
|
||||
|
||||
return objectPrototype.hasOwnProperty.call(arg, id);
|
||||
}
|
||||
|
||||
// ## each
|
||||
// Iterates over all elements af an array or all own keys of an object.
|
||||
function each(obj, iterator, context) {
|
||||
|
||||
if (arrayForEach && obj.forEach === arrayForEach) {
|
||||
obj.forEach(iterator, context);
|
||||
} else if (obj.length === +obj.length) {
|
||||
for (var i = 0, l = obj.length; i < l; i += 1) {
|
||||
iterator.call(context, obj[i], i, obj);
|
||||
}
|
||||
} else {
|
||||
for (var key in obj) {
|
||||
if (has(obj, key)) {
|
||||
iterator.call(context, obj[key], key, obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ## contains
|
||||
// Returns `true` if array contains element, otherwise `false`.
|
||||
function contains(array, element) {
|
||||
|
||||
for (var i = 0, l = array.length; i < l; i += 1) {
|
||||
if (array[i] === element) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// ## uniq
|
||||
// Returns an new array containing no duplicates. Preserves first occurence and order.
|
||||
function uniq(array) {
|
||||
|
||||
var elements = {};
|
||||
var result = [];
|
||||
|
||||
each(array, function (el) {
|
||||
|
||||
if (!has(elements, el)) {
|
||||
result.push(el);
|
||||
elements[el] = 1;
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// ## err
|
||||
// Throws an error if `condition` is `true`.
|
||||
function err(condition, code, message) {
|
||||
|
||||
if (condition) {
|
||||
throw {
|
||||
// machine readable
|
||||
code: code,
|
||||
|
||||
// human readable
|
||||
msg: message,
|
||||
|
||||
// let it be helpful in consoles
|
||||
toString: function () {
|
||||
|
||||
return name + ' error ' + code + ': ' + message;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// # Private
|
||||
|
||||
// ## definitions
|
||||
// Module definitions.
|
||||
var definitions = {};
|
||||
|
||||
// ## instances
|
||||
// Module instances.
|
||||
var instances = {};
|
||||
|
||||
// ## resolve
|
||||
// Resolves an `id` to an object, or if `onlyDepIds` is `true` only returns dependency-ids.
|
||||
// `stack` is used internal to check for circular dependencies.
|
||||
function resolve(id, onlyDepIds, stack) {
|
||||
|
||||
// check arguments
|
||||
err(!isString(id), 31, 'id must be a string "' + id + '"');
|
||||
|
||||
// if a module is required that was already created return that object
|
||||
if (!onlyDepIds && has(instances, id)) {
|
||||
return instances[id];
|
||||
}
|
||||
|
||||
// check if `id` is defined
|
||||
var def = definitions[id];
|
||||
err(!def, 32, 'id not defined "' + id + '"');
|
||||
|
||||
// copy resolve stack and add this `id`
|
||||
stack = (stack || []).slice(0);
|
||||
stack.push(id);
|
||||
|
||||
// if onlyDepIds this will hold the dependency-ids, otherwise it will hold the dependency-objects
|
||||
var deps = [];
|
||||
|
||||
each(def.deps, function (depId) {
|
||||
|
||||
// check for circular dependencies
|
||||
err(contains(stack, depId), 33, 'circular dependencies: ' + stack + ' & ' + depId);
|
||||
|
||||
if (onlyDepIds) {
|
||||
deps = deps.concat(resolve(depId, onlyDepIds, stack));
|
||||
deps.push(depId);
|
||||
} else {
|
||||
deps.push(resolve(depId, onlyDepIds, stack));
|
||||
}
|
||||
});
|
||||
|
||||
// if `onlyDepIds` return only dependency-ids in right order
|
||||
if (onlyDepIds) {
|
||||
return uniq(deps);
|
||||
}
|
||||
|
||||
// create, memorize and return object
|
||||
var obj = def.fn.apply(global, deps);
|
||||
instances[id] = obj;
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// # Public
|
||||
|
||||
// ## define
|
||||
// Defines a module for `id: String`, optional `deps: Array[String]`,
|
||||
// `arg: Object/function`.
|
||||
function define(id, deps, arg) {
|
||||
|
||||
// sort arguments
|
||||
if (arg === undefined) {
|
||||
arg = deps;
|
||||
deps = [];
|
||||
}
|
||||
// check arguments
|
||||
err(!isString(id), 11, 'id must be a string "' + id + '"');
|
||||
err(definitions[id], 12, 'id already defined "' + id + '"');
|
||||
err(!isArray(deps), 13, 'dependencies for "' + id + '" must be an array "' + deps + '"');
|
||||
err(!isObject(arg) && !isFunction(arg), 14, 'arg for "' + id + '" must be object or function "' + arg + '"');
|
||||
|
||||
// accept definition
|
||||
definitions[id] = {
|
||||
id: id,
|
||||
deps: deps,
|
||||
fn: isFunction(arg) ? arg : function () { return arg; }
|
||||
};
|
||||
}
|
||||
|
||||
// ## require
|
||||
// Returns an instance for `id`.
|
||||
function require(id) {
|
||||
|
||||
return resolve(id);
|
||||
}
|
||||
|
||||
// ## state
|
||||
// Returns an object that holds infos about the current definitions and dependencies.
|
||||
function state() {
|
||||
|
||||
var res = {};
|
||||
|
||||
each(definitions, function (def, id) {
|
||||
|
||||
res[id] = {
|
||||
|
||||
// direct dependencies
|
||||
deps: def.deps.slice(0),
|
||||
|
||||
// transitive dependencies
|
||||
reqs: resolve(id, true),
|
||||
|
||||
// already initiated/required
|
||||
init: has(instances, id)
|
||||
};
|
||||
});
|
||||
|
||||
each(definitions, function (def, id) {
|
||||
|
||||
var inv = [];
|
||||
each(definitions, function (def2, id2) {
|
||||
|
||||
if (contains(res[id2].reqs, id)) {
|
||||
inv.push(id2);
|
||||
}
|
||||
});
|
||||
|
||||
// all inverse dependencies
|
||||
res[id].reqd = inv;
|
||||
});
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
// ## log
|
||||
// Returns a string that displays module dependencies.
|
||||
function log(inv) {
|
||||
|
||||
var out = '\n';
|
||||
|
||||
each(state(), function (st, id) {
|
||||
|
||||
var list = inv ? st.reqd : st.reqs;
|
||||
out += (st.init ? '* ' : ' ') + id + ' -> [ ' + list.join(', ') + ' ]\n';
|
||||
});
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// # Publish
|
||||
|
||||
global[name] = {
|
||||
define: define,
|
||||
require: require,
|
||||
state: state,
|
||||
log: log,
|
||||
_private: {
|
||||
isString: isString,
|
||||
isFunction: isFunction,
|
||||
isArray: isArray,
|
||||
isObject: isObject,
|
||||
has: has,
|
||||
each: each,
|
||||
contains: contains,
|
||||
uniq: uniq,
|
||||
err: err,
|
||||
definitions: definitions,
|
||||
instances: instances,
|
||||
resolve: resolve
|
||||
}
|
||||
};
|
||||
|
||||
}(this));
|
2
src/_h5ai/client/js/lib/modulejs-1.4.0.min.js
vendored
Normal file
2
src/_h5ai/client/js/lib/modulejs-1.4.0.min.js
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
/* modulejs 1.4.0 - http://larsjung.de/modulejs/ */
|
||||
!function(n){"use strict";function r(n){return function(r){return h.toString.call(r)==="[object "+n+"]"}}function t(n){return n===new Object(n)}function e(n,r){return h.hasOwnProperty.call(n,r)}function i(n,r,t){if(v&&n.forEach===v)n.forEach(r,t);else if(n.length===+n.length)for(var i=0,o=n.length;o>i;i+=1)r.call(t,n[i],i,n);else for(var u in n)e(n,u)&&r.call(t,n[u],u,n)}function o(n,r){for(var t=0,e=n.length;e>t;t+=1)if(n[t]===r)return!0;return!1}function u(n){var r={},t=[];return i(n,function(n){e(r,n)||(t.push(n),r[n]=1)}),t}function c(n,r,t){if(n)throw{code:r,msg:t,toString:function(){return p+" error "+r+": "+t}}}function f(r,t,a){if(c(!g(r),31,'id must be a string "'+r+'"'),!t&&e(q,r))return q[r];var s=j[r];c(!s,32,'id not defined "'+r+'"'),a=(a||[]).slice(0),a.push(r);var d=[];if(i(s.deps,function(n){c(o(a,n),33,"circular dependencies: "+a+" & "+n),t?(d=d.concat(f(n,t,a)),d.push(n)):d.push(f(n,t,a))}),t)return u(d);var l=s.fn.apply(n,d);return q[r]=l,l}function a(n,r,e){void 0===e&&(e=r,r=[]),c(!g(n),11,'id must be a string "'+n+'"'),c(j[n],12,'id already defined "'+n+'"'),c(!b(r),13,'dependencies for "'+n+'" must be an array "'+r+'"'),c(!t(e)&&!y(e),14,'arg for "'+n+'" must be object or function "'+e+'"'),j[n]={id:n,deps:r,fn:y(e)?e:function(){return e}}}function s(n){return f(n)}function d(){var n={};return i(j,function(r,t){n[t]={deps:r.deps.slice(0),reqs:f(t,!0),init:e(q,t)}}),i(j,function(r,t){var e=[];i(j,function(r,i){o(n[i].reqs,t)&&e.push(i)}),n[t].reqd=e}),n}function l(n){var r="\n";return i(d(),function(t,e){var i=n?t.reqd:t.reqs;r+=(t.init?"* ":" ")+e+" -> [ "+i.join(", ")+" ]\n"}),r}var p="modulejs",h=Object.prototype,v=Array.prototype.forEach,g=r("String"),y=r("Function"),b=Array.isArray||r("Array"),j={},q={};n[p]={define:a,require:s,state:d,log:l,_private:{isString:g,isFunction:y,isArray:b,isObject:t,has:e,each:i,contains:o,uniq:u,err:c,definitions:j,instances:q,resolve:f}}}(this);
|
Loading…
Add table
Reference in a new issue