Merge pull request #126 from XhmikosR/jquery

update 3rd party libs
This commit is contained in:
Lars Jung 2012-10-05 06:20:02 -07:00
commit e0fb8b3285
17 changed files with 14420 additions and 362 deletions

View File

@ -13,7 +13,7 @@ It profits from these great projects:
[AmplifyJS](http://amplifyjs.com) (MIT/GPL),
[Faenza icon set](http://tiheum.deviantart.com/art/Faenza-Icons-173323228) (GPL),
[HTML5 ★ Boilerplate](http://html5boilerplate.com) (MIT),
[jQuery](http://jquery.com) (MIT/GPL),
[jQuery](http://jquery.com) (MIT),
[jQuery.fracs](http://larsjung.de/fracs/) (MIT),
[jQuery.mousewheel](http://github.com/brandonaaron/jquery-mousewheel) (MIT),
[jQuery.qrcode](http://larsjung.de/qrcode/) (MIT),

View File

@ -0,0 +1,788 @@
/*!
* AmplifyJS 1.1.0 - Core, Store, Request
*
* Copyright 2011 appendTo LLC. (http://appendto.com/team)
* Dual licensed under the MIT or GPL licenses.
* http://appendto.com/open-source-licenses
*
* http://amplifyjs.com
*/
/*!
* Amplify Core 1.1.0
*
* Copyright 2011 appendTo LLC. (http://appendto.com/team)
* Dual licensed under the MIT or GPL licenses.
* http://appendto.com/open-source-licenses
*
* http://amplifyjs.com
*/
(function( global, undefined ) {
var slice = [].slice,
subscriptions = {};
var amplify = global.amplify = {
publish: function( topic ) {
var args = slice.call( arguments, 1 ),
topicSubscriptions,
subscription,
length,
i = 0,
ret;
if ( !subscriptions[ topic ] ) {
return true;
}
topicSubscriptions = subscriptions[ topic ].slice();
for ( length = topicSubscriptions.length; i < length; i++ ) {
subscription = topicSubscriptions[ i ];
ret = subscription.callback.apply( subscription.context, args );
if ( ret === false ) {
break;
}
}
return ret !== false;
},
subscribe: function( topic, context, callback, priority ) {
if ( arguments.length === 3 && typeof callback === "number" ) {
priority = callback;
callback = context;
context = null;
}
if ( arguments.length === 2 ) {
callback = context;
context = null;
}
priority = priority || 10;
var topicIndex = 0,
topics = topic.split( /\s/ ),
topicLength = topics.length,
added;
for ( ; topicIndex < topicLength; topicIndex++ ) {
topic = topics[ topicIndex ];
added = false;
if ( !subscriptions[ topic ] ) {
subscriptions[ topic ] = [];
}
var i = subscriptions[ topic ].length - 1,
subscriptionInfo = {
callback: callback,
context: context,
priority: priority
};
for ( ; i >= 0; i-- ) {
if ( subscriptions[ topic ][ i ].priority <= priority ) {
subscriptions[ topic ].splice( i + 1, 0, subscriptionInfo );
added = true;
break;
}
}
if ( !added ) {
subscriptions[ topic ].unshift( subscriptionInfo );
}
}
return callback;
},
unsubscribe: function( topic, callback ) {
if ( !subscriptions[ topic ] ) {
return;
}
var length = subscriptions[ topic ].length,
i = 0;
for ( ; i < length; i++ ) {
if ( subscriptions[ topic ][ i ].callback === callback ) {
subscriptions[ topic ].splice( i, 1 );
break;
}
}
}
};
}( this ) );
/*!
* Amplify Store - Persistent Client-Side Storage 1.1.0
*
* Copyright 2011 appendTo LLC. (http://appendto.com/team)
* Dual licensed under the MIT or GPL licenses.
* http://appendto.com/open-source-licenses
*
* http://amplifyjs.com
*/
(function( amplify, undefined ) {
var store = amplify.store = function( key, value, options, type ) {
var type = store.type;
if ( options && options.type && options.type in store.types ) {
type = options.type;
}
return store.types[ type ]( key, value, options || {} );
};
store.types = {};
store.type = null;
store.addType = function( type, storage ) {
if ( !store.type ) {
store.type = type;
}
store.types[ type ] = storage;
store[ type ] = function( key, value, options ) {
options = options || {};
options.type = type;
return store( key, value, options );
};
}
store.error = function() {
return "amplify.store quota exceeded";
};
var rprefix = /^__amplify__/;
function createFromStorageInterface( storageType, storage ) {
store.addType( storageType, function( key, value, options ) {
var storedValue, parsed, i, remove,
ret = value,
now = (new Date()).getTime();
if ( !key ) {
ret = {};
remove = [];
i = 0;
try {
// accessing the length property works around a localStorage bug
// in Firefox 4.0 where the keys don't update cross-page
// we assign to key just to avoid Closure Compiler from removing
// the access as "useless code"
// https://bugzilla.mozilla.org/show_bug.cgi?id=662511
key = storage.length;
while ( key = storage.key( i++ ) ) {
if ( rprefix.test( key ) ) {
parsed = JSON.parse( storage.getItem( key ) );
if ( parsed.expires && parsed.expires <= now ) {
remove.push( key );
} else {
ret[ key.replace( rprefix, "" ) ] = parsed.data;
}
}
}
while ( key = remove.pop() ) {
storage.removeItem( key );
}
} catch ( error ) {}
return ret;
}
// protect against name collisions with direct storage
key = "__amplify__" + key;
if ( value === undefined ) {
storedValue = storage.getItem( key );
parsed = storedValue ? JSON.parse( storedValue ) : { expires: -1 };
if ( parsed.expires && parsed.expires <= now ) {
storage.removeItem( key );
} else {
return parsed.data;
}
} else {
if ( value === null ) {
storage.removeItem( key );
} else {
parsed = JSON.stringify({
data: value,
expires: options.expires ? now + options.expires : null
});
try {
storage.setItem( key, parsed );
// quota exceeded
} catch( error ) {
// expire old data and try again
store[ storageType ]();
try {
storage.setItem( key, parsed );
} catch( error ) {
throw store.error();
}
}
}
}
return ret;
});
}
// localStorage + sessionStorage
// IE 8+, Firefox 3.5+, Safari 4+, Chrome 4+, Opera 10.5+, iPhone 2+, Android 2+
for ( var webStorageType in { localStorage: 1, sessionStorage: 1 } ) {
// try/catch for file protocol in Firefox
try {
if ( window[ webStorageType ].getItem ) {
createFromStorageInterface( webStorageType, window[ webStorageType ] );
}
} catch( e ) {}
}
// globalStorage
// non-standard: Firefox 2+
// https://developer.mozilla.org/en/dom/storage#globalStorage
if ( window.globalStorage ) {
// try/catch for file protocol in Firefox
try {
createFromStorageInterface( "globalStorage",
window.globalStorage[ window.location.hostname ] );
// Firefox 2.0 and 3.0 have sessionStorage and globalStorage
// make sure we default to globalStorage
// but don't default to globalStorage in 3.5+ which also has localStorage
if ( store.type === "sessionStorage" ) {
store.type = "globalStorage";
}
} catch( e ) {}
}
// userData
// non-standard: IE 5+
// http://msdn.microsoft.com/en-us/library/ms531424(v=vs.85).aspx
(function() {
// IE 9 has quirks in userData that are a huge pain
// rather than finding a way to detect these quirks
// we just don't register userData if we have localStorage
if ( store.types.localStorage ) {
return;
}
// append to html instead of body so we can do this from the head
var div = document.createElement( "div" ),
attrKey = "amplify";
div.style.display = "none";
document.getElementsByTagName( "head" )[ 0 ].appendChild( div );
// we can't feature detect userData support
// so just try and see if it fails
// surprisingly, even just adding the behavior isn't enough for a failure
// so we need to load the data as well
try {
div.addBehavior( "#default#userdata" );
div.load( attrKey );
} catch( e ) {
div.parentNode.removeChild( div );
return;
}
store.addType( "userData", function( key, value, options ) {
div.load( attrKey );
var attr, parsed, prevValue, i, remove,
ret = value,
now = (new Date()).getTime();
if ( !key ) {
ret = {};
remove = [];
i = 0;
while ( attr = div.XMLDocument.documentElement.attributes[ i++ ] ) {
parsed = JSON.parse( attr.value );
if ( parsed.expires && parsed.expires <= now ) {
remove.push( attr.name );
} else {
ret[ attr.name ] = parsed.data;
}
}
while ( key = remove.pop() ) {
div.removeAttribute( key );
}
div.save( attrKey );
return ret;
}
// convert invalid characters to dashes
// http://www.w3.org/TR/REC-xml/#NT-Name
// simplified to assume the starting character is valid
// also removed colon as it is invalid in HTML attribute names
key = key.replace( /[^-._0-9A-Za-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u37f-\u1fff\u200c-\u200d\u203f\u2040\u2070-\u218f]/g, "-" );
if ( value === undefined ) {
attr = div.getAttribute( key );
parsed = attr ? JSON.parse( attr ) : { expires: -1 };
if ( parsed.expires && parsed.expires <= now ) {
div.removeAttribute( key );
} else {
return parsed.data;
}
} else {
if ( value === null ) {
div.removeAttribute( key );
} else {
// we need to get the previous value in case we need to rollback
prevValue = div.getAttribute( key );
parsed = JSON.stringify({
data: value,
expires: (options.expires ? (now + options.expires) : null)
});
div.setAttribute( key, parsed );
}
}
try {
div.save( attrKey );
// quota exceeded
} catch ( error ) {
// roll the value back to the previous value
if ( prevValue === null ) {
div.removeAttribute( key );
} else {
div.setAttribute( key, prevValue );
}
// expire old data and try again
store.userData();
try {
div.setAttribute( key, parsed );
div.save( attrKey );
} catch ( error ) {
// roll the value back to the previous value
if ( prevValue === null ) {
div.removeAttribute( key );
} else {
div.setAttribute( key, prevValue );
}
throw store.error();
}
}
return ret;
});
}() );
// in-memory storage
// fallback for all browsers to enable the API even if we can't persist data
(function() {
var memory = {},
timeout = {};
function copy( obj ) {
return obj === undefined ? undefined : JSON.parse( JSON.stringify( obj ) );
}
store.addType( "memory", function( key, value, options ) {
if ( !key ) {
return copy( memory );
}
if ( value === undefined ) {
return copy( memory[ key ] );
}
if ( timeout[ key ] ) {
clearTimeout( timeout[ key ] );
delete timeout[ key ];
}
if ( value === null ) {
delete memory[ key ];
return null;
}
memory[ key ] = value;
if ( options.expires ) {
timeout[ key ] = setTimeout(function() {
delete memory[ key ];
delete timeout[ key ];
}, options.expires );
}
return value;
});
}() );
}( this.amplify = this.amplify || {} ) );
/*!
* Amplify Request 1.1.0
*
* Copyright 2011 appendTo LLC. (http://appendto.com/team)
* Dual licensed under the MIT or GPL licenses.
* http://appendto.com/open-source-licenses
*
* http://amplifyjs.com
*/
(function( amplify, undefined ) {
function noop() {}
function isFunction( obj ) {
return ({}).toString.call( obj ) === "[object Function]";
}
function async( fn ) {
var isAsync = false;
setTimeout(function() {
isAsync = true;
}, 1 );
return function() {
var that = this,
args = arguments;
if ( isAsync ) {
fn.apply( that, args );
} else {
setTimeout(function() {
fn.apply( that, args );
}, 1 );
}
};
}
amplify.request = function( resourceId, data, callback ) {
// default to an empty hash just so we can handle a missing resourceId
// in one place
var settings = resourceId || {};
if ( typeof settings === "string" ) {
if ( isFunction( data ) ) {
callback = data;
data = {};
}
settings = {
resourceId: resourceId,
data: data || {},
success: callback
};
}
var request = { abort: noop },
resource = amplify.request.resources[ settings.resourceId ],
success = settings.success || noop,
error = settings.error || noop;
settings.success = async( function( data, status ) {
status = status || "success";
amplify.publish( "request.success", settings, data, status );
amplify.publish( "request.complete", settings, data, status );
success( data, status );
});
settings.error = async( function( data, status ) {
status = status || "error";
amplify.publish( "request.error", settings, data, status );
amplify.publish( "request.complete", settings, data, status );
error( data, status );
});
if ( !resource ) {
if ( !settings.resourceId ) {
throw "amplify.request: no resourceId provided";
}
throw "amplify.request: unknown resourceId: " + settings.resourceId;
}
if ( !amplify.publish( "request.before", settings ) ) {
settings.error( null, "abort" );
return;
}
amplify.request.resources[ settings.resourceId ]( settings, request );
return request;
};
amplify.request.types = {};
amplify.request.resources = {};
amplify.request.define = function( resourceId, type, settings ) {
if ( typeof type === "string" ) {
if ( !( type in amplify.request.types ) ) {
throw "amplify.request.define: unknown type: " + type;
}
settings.resourceId = resourceId;
amplify.request.resources[ resourceId ] =
amplify.request.types[ type ]( settings );
} else {
// no pre-processor or settings for one-off types (don't invoke)
amplify.request.resources[ resourceId ] = type;
}
};
}( amplify ) );
(function( amplify, $, undefined ) {
var xhrProps = [ "status", "statusText", "responseText", "responseXML", "readyState" ],
rurlData = /\{([^\}]+)\}/g;
amplify.request.types.ajax = function( defnSettings ) {
defnSettings = $.extend({
type: "GET"
}, defnSettings );
return function( settings, request ) {
var xhr,
url = defnSettings.url,
abort = request.abort,
ajaxSettings = $.extend( true, {}, defnSettings, { data: settings.data } ),
aborted = false,
ampXHR = {
readyState: 0,
setRequestHeader: function( name, value ) {
return xhr.setRequestHeader( name, value );
},
getAllResponseHeaders: function() {
return xhr.getAllResponseHeaders();
},
getResponseHeader: function( key ) {
return xhr.getResponseHeader( key );
},
overrideMimeType: function( type ) {
return xhr.overrideMideType( type );
},
abort: function() {
aborted = true;
try {
xhr.abort();
// IE 7 throws an error when trying to abort
} catch( e ) {}
handleResponse( null, "abort" );
},
success: function( data, status ) {
settings.success( data, status );
},
error: function( data, status ) {
settings.error( data, status );
}
};
amplify.publish( "request.ajax.preprocess",
defnSettings, settings, ajaxSettings, ampXHR );
$.extend( ajaxSettings, {
success: function( data, status ) {
handleResponse( data, status );
},
error: function( _xhr, status ) {
handleResponse( null, status );
},
beforeSend: function( _xhr, _ajaxSettings ) {
xhr = _xhr;
ajaxSettings = _ajaxSettings;
var ret = defnSettings.beforeSend ?
defnSettings.beforeSend.call( this, ampXHR, ajaxSettings ) : true;
return ret && amplify.publish( "request.before.ajax",
defnSettings, settings, ajaxSettings, ampXHR );
}
});
$.ajax( ajaxSettings );
function handleResponse( data, status ) {
$.each( xhrProps, function( i, key ) {
try {
ampXHR[ key ] = xhr[ key ];
} catch( e ) {}
});
// Playbook returns "HTTP/1.1 200 OK"
// TODO: something also returns "OK", what?
if ( /OK$/.test( ampXHR.statusText ) ) {
ampXHR.statusText = "success";
}
if ( data === undefined ) {
// TODO: add support for ajax errors with data
data = null;
}
if ( aborted ) {
status = "abort";
}
if ( /timeout|error|abort/.test( status ) ) {
ampXHR.error( data, status );
} else {
ampXHR.success( data, status );
}
// avoid handling a response multiple times
// this can happen if a request is aborted
// TODO: figure out if this breaks polling or multi-part responses
handleResponse = $.noop;
}
request.abort = function() {
ampXHR.abort();
abort.call( this );
};
};
};
amplify.subscribe( "request.ajax.preprocess", function( defnSettings, settings, ajaxSettings ) {
var mappedKeys = [],
data = ajaxSettings.data;
if ( typeof data === "string" ) {
return;
}
data = $.extend( true, {}, defnSettings.data, data );
ajaxSettings.url = ajaxSettings.url.replace( rurlData, function ( m, key ) {
if ( key in data ) {
mappedKeys.push( key );
return data[ key ];
}
});
// We delete the keys later so duplicates are still replaced
$.each( mappedKeys, function ( i, key ) {
delete data[ key ];
});
ajaxSettings.data = data;
});
amplify.subscribe( "request.ajax.preprocess", function( defnSettings, settings, ajaxSettings ) {
var data = ajaxSettings.data,
dataMap = defnSettings.dataMap;
if ( !dataMap || typeof data === "string" ) {
return;
}
if ( $.isFunction( dataMap ) ) {
ajaxSettings.data = dataMap( data );
} else {
$.each( defnSettings.dataMap, function( orig, replace ) {
if ( orig in data ) {
data[ replace ] = data[ orig ];
delete data[ orig ];
}
});
ajaxSettings.data = data;
}
});
var cache = amplify.request.cache = {
_key: function( resourceId, url, data ) {
data = url + data;
var length = data.length,
i = 0,
checksum = chunk();
while ( i < length ) {
checksum ^= chunk();
}
function chunk() {
return data.charCodeAt( i++ ) << 24 |
data.charCodeAt( i++ ) << 16 |
data.charCodeAt( i++ ) << 8 |
data.charCodeAt( i++ ) << 0;
}
return "request-" + resourceId + "-" + checksum;
},
_default: (function() {
var memoryStore = {};
return function( resource, settings, ajaxSettings, ampXHR ) {
// data is already converted to a string by the time we get here
var cacheKey = cache._key( settings.resourceId,
ajaxSettings.url, ajaxSettings.data ),
duration = resource.cache;
if ( cacheKey in memoryStore ) {
ampXHR.success( memoryStore[ cacheKey ] );
return false;
}
var success = ampXHR.success;
ampXHR.success = function( data ) {
memoryStore[ cacheKey ] = data;
if ( typeof duration === "number" ) {
setTimeout(function() {
delete memoryStore[ cacheKey ];
}, duration );
}
success.apply( this, arguments );
};
};
}())
};
if ( amplify.store ) {
$.each( amplify.store.types, function( type ) {
cache[ type ] = function( resource, settings, ajaxSettings, ampXHR ) {
var cacheKey = cache._key( settings.resourceId,
ajaxSettings.url, ajaxSettings.data ),
cached = amplify.store[ type ]( cacheKey );
if ( cached ) {
ajaxSettings.success( cached );
return false;
}
var success = ampXHR.success;
ampXHR.success = function( data ) {
amplify.store[ type ]( cacheKey, data, { expires: resource.cache.expires } );
success.apply( this, arguments );
};
};
});
cache.persist = cache[ amplify.store.type ];
}
amplify.subscribe( "request.before.ajax", function( resource ) {
var cacheType = resource.cache;
if ( cacheType ) {
// normalize between objects and strings/booleans/numbers
cacheType = cacheType.type || cacheType;
return cache[ cacheType in cache ? cacheType : "_default" ]
.apply( this, arguments );
}
});
amplify.request.decoders = {
// http://labs.omniti.com/labs/jsend
jsend: function( data, status, ampXHR, success, error ) {
if ( data.status === "success" ) {
success( data.data );
} else if ( data.status === "fail" ) {
error( data.data, "fail" );
} else if ( data.status === "error" ) {
delete data.status;
error( data, "error" );
}
}
};
amplify.subscribe( "request.before.ajax", function( resource, settings, ajaxSettings, ampXHR ) {
var _success = ampXHR.success,
_error = ampXHR.error,
decoder = $.isFunction( resource.decoder )
? resource.decoder
: resource.decoder in amplify.request.decoders
? amplify.request.decoders[ resource.decoder ]
: amplify.request.decoders._default;
if ( !decoder ) {
return;
}
function success( data, status ) {
_success( data, status );
}
function error( data, status ) {
_error( data, status );
}
ampXHR.success = function( data, status ) {
decoder( data, status, ampXHR, success, error );
};
ampXHR.error = function( data, status ) {
decoder( data, status, ampXHR, success, error );
};
});
}( amplify, jQuery ) );

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

9440
src/_h5ai/js/lib/jquery-1.8.2.js vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,243 @@
/*! jQuery.scrollpanel 0.1 - //larsjung.de/scrollpanel - MIT License */
(function ($) {
'use strict';
var $window = $(window),
name = 'scrollpanel',
defaults = {
prefix: 'sp-'
},
// Scrollpanel
// ===========
ScrollPanel = function (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),
scrollpanel = $this.data(name);
if (!scrollpanel) {
scrollpanel = new ScrollPanel(this, options);
scrollpanel.update();
$this.data(name, scrollpanel);
}
if (options === 'update') {
scrollpanel.update(options2);
}
});
};
}(jQuery));

View File

@ -1,2 +0,0 @@
/*! jQuery.scrollpanel 0.1 - //larsjung.de/scrollpanel - MIT License */
(function(a){"use strict";var b=a(window),c="scrollpanel",d={prefix:"sp-"},e=function(b,c){var e=this;e.$el=a(b),e.settings=a.extend({},d,c);var f=e.settings.prefix;e.mouseOffsetY=0,e.updateId=0,e.scrollProxy=a.proxy(e.scroll,e),(!e.$el.css("position")||e.$el.css("position")==="static")&&e.$el.css("position","relative"),e.$scrollbar=a('<div class="'+f+'scrollbar" />'),e.$thumb=a('<div class="'+f+'thumb" />').appendTo(e.$scrollbar),e.$el.addClass(f+"host").wrapInner('<div class="'+f+'viewport"><div class="'+f+'container" /></div>').append(e.$scrollbar),e.$viewport=e.$el.find("> ."+f+"viewport"),e.$container=e.$viewport.find("> ."+f+"container"),e.$el.on("mousewheel",function(a,b,c,d){e.$viewport.scrollTop(e.$viewport.scrollTop()-50*d),e.update(),a.preventDefault(),a.stopPropagation()}).on("scroll",function(){e.update()}),e.$viewport.css({paddingRight:e.$scrollbar.outerWidth(!0),height:e.$el.height(),overflow:"hidden"}),e.$container.css({overflow:"hidden"}),e.$scrollbar.css({position:"absolute",top:0,right:0,overflow:"hidden"}).on("mousedown",function(a){e.mouseOffsetY=e.$thumb.outerHeight()/2,e.onMousedown(a)}).each(function(){e.onselectstart=function(){return!1}}),e.$thumb.css({position:"absolute",left:0,width:"100%"}).on("mousedown",function(a){e.mouseOffsetY=a.pageY-e.$thumb.offset().top,e.onMousedown(a)}),e.update()};a.extend(e.prototype,{update:function(a){var b=this;b.updateId&&!a?(clearInterval(b.updateId),b.updateId=0):!b.updateId&&a&&(b.updateId=setInterval(function(){b.update(!0)},50)),b.$viewport.css("height",b.$el.height());var c=b.$el.height(),d=b.$container.outerHeight(),e=b.$viewport.scrollTop(),f=e/d,g=Math.min(c/d,1),h=b.$scrollbar.height();g<1?(b.$scrollbar.css({height:b.$el.innerHeight()+h-b.$scrollbar.outerHeight(!0)}).fadeIn(50),b.$thumb.css({top:h*f,height:h*g})):b.$scrollbar.fadeOut(50)},scroll:function(a){var b=this,c=(a.pageY-b.$scrollbar.offset().top-b.mouseOffsetY)/b.$scrollbar.height();b.$viewport.scrollTop(b.$container.outerHeight()*c),b.update(),a.preventDefault(),a.stopPropagation()},onMousedown:function(a){var c=this;c.scroll(a),c.$scrollbar.addClass("active"),b.on("mousemove",c.scrollProxy).one("mouseup",function(a){c.$scrollbar.removeClass("active"),b.off("mousemove",c.scrollProxy),c.scroll(a)})}}),a.fn[c]=function(b,d){return this.each(function(){var f=a(this),g=f.data(c);g||(g=new e(this,b),g.update(),f.data(c,g)),b==="update"&&g.update(d)})}})(jQuery)

404
src/_h5ai/js/lib/modernizr-2.6.2.js vendored Normal file
View File

@ -0,0 +1,404 @@
/* Modernizr 2.6.2 (Custom Build) | MIT & BSD
* Build: http://modernizr.com/download/#-opacity-rgba-canvas-history-audio-video-shiv-cssclasses-prefixes
*/
;
window.Modernizr = (function( window, document, undefined ) {
var version = '2.6.2',
Modernizr = {},
enableClasses = true,
docElement = document.documentElement,
mod = 'modernizr',
modElem = document.createElement(mod),
mStyle = modElem.style,
inputElem ,
toString = {}.toString,
prefixes = ' -webkit- -moz- -o- -ms- '.split(' '),
tests = {},
inputs = {},
attrs = {},
classes = [],
slice = classes.slice,
featureName,
_hasOwnProperty = ({}).hasOwnProperty, hasOwnProp;
if ( !is(_hasOwnProperty, 'undefined') && !is(_hasOwnProperty.call, 'undefined') ) {
hasOwnProp = function (object, property) {
return _hasOwnProperty.call(object, property);
};
}
else {
hasOwnProp = function (object, property) {
return ((property in object) && is(object.constructor.prototype[property], 'undefined'));
};
}
if (!Function.prototype.bind) {
Function.prototype.bind = function bind(that) {
var target = this;
if (typeof target != "function") {
throw new TypeError();
}
var args = slice.call(arguments, 1),
bound = function () {
if (this instanceof bound) {
var F = function(){};
F.prototype = target.prototype;
var self = new F();
var result = target.apply(
self,
args.concat(slice.call(arguments))
);
if (Object(result) === result) {
return result;
}
return self;
} else {
return target.apply(
that,
args.concat(slice.call(arguments))
);
}
};
return bound;
};
}
function setCss( str ) {
mStyle.cssText = str;
}
function setCssAll( str1, str2 ) {
return setCss(prefixes.join(str1 + ';') + ( str2 || '' ));
}
function is( obj, type ) {
return typeof obj === type;
}
function contains( str, substr ) {
return !!~('' + str).indexOf(substr);
}
function testDOMProps( props, obj, elem ) {
for ( var i in props ) {
var item = obj[props[i]];
if ( item !== undefined) {
if (elem === false) return props[i];
if (is(item, 'function')){
return item.bind(elem || obj);
}
return item;
}
}
return false;
} tests['canvas'] = function() {
var elem = document.createElement('canvas');
return !!(elem.getContext && elem.getContext('2d'));
};
tests['history'] = function() {
return !!(window.history && history.pushState);
}; tests['rgba'] = function() {
setCss('background-color:rgba(150,255,150,.5)');
return contains(mStyle.backgroundColor, 'rgba');
}; tests['opacity'] = function() {
setCssAll('opacity:.55');
return (/^0.55$/).test(mStyle.opacity);
};
tests['video'] = function() {
var elem = document.createElement('video'),
bool = false;
try {
if ( bool = !!elem.canPlayType ) {
bool = new Boolean(bool);
bool.ogg = elem.canPlayType('video/ogg; codecs="theora"') .replace(/^no$/,'');
bool.h264 = elem.canPlayType('video/mp4; codecs="avc1.42E01E"') .replace(/^no$/,'');
bool.webm = elem.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,'');
}
} catch(e) { }
return bool;
};
tests['audio'] = function() {
var elem = document.createElement('audio'),
bool = false;
try {
if ( bool = !!elem.canPlayType ) {
bool = new Boolean(bool);
bool.ogg = elem.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,'');
bool.mp3 = elem.canPlayType('audio/mpeg;') .replace(/^no$/,'');
bool.wav = elem.canPlayType('audio/wav; codecs="1"') .replace(/^no$/,'');
bool.m4a = ( elem.canPlayType('audio/x-m4a;') ||
elem.canPlayType('audio/aac;')) .replace(/^no$/,'');
}
} catch(e) { }
return bool;
}; for ( var feature in tests ) {
if ( hasOwnProp(tests, feature) ) {
featureName = feature.toLowerCase();
Modernizr[featureName] = tests[feature]();
classes.push((Modernizr[featureName] ? '' : 'no-') + featureName);
}
}
Modernizr.addTest = function ( feature, test ) {
if ( typeof feature == 'object' ) {
for ( var key in feature ) {
if ( hasOwnProp( feature, key ) ) {
Modernizr.addTest( key, feature[ key ] );
}
}
} else {
feature = feature.toLowerCase();
if ( Modernizr[feature] !== undefined ) {
return Modernizr;
}
test = typeof test == 'function' ? test() : test;
if (typeof enableClasses !== "undefined" && enableClasses) {
docElement.className += ' ' + (test ? '' : 'no-') + feature;
}
Modernizr[feature] = test;
}
return Modernizr;
};
setCss('');
modElem = inputElem = null;
;(function(window, document) {
var options = window.html5 || {};
var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i;
var saveClones = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i;
var supportsHtml5Styles;
var expando = '_html5shiv';
var expanID = 0;
var expandoData = {};
var supportsUnknownElements;
(function() {
try {
var a = document.createElement('a');
a.innerHTML = '<xyz></xyz>';
supportsHtml5Styles = ('hidden' in a);
supportsUnknownElements = a.childNodes.length == 1 || (function() {
(document.createElement)('a');
var frag = document.createDocumentFragment();
return (
typeof frag.cloneNode == 'undefined' ||
typeof frag.createDocumentFragment == 'undefined' ||
typeof frag.createElement == 'undefined'
);
}());
} catch(e) {
supportsHtml5Styles = true;
supportsUnknownElements = true;
}
}()); function addStyleSheet(ownerDocument, cssText) {
var p = ownerDocument.createElement('p'),
parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement;
p.innerHTML = 'x<style>' + cssText + '</style>';
return parent.insertBefore(p.lastChild, parent.firstChild);
}
function getElements() {
var elements = html5.elements;
return typeof elements == 'string' ? elements.split(' ') : elements;
}
function getExpandoData(ownerDocument) {
var data = expandoData[ownerDocument[expando]];
if (!data) {
data = {};
expanID++;
ownerDocument[expando] = expanID;
expandoData[expanID] = data;
}
return data;
}
function createElement(nodeName, ownerDocument, data){
if (!ownerDocument) {
ownerDocument = document;
}
if(supportsUnknownElements){
return ownerDocument.createElement(nodeName);
}
if (!data) {
data = getExpandoData(ownerDocument);
}
var node;
if (data.cache[nodeName]) {
node = data.cache[nodeName].cloneNode();
} else if (saveClones.test(nodeName)) {
node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode();
} else {
node = data.createElem(nodeName);
}
return node.canHaveChildren && !reSkip.test(nodeName) ? data.frag.appendChild(node) : node;
}
function createDocumentFragment(ownerDocument, data){
if (!ownerDocument) {
ownerDocument = document;
}
if(supportsUnknownElements){
return ownerDocument.createDocumentFragment();
}
data = data || getExpandoData(ownerDocument);
var clone = data.frag.cloneNode(),
i = 0,
elems = getElements(),
l = elems.length;
for(;i<l;i++){
clone.createElement(elems[i]);
}
return clone;
}
function shivMethods(ownerDocument, data) {
if (!data.cache) {
data.cache = {};
data.createElem = ownerDocument.createElement;
data.createFrag = ownerDocument.createDocumentFragment;
data.frag = data.createFrag();
}
ownerDocument.createElement = function(nodeName) {
if (!html5.shivMethods) {
return data.createElem(nodeName);
}
return createElement(nodeName, ownerDocument, data);
};
ownerDocument.createDocumentFragment = Function('h,f', 'return function(){' +
'var n=f.cloneNode(),c=n.createElement;' +
'h.shivMethods&&(' +
getElements().join().replace(/\w+/g, function(nodeName) {
data.createElem(nodeName);
data.frag.createElement(nodeName);
return 'c("' + nodeName + '")';
}) +
');return n}'
)(html5, data.frag);
} function shivDocument(ownerDocument) {
if (!ownerDocument) {
ownerDocument = document;
}
var data = getExpandoData(ownerDocument);
if (html5.shivCSS && !supportsHtml5Styles && !data.hasCSS) {
data.hasCSS = !!addStyleSheet(ownerDocument,
'article,aside,figcaption,figure,footer,header,hgroup,nav,section{display:block}' +
'mark{background:#FF0;color:#000}'
);
}
if (!supportsUnknownElements) {
shivMethods(ownerDocument, data);
}
return ownerDocument;
} var html5 = {
'elements': options.elements || 'abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video',
'shivCSS': (options.shivCSS !== false),
'supportsUnknownElements': supportsUnknownElements,
'shivMethods': (options.shivMethods !== false),
'type': 'default',
'shivDocument': shivDocument,
createElement: createElement,
createDocumentFragment: createDocumentFragment
}; window.html5 = html5;
shivDocument(document);
}(this, document));
Modernizr._version = version;
Modernizr._prefixes = prefixes;
docElement.className = docElement.className.replace(/(^|\s)no-js(\s|$)/, '$1$2') +
(enableClasses ? ' js ' + classes.join(' ') : '');
return Modernizr;
})(this, this.document);
;

View File

@ -1,4 +0,0 @@
/* Modernizr 2.6.2 (Custom Build) | MIT & BSD
* Build: http://modernizr.com/download/#-opacity-rgba-canvas-history-audio-video-shiv-cssclasses-prefixes
*/
;window.Modernizr=function(a,b,c){function v(a){j.cssText=a}function w(a,b){return v(m.join(a+";")+(b||""))}function x(a,b){return typeof a===b}function y(a,b){return!!~(""+a).indexOf(b)}function z(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:x(f,"function")?f.bind(d||b):f}return!1}var d="2.6.2",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={}.toString,m=" -webkit- -moz- -o- -ms- ".split(" "),n={},o={},p={},q=[],r=q.slice,s,t={}.hasOwnProperty,u;!x(t,"undefined")&&!x(t.call,"undefined")?u=function(a,b){return t.call(a,b)}:u=function(a,b){return b in a&&x(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=r.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(r.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(r.call(arguments)))};return e}),n.canvas=function(){var a=b.createElement("canvas");return!!a.getContext&&!!a.getContext("2d")},n.history=function(){return!!a.history&&!!history.pushState},n.rgba=function(){return v("background-color:rgba(150,255,150,.5)"),y(j.backgroundColor,"rgba")},n.opacity=function(){return w("opacity:.55"),/^0.55$/.test(j.opacity)},n.video=function(){var a=b.createElement("video"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,""),c.h264=a.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,""),c.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,"")}catch(d){}return c},n.audio=function(){var a=b.createElement("audio"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),c.mp3=a.canPlayType("audio/mpeg;").replace(/^no$/,""),c.wav=a.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),c.m4a=(a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/aac;")).replace(/^no$/,"")}catch(d){}return c};for(var A in n)u(n,A)&&(s=A.toLowerCase(),e[s]=n[A](),q.push((e[s]?"":"no-")+s));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)u(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},v(""),i=k=null,function(a,b){function k(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function l(){var a=r.elements;return typeof a=="string"?a.split(" "):a}function m(a){var b=i[a[g]];return b||(b={},h++,a[g]=h,i[h]=b),b}function n(a,c,f){c||(c=b);if(j)return c.createElement(a);f||(f=m(c));var g;return f.cache[a]?g=f.cache[a].cloneNode():e.test(a)?g=(f.cache[a]=f.createElem(a)).cloneNode():g=f.createElem(a),g.canHaveChildren&&!d.test(a)?f.frag.appendChild(g):g}function o(a,c){a||(a=b);if(j)return a.createDocumentFragment();c=c||m(a);var d=c.frag.cloneNode(),e=0,f=l(),g=f.length;for(;e<g;e++)d.createElement(f[e]);return d}function p(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return r.shivMethods?n(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+l().join().replace(/\w+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(r,b.frag)}function q(a){a||(a=b);var c=m(a);return r.shivCSS&&!f&&!c.hasCSS&&(c.hasCSS=!!k(a,"article,aside,figcaption,figure,footer,header,hgroup,nav,section{display:block}mark{background:#FF0;color:#000}")),j||p(a,c),a}var c=a.html5||{},d=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,e=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,f,g="_html5shiv",h=0,i={},j;(function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",f="hidden"in a,j=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){f=!0,j=!0}})();var r={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,supportsUnknownElements:j,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:q,createElement:n,createDocumentFragment:o};a.html5=r,q(b)}(this,b),e._version=d,e._prefixes=m,g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+q.join(" "):""),e}(this,this.document);

View File

@ -1,17 +1,17 @@
// moment.js
// version : 1.7.0
// version : 1.7.2
// author : Tim Wood
// license : MIT
// momentjs.com
(function (Date, undefined) {
(function (undefined) {
/************************************
Constants
************************************/
var moment,
VERSION = "1.7.0",
VERSION = "1.7.2",
round = Math.round, i,
// internal storage for language config files
languages = {},
@ -30,9 +30,8 @@
aspNetJsonRegex = /^\/?Date\((\-?\d+)/i,
// format tokens
formattingTokens = /(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|YYYY|YY|a|A|hh?|HH?|mm?|ss?|SS?S?|zz?|ZZ?)/g,
localFormattingTokens = /(LT|LL?L?L?)/g,
formattingRemoveEscapes = /(^\[)|(\\)|\]$/g,
formattingTokens = /(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|YYYY|YY|a|A|hh?|HH?|mm?|ss?|SS?S?|zz?|ZZ?|.)/g,
localFormattingTokens = /(\[[^\[]*\])|(\\)?(LT|LL?L?L?)/g,
// parsing tokens
parseMultipleFormatChunker = /([0-9a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+)/gi,
@ -46,7 +45,7 @@
parseTokenTimezone = /Z|[\+\-]\d\d:?\d\d/i, // +00:00 -00:00 +0000 -0000 or Z
parseTokenT = /T/i, // T (ISO seperator)
// preliminary iso regex
// preliminary iso regex
// 0000-00-00 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000
isoRegex = /^\s*\d{4}-\d\d-\d\d(T(\d\d(:\d\d(:\d\d(\.\d\d?\d?)?)?)?)?([\+\-]\d\d:?\d\d)?)?/,
isoFormat = 'YYYY-MM-DDTHH:mm:ssZ',
@ -77,6 +76,10 @@
// format function strings
formatFunctions = {},
// tokens to ordinalize and pad
ordinalizeTokens = 'DDD w M D d'.split(' '),
paddedTokens = 'M D H h m s w'.split(' '),
/*
* moment.fn.format uses new Function() to create an inlined formatting function.
* Results are a 3x speed boost
@ -84,7 +87,7 @@
*
* These strings are appended into a function using replaceFormatTokens and makeFormatFunction
*/
formatFunctionStrings = {
formatTokenFunctions = {
// a = placeholder
// b = placeholder
// t = the current moment being formatted
@ -92,43 +95,119 @@
// o = language.ordinal function
// p = leftZeroFill function
// m = language.meridiem value or function
M : '(a=t.month()+1)',
MMM : 'v("monthsShort",t.month())',
MMMM : 'v("months",t.month())',
D : '(a=t.date())',
DDD : '(a=new Date(t.year(),t.month(),t.date()),b=new Date(t.year(),0,1),a=~~(((a-b)/864e5)+1.5))',
d : '(a=t.day())',
dd : 'v("weekdaysMin",t.day())',
ddd : 'v("weekdaysShort",t.day())',
dddd : 'v("weekdays",t.day())',
w : '(a=new Date(t.year(),t.month(),t.date()-t.day()+5),b=new Date(a.getFullYear(),0,4),a=~~((a-b)/864e5/7+1.5))',
YY : 'p(t.year()%100,2)',
YYYY : 'p(t.year(),4)',
a : 'm(t.hours(),t.minutes(),!0)',
A : 'm(t.hours(),t.minutes(),!1)',
H : 't.hours()',
h : 't.hours()%12||12',
m : 't.minutes()',
s : 't.seconds()',
S : '~~(t.milliseconds()/100)',
SS : 'p(~~(t.milliseconds()/10),2)',
SSS : 'p(t.milliseconds(),3)',
Z : '((a=-t.zone())<0?((a=-a),"-"):"+")+p(~~(a/60),2)+":"+p(~~a%60,2)',
ZZ : '((a=-t.zone())<0?((a=-a),"-"):"+")+p(~~(10*a/6),4)'
},
M : function () {
return this.month() + 1;
},
MMM : function (format) {
return getValueFromArray("monthsShort", this.month(), this, format);
},
MMMM : function (format) {
return getValueFromArray("months", this.month(), this, format);
},
D : function () {
return this.date();
},
DDD : function () {
var a = new Date(this.year(), this.month(), this.date()),
b = new Date(this.year(), 0, 1);
return ~~(((a - b) / 864e5) + 1.5);
},
d : function () {
return this.day();
},
dd : function (format) {
return getValueFromArray("weekdaysMin", this.day(), this, format);
},
ddd : function (format) {
return getValueFromArray("weekdaysShort", this.day(), this, format);
},
dddd : function (format) {
return getValueFromArray("weekdays", this.day(), this, format);
},
w : function () {
var a = new Date(this.year(), this.month(), this.date() - this.day() + 5),
b = new Date(a.getFullYear(), 0, 4);
return ~~((a - b) / 864e5 / 7 + 1.5);
},
YY : function () {
return leftZeroFill(this.year() % 100, 2);
},
YYYY : function () {
return leftZeroFill(this.year(), 4);
},
a : function () {
return this.lang().meridiem(this.hours(), this.minutes(), true);
},
A : function () {
return this.lang().meridiem(this.hours(), this.minutes(), false);
},
H : function () {
return this.hours();
},
h : function () {
return this.hours() % 12 || 12;
},
m : function () {
return this.minutes();
},
s : function () {
return this.seconds();
},
S : function () {
return ~~(this.milliseconds() / 100);
},
SS : function () {
return leftZeroFill(~~(this.milliseconds() / 10), 2);
},
SSS : function () {
return leftZeroFill(this.milliseconds(), 3);
},
Z : function () {
var a = -this.zone(),
b = "+";
if (a < 0) {
a = -a;
b = "-";
}
return b + leftZeroFill(~~(a / 60), 2) + ":" + leftZeroFill(~~a % 60, 2);
},
ZZ : function () {
var a = -this.zone(),
b = "+";
if (a < 0) {
a = -a;
b = "-";
}
return b + leftZeroFill(~~(10 * a / 6), 4);
}
};
ordinalizeTokens = 'DDD w M D d'.split(' '),
paddedTokens = 'M D H h m s w'.split(' ');
function getValueFromArray(key, index, m, format) {
var lang = m.lang();
return lang[key].call ? lang[key](m, format) : lang[key][index];
}
function padToken(func, count) {
return function (a) {
return leftZeroFill(func.call(this, a), count);
};
}
function ordinalizeToken(func) {
return function (a) {
var b = func.call(this, a);
return b + this.lang().ordinal(b);
};
}
while (ordinalizeTokens.length) {
i = ordinalizeTokens.pop();
formatFunctionStrings[i + 'o'] = formatFunctionStrings[i] + '+o(a)';
formatTokenFunctions[i + 'o'] = ordinalizeToken(formatTokenFunctions[i]);
}
while (paddedTokens.length) {
i = paddedTokens.pop();
formatFunctionStrings[i + i] = 'p(' + formatFunctionStrings[i] + ',2)';
formatTokenFunctions[i + i] = padToken(formatTokenFunctions[i], 2);
}
formatFunctionStrings.DDDD = 'p(' + formatFunctionStrings.DDD + ',3)';
formatTokenFunctions.DDDD = padToken(formatTokenFunctions.DDD, 3);
/************************************
@ -141,7 +220,6 @@
this._d = date;
this._isUTC = !!isUTC;
this._a = date._a || null;
date._a = null;
this._lang = lang || false;
}
@ -149,7 +227,7 @@
function Duration(duration) {
var data = this._data = {},
years = duration.years || duration.y || 0,
months = duration.months || duration.M || 0,
months = duration.months || duration.M || 0,
weeks = duration.weeks || duration.w || 0,
days = duration.days || duration.d || 0,
hours = duration.hours || duration.h || 0,
@ -171,7 +249,7 @@
// it separately.
this._months = months +
years * 12;
// The following code bubbles up values, see the tests for
// examples of what that means.
data.milliseconds = milliseconds % 1000;
@ -188,7 +266,7 @@
days += weeks * 7;
data.days = days % 30;
months += absRound(days / 30);
data.months = months % 12;
@ -267,13 +345,21 @@
// the array should mirror the parameters below
// note: all values past the year are optional and will default to the lowest possible value.
// [year, month, day , hour, minute, second, millisecond]
function dateFromArray(input, asUTC) {
var i, date;
for (i = 1; i < 7; i++) {
input[i] = (input[i] == null) ? (i === 2 ? 1 : 0) : input[i];
function dateFromArray(input, asUTC, hoursOffset, minutesOffset) {
var i, date, forValid = [];
for (i = 0; i < 7; i++) {
forValid[i] = input[i] = (input[i] == null) ? (i === 2 ? 1 : 0) : input[i];
}
// we store whether we used utc or not in the input array
input[7] = asUTC;
input[7] = forValid[7] = asUTC;
// if the parser flagged the input as invalid, we pass the value along
if (input[8] != null) {
forValid[8] = input[8];
}
// add the offsets to the time to be parsed so that we can have a clean array
// for checking isValid
input[3] += hoursOffset || 0;
input[4] += minutesOffset || 0;
date = new Date(0);
if (asUTC) {
date.setUTCFullYear(input[0], input[1], input[2]);
@ -282,7 +368,7 @@
date.setFullYear(input[0], input[1], input[2]);
date.setHours(input[3], input[4], input[5], input[6]);
}
date._a = input;
date._a = forValid;
return date;
}
@ -297,7 +383,7 @@
if (!values && hasModule) {
values = require('./lang/' + key);
}
for (i = 0; i < langConfigProperties.length; i++) {
// If a language definition does not provide a value, inherit
// from English
@ -307,13 +393,13 @@
for (i = 0; i < 12; i++) {
m = moment([2000, i]);
parse[i] = new RegExp('^' + (values.months[i] || values.months(m, '')) +
parse[i] = new RegExp('^' + (values.months[i] || values.months(m, '')) +
'|^' + (values.monthsShort[i] || values.monthsShort(m, '')).replace('.', ''), 'i');
}
values.monthsParse = values.monthsParse || parse;
languages[key] = values;
return values;
}
@ -339,46 +425,42 @@
************************************/
// helper for building inline formatting functions
function replaceFormatTokens(token) {
return formatFunctionStrings[token] ?
("'+(" + formatFunctionStrings[token] + ")+'") :
token.replace(formattingRemoveEscapes, "").replace(/\\?'/g, "\\'");
}
// helper for recursing long date formatting tokens
function replaceLongDateFormatTokens(input) {
return getLangDefinition().longDateFormat[input] || input;
function removeFormattingTokens(input) {
if (input.match(/\[.*\]/)) {
return input.replace(/^\[|\]$/g, "");
}
return input.replace(/\\/g, "");
}
function makeFormatFunction(format) {
var output = "var a,b;return '" +
format.replace(formattingTokens, replaceFormatTokens) + "';",
Fn = Function; // get around jshint
// t = the current moment being formatted
// v = getValueAtKey function
// o = language.ordinal function
// p = leftZeroFill function
// m = language.meridiem value or function
return new Fn('t', 'v', 'o', 'p', 'm', output);
}
var array = format.match(formattingTokens), i, length;
function makeOrGetFormatFunction(format) {
if (!formatFunctions[format]) {
formatFunctions[format] = makeFormatFunction(format);
for (i = 0, length = array.length; i < length; i++) {
if (formatTokenFunctions[array[i]]) {
array[i] = formatTokenFunctions[array[i]];
} else {
array[i] = removeFormattingTokens(array[i]);
}
}
return formatFunctions[format];
return function (mom) {
var output = "";
for (i = 0; i < length; i++) {
output += typeof array[i].call === 'function' ? array[i].call(mom, format) : array[i];
}
return output;
};
}
// format date using native date object
function formatMoment(m, format) {
var lang = getLangDefinition(m);
var i = 5;
function getValueFromArray(key, index) {
return lang[key].call ? lang[key](m, format) : lang[key][index];
function replaceLongDateFormatTokens(input) {
return m.lang().longDateFormat[input] || input;
}
while (localFormattingTokens.test(format)) {
while (i-- && localFormattingTokens.test(format)) {
format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);
}
@ -386,7 +468,7 @@
formatFunctions[format] = makeFormatFunction(format);
}
return formatFunctions[format](m, getValueFromArray, lang.ordinal, leftZeroFill, lang.meridiem);
return formatFunctions[format](m);
}
@ -442,8 +524,8 @@
// function to convert string input to date
function addTimeToArrayFromToken(token, input, datePartArray, config) {
var a;
//console.log('addTime', format, input);
var a, b;
switch (token) {
// MONTH
case 'M' : // fall through to MM
@ -455,9 +537,14 @@
for (a = 0; a < 12; a++) {
if (getLangDefinition().monthsParse[a].test(input)) {
datePartArray[1] = a;
b = true;
break;
}
}
// if we didn't find a month name, mark the date as invalid.
if (!b) {
datePartArray[8] = false;
}
break;
// DAY OF MONTH
case 'D' : // fall through to DDDD
@ -470,8 +557,7 @@
break;
// YEAR
case 'YY' :
input = ~~input;
datePartArray[0] = input + (input > 70 ? 1900 : 2000);
datePartArray[0] = ~~input + (~~input > 70 ? 1900 : 2000);
break;
case 'YYYY' :
datePartArray[0] = ~~Math.abs(input);
@ -522,10 +608,19 @@
}
break;
}
// if the input is null, the date is not valid
if (input == null) {
datePartArray[8] = false;
}
}
// date from string and format string
function makeDateFromStringAndFormat(string, format) {
// This array is used to make a Date, either with `new Date` or `Date.UTC`
// We store some additional data on the array for validation
// datePartArray[7] is true if the Date was created with `Date.UTC` and false if created with `new Date`
// datePartArray[8] is false if the Date is invalid, and undefined if the validity is unknown.
var datePartArray = [0, 0, 1, 0, 0, 0, 0],
config = {
tzh : 0, // timezone hour offset
@ -536,8 +631,13 @@
for (i = 0; i < tokens.length; i++) {
parsedInput = (getParseRegexForToken(tokens[i]).exec(string) || [])[0];
string = string.replace(getParseRegexForToken(tokens[i]), '');
addTimeToArrayFromToken(tokens[i], parsedInput, datePartArray, config);
if (parsedInput) {
string = string.slice(string.indexOf(parsedInput) + parsedInput.length);
}
// don't parse if its not a known token
if (formatTokenFunctions[tokens[i]]) {
addTimeToArrayFromToken(tokens[i], parsedInput, datePartArray, config);
}
}
// handle am pm
if (config.isPm && datePartArray[3] < 12) {
@ -547,11 +647,8 @@
if (config.isPm === false && datePartArray[3] === 12) {
datePartArray[3] = 0;
}
// handle timezone
datePartArray[3] += config.tzh;
datePartArray[4] += config.tzm;
// return
return dateFromArray(datePartArray, config.isUTC);
return dateFromArray(datePartArray, config.isUTC, config.tzh, config.tzm);
}
// date from string and array of format strings
@ -586,7 +683,7 @@
break;
}
}
return parseTokenTimezone.exec(string) ?
return parseTokenTimezone.exec(string) ?
makeDateFromStringAndFormat(string, format + ' Z') :
makeDateFromStringAndFormat(string, format);
}
@ -855,7 +952,12 @@
isValid : function () {
if (this._a) {
return !compareArrays(this._a, (this._a[7] ? moment.utc(this) : this).toArray());
// if the parser finds that the input is invalid, it sets
// the eighth item in the input array to false.
if (this._a[8] != null) {
return !!this._a[8];
}
return !compareArrays(this._a, (this._a[7] ? moment.utc(this._a) : moment(this._a)).toArray());
}
return !isNaN(this._d.getTime());
},
@ -936,7 +1038,7 @@
},
isDST : function () {
return (this.zone() < moment([this.year()]).zone() ||
return (this.zone() < moment([this.year()]).zone() ||
this.zone() < moment([this.year(), 5]).zone());
},
@ -975,7 +1077,7 @@
endOf: function (val) {
return this.startOf(val).add(val.replace(/s?$/, 's'), 1).subtract('ms', 1);
},
sod: function () {
return this.clone().startOf('day');
},
@ -1047,10 +1149,15 @@
humanize : function (withSuffix) {
var difference = +this,
rel = this.lang().relativeTime,
output = relativeTime(difference, !withSuffix, this.lang());
output = relativeTime(difference, !withSuffix, this.lang()),
fromNow = difference <= 0 ? rel.past : rel.future;
if (withSuffix) {
output = (difference <= 0 ? rel.past : rel.future).replace(/%s/i, output);
if (typeof fromNow === 'function') {
output = fromNow(output);
} else {
output = fromNow.replace(/%s/i, output);
}
}
return output;
@ -1103,4 +1210,4 @@
return moment;
});
}
}).call(this, Date);
}).call(this);

View File

@ -1,2 +0,0 @@
//fgnass.github.com/spin.js#v1.2.6
!function(e,t,n){function o(e,n){var r=t.createElement(e||"div"),i;for(i in n)r[i]=n[i];return r}function u(e){for(var t=1,n=arguments.length;t<n;t++)e.appendChild(arguments[t]);return e}function f(e,t,n,r){var o=["opacity",t,~~(e*100),n,r].join("-"),u=.01+n/r*100,f=Math.max(1-(1-e)/t*(100-u),e),l=s.substring(0,s.indexOf("Animation")).toLowerCase(),c=l&&"-"+l+"-"||"";return i[o]||(a.insertRule("@"+c+"keyframes "+o+"{"+"0%{opacity:"+f+"}"+u+"%{opacity:"+e+"}"+(u+.01)+"%{opacity:1}"+(u+t)%100+"%{opacity:"+e+"}"+"100%{opacity:"+f+"}"+"}",a.cssRules.length),i[o]=1),o}function l(e,t){var i=e.style,s,o;if(i[t]!==n)return t;t=t.charAt(0).toUpperCase()+t.slice(1);for(o=0;o<r.length;o++){s=r[o]+t;if(i[s]!==n)return s}}function c(e,t){for(var n in t)e.style[l(e,n)||n]=t[n];return e}function h(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)e[i]===n&&(e[i]=r[i])}return e}function p(e){var t={x:e.offsetLeft,y:e.offsetTop};while(e=e.offsetParent)t.x+=e.offsetLeft,t.y+=e.offsetTop;return t}var r=["webkit","Moz","ms","O"],i={},s,a=function(){var e=o("style",{type:"text/css"});return u(t.getElementsByTagName("head")[0],e),e.sheet||e.styleSheet}(),d={lines:12,length:7,width:5,radius:10,rotate:0,corners:1,color:"#000",speed:1,trail:100,opacity:.25,fps:20,zIndex:2e9,className:"spinner",top:"auto",left:"auto"},v=function m(e){if(!this.spin)return new m(e);this.opts=h(e||{},m.defaults,d)};v.defaults={},h(v.prototype,{spin:function(e){this.stop();var t=this,n=t.opts,r=t.el=c(o(0,{className:n.className}),{position:"relative",width:0,zIndex:n.zIndex}),i=n.radius+n.length+n.width,u,a;e&&(e.insertBefore(r,e.firstChild||null),a=p(e),u=p(r),c(r,{left:(n.left=="auto"?a.x-u.x+(e.offsetWidth>>1):parseInt(n.left,10)+i)+"px",top:(n.top=="auto"?a.y-u.y+(e.offsetHeight>>1):parseInt(n.top,10)+i)+"px"})),r.setAttribute("aria-role","progressbar"),t.lines(r,t.opts);if(!s){var f=0,l=n.fps,h=l/n.speed,d=(1-n.opacity)/(h*n.trail/100),v=h/n.lines;(function m(){f++;for(var e=n.lines;e;e--){var i=Math.max(1-(f+e*v)%h*d,n.opacity);t.opacity(r,n.lines-e,i,n)}t.timeout=t.el&&setTimeout(m,~~(1e3/l))})()}return t},stop:function(){var e=this.el;return e&&(clearTimeout(this.timeout),e.parentNode&&e.parentNode.removeChild(e),this.el=n),this},lines:function(e,t){function i(e,r){return c(o(),{position:"absolute",width:t.length+t.width+"px",height:t.width+"px",background:e,boxShadow:r,transformOrigin:"left",transform:"rotate("+~~(360/t.lines*n+t.rotate)+"deg) translate("+t.radius+"px"+",0)",borderRadius:(t.corners*t.width>>1)+"px"})}var n=0,r;for(;n<t.lines;n++)r=c(o(),{position:"absolute",top:1+~(t.width/2)+"px",transform:t.hwaccel?"translate3d(0,0,0)":"",opacity:t.opacity,animation:s&&f(t.opacity,t.trail,n,t.lines)+" "+1/t.speed+"s linear infinite"}),t.shadow&&u(r,c(i("#000","0 0 4px #000"),{top:"2px"})),u(e,u(r,i(t.color,"0 0 1px rgba(0,0,0,.1)")));return e},opacity:function(e,t,n){t<e.childNodes.length&&(e.childNodes[t].style.opacity=n)}}),function(){function e(e,t){return o("<"+e+' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">',t)}var t=c(o("group"),{behavior:"url(#default#VML)"});!l(t,"transform")&&t.adj?(a.addRule(".spin-vml","behavior:url(#default#VML)"),v.prototype.lines=function(t,n){function s(){return c(e("group",{coordsize:i+" "+i,coordorigin:-r+" "+ -r}),{width:i,height:i})}function l(t,i,o){u(a,u(c(s(),{rotation:360/n.lines*t+"deg",left:~~i}),u(c(e("roundrect",{arcsize:n.corners}),{width:r,height:n.width,left:n.radius,top:-n.width>>1,filter:o}),e("fill",{color:n.color,opacity:n.opacity}),e("stroke",{opacity:0}))))}var r=n.length+n.width,i=2*r,o=-(n.width+n.length)*2+"px",a=c(s(),{position:"absolute",top:o,left:o}),f;if(n.shadow)for(f=1;f<=n.lines;f++)l(f,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(f=1;f<=n.lines;f++)l(f);return u(t,a)},v.prototype.opacity=function(e,t,n,r){var i=e.firstChild;r=r.shadow&&r.lines||0,i&&t+r<i.childNodes.length&&(i=i.childNodes[t+r],i=i&&i.firstChild,i=i&&i.firstChild,i&&(i.opacity=n))}):s=l(t,"animation")}(),typeof define=="function"&&define.amd?define(function(){return v}):e.Spinner=v}(window,document);

View File

@ -0,0 +1,320 @@
//fgnass.github.com/spin.js#v1.2.7
!function(window, document, undefined) {
/**
* Copyright (c) 2011 Felix Gnass [fgnass at neteye dot de]
* Licensed under the MIT license
*/
var prefixes = ['webkit', 'Moz', 'ms', 'O'] /* Vendor prefixes */
, animations = {} /* Animation rules keyed by their name */
, useCssAnimations
/**
* Utility function to create elements. If no tag name is given,
* a DIV is created. Optionally properties can be passed.
*/
function createEl(tag, prop) {
var el = document.createElement(tag || 'div')
, n
for(n in prop) el[n] = prop[n]
return el
}
/**
* Appends children and returns the parent.
*/
function ins(parent /* child1, child2, ...*/) {
for (var i=1, n=arguments.length; i<n; i++)
parent.appendChild(arguments[i])
return parent
}
/**
* Insert a new stylesheet to hold the @keyframe or VML rules.
*/
var sheet = function() {
var el = createEl('style', {type : 'text/css'})
ins(document.getElementsByTagName('head')[0], el)
return el.sheet || el.styleSheet
}()
/**
* Creates an opacity keyframe animation rule and returns its name.
* Since most mobile Webkits have timing issues with animation-delay,
* we create separate rules for each line/segment.
*/
function addAnimation(alpha, trail, i, lines) {
var name = ['opacity', trail, ~~(alpha*100), i, lines].join('-')
, start = 0.01 + i/lines*100
, z = Math.max(1 - (1-alpha) / trail * (100-start), alpha)
, prefix = useCssAnimations.substring(0, useCssAnimations.indexOf('Animation')).toLowerCase()
, pre = prefix && '-'+prefix+'-' || ''
if (!animations[name]) {
sheet.insertRule(
'@' + pre + 'keyframes ' + name + '{' +
'0%{opacity:' + z + '}' +
start + '%{opacity:' + alpha + '}' +
(start+0.01) + '%{opacity:1}' +
(start+trail) % 100 + '%{opacity:' + alpha + '}' +
'100%{opacity:' + z + '}' +
'}', sheet.cssRules.length)
animations[name] = 1
}
return name
}
/**
* Tries various vendor prefixes and returns the first supported property.
**/
function vendor(el, prop) {
var s = el.style
, pp
, i
if(s[prop] !== undefined) return prop
prop = prop.charAt(0).toUpperCase() + prop.slice(1)
for(i=0; i<prefixes.length; i++) {
pp = prefixes[i]+prop
if(s[pp] !== undefined) return pp
}
}
/**
* Sets multiple style properties at once.
*/
function css(el, prop) {
for (var n in prop)
el.style[vendor(el, n)||n] = prop[n]
return el
}
/**
* Fills in default values.
*/
function merge(obj) {
for (var i=1; i < arguments.length; i++) {
var def = arguments[i]
for (var n in def)
if (obj[n] === undefined) obj[n] = def[n]
}
return obj
}
/**
* Returns the absolute page-offset of the given element.
*/
function pos(el) {
var o = { x:el.offsetLeft, y:el.offsetTop }
while((el = el.offsetParent))
o.x+=el.offsetLeft, o.y+=el.offsetTop
return o
}
var defaults = {
lines: 12, // The number of lines to draw
length: 7, // The length of each line
width: 5, // The line thickness
radius: 10, // The radius of the inner circle
rotate: 0, // Rotation offset
corners: 1, // Roundness (0..1)
color: '#000', // #rgb or #rrggbb
speed: 1, // Rounds per second
trail: 100, // Afterglow percentage
opacity: 1/4, // Opacity of the lines
fps: 20, // Frames per second when using setTimeout()
zIndex: 2e9, // Use a high z-index by default
className: 'spinner', // CSS class to assign to the element
top: 'auto', // center vertically
left: 'auto', // center horizontally
position: 'relative' // element position
}
/** The constructor */
var Spinner = function Spinner(o) {
if (!this.spin) return new Spinner(o)
this.opts = merge(o || {}, Spinner.defaults, defaults)
}
Spinner.defaults = {}
merge(Spinner.prototype, {
spin: function(target) {
this.stop()
var self = this
, o = self.opts
, el = self.el = css(createEl(0, {className: o.className}), {position: o.position, width: 0, zIndex: o.zIndex})
, mid = o.radius+o.length+o.width
, ep // element position
, tp // target position
if (target) {
target.insertBefore(el, target.firstChild||null)
tp = pos(target)
ep = pos(el)
css(el, {
left: (o.left == 'auto' ? tp.x-ep.x + (target.offsetWidth >> 1) : parseInt(o.left, 10) + mid) + 'px',
top: (o.top == 'auto' ? tp.y-ep.y + (target.offsetHeight >> 1) : parseInt(o.top, 10) + mid) + 'px'
})
}
el.setAttribute('aria-role', 'progressbar')
self.lines(el, self.opts)
if (!useCssAnimations) {
// No CSS animation support, use setTimeout() instead
var i = 0
, fps = o.fps
, f = fps/o.speed
, ostep = (1-o.opacity) / (f*o.trail / 100)
, astep = f/o.lines
;(function anim() {
i++;
for (var s=o.lines; s; s--) {
var alpha = Math.max(1-(i+s*astep)%f * ostep, o.opacity)
self.opacity(el, o.lines-s, alpha, o)
}
self.timeout = self.el && setTimeout(anim, ~~(1000/fps))
})()
}
return self
},
stop: function() {
var el = this.el
if (el) {
clearTimeout(this.timeout)
if (el.parentNode) el.parentNode.removeChild(el)
this.el = undefined
}
return this
},
lines: function(el, o) {
var i = 0
, seg
function fill(color, shadow) {
return css(createEl(), {
position: 'absolute',
width: (o.length+o.width) + 'px',
height: o.width + 'px',
background: color,
boxShadow: shadow,
transformOrigin: 'left',
transform: 'rotate(' + ~~(360/o.lines*i+o.rotate) + 'deg) translate(' + o.radius+'px' +',0)',
borderRadius: (o.corners * o.width>>1) + 'px'
})
}
for (; i < o.lines; i++) {
seg = css(createEl(), {
position: 'absolute',
top: 1+~(o.width/2) + 'px',
transform: o.hwaccel ? 'translate3d(0,0,0)' : '',
opacity: o.opacity,
animation: useCssAnimations && addAnimation(o.opacity, o.trail, i, o.lines) + ' ' + 1/o.speed + 's linear infinite'
})
if (o.shadow) ins(seg, css(fill('#000', '0 0 4px ' + '#000'), {top: 2+'px'}))
ins(el, ins(seg, fill(o.color, '0 0 1px rgba(0,0,0,.1)')))
}
return el
},
opacity: function(el, i, val) {
if (i < el.childNodes.length) el.childNodes[i].style.opacity = val
}
})
/////////////////////////////////////////////////////////////////////////
// VML rendering for IE
/////////////////////////////////////////////////////////////////////////
/**
* Check and init VML support
*/
;(function() {
function vml(tag, attr) {
return createEl('<' + tag + ' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">', attr)
}
var s = css(createEl('group'), {behavior: 'url(#default#VML)'})
if (!vendor(s, 'transform') && s.adj) {
// VML support detected. Insert CSS rule ...
sheet.addRule('.spin-vml', 'behavior:url(#default#VML)')
Spinner.prototype.lines = function(el, o) {
var r = o.length+o.width
, s = 2*r
function grp() {
return css(
vml('group', {
coordsize: s + ' ' + s,
coordorigin: -r + ' ' + -r
}),
{ width: s, height: s }
)
}
var margin = -(o.width+o.length)*2 + 'px'
, g = css(grp(), {position: 'absolute', top: margin, left: margin})
, i
function seg(i, dx, filter) {
ins(g,
ins(css(grp(), {rotation: 360 / o.lines * i + 'deg', left: ~~dx}),
ins(css(vml('roundrect', {arcsize: o.corners}), {
width: r,
height: o.width,
left: o.radius,
top: -o.width>>1,
filter: filter
}),
vml('fill', {color: o.color, opacity: o.opacity}),
vml('stroke', {opacity: 0}) // transparent stroke to fix color bleeding upon opacity change
)
)
)
}
if (o.shadow)
for (i = 1; i <= o.lines; i++)
seg(i, -2, 'progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)')
for (i = 1; i <= o.lines; i++) seg(i)
return ins(el, g)
}
Spinner.prototype.opacity = function(el, i, val, o) {
var c = el.firstChild
o = o.shadow && o.lines || 0
if (c && i+o < c.childNodes.length) {
c = c.childNodes[i+o]; c = c && c.firstChild; c = c && c.firstChild
if (c) c.opacity = val
}
}
}
else
useCssAnimations = vendor(s, 'animation')
})()
if (typeof define == 'function' && define.amd)
define(function() { return Spinner })
else
window.Spinner = Spinner
}(window, document);