diff options
Diffstat (limited to 'js/vendor')
26 files changed, 3204 insertions, 0 deletions
diff --git a/js/vendor/ev-emitter/.bower.json b/js/vendor/ev-emitter/.bower.json new file mode 100644 index 000000000..54903332e --- /dev/null +++ b/js/vendor/ev-emitter/.bower.json @@ -0,0 +1,38 @@ +{ + "name": "ev-emitter", + "main": "ev-emitter.js", + "homepage": "https://github.com/metafizzy/ev-emitter", + "authors": [ + "David DeSandro <desandrocodes@gmail.com>" + ], + "description": "lil' event emitter", + "moduleType": [ + "amd", + "globals", + "node" + ], + "keywords": [ + "event", + "emitter", + "pubsub" + ], + "license": "MIT", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests", + "sandbox" + ], + "version": "1.0.1", + "_release": "1.0.1", + "_resolution": { + "type": "version", + "tag": "v1.0.1", + "commit": "e217618dcb466eb5c800602b46252083dc02cc49" + }, + "_source": "git://github.com/metafizzy/ev-emitter.git", + "_target": "~1.0.0", + "_originalSource": "ev-emitter" +}
\ No newline at end of file diff --git a/js/vendor/ev-emitter/README.md b/js/vendor/ev-emitter/README.md new file mode 100644 index 000000000..06c642d04 --- /dev/null +++ b/js/vendor/ev-emitter/README.md @@ -0,0 +1,101 @@ +# EvEmitter + +_Lil' event emitter_ — add a little pub/sub + +EvEmitter adds publish/subscribe pattern to a browser class. It's a smaller version of [Olical/EventEmitter](https://github.com/Olical/EventEmitter). That EventEmitter is full featured, widely used, and great. This EvEmitter has just the base event functionality to power the event API in libraries like [Isotope](http://isotope.metafizzy.co), [Flickity](http://flickity.metafizzy.co), [Masonry](http://masonry.desandro.com), and [imagesLoaded](http://imagesloaded.desandro.com). + +## API + +``` js +// Inherit prototype, IE8+ +MyClass.prototype = new EvEmitter(); + +// Inherit prototype, IE9+ +MyClass.prototype = Object.create( EvEmitter.prototype ); + +// Mixin prototype +_.extend( MyClass.prototype, EvEmitter.prototype ); + +// single instance +var emitter = new EventEmitter(); +``` + +### on + +Add an event listener. + +``` js +emitter.on( eventName, listener ) +``` + ++ `eventName` - _String_ - name of the event ++ `listener` - _Function_ + +### off + +Remove an event listener. + +``` js +emitter.off( eventName, listener ) +``` + +### once + +Add an event listener to be triggered only once. + +``` js +emitter.once( eventName, listener ) +``` + +### emitEvent + +Trigger an event. + +``` js +emitter.emitEvent( eventName, args ) +``` + ++ `eventName` - _String_ - name of the event ++ `args` - _Array_ - arguments passed to listeners + +## Code example + +``` js +// create event emitter +var emitter = new EventEmitter(); + +// listeners +function hey( a, b, c ) { + console.log( 'Hey', a, b, c ) +} + +function ho( a, b, c ) { + console.log( 'Ho', a, b, c ) +} + +function letsGo( a, b, c ) { + console.log( 'Lets go', a, b, c ) +} + +// bind listeners +emitter.on( 'rock', hey ) +emitter.once( 'rock', ho ) +// trigger letsGo once +emitter.on( 'rock', letsGo ) + +// emit event +emitter.emitEvent( 'rock', [ 1, 2, 3 ] ) +// => 'Hey', 1, 2, 3 +// => 'Ho', 1, 2, 3 +// => 'Lets go', 1, 2, 3 + +// unbind +emitter.off( 'rock', ho ) + +emitter.emitEvent( 'rock', [ 4, 5, 6 ] ) +// => 'Hey' 4, 5, 6 +``` + +## License + +EvEmitter is released under the [MIT License](http://desandro.mit-license.org/). Have at it. diff --git a/js/vendor/ev-emitter/bower.json b/js/vendor/ev-emitter/bower.json new file mode 100644 index 000000000..cabd1115d --- /dev/null +++ b/js/vendor/ev-emitter/bower.json @@ -0,0 +1,28 @@ +{ + "name": "ev-emitter", + "main": "ev-emitter.js", + "homepage": "https://github.com/metafizzy/ev-emitter", + "authors": [ + "David DeSandro <desandrocodes@gmail.com>" + ], + "description": "lil' event emitter", + "moduleType": [ + "amd", + "globals", + "node" + ], + "keywords": [ + "event", + "emitter", + "pubsub" + ], + "license": "MIT", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests", + "sandbox" + ] +} diff --git a/js/vendor/ev-emitter/ev-emitter.js b/js/vendor/ev-emitter/ev-emitter.js new file mode 100644 index 000000000..212a978a8 --- /dev/null +++ b/js/vendor/ev-emitter/ev-emitter.js @@ -0,0 +1,109 @@ +/** + * EvEmitter v1.0.1 + * Lil' event emitter + * MIT License + */ + +/* jshint unused: true, undef: true, strict: true */ + +( function( global, factory ) { + // universal module definition + /* jshint strict: false */ /* globals define, module */ + if ( typeof define == 'function' && define.amd ) { + // AMD - RequireJS + define( factory ); + } else if ( typeof module == 'object' && module.exports ) { + // CommonJS - Browserify, Webpack + module.exports = factory(); + } else { + // Browser globals + global.EvEmitter = factory(); + } + +}( this, function() { + +"use strict"; + +function EvEmitter() {} + +var proto = EvEmitter.prototype; + +proto.on = function( eventName, listener ) { + if ( !eventName || !listener ) { + return; + } + // set events hash + var events = this._events = this._events || {}; + // set listeners array + var listeners = events[ eventName ] = events[ eventName ] || []; + // only add once + if ( listeners.indexOf( listener ) == -1 ) { + listeners.push( listener ); + } + + return this; +}; + +proto.once = function( eventName, listener ) { + if ( !eventName || !listener ) { + return; + } + // add event + this.on( eventName, listener ); + // set once flag + // set onceEvents hash + var onceEvents = this._onceEvents = this._onceEvents || {}; + // set onceListeners array + var onceListeners = onceEvents[ eventName ] = onceEvents[ eventName ] || []; + // set flag + onceListeners[ listener ] = true; + + return this; +}; + +proto.off = function( eventName, listener ) { + var listeners = this._events && this._events[ eventName ]; + if ( !listeners || !listeners.length ) { + return; + } + var index = listeners.indexOf( listener ); + if ( index != -1 ) { + listeners.splice( index, 1 ); + } + + return this; +}; + +proto.emitEvent = function( eventName, args ) { + var listeners = this._events && this._events[ eventName ]; + if ( !listeners || !listeners.length ) { + return; + } + var i = 0; + var listener = listeners[i]; + args = args || []; + // once stuff + var onceListeners = this._onceEvents && this._onceEvents[ eventName ]; + + while ( listener ) { + var isOnce = onceListeners && onceListeners[ listener ]; + if ( isOnce ) { + // remove listener + // remove before trigger to prevent recursion + this.off( eventName, listener ); + // unset once flag + delete onceListeners[ listener ]; + } + // trigger listener + listener.apply( this, args ); + // get next listener + i += isOnce ? 0 : 1; + listener = listeners[i]; + } + + return this; +}; + +return EvEmitter; + +})); diff --git a/js/vendor/ev-emitter/package.json b/js/vendor/ev-emitter/package.json new file mode 100644 index 000000000..d12f35779 --- /dev/null +++ b/js/vendor/ev-emitter/package.json @@ -0,0 +1,27 @@ +{ + "name": "ev-emitter", + "version": "1.0.1", + "description": "lil' event emitter", + "main": "ev-emitter.js", + "scripts": { + "test": "mocha test/test" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/metafizzy/ev-emitter.git" + }, + "keywords": [ + "event", + "emitter", + "pubsub" + ], + "author": "David DeSandro", + "license": "MIT", + "bugs": { + "url": "https://github.com/metafizzy/ev-emitter/issues" + }, + "homepage": "https://github.com/metafizzy/ev-emitter#readme", + "directories": { + "test": "test" + } +} diff --git a/js/vendor/fizzy-ui-utils/.bower.json b/js/vendor/fizzy-ui-utils/.bower.json new file mode 100644 index 000000000..de72a0780 --- /dev/null +++ b/js/vendor/fizzy-ui-utils/.bower.json @@ -0,0 +1,43 @@ +{ + "name": "fizzy-ui-utils", + "version": "2.0.0", + "authors": [ + "David DeSandro" + ], + "description": "UI utilities", + "main": "utils.js", + "dependencies": { + "matches-selector": "~2.0.0" + }, + "moduleType": [ + "amd", + "globals", + "node" + ], + "keywords": [ + "utility", + "ui" + ], + "license": "MIT", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests", + "package.json" + ], + "devDependencies": { + "qunit": "~1.20.0" + }, + "homepage": "https://github.com/metafizzy/fizzy-ui-utils", + "_release": "2.0.0", + "_resolution": { + "type": "version", + "tag": "v2.0.0", + "commit": "8d35dbc42874d439d0854337e79d2c25232e3a56" + }, + "_source": "git://github.com/metafizzy/fizzy-ui-utils.git", + "_target": "~2.0.0", + "_originalSource": "fizzy-ui-utils" +}
\ No newline at end of file diff --git a/js/vendor/fizzy-ui-utils/README.md b/js/vendor/fizzy-ui-utils/README.md new file mode 100644 index 000000000..ae461c4c5 --- /dev/null +++ b/js/vendor/fizzy-ui-utils/README.md @@ -0,0 +1,64 @@ +# Fizzy UI utils + +UI utility & helper functions + +Used in [Flickity](http://flickity.metafizzy.co), [Isotope](http://isotope.metafizzy.co), [Masonry](http://masonry.desandro.com), [Draggabilly](http://draggabilly.desandro.com) + +## Install + +Bower: `bower install fizzy-ui-utils --save` + +npm: `npm install fizzy-ui-utils --save` + +## API + +``` js +// fizzyUIUtils is the browser global +var utils = fizzyUIUtils; + +// ---- ---- // + +utils.extend( a, b ) +// extend object + +utils.modulo( num, div ) +// num [modulo] div + +utils.makeArray( obj ) +// make array from object + +utils.removeFrom( ary, obj ) +// remove object from array + +utils.getParent( elem, selector ) +// get parent element of an element, given a selector string + +utils.getQueryElement( elem ) +// if elem is a string, use it as a selector and return element + +Class.prototype.handleEvent = utils.handleEvent; +// enable Class.onclick when element.addEventListener( 'click', this, false ) + +utils.filterFindElements( elems, selector ) +// iterate through elems, filter and find all elements that match selector + +utils.debounceMethod( Class, methodName, threhold ) +// debounce a class method + +utils.docReady( callback ) +// trigger callback on document ready + +utils.toDashed( str ) +// 'camelCaseString' -> 'camel-case-string' + +utils.htmlInit( Class, namespace ) +// on document ready, initialize Class on every element +// that matches js-namespace +// pass in JSON options from element's data-options-namespace attribute +``` + +--- + +[MIT license](http://desandro.mit-license.org/). Have at it. + +By [Metafizzy](http://metafizzy.co) diff --git a/js/vendor/fizzy-ui-utils/bower.json b/js/vendor/fizzy-ui-utils/bower.json new file mode 100644 index 000000000..ec254413d --- /dev/null +++ b/js/vendor/fizzy-ui-utils/bower.json @@ -0,0 +1,33 @@ +{ + "name": "fizzy-ui-utils", + "version": "2.0.0", + "authors": [ + "David DeSandro" + ], + "description": "UI utilities", + "main": "utils.js", + "dependencies": { + "matches-selector": "~2.0.0" + }, + "moduleType": [ + "amd", + "globals", + "node" + ], + "keywords": [ + "utility", + "ui" + ], + "license": "MIT", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests", + "package.json" + ], + "devDependencies": { + "qunit": "~1.20.0" + } +} diff --git a/js/vendor/fizzy-ui-utils/utils.js b/js/vendor/fizzy-ui-utils/utils.js new file mode 100644 index 000000000..f4bed3670 --- /dev/null +++ b/js/vendor/fizzy-ui-utils/utils.js @@ -0,0 +1,236 @@ +/** + * Fizzy UI utils v2.0.0 + * MIT license + */ + +/*jshint browser: true, undef: true, unused: true, strict: true */ + +( function( window, factory ) { + /*global define: false, module: false, require: false */ + 'use strict'; + // universal module definition + + if ( typeof define == 'function' && define.amd ) { + // AMD + define( [ + 'matches-selector/matches-selector' + ], function( matchesSelector ) { + return factory( window, matchesSelector ); + }); + } else if ( typeof module == 'object' && module.exports ) { + // CommonJS + module.exports = factory( + window, + require('desandro-matches-selector') + ); + } else { + // browser global + window.fizzyUIUtils = factory( + window, + window.matchesSelector + ); + } + +}( window, function factory( window, matchesSelector ) { + +'use strict'; + +var utils = {}; + +// ----- extend ----- // + +// extends objects +utils.extend = function( a, b ) { + for ( var prop in b ) { + a[ prop ] = b[ prop ]; + } + return a; +}; + +// ----- modulo ----- // + +utils.modulo = function( num, div ) { + return ( ( num % div ) + div ) % div; +}; + +// ----- makeArray ----- // + +// turn element or nodeList into an array +utils.makeArray = function( obj ) { + var ary = []; + if ( Array.isArray( obj ) ) { + // use object if already an array + ary = obj; + } else if ( obj && typeof obj.length == 'number' ) { + // convert nodeList to array + for ( var i=0; i < obj.length; i++ ) { + ary.push( obj[i] ); + } + } else { + // array of single index + ary.push( obj ); + } + return ary; +}; + +// ----- removeFrom ----- // + +utils.removeFrom = function( ary, obj ) { + var index = ary.indexOf( obj ); + if ( index != -1 ) { + ary.splice( index, 1 ); + } +}; + +// ----- getParent ----- // + +utils.getParent = function( elem, selector ) { + while ( elem != document.body ) { + elem = elem.parentNode; + if ( matchesSelector( elem, selector ) ) { + return elem; + } + } +}; + +// ----- getQueryElement ----- // + +// use element as selector string +utils.getQueryElement = function( elem ) { + if ( typeof elem == 'string' ) { + return document.querySelector( elem ); + } + return elem; +}; + +// ----- handleEvent ----- // + +// enable .ontype to trigger from .addEventListener( elem, 'type' ) +utils.handleEvent = function( event ) { + var method = 'on' + event.type; + if ( this[ method ] ) { + this[ method ]( event ); + } +}; + +// ----- filterFindElements ----- // + +utils.filterFindElements = function( elems, selector ) { + // make array of elems + elems = utils.makeArray( elems ); + var ffElems = []; + + elems.forEach( function( elem ) { + // check that elem is an actual element + if ( !( elem instanceof HTMLElement ) ) { + return; + } + // add elem if no selector + if ( !selector ) { + ffElems.push( elem ); + return; + } + // filter & find items if we have a selector + // filter + if ( matchesSelector( elem, selector ) ) { + ffElems.push( elem ); + } + // find children + var childElems = elem.querySelectorAll( selector ); + // concat childElems to filterFound array + for ( var i=0; i < childElems.length; i++ ) { + ffElems.push( childElems[i] ); + } + }); + + return ffElems; +}; + +// ----- debounceMethod ----- // + +utils.debounceMethod = function( _class, methodName, threshold ) { + // original method + var method = _class.prototype[ methodName ]; + var timeoutName = methodName + 'Timeout'; + + _class.prototype[ methodName ] = function() { + var timeout = this[ timeoutName ]; + if ( timeout ) { + clearTimeout( timeout ); + } + var args = arguments; + + var _this = this; + this[ timeoutName ] = setTimeout( function() { + method.apply( _this, args ); + delete _this[ timeoutName ]; + }, threshold || 100 ); + }; +}; + +// ----- docReady ----- // + +utils.docReady = function( callback ) { + if ( document.readyState == 'complete' ) { + callback(); + } else { + document.addEventListener( 'DOMContentLoaded', callback ); + } +}; + +// ----- htmlInit ----- // + +// http://jamesroberts.name/blog/2010/02/22/string-functions-for-javascript-trim-to-camel-case-to-dashed-and-to-underscore/ +utils.toDashed = function( str ) { + return str.replace( /(.)([A-Z])/g, function( match, $1, $2 ) { + return $1 + '-' + $2; + }).toLowerCase(); +}; + +var console = window.console; +/** + * allow user to initialize classes via [data-namespace] or .js-namespace class + * htmlInit( Widget, 'widgetName' ) + * options are parsed from data-namespace-options + */ +utils.htmlInit = function( WidgetClass, namespace ) { + utils.docReady( function() { + var dashedNamespace = utils.toDashed( namespace ); + var dataAttr = 'data-' + dashedNamespace; + var dataAttrElems = document.querySelectorAll( '[' + dataAttr + ']' ); + var jsDashElems = document.querySelectorAll( '.js-' + dashedNamespace ); + var elems = utils.makeArray( dataAttrElems ) + .concat( utils.makeArray( jsDashElems ) ); + var dataOptionsAttr = dataAttr + '-options'; + var jQuery = window.jQuery; + + elems.forEach( function( elem ) { + var attr = elem.getAttribute( dataAttr ) || + elem.getAttribute( dataOptionsAttr ); + var options; + try { + options = attr && JSON.parse( attr ); + } catch ( error ) { + // log error, do not initialize + if ( console ) { + console.error( 'Error parsing ' + dataAttr + ' on ' + elem.className + + ': ' + error ); + } + return; + } + // initialize + var instance = new WidgetClass( elem, options ); + // make available via $().data('layoutname') + if ( jQuery ) { + jQuery.data( elem, namespace, instance ); + } + }); + + }); +}; + +// ----- ----- // + +return utils; + +})); diff --git a/js/vendor/get-size/.bower.json b/js/vendor/get-size/.bower.json new file mode 100644 index 000000000..b2b5fb873 --- /dev/null +++ b/js/vendor/get-size/.bower.json @@ -0,0 +1,45 @@ +{ + "name": "get-size", + "version": "2.0.2", + "main": "get-size.js", + "description": "measures element size", + "dependencies": {}, + "devDependencies": { + "qunit": "~1.10" + }, + "ignore": [ + "test/", + "**/.*", + "package.json", + "node_modules", + "bower_components", + "test", + "tests", + "sandbox.html" + ], + "homepage": "https://github.com/desandro/get-size", + "authors": [ + "David DeSandro <desandrocodes@gmail.com>" + ], + "moduleType": [ + "amd", + "globals", + "node" + ], + "keywords": [ + "size", + "dom", + "width", + "height" + ], + "license": "MIT", + "_release": "2.0.2", + "_resolution": { + "type": "version", + "tag": "v2.0.2", + "commit": "53ad18840e260d5eb89fd579362596dad5852c77" + }, + "_source": "git://github.com/desandro/get-size.git", + "_target": "~2.0.2", + "_originalSource": "get-size" +}
\ No newline at end of file diff --git a/js/vendor/get-size/README.md b/js/vendor/get-size/README.md new file mode 100644 index 000000000..f3573a874 --- /dev/null +++ b/js/vendor/get-size/README.md @@ -0,0 +1,37 @@ +# getSize + +Get the size of elements. + +``` js +var size = getSize( elem ); +// elem can be an element +var size = getSize( document.querySelector('#selector') ) +// elem can be a string, used as a query selector +var size = getSize('#selector') +``` + +Returns an object with: `width`, `height`, `innerWidth/Height`, `outerWidth/Height`, `paddingLeft/Top/Right/Bottom`, `marginLeft/Top/Right/Bottom`, `borderLeft/Top/Right/BottomWidth` and `isBorderBox`. + +Browser support: IE10+, Android 4.0+, iOS 5+, and modern browsers + +## Install + +Install with [Bower](http://bower.io): `bower install get-size` + +Install with npm: `npm install get-size` + +## Firefox hidden iframe bug + +[Firefox has an old bug](https://bugzilla.mozilla.org/show_bug.cgi?id=548397) that occurs within iframes that are hidden with `display: none`. To resolve this, you can use alternate CSS to hide the iframe off-screen, with out `display: none`. + +``` css +.hide-iframe { + visibility: hidden; + position: absolute; + left: -999em; +} +``` + +## MIT License + +getSize is released under the [MIT License](http://desandro.mit-license.org/). diff --git a/js/vendor/get-size/bower.json b/js/vendor/get-size/bower.json new file mode 100644 index 000000000..bb7a6e6b3 --- /dev/null +++ b/js/vendor/get-size/bower.json @@ -0,0 +1,37 @@ +{ + "name": "get-size", + "version": "2.0.2", + "main": "get-size.js", + "description": "measures element size", + "dependencies": { + }, + "devDependencies": { + "qunit": "~1.10" + }, + "ignore": [ + "test/", + "**/.*", + "package.json", + "node_modules", + "bower_components", + "test", + "tests", + "sandbox.html" + ], + "homepage": "https://github.com/desandro/get-size", + "authors": [ + "David DeSandro <desandrocodes@gmail.com>" + ], + "moduleType": [ + "amd", + "globals", + "node" + ], + "keywords": [ + "size", + "dom", + "width", + "height" + ], + "license": "MIT" +} diff --git a/js/vendor/get-size/get-size.js b/js/vendor/get-size/get-size.js new file mode 100644 index 000000000..fda33b69c --- /dev/null +++ b/js/vendor/get-size/get-size.js @@ -0,0 +1,209 @@ +/*! + * getSize v2.0.2 + * measure size of elements + * MIT license + */ + +/*jshint browser: true, strict: true, undef: true, unused: true */ +/*global define: false, module: false, console: false */ + +( function( window, factory ) { + 'use strict'; + + if ( typeof define == 'function' && define.amd ) { + // AMD + define( function() { + return factory(); + }); + } else if ( typeof module == 'object' && module.exports ) { + // CommonJS + module.exports = factory(); + } else { + // browser global + window.getSize = factory(); + } + +})( window, function factory() { +'use strict'; + +// -------------------------- helpers -------------------------- // + +// get a number from a string, not a percentage +function getStyleSize( value ) { + var num = parseFloat( value ); + // not a percent like '100%', and a number + var isValid = value.indexOf('%') == -1 && !isNaN( num ); + return isValid && num; +} + +function noop() {} + +var logError = typeof console == 'undefined' ? noop : + function( message ) { + console.error( message ); + }; + +// -------------------------- measurements -------------------------- // + < |