From 812c3f81ce29781f4255e97686c1117ef38d898c Mon Sep 17 00:00:00 2001 From: David DeSandro Date: Wed, 27 Apr 2016 08:38:27 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20build=20v3.0.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ⬆️ outlayer v2.1.0, masonry v4.1.0 Fixes #947 --- bower.json | 4 +- dist/isotope.pkgd.js | 2353 +++++++++++++------------------------- dist/isotope.pkgd.min.js | 8 +- js/isotope.js | 2 +- package.json | 4 +- 5 files changed, 814 insertions(+), 1557 deletions(-) diff --git a/bower.json b/bower.json index 50e837f..12c17d1 100644 --- a/bower.json +++ b/bower.json @@ -6,8 +6,8 @@ "desandro-matches-selector": "^2.0.0", "fizzy-ui-utils": "^2.0.0", "get-size": "^2.0.0", - "masonry": "^4.0.0", - "outlayer": "stagger" + "masonry": "^4.1.0", + "outlayer": "^2.1.0" }, "devDependencies": { "jquery": "2 < 4", diff --git a/dist/isotope.pkgd.js b/dist/isotope.pkgd.js index 40561c1..15b0739 100644 --- a/dist/isotope.pkgd.js +++ b/dist/isotope.pkgd.js @@ -1,777 +1,295 @@ /*! - * Isotope PACKAGED v2.2.2 + * Isotope PACKAGED v3.0.0 * * Licensed GPLv3 for open source use * or Isotope Commercial License for commercial use * * http://isotope.metafizzy.co - * Copyright 2015 Metafizzy + * Copyright 2016 Metafizzy */ /** * Bridget makes jQuery widgets - * v1.1.0 + * v2.0.0 * MIT license */ -( function( window ) { +/* jshint browser: true, strict: true, undef: true, unused: true */ +( function( window, factory ) { + 'use strict'; + /* globals define: false, module: false, require: false */ - -// -------------------------- utils -------------------------- // - -var slice = Array.prototype.slice; - -function noop() {} - -// -------------------------- definition -------------------------- // - -function defineBridget( $ ) { - -// bail if no jQuery -if ( !$ ) { - return; -} - -// -------------------------- addOptionMethod -------------------------- // - -/** - * adds option method -> $().plugin('option', {...}) - * @param {Function} PluginClass - constructor class - */ -function addOptionMethod( PluginClass ) { - // don't overwrite original option method - if ( PluginClass.prototype.option ) { - return; + if ( typeof define == 'function' && define.amd ) { + // AMD + define( 'jquery-bridget/jquery-bridget',[ 'jquery' ], function( jQuery ) { + factory( window, jQuery ); + }); + } else if ( typeof module == 'object' && module.exports ) { + // CommonJS + module.exports = factory( + window, + require('jquery') + ); + } else { + // browser global + window.jQueryBridget = factory( + window, + window.jQuery + ); } - // option setter - PluginClass.prototype.option = function( opts ) { - // bail out if not an object - if ( !$.isPlainObject( opts ) ){ - return; - } - this.options = $.extend( true, this.options, opts ); - }; -} +}( window, function factory( window, jQuery ) { +'use strict'; + +// ----- utils ----- // -// -------------------------- plugin bridge -------------------------- // +var arraySlice = Array.prototype.slice; // helper function for logging errors // $.error breaks jQuery chaining -var logError = typeof console === 'undefined' ? noop : +var console = window.console; +var logError = typeof console == 'undefined' ? function() {} : function( message ) { console.error( message ); }; -/** - * jQuery plugin bridge, access methods like $elem.plugin('method') - * @param {String} namespace - plugin name - * @param {Function} PluginClass - constructor class - */ -function bridge( namespace, PluginClass ) { - // add to jQuery fn namespace - $.fn[ namespace ] = function( options ) { - if ( typeof options === 'string' ) { - // call plugin method when first argument is a string - // get arguments for method - var args = slice.call( arguments, 1 ); - - for ( var i=0, len = this.length; i < len; i++ ) { - var elem = this[i]; - var instance = $.data( elem, namespace ); - if ( !instance ) { - logError( "cannot call methods on " + namespace + " prior to initialization; " + - "attempted to call '" + options + "'" ); - continue; - } - if ( !$.isFunction( instance[options] ) || options.charAt(0) === '_' ) { - logError( "no such method '" + options + "' for " + namespace + " instance" ); - continue; - } +// ----- jQueryBridget ----- // - // trigger method with arguments - var returnValue = instance[ options ].apply( instance, args ); +function jQueryBridget( namespace, PluginClass, $ ) { + $ = $ || jQuery || window.jQuery; + if ( !$ ) { + return; + } - // break look and return first value if provided - if ( returnValue !== undefined ) { - return returnValue; - } + // add option method -> $().plugin('option', {...}) + if ( !PluginClass.prototype.option ) { + // option setter + PluginClass.prototype.option = function( opts ) { + // bail out if not an object + if ( !$.isPlainObject( opts ) ){ + return; } - // return this if no return value - return this; - } else { - return this.each( function() { - var instance = $.data( this, namespace ); - if ( instance ) { - // apply options & init - instance.option( options ); - instance._init(); - } else { - // initialize new instance - instance = new PluginClass( this, options ); - $.data( this, namespace, instance ); - } - }); + this.options = $.extend( true, this.options, opts ); + }; + } + + // make jQuery plugin + $.fn[ namespace ] = function( arg0 /*, arg1 */ ) { + if ( typeof arg0 == 'string' ) { + // method call $().plugin( 'methodName', { options } ) + // shift arguments by 1 + var args = arraySlice.call( arguments, 1 ); + return methodCall( this, arg0, args ); } + // just $().plugin({ options }) + plainCall( this, arg0 ); + return this; }; -} - -// -------------------------- bridget -------------------------- // - -/** - * converts a Prototypical class into a proper jQuery plugin - * the class must have a ._init method - * @param {String} namespace - plugin name, used in $().pluginName - * @param {Function} PluginClass - constructor class - */ -$.bridget = function( namespace, PluginClass ) { - addOptionMethod( PluginClass ); - bridge( namespace, PluginClass ); -}; - -return $.bridget; - -} - -// transport -if ( typeof define === 'function' && define.amd ) { - // AMD - define( 'jquery-bridget/jquery.bridget',[ 'jquery' ], defineBridget ); -} else if ( typeof exports === 'object' ) { - defineBridget( require('jquery') ); -} else { - // get jquery from browser global - defineBridget( window.jQuery ); -} - -})( window ); - -/*! - * eventie v1.0.6 - * event binding helper - * eventie.bind( elem, 'click', myFn ) - * eventie.unbind( elem, 'click', myFn ) - * MIT license - */ - -/*jshint browser: true, undef: true, unused: true */ -/*global define: false, module: false */ - -( function( window ) { - + // $().plugin('methodName') + function methodCall( $elems, methodName, args ) { + var returnValue; + var pluginMethodStr = '$().' + namespace + '("' + methodName + '")'; + $elems.each( function( i, elem ) { + // get instance + var instance = $.data( elem, namespace ); + if ( !instance ) { + logError( namespace + ' not initialized. Cannot call methods, i.e. ' + + pluginMethodStr ); + return; + } -var docElem = document.documentElement; + var method = instance[ methodName ]; + if ( !method || methodName.charAt(0) == '_' ) { + logError( pluginMethodStr + ' is not a valid method' ); + return; + } -var bind = function() {}; + // apply method, get return value + var value = method.apply( instance, args ); + // set return value if value is returned, use only first value + returnValue = returnValue === undefined ? value : returnValue; + }); -function getIEEvent( obj ) { - var event = window.event; - // add event.target - event.target = event.target || event.srcElement || obj; - return event; -} + return returnValue !== undefined ? returnValue : $elems; + } -if ( docElem.addEventListener ) { - bind = function( obj, type, fn ) { - obj.addEventListener( type, fn, false ); - }; -} else if ( docElem.attachEvent ) { - bind = function( obj, type, fn ) { - obj[ type + fn ] = fn.handleEvent ? - function() { - var event = getIEEvent( obj ); - fn.handleEvent.call( fn, event ); - } : - function() { - var event = getIEEvent( obj ); - fn.call( obj, event ); - }; - obj.attachEvent( "on" + type, obj[ type + fn ] ); - }; -} + function plainCall( $elems, options ) { + $elems.each( function( i, elem ) { + var instance = $.data( elem, namespace ); + if ( instance ) { + // set options & init + instance.option( options ); + instance._init(); + } else { + // initialize new instance + instance = new PluginClass( elem, options ); + $.data( elem, namespace, instance ); + } + }); + } -var unbind = function() {}; + updateJQuery( $ ); -if ( docElem.removeEventListener ) { - unbind = function( obj, type, fn ) { - obj.removeEventListener( type, fn, false ); - }; -} else if ( docElem.detachEvent ) { - unbind = function( obj, type, fn ) { - obj.detachEvent( "on" + type, obj[ type + fn ] ); - try { - delete obj[ type + fn ]; - } catch ( err ) { - // can't delete window object properties - obj[ type + fn ] = undefined; - } - }; } -var eventie = { - bind: bind, - unbind: unbind -}; +// ----- updateJQuery ----- // -// ----- module definition ----- // - -if ( typeof define === 'function' && define.amd ) { - // AMD - define( 'eventie/eventie',eventie ); -} else if ( typeof exports === 'object' ) { - // CommonJS - module.exports = eventie; -} else { - // browser global - window.eventie = eventie; +// set $.bridget for v1 backwards compatibility +function updateJQuery( $ ) { + if ( !$ || ( $ && $.bridget ) ) { + return; + } + $.bridget = jQueryBridget; } -})( window ); - -/*! - * EventEmitter v4.2.11 - git.io/ee - * Unlicense - http://unlicense.org/ - * Oliver Caldwell - http://oli.me.uk/ - * @preserve - */ - -;(function () { - 'use strict'; - - /** - * Class for managing events. - * Can be extended to provide event functionality in other classes. - * - * @class EventEmitter Manages event registering and emitting. - */ - function EventEmitter() {} - - // Shortcuts to improve speed and size - var proto = EventEmitter.prototype; - var exports = this; - var originalGlobalValue = exports.EventEmitter; - - /** - * Finds the index of the listener for the event in its storage array. - * - * @param {Function[]} listeners Array of listeners to search through. - * @param {Function} listener Method to look for. - * @return {Number} Index of the specified listener, -1 if not found - * @api private - */ - function indexOfListener(listeners, listener) { - var i = listeners.length; - while (i--) { - if (listeners[i].listener === listener) { - return i; - } - } - - return -1; - } - - /** - * Alias a method while keeping the context correct, to allow for overwriting of target method. - * - * @param {String} name The name of the target method. - * @return {Function} The aliased method - * @api private - */ - function alias(name) { - return function aliasClosure() { - return this[name].apply(this, arguments); - }; - } - - /** - * Returns the listener array for the specified event. - * Will initialise the event object and listener arrays if required. - * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them. - * Each property in the object response is an array of listener functions. - * - * @param {String|RegExp} evt Name of the event to return the listeners from. - * @return {Function[]|Object} All listener functions for the event. - */ - proto.getListeners = function getListeners(evt) { - var events = this._getEvents(); - var response; - var key; - - // Return a concatenated array of all matching events if - // the selector is a regular expression. - if (evt instanceof RegExp) { - response = {}; - for (key in events) { - if (events.hasOwnProperty(key) && evt.test(key)) { - response[key] = events[key]; - } - } - } - else { - response = events[evt] || (events[evt] = []); - } - - return response; - }; - - /** - * Takes a list of listener objects and flattens it into a list of listener functions. - * - * @param {Object[]} listeners Raw listener objects. - * @return {Function[]} Just the listener functions. - */ - proto.flattenListeners = function flattenListeners(listeners) { - var flatListeners = []; - var i; - - for (i = 0; i < listeners.length; i += 1) { - flatListeners.push(listeners[i].listener); - } - - return flatListeners; - }; - - /** - * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful. - * - * @param {String|RegExp} evt Name of the event to return the listeners from. - * @return {Object} All listener functions for an event in an object. - */ - proto.getListenersAsObject = function getListenersAsObject(evt) { - var listeners = this.getListeners(evt); - var response; - - if (listeners instanceof Array) { - response = {}; - response[evt] = listeners; - } - - return response || listeners; - }; - - /** - * Adds a listener function to the specified event. - * The listener will not be added if it is a duplicate. - * If the listener returns true then it will be removed after it is called. - * If you pass a regular expression as the event name then the listener will be added to all events that match it. - * - * @param {String|RegExp} evt Name of the event to attach the listener to. - * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling. - * @return {Object} Current instance of EventEmitter for chaining. - */ - proto.addListener = function addListener(evt, listener) { - var listeners = this.getListenersAsObject(evt); - var listenerIsWrapped = typeof listener === 'object'; - var key; - - for (key in listeners) { - if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) { - listeners[key].push(listenerIsWrapped ? listener : { - listener: listener, - once: false - }); - } - } - - return this; - }; - - /** - * Alias of addListener - */ - proto.on = alias('addListener'); - - /** - * Semi-alias of addListener. It will add a listener that will be - * automatically removed after its first execution. - * - * @param {String|RegExp} evt Name of the event to attach the listener to. - * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling. - * @return {Object} Current instance of EventEmitter for chaining. - */ - proto.addOnceListener = function addOnceListener(evt, listener) { - return this.addListener(evt, { - listener: listener, - once: true - }); - }; - - /** - * Alias of addOnceListener. - */ - proto.once = alias('addOnceListener'); - - /** - * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad. - * You need to tell it what event names should be matched by a regex. - * - * @param {String} evt Name of the event to create. - * @return {Object} Current instance of EventEmitter for chaining. - */ - proto.defineEvent = function defineEvent(evt) { - this.getListeners(evt); - return this; - }; - - /** - * Uses defineEvent to define multiple events. - * - * @param {String[]} evts An array of event names to define. - * @return {Object} Current instance of EventEmitter for chaining. - */ - proto.defineEvents = function defineEvents(evts) { - for (var i = 0; i < evts.length; i += 1) { - this.defineEvent(evts[i]); - } - return this; - }; - - /** - * Removes a listener function from the specified event. - * When passed a regular expression as the event name, it will remove the listener from all events that match it. - * - * @param {String|RegExp} evt Name of the event to remove the listener from. - * @param {Function} listener Method to remove from the event. - * @return {Object} Current instance of EventEmitter for chaining. - */ - proto.removeListener = function removeListener(evt, listener) { - var listeners = this.getListenersAsObject(evt); - var index; - var key; - - for (key in listeners) { - if (listeners.hasOwnProperty(key)) { - index = indexOfListener(listeners[key], listener); - - if (index !== -1) { - listeners[key].splice(index, 1); - } - } - } - - return this; - }; - - /** - * Alias of removeListener - */ - proto.off = alias('removeListener'); - - /** - * Adds listeners in bulk using the manipulateListeners method. - * If you pass an object as the second argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added. - * You can also pass it a regular expression to add the array of listeners to all events that match it. - * Yeah, this function does quite a bit. That's probably a bad thing. - * - * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once. - * @param {Function[]} [listeners] An optional array of listener functions to add. - * @return {Object} Current instance of EventEmitter for chaining. - */ - proto.addListeners = function addListeners(evt, listeners) { - // Pass through to manipulateListeners - return this.manipulateListeners(false, evt, listeners); - }; - - /** - * Removes listeners in bulk using the manipulateListeners method. - * If you pass an object as the second argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. - * You can also pass it an event name and an array of listeners to be removed. - * You can also pass it a regular expression to remove the listeners from all events that match it. - * - * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once. - * @param {Function[]} [listeners] An optional array of listener functions to remove. - * @return {Object} Current instance of EventEmitter for chaining. - */ - proto.removeListeners = function removeListeners(evt, listeners) { - // Pass through to manipulateListeners - return this.manipulateListeners(true, evt, listeners); - }; +updateJQuery( jQuery || window.jQuery ); - /** - * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level. - * The first argument will determine if the listeners are removed (true) or added (false). - * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. - * You can also pass it an event name and an array of listeners to be added/removed. - * You can also pass it a regular expression to manipulate the listeners of all events that match it. - * - * @param {Boolean} remove True if you want to remove listeners, false if you want to add. - * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once. - * @param {Function[]} [listeners] An optional array of listener functions to add/remove. - * @return {Object} Current instance of EventEmitter for chaining. - */ - proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) { - var i; - var value; - var single = remove ? this.removeListener : this.addListener; - var multiple = remove ? this.removeListeners : this.addListeners; - - // If evt is an object then pass each of its properties to this method - if (typeof evt === 'object' && !(evt instanceof RegExp)) { - for (i in evt) { - if (evt.hasOwnProperty(i) && (value = evt[i])) { - // Pass the single listener straight through to the singular method - if (typeof value === 'function') { - single.call(this, i, value); - } - else { - // Otherwise pass back to the multiple function - multiple.call(this, i, value); - } - } - } - } - else { - // So evt must be a string - // And listeners must be an array of listeners - // Loop over it and pass each one to the multiple method - i = listeners.length; - while (i--) { - single.call(this, evt, listeners[i]); - } - } - - return this; - }; +// ----- ----- // - /** - * Removes all listeners from a specified event. - * If you do not specify an event then all listeners will be removed. - * That means every event will be emptied. - * You can also pass a regex to remove all events that match it. - * - * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed. - * @return {Object} Current instance of EventEmitter for chaining. - */ - proto.removeEvent = function removeEvent(evt) { - var type = typeof evt; - var events = this._getEvents(); - var key; - - // Remove different things depending on the state of evt - if (type === 'string') { - // Remove all listeners for the specified event - delete events[evt]; - } - else if (evt instanceof RegExp) { - // Remove all events matching the regex. - for (key in events) { - if (events.hasOwnProperty(key) && evt.test(key)) { - delete events[key]; - } - } - } - else { - // Remove all listeners in all events - delete this._events; - } +return jQueryBridget; - return this; - }; +})); - /** - * Alias of removeEvent. - * - * Added to mirror the node API. - */ - proto.removeAllListeners = alias('removeEvent'); - - /** - * Emits an event of your choice. - * When emitted, every listener attached to that event will be executed. - * If you pass the optional argument array then those arguments will be passed to every listener upon execution. - * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately. - * So they will not arrive within the array on the other side, they will be separate. - * You can also pass a regular expression to emit to all events that match it. - * - * @param {String|RegExp} evt Name of the event to emit and execute listeners for. - * @param {Array} [args] Optional array of arguments to be passed to each listener. - * @return {Object} Current instance of EventEmitter for chaining. - */ - proto.emitEvent = function emitEvent(evt, args) { - var listeners = this.getListenersAsObject(evt); - var listener; - var i; - var key; - var response; - - for (key in listeners) { - if (listeners.hasOwnProperty(key)) { - i = listeners[key].length; - - while (i--) { - // If the listener returns true then it shall be removed from the event - // The function is executed either with a basic call or an apply if there is an args array - listener = listeners[key][i]; - - if (listener.once === true) { - this.removeListener(evt, listener.listener); - } - - response = listener.listener.apply(this, args || []); - - if (response === this._getOnceReturnValue()) { - this.removeListener(evt, listener.listener); - } - } - } - } +/** + * EvEmitter v1.0.2 + * Lil' event emitter + * MIT License + */ - return this; - }; +/* jshint unused: true, undef: true, strict: true */ - /** - * Alias of emitEvent - */ - proto.trigger = alias('emitEvent'); - - /** - * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on. - * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it. - * - * @param {String|RegExp} evt Name of the event to emit and execute listeners for. - * @param {...*} Optional additional arguments to be passed to each listener. - * @return {Object} Current instance of EventEmitter for chaining. - */ - proto.emit = function emit(evt) { - var args = Array.prototype.slice.call(arguments, 1); - return this.emitEvent(evt, args); - }; +( function( global, factory ) { + // universal module definition + /* jshint strict: false */ /* globals define, module */ + if ( typeof define == 'function' && define.amd ) { + // AMD - RequireJS + define( 'ev-emitter/ev-emitter',factory ); + } else if ( typeof module == 'object' && module.exports ) { + // CommonJS - Browserify, Webpack + module.exports = factory(); + } else { + // Browser globals + global.EvEmitter = factory(); + } - /** - * Sets the current value to check against when executing listeners. If a - * listeners return value matches the one set here then it will be removed - * after execution. This value defaults to true. - * - * @param {*} value The new value to check for when executing listeners. - * @return {Object} Current instance of EventEmitter for chaining. - */ - proto.setOnceReturnValue = function setOnceReturnValue(value) { - this._onceReturnValue = value; - return this; - }; +}( this, function() { - /** - * Fetches the current value to check against when executing listeners. If - * the listeners return value matches this one then it should be removed - * automatically. It will return true by default. - * - * @return {*|Boolean} The current value to check for or the default, true. - * @api private - */ - proto._getOnceReturnValue = function _getOnceReturnValue() { - if (this.hasOwnProperty('_onceReturnValue')) { - return this._onceReturnValue; - } - else { - return true; - } - }; - /** - * Fetches the events object and creates one if required. - * - * @return {Object} The events storage object. - * @api private - */ - proto._getEvents = function _getEvents() { - return this._events || (this._events = {}); - }; - /** - * Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version. - * - * @return {Function} Non conflicting EventEmitter class. - */ - EventEmitter.noConflict = function noConflict() { - exports.EventEmitter = originalGlobalValue; - return EventEmitter; - }; +function EvEmitter() {} - // Expose the class either via AMD, CommonJS or the global object - if (typeof define === 'function' && define.amd) { - define('eventEmitter/EventEmitter',[],function () { - return EventEmitter; - }); - } - else if (typeof module === 'object' && module.exports){ - module.exports = EventEmitter; - } - else { - exports.EventEmitter = EventEmitter; - } -}.call(this)); +var proto = EvEmitter.prototype; -/*! - * getStyleProperty v1.0.4 - * original by kangax - * http://perfectionkills.com/feature-testing-css-properties/ - * MIT license - */ - -/*jshint browser: true, strict: true, undef: true */ -/*global define: false, exports: false, module: false */ - -( function( window ) { +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 object + var onceListeners = onceEvents[ eventName ] = onceEvents[ eventName ] || {}; + // set flag + onceListeners[ listener ] = true; -var prefixes = 'Webkit Moz ms Ms O'.split(' '); -var docElemStyle = document.documentElement.style; + return this; +}; -function getStyleProperty( propName ) { - if ( !propName ) { +proto.off = function( eventName, listener ) { + var listeners = this._events && this._events[ eventName ]; + if ( !listeners || !listeners.length ) { return; } - - // test standard property first - if ( typeof docElemStyle[ propName ] === 'string' ) { - return propName; + var index = listeners.indexOf( listener ); + if ( index != -1 ) { + listeners.splice( index, 1 ); } - // capitalize - propName = propName.charAt(0).toUpperCase() + propName.slice(1); + return this; +}; - // test vendor specific properties - var prefixed; - for ( var i=0, len = prefixes.length; i < len; i++ ) { - prefixed = prefixes[i] + propName; - if ( typeof docElemStyle[ prefixed ] === 'string' ) { - return prefixed; +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]; } -} -// transport -if ( typeof define === 'function' && define.amd ) { - // AMD - define( 'get-style-property/get-style-property',[],function() { - return getStyleProperty; - }); -} else if ( typeof exports === 'object' ) { - // CommonJS for Component - module.exports = getStyleProperty; -} else { - // browser global - window.getStyleProperty = getStyleProperty; -} + return this; +}; + +return EvEmitter; -})( window ); +})); /*! - * getSize v1.2.2 + * getSize v2.0.2 * measure size of elements * MIT license */ /*jshint browser: true, strict: true, undef: true, unused: true */ -/*global define: false, exports: false, require: false, module: false, console: false */ +/*global define: false, module: false, console: false */ -( function( window, undefined ) { +( function( window, factory ) { + 'use strict'; + if ( typeof define == 'function' && define.amd ) { + // AMD + define( 'get-size/get-size',[],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 -------------------------- // @@ -779,13 +297,13 @@ if ( typeof define === 'function' && define.amd ) { function getStyleSize( value ) { var num = parseFloat( value ); // not a percent like '100%', and a number - var isValid = value.indexOf('%') === -1 && !isNaN( num ); + var isValid = value.indexOf('%') == -1 && !isNaN( num ); return isValid && num; } function noop() {} -var logError = typeof console === 'undefined' ? noop : +var logError = typeof console == 'undefined' ? noop : function( message ) { console.error( message ); }; @@ -807,6 +325,8 @@ var measurements = [ 'borderBottomWidth' ]; +var measurementsLength = measurements.length; + function getZeroSize() { var size = { width: 0, @@ -816,27 +336,39 @@ function getZeroSize() { outerWidth: 0, outerHeight: 0 }; - for ( var i=0, len = measurements.length; i < len; i++ ) { + for ( var i=0; i < measurementsLength; i++ ) { var measurement = measurements[i]; size[ measurement ] = 0; } return size; } +// -------------------------- getStyle -------------------------- // - -function defineGetSize( getStyleProperty ) { +/** + * getStyle, get style of element, check for Firefox bug + * https://bugzilla.mozilla.org/show_bug.cgi?id=548397 + */ +function getStyle( elem ) { + var style = getComputedStyle( elem ); + if ( !style ) { + logError( 'Style returned ' + style + + '. Are you running this code in a hidden iframe on Firefox? ' + + 'See http://bit.ly/getsizebug1' ); + } + return style; +} // -------------------------- setup -------------------------- // var isSetup = false; -var getStyle, boxSizingProp, isBoxSizeOuter; +var isBoxSizeOuter; /** - * setup vars and functions - * do it on initial getSize(), rather than on script load - * For Firefox bug https://bugzilla.mozilla.org/show_bug.cgi?id=548397 + * setup + * check isBoxSizerOuter + * do on first getSize() rather than on page load for Firefox bug */ function setup() { // setup once @@ -845,50 +377,25 @@ function setup() { } isSetup = true; - var getComputedStyle = window.getComputedStyle; - getStyle = ( function() { - var getStyleFn = getComputedStyle ? - function( elem ) { - return getComputedStyle( elem, null ); - } : - function( elem ) { - return elem.currentStyle; - }; - - return function getStyle( elem ) { - var style = getStyleFn( elem ); - if ( !style ) { - logError( 'Style returned ' + style + - '. Are you running this code in a hidden iframe on Firefox? ' + - 'See http://bit.ly/getsizebug1' ); - } - return style; - }; - })(); - // -------------------------- box sizing -------------------------- // - boxSizingProp = getStyleProperty('boxSizing'); - /** * WebKit measures the outer-width on style.width on border-box elems - * IE & Firefox measures the inner-width + * IE & Firefox<29 measures the inner-width */ - if ( boxSizingProp ) { - var div = document.createElement('div'); - div.style.width = '200px'; - div.style.padding = '1px 2px 3px 4px'; - div.style.borderStyle = 'solid'; - div.style.borderWidth = '1px 2px 3px 4px'; - div.style[ boxSizingProp ] = 'border-box'; - - var body = document.body || document.documentElement; - body.appendChild( div ); - var style = getStyle( div ); - - isBoxSizeOuter = getStyleSize( style.width ) === 200; - body.removeChild( div ); - } + var div = document.createElement('div'); + div.style.width = '200px'; + div.style.padding = '1px 2px 3px 4px'; + div.style.borderStyle = 'solid'; + div.style.borderWidth = '1px 2px 3px 4px'; + div.style.boxSizing = 'border-box'; + + var body = document.body || document.documentElement; + body.appendChild( div ); + var style = getStyle( div ); + + getSize.isBoxSizeOuter = isBoxSizeOuter = getStyleSize( style.width ) == 200; + body.removeChild( div ); } @@ -898,19 +405,19 @@ function getSize( elem ) { setup(); // use querySeletor if elem is string - if ( typeof elem === 'string' ) { + if ( typeof elem == 'string' ) { elem = document.querySelector( elem ); } // do not proceed on non-objects - if ( !elem || typeof elem !== 'object' || !elem.nodeType ) { + if ( !elem || typeof elem != 'object' || !elem.nodeType ) { return; } var style = getStyle( elem ); // if hidden, everything is 0 - if ( style.display === 'none' ) { + if ( style.display == 'none' ) { return getZeroSize(); } @@ -918,14 +425,12 @@ function getSize( elem ) { size.width = elem.offsetWidth; size.height = elem.offsetHeight; - var isBorderBox = size.isBorderBox = !!( boxSizingProp && - style[ boxSizingProp ] && style[ boxSizingProp ] === 'border-box' ); + var isBorderBox = size.isBorderBox = style.boxSizing == 'border-box'; // get all measurements - for ( var i=0, len = measurements.length; i < len; i++ ) { + for ( var i=0; i < measurementsLength; i++ ) { var measurement = measurements[i]; var value = style[ measurement ]; - value = mungeNonPixel( elem, value ); var num = parseFloat( value ); // any 'auto', 'medium' value will be 0 size[ measurement ] = !isNaN( num ) ? num : 0; @@ -964,148 +469,38 @@ function getSize( elem ) { return size; } -// IE8 returns percent values, not pixels -// taken from jQuery's curCSS -function mungeNonPixel( elem, value ) { - // IE8 and has percent value - if ( window.getComputedStyle || value.indexOf('%') === -1 ) { - return value; - } - var style = elem.style; - // Remember the original values - var left = style.left; - var rs = elem.runtimeStyle; - var rsLeft = rs && rs.left; - - // Put in the new values to get a computed value out - if ( rsLeft ) { - rs.left = elem.currentStyle.left; - } - style.left = value; - value = style.pixelLeft; - - // Revert the changed values - style.left = left; - if ( rsLeft ) { - rs.left = rsLeft; - } - - return value; -} - return getSize; -} - -// transport -if ( typeof define === 'function' && define.amd ) { - // AMD for RequireJS - define( 'get-size/get-size',[ 'get-style-property/get-style-property' ], defineGetSize ); -} else if ( typeof exports === 'object' ) { - // CommonJS for Component - module.exports = defineGetSize( require('desandro-get-style-property') ); -} else { - // browser global - window.getSize = defineGetSize( window.getStyleProperty ); -} - -})( window ); - -/*! - * docReady v1.0.4 - * Cross browser DOMContentLoaded event emitter - * MIT license - */ - -/*jshint browser: true, strict: true, undef: true, unused: true*/ -/*global define: false, require: false, module: false */ - -( function( window ) { - - - -var document = window.document; -// collection of functions to be triggered on ready -var queue = []; - -function docReady( fn ) { - // throw out non-functions - if ( typeof fn !== 'function' ) { - return; - } - - if ( docReady.isReady ) { - // ready now, hit it - fn(); - } else { - // queue function when ready - queue.push( fn ); - } -} - -docReady.isReady = false; - -// triggered on various doc ready events -function onReady( event ) { - // bail if already triggered or IE8 document is not ready just yet - var isIE8NotReady = event.type === 'readystatechange' && document.readyState !== 'complete'; - if ( docReady.isReady || isIE8NotReady ) { - return; - } - - trigger(); -} - -function trigger() { - docReady.isReady = true; - // process queue - for ( var i=0, len = queue.length; i < len; i++ ) { - var fn = queue[i]; - fn(); - } -} - -function defineDocReady( eventie ) { - // trigger ready if page is ready - if ( document.readyState === 'complete' ) { - trigger(); - } else { - // listen for events - eventie.bind( document, 'DOMContentLoaded', onReady ); - eventie.bind( document, 'readystatechange', onReady ); - eventie.bind( window, 'load', onReady ); - } - - return docReady; -} - -// transport -if ( typeof define === 'function' && define.amd ) { - // AMD - define( 'doc-ready/doc-ready',[ 'eventie/eventie' ], defineDocReady ); -} else if ( typeof exports === 'object' ) { - module.exports = defineDocReady( require('eventie') ); -} else { - // browser global - window.docReady = defineDocReady( window.eventie ); -} - -})( window ); +}); /** - * matchesSelector v1.0.3 + * matchesSelector v2.0.1 * matchesSelector( element, '.selector' ) * MIT license */ /*jshint browser: true, strict: true, undef: true, unused: true */ -/*global define: false, module: false */ -( function( ElemProto ) { +( function( window, factory ) { + /*global define: false, module: false */ + 'use strict'; + // universal module definition + if ( typeof define == 'function' && define.amd ) { + // AMD + define( 'desandro-matches-selector/matches-selector',factory ); + } else if ( typeof module == 'object' && module.exports ) { + // CommonJS + module.exports = factory(); + } else { + // browser global + window.matchesSelector = factory(); + } +}( window, function factory() { 'use strict'; var matchesMethod = ( function() { + var ElemProto = Element.prototype; // check for the standard method name first if ( ElemProto.matches ) { return 'matches'; @@ -1117,7 +512,7 @@ if ( typeof define === 'function' && define.amd ) { // check vendor prefixes var prefixes = [ 'webkit', 'moz', 'ms', 'o' ]; - for ( var i=0, len = prefixes.length; i < len; i++ ) { + for ( var i=0; i < prefixes.length; i++ ) { var prefix = prefixes[i]; var method = prefix + 'MatchesSelector'; if ( ElemProto[ method ] ) { @@ -1126,117 +521,45 @@ if ( typeof define === 'function' && define.amd ) { } })(); - // ----- match ----- // - - function match( elem, selector ) { + return function matchesSelector( elem, selector ) { return elem[ matchesMethod ]( selector ); - } - - // ----- appendToFragment ----- // - - function checkParent( elem ) { - // not needed if already has parent - if ( elem.parentNode ) { - return; - } - var fragment = document.createDocumentFragment(); - fragment.appendChild( elem ); - } - - // ----- query ----- // - - // fall back to using QSA - // thx @jonathantneal https://gist.github.com/3062955 - function query( elem, selector ) { - // append to fragment if no parent - checkParent( elem ); - - // match elem with all selected elems of parent - var elems = elem.parentNode.querySelectorAll( selector ); - for ( var i=0, len = elems.length; i < len; i++ ) { - // return true if match - if ( elems[i] === elem ) { - return true; - } - } - // otherwise return false - return false; - } - - // ----- matchChild ----- // - - function matchChild( elem, selector ) { - checkParent( elem ); - return match( elem, selector ); - } - - // ----- matchesSelector ----- // - - var matchesSelector; - - if ( matchesMethod ) { - // IE9 supports matchesSelector, but doesn't work on orphaned elems - // check for that - var div = document.createElement('div'); - var supportsOrphans = match( div, 'div' ); - matchesSelector = supportsOrphans ? match : matchChild; - } else { - matchesSelector = query; - } - - // transport - if ( typeof define === 'function' && define.amd ) { - // AMD - define( 'matches-selector/matches-selector',[],function() { - return matchesSelector; - }); - } else if ( typeof exports === 'object' ) { - module.exports = matchesSelector; - } - else { - // browser global - window.matchesSelector = matchesSelector; - } + }; -})( Element.prototype ); +})); /** - * Fizzy UI utils v1.0.1 + * Fizzy UI utils v2.0.1 * 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 + /*jshint strict: false */ /*globals define, module, require */ if ( typeof define == 'function' && define.amd ) { // AMD define( 'fizzy-ui-utils/utils',[ - 'doc-ready/doc-ready', - 'matches-selector/matches-selector' - ], function( docReady, matchesSelector ) { - return factory( window, docReady, matchesSelector ); + 'desandro-matches-selector/matches-selector' + ], function( matchesSelector ) { + return factory( window, matchesSelector ); }); - } else if ( typeof exports == 'object' ) { + } else if ( typeof module == 'object' && module.exports ) { // CommonJS module.exports = factory( window, - require('doc-ready'), require('desandro-matches-selector') ); } else { // browser global window.fizzyUIUtils = factory( window, - window.docReady, window.matchesSelector ); } -}( window, function factory( window, docReady, matchesSelector ) { +}( window, function factory( window, matchesSelector ) { @@ -1258,24 +581,17 @@ utils.modulo = function( num, div ) { return ( ( num % div ) + div ) % div; }; -// ----- isArray ----- // - -var objToString = Object.prototype.toString; -utils.isArray = function( obj ) { - return objToString.call( obj ) == '[object Array]'; -}; - // ----- makeArray ----- // // turn element or nodeList into an array utils.makeArray = function( obj ) { var ary = []; - if ( utils.isArray( obj ) ) { + 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, len = obj.length; i < len; i++ ) { + for ( var i=0; i < obj.length; i++ ) { ary.push( obj[i] ); } } else { @@ -1285,53 +601,15 @@ utils.makeArray = function( obj ) { return ary; }; -// ----- indexOf ----- // - -// index of helper cause IE8 -utils.indexOf = Array.prototype.indexOf ? function( ary, obj ) { - return ary.indexOf( obj ); - } : function( ary, obj ) { - for ( var i=0, len = ary.length; i < len; i++ ) { - if ( ary[i] === obj ) { - return i; - } - } - return -1; - }; - // ----- removeFrom ----- // utils.removeFrom = function( ary, obj ) { - var index = utils.indexOf( ary, obj ); + var index = ary.indexOf( obj ); if ( index != -1 ) { ary.splice( index, 1 ); } }; -// ----- isElement ----- // - -// http://stackoverflow.com/a/384380/182183 -utils.isElement = ( typeof HTMLElement == 'function' || typeof HTMLElement == 'object' ) ? - function isElementDOM2( obj ) { - return obj instanceof HTMLElement; - } : - function isElementQuirky( obj ) { - return obj && typeof obj == 'object' && - obj.nodeType == 1 && typeof obj.nodeName == 'string'; - }; - -// ----- setText ----- // - -utils.setText = ( function() { - var setTextProperty; - function setText( elem, text ) { - // only check setTextProperty once - setTextProperty = setTextProperty || ( document.documentElement.textContent !== undefined ? 'textContent' : 'innerText' ); - elem[ setTextProperty ] = text; - } - return setText; -})(); - // ----- getParent ----- // utils.getParent = function( elem, selector ) { @@ -1370,28 +648,28 @@ utils.filterFindElements = function( elems, selector ) { elems = utils.makeArray( elems ); var ffElems = []; - for ( var i=0, len = elems.length; i < len; i++ ) { - var elem = elems[i]; + elems.forEach( function( elem ) { // check that elem is an actual element - if ( !utils.isElement( elem ) ) { - continue; + if ( !( elem instanceof HTMLElement ) ) { + return; + } + // add elem if no selector + if ( !selector ) { + ffElems.push( elem ); + return; } // filter & find items if we have a selector - if ( selector ) { - // filter siblings - if ( matchesSelector( elem, selector ) ) { - ffElems.push( elem ); - } - // find children - var childElems = elem.querySelectorAll( selector ); - // concat childElems to filterFound array - for ( var j=0, jLen = childElems.length; j < jLen; j++ ) { - ffElems.push( childElems[j] ); - } - } else { + // 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; }; @@ -1418,6 +696,16 @@ utils.debounceMethod = function( _class, methodName, threshold ) { }; }; +// ----- 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/ @@ -1429,39 +717,43 @@ utils.toDashed = function( str ) { var console = window.console; /** - * allow user to initialize classes via .js-namespace class + * allow user to initialize classes via [data-namespace] or .js-namespace class * htmlInit( Widget, 'widgetName' ) - * options are parsed from data-namespace-option attribute + * options are parsed from data-namespace-options */ utils.htmlInit = function( WidgetClass, namespace ) { - docReady( function() { + utils.docReady( function() { var dashedNamespace = utils.toDashed( namespace ); - var elems = document.querySelectorAll( '.js-' + dashedNamespace ); - var dataAttr = 'data-' + dashedNamespace + '-options'; - - for ( var i=0, len = elems.length; i < len; i++ ) { - var elem = elems[i]; - var attr = elem.getAttribute( dataAttr ); + 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.nodeName.toLowerCase() + ( elem.id ? '#' + elem.id : '' ) + ': ' + - error ); + console.error( 'Error parsing ' + dataAttr + ' on ' + elem.className + + ': ' + error ); } - continue; + return; } // initialize var instance = new WidgetClass( elem, options ); // make available via $().data('layoutname') - var jQuery = window.jQuery; if ( jQuery ) { jQuery.data( elem, namespace, instance ); } - } + }); + }); }; @@ -1476,56 +768,36 @@ return utils; */ ( function( window, factory ) { - 'use strict'; // universal module definition - if ( typeof define === 'function' && define.amd ) { - // AMD + /* jshint strict: false */ /* globals define, module, require */ + if ( typeof define == 'function' && define.amd ) { + // AMD - RequireJS define( 'outlayer/item',[ - 'eventEmitter/EventEmitter', - 'get-size/get-size', - 'get-style-property/get-style-property', - 'fizzy-ui-utils/utils' + 'ev-emitter/ev-emitter', + 'get-size/get-size' ], - function( EventEmitter, getSize, getStyleProperty, utils ) { - return factory( window, EventEmitter, getSize, getStyleProperty, utils ); - } + factory ); - } else if (typeof exports === 'object') { - // CommonJS + } else if ( typeof module == 'object' && module.exports ) { + // CommonJS - Browserify, Webpack module.exports = factory( - window, - require('wolfy87-eventemitter'), - require('get-size'), - require('desandro-get-style-property'), - require('fizzy-ui-utils') + require('ev-emitter'), + require('get-size') ); } else { // browser global window.Outlayer = {}; window.Outlayer.Item = factory( - window, - window.EventEmitter, - window.getSize, - window.getStyleProperty, - window.fizzyUIUtils + window.EvEmitter, + window.getSize ); } -}( window, function factory( window, EventEmitter, getSize, getStyleProperty, utils ) { +}( window, function factory( EvEmitter, getSize ) { 'use strict'; // ----- helpers ----- // -var getComputedStyle = window.getComputedStyle; -var getStyle = getComputedStyle ? - function( elem ) { - return getComputedStyle( elem, null ); - } : - function( elem ) { - return elem.currentStyle; - }; - - function isEmptyObj( obj ) { for ( var prop in obj ) { return false; @@ -1536,38 +808,27 @@ function isEmptyObj( obj ) { // -------------------------- CSS3 support -------------------------- // -var transitionProperty = getStyleProperty('transition'); -var transformProperty = getStyleProperty('transform'); -var supportsCSS3 = transitionProperty && transformProperty; -var is3d = !!getStyleProperty('perspective'); + +var docElemStyle = document.documentElement.style; + +var transitionProperty = typeof docElemStyle.transition == 'string' ? + 'transition' : 'WebkitTransition'; +var transformProperty = typeof docElemStyle.transform == 'string' ? + 'transform' : 'WebkitTransform'; var transitionEndEvent = { WebkitTransition: 'webkitTransitionEnd', - MozTransition: 'transitionend', - OTransition: 'otransitionend', transition: 'transitionend' }[ transitionProperty ]; -// properties that could have vendor prefix -var prefixableProperties = [ - 'transform', - 'transition', - 'transitionDuration', - 'transitionProperty' -]; - -// cache all vendor properties -var vendorProperties = ( function() { - var cache = {}; - for ( var i=0, len = prefixableProperties.length; i < len; i++ ) { - var prop = prefixableProperties[i]; - var supportedProp = getStyleProperty( prop ); - if ( supportedProp && supportedProp !== prop ) { - cache[ prop ] = supportedProp; - } - } - return cache; -})(); +// cache all vendor properties that could have vendor prefix +var vendorProperties = { + transform: transformProperty, + transition: transitionProperty, + transitionDuration: transitionProperty + 'Duration', + transitionProperty: transitionProperty + 'Property', + transitionDelay: transitionProperty + 'Delay' +}; // -------------------------- Item -------------------------- // @@ -1587,10 +848,11 @@ function Item( element, layout ) { this._create(); } -// inherit EventEmitter -utils.extend( Item.prototype, EventEmitter.prototype ); +// inherit EvEmitter +var proto = Item.prototype = Object.create( EvEmitter.prototype ); +proto.constructor = Item; -Item.prototype._create = function() { +proto._create = function() { // transition objects this._transn = { ingProperties: {}, @@ -1604,14 +866,14 @@ Item.prototype._create = function() { }; // trigger specified handler for event type -Item.prototype.handleEvent = function( event ) { +proto.handleEvent = function( event ) { var method = 'on' + event.type; if ( this[ method ] ) { this[ method ]( event ); } }; -Item.prototype.getSize = function() { +proto.getSize = function() { this.size = getSize( this.element ); }; @@ -1619,7 +881,7 @@ Item.prototype.getSize = function() { * apply CSS styles to element * @param {Object} style */ -Item.prototype.css = function( style ) { +proto.css = function( style ) { var elemStyle = this.element.style; for ( var prop in style ) { @@ -1630,11 +892,10 @@ Item.prototype.css = function( style ) { }; // measure position, and sets it -Item.prototype.getPosition = function() { - var style = getStyle( this.element ); - var layoutOptions = this.layout.options; - var isOriginLeft = layoutOptions.isOriginLeft; - var isOriginTop = layoutOptions.isOriginTop; +proto.getPosition = function() { + var style = getComputedStyle( this.element ); + var isOriginLeft = this.layout._getOption('originLeft'); + var isOriginTop = this.layout._getOption('originTop'); var xValue = style[ isOriginLeft ? 'left' : 'right' ]; var yValue = style[ isOriginTop ? 'top' : 'bottom' ]; // convert percent to pixels @@ -1656,15 +917,16 @@ Item.prototype.getPosition = function() { }; // set settled position, apply padding -Item.prototype.layoutPosition = function() { +proto.layoutPosition = function() { var layoutSize = this.layout.size; - var layoutOptions = this.layout.options; var style = {}; + var isOriginLeft = this.layout._getOption('originLeft'); + var isOriginTop = this.layout._getOption('originTop'); // x - var xPadding = layoutOptions.isOriginLeft ? 'paddingLeft' : 'paddingRight'; - var xProperty = layoutOptions.isOriginLeft ? 'left' : 'right'; - var xResetProperty = layoutOptions.isOriginLeft ? 'right' : 'left'; + var xPadding = isOriginLeft ? 'paddingLeft' : 'paddingRight'; + var xProperty = isOriginLeft ? 'left' : 'right'; + var xResetProperty = isOriginLeft ? 'right' : 'left'; var x = this.position.x + layoutSize[ xPadding ]; // set in percentage or pixels @@ -1673,9 +935,9 @@ Item.prototype.layoutPosition = function() { style[ xResetProperty ] = ''; // y - var yPadding = layoutOptions.isOriginTop ? 'paddingTop' : 'paddingBottom'; - var yProperty = layoutOptions.isOriginTop ? 'top' : 'bottom'; - var yResetProperty = layoutOptions.isOriginTop ? 'bottom' : 'top'; + var yPadding = isOriginTop ? 'paddingTop' : 'paddingBottom'; + var yProperty = isOriginTop ? 'top' : 'bottom'; + var yResetProperty = isOriginTop ? 'bottom' : 'top'; var y = this.position.y + layoutSize[ yPadding ]; // set in percentage or pixels @@ -1687,20 +949,19 @@ Item.prototype.layoutPosition = function() { this.emitEvent( 'layout', [ this ] ); }; -Item.prototype.getXValue = function( x ) { - var layoutOptions = this.layout.options; - return layoutOptions.percentPosition && !layoutOptions.isHorizontal ? +proto.getXValue = function( x ) { + var isHorizontal = this.layout._getOption('horizontal'); + return this.layout.options.percentPosition && !isHorizontal ? ( ( x / this.layout.size.width ) * 100 ) + '%' : x + 'px'; }; -Item.prototype.getYValue = function( y ) { - var layoutOptions = this.layout.options; - return layoutOptions.percentPosition && layoutOptions.isHorizontal ? +proto.getYValue = function( y ) { + var isHorizontal = this.layout._getOption('horizontal'); + return this.layout.options.percentPosition && isHorizontal ? ( ( y / this.layout.size.height ) * 100 ) + '%' : y + 'px'; }; - -Item.prototype._transitionTo = function( x, y ) { +proto._transitionTo = function( x, y ) { this.getPosition(); // get current x & y from top/left var curX = this.position.x; @@ -1733,30 +994,24 @@ Item.prototype._transitionTo = function( x, y ) { }); }; -Item.prototype.getTranslate = function( x, y ) { +proto.getTranslate = function( x, y ) { // flip cooridinates if origin on right or bottom - var layoutOptions = this.layout.options; - x = layoutOptions.isOriginLeft ? x : -x; - y = layoutOptions.isOriginTop ? y : -y; - - if ( is3d ) { - return 'translate3d(' + x + 'px, ' + y + 'px, 0)'; - } - - return 'translate(' + x + 'px, ' + y + 'px)'; + var isOriginLeft = this.layout._getOption('originLeft'); + var isOriginTop = this.layout._getOption('originTop'); + x = isOriginLeft ? x : -x; + y = isOriginTop ? y : -y; + return 'translate3d(' + x + 'px, ' + y + 'px, 0)'; }; // non transition + transform support -Item.prototype.goTo = function( x, y ) { +proto.goTo = function( x, y ) { this.setPosition( x, y ); this.layoutPosition(); }; -// use transition and transforms if supported -Item.prototype.moveTo = supportsCSS3 ? - Item.prototype._transitionTo : Item.prototype.goTo; +proto.moveTo = proto._transitionTo; -Item.prototype.setPosition = function( x, y ) { +proto.setPosition = function( x, y ) { this.position.x = parseInt( x, 10 ); this.position.y = parseInt( y, 10 ); }; @@ -1769,7 +1024,7 @@ Item.prototype.setPosition = function( x, y ) { */ // non transition, just trigger callback -Item.prototype._nonTransition = function( args ) { +proto._nonTransition = function( args ) { this.css( args.to ); if ( args.isCleaning ) { this._removeStyles( args.to ); @@ -1787,7 +1042,7 @@ Item.prototype._nonTransition = function( args ) { * @param {Boolean} isCleaning - removes transition styles after transition * @param {Function} onTransitionEnd - callback */ -Item.prototype._transition = function( args ) { +proto.transition = function( args ) { // redirect to nonTransition if no transition duration if ( !parseFloat( this.layout.options.transitionDuration ) ) { this._nonTransition( args ); @@ -1833,10 +1088,9 @@ function toDashedAll( str ) { }); } -var transitionProps = 'opacity,' + - toDashedAll( vendorProperties.transform || 'transform' ); +var transitionProps = 'opacity,' + toDashedAll( transformProperty ); -Item.prototype.enableTransition = function(/* style */) { +proto.enableTransition = function(/* style */) { // HACK changing transitionProperty during a transition // will cause transition to jump if ( this.isTransitioning ) { @@ -1852,35 +1106,35 @@ Item.prototype.enableTransition = function(/* style */) { // prop = vendorProperties[ prop ] || prop; // transitionValues.push( toDashedAll( prop ) ); // } + // munge number to millisecond, to match stagger + var duration = this.layout.options.transitionDuration; + duration = typeof duration == 'number' ? duration + 'ms' : duration; // enable transition styles this.css({ transitionProperty: transitionProps, - transitionDuration: this.layout.options.transitionDuration + transitionDuration: duration, + transitionDelay: this.staggerDelay || 0 }); // listen for transition end event this.element.addEventListener( transitionEndEvent, this, false ); }; -Item.prototype.transition = Item.prototype[ transitionProperty ? '_transition' : '_nonTransition' ]; - // ----- events ----- // -Item.prototype.onwebkitTransitionEnd = function( event ) { +proto.onwebkitTransitionEnd = function( event ) { this.ontransitionend( event ); }; -Item.prototype.onotransitionend = function( event ) { +proto.onotransitionend = function( event ) { this.ontransitionend( event ); }; // properties that I munge to make my life easier var dashedVendorProperties = { - '-webkit-transform': 'transform', - '-moz-transform': 'transform', - '-o-transform': 'transform' + '-webkit-transform': 'transform' }; -Item.prototype.ontransitionend = function( event ) { +proto.ontransitionend = function( event ) { // disregard bubbled events from children if ( event.target !== this.element ) { return; @@ -1912,7 +1166,7 @@ Item.prototype.ontransitionend = function( event ) { this.emitEvent( 'transitionEnd', [ this ] ); }; -Item.prototype.disableTransition = function() { +proto.disableTransition = function() { this.removeTransitionStyles(); this.element.removeEventListener( transitionEndEvent, this, false ); this.isTransitioning = false; @@ -1922,7 +1176,7 @@ Item.prototype.disableTransition = function() { * removes style property from element * @param {Object} style **/ -Item.prototype._removeStyles = function( style ) { +proto._removeStyles = function( style ) { // clean up transition styles var cleanStyle = {}; for ( var prop in style ) { @@ -1933,25 +1187,33 @@ Item.prototype._removeStyles = function( style ) { var cleanTransitionStyle = { transitionProperty: '', - transitionDuration: '' + transitionDuration: '', + transitionDelay: '' }; -Item.prototype.removeTransitionStyles = function() { +proto.removeTransitionStyles = function() { // remove transition this.css( cleanTransitionStyle ); }; +// ----- stagger ----- // + +proto.stagger = function( delay ) { + delay = isNaN( delay ) ? 0 : delay; + this.staggerDelay = delay + 'ms'; +}; + // ----- show/hide/remove ----- // // remove element from DOM -Item.prototype.removeElem = function() { +proto.removeElem = function() { this.element.parentNode.removeChild( this.element ); // remove display: none this.css({ display: '' }); this.emitEvent( 'remove', [ this ] ); }; -Item.prototype.remove = function() { +proto.remove = function() { // just remove element if no transition support or no transition if ( !transitionProperty || !parseFloat( this.layout.options.transitionDuration ) ) { this.removeElem(); @@ -1959,14 +1221,13 @@ Item.prototype.remove = function() { } // start transition - var _this = this; this.once( 'transitionEnd', function() { - _this.removeElem(); + this.removeElem(); }); this.hide(); }; -Item.prototype.reveal = function() { +proto.reveal = function() { delete this.isHidden; // remove display: none this.css({ display: '' }); @@ -1985,7 +1246,7 @@ Item.prototype.reveal = function() { }); }; -Item.prototype.onRevealTransitionEnd = function() { +proto.onRevealTransitionEnd = function() { // check if still visible // during transition, item may have been hidden if ( !this.isHidden ) { @@ -1998,7 +1259,7 @@ Item.prototype.onRevealTransitionEnd = function() { * @param {String} styleProperty - hiddenStyle/visibleStyle * @returns {String} */ -Item.prototype.getHideRevealTransitionEndProperty = function( styleProperty ) { +proto.getHideRevealTransitionEndProperty = function( styleProperty ) { var optionStyle = this.layout.options[ styleProperty ]; // use opacity if ( optionStyle.opacity ) { @@ -2010,7 +1271,7 @@ Item.prototype.getHideRevealTransitionEndProperty = function( styleProperty ) { } }; -Item.prototype.hide = function() { +proto.hide = function() { // set flag this.isHidden = true; // remove display: none @@ -2031,7 +1292,7 @@ Item.prototype.hide = function() { }); }; -Item.prototype.onHideTransitionEnd = function() { +proto.onHideTransitionEnd = function() { // check if still hidden // during transition, item may have been un-hidden if ( this.isHidden ) { @@ -2040,7 +1301,7 @@ Item.prototype.onHideTransitionEnd = function() { } }; -Item.prototype.destroy = function() { +proto.destroy = function() { this.css({ position: '', left: '', @@ -2057,7 +1318,7 @@ return Item; })); /*! - * Outlayer v1.4.2 + * Outlayer v2.1.0 * the brains and guts of a layout library * MIT license */ @@ -2065,26 +1326,24 @@ return Item; ( function( window, factory ) { 'use strict'; // universal module definition - + /* jshint strict: false */ /* globals define, module, require */ if ( typeof define == 'function' && define.amd ) { - // AMD + // AMD - RequireJS define( 'outlayer/outlayer',[ - 'eventie/eventie', - 'eventEmitter/EventEmitter', + 'ev-emitter/ev-emitter', 'get-size/get-size', 'fizzy-ui-utils/utils', './item' ], - function( eventie, EventEmitter, getSize, utils, Item ) { - return factory( window, eventie, EventEmitter, getSize, utils, Item); + function( EvEmitter, getSize, utils, Item ) { + return factory( window, EvEmitter, getSize, utils, Item); } ); - } else if ( typeof exports == 'object' ) { - // CommonJS + } else if ( typeof module == 'object' && module.exports ) { + // CommonJS - Browserify, Webpack module.exports = factory( window, - require('eventie'), - require('wolfy87-eventemitter'), + require('ev-emitter'), require('get-size'), require('fizzy-ui-utils'), require('./item') @@ -2093,15 +1352,14 @@ return Item; // browser global window.Outlayer = factory( window, - window.eventie, - window.EventEmitter, + window.EvEmitter, window.getSize, window.fizzyUIUtils, window.Outlayer.Item ); } -}( window, function factory( window, eventie, EventEmitter, getSize, utils, Item ) { +}( window, function factory( window, EvEmitter, getSize, utils, Item ) { 'use strict'; // ----- vars ----- // @@ -2150,7 +1408,8 @@ function Outlayer( element, options ) { // kick it off this._create(); - if ( this.options.isInitLayout ) { + var isInitLayout = this._getOption('initLayout'); + if ( isInitLayout ) { this.layout(); } } @@ -2164,11 +1423,11 @@ Outlayer.defaults = { containerStyle: { position: 'relative' }, - isInitLayout: true, - isOriginLeft: true, - isOriginTop: true, - isResizeBound: true, - isResizingContainer: true, + initLayout: true, + originLeft: true, + originTop: true, + resize: true, + resizeContainer: true, // item options transitionDuration: '0.4s', hiddenStyle: { @@ -2181,18 +1440,39 @@ Outlayer.defaults = { } }; -// inherit EventEmitter -utils.extend( Outlayer.prototype, EventEmitter.prototype ); +var proto = Outlayer.prototype; +// inherit EvEmitter +utils.extend( proto, EvEmitter.prototype ); /** * set options * @param {Object} opts */ -Outlayer.prototype.option = function( opts ) { +proto.option = function( opts ) { utils.extend( this.options, opts ); }; -Outlayer.prototype._create = function() { +/** + * get backwards compatible option value, check old name + */ +proto._getOption = function( option ) { + var oldOption = this.constructor.compatOptions[ option ]; + return oldOption && this.options[ oldOption ] !== undefined ? + this.options[ oldOption ] : this.options[ option ]; +}; + +Outlayer.compatOptions = { + // currentName: oldName + initLayout: 'isInitLayout', + horizontal: 'isHorizontal', + layoutInstant: 'isLayoutInstant', + originLeft: 'isOriginLeft', + originTop: 'isOriginTop', + resize: 'isResizeBound', + resizeContainer: 'isResizingContainer' +}; + +proto._create = function() { // get items from children this.reloadItems(); // elements that affect layout, but are not laid out @@ -2202,13 +1482,14 @@ Outlayer.prototype._create = function() { utils.extend( this.element.style, this.options.containerStyle ); // bind resize method - if ( this.options.isResizeBound ) { + var canBindResize = this._getOption('resize'); + if ( canBindResize ) { this.bindResize(); } }; // goes through all children again and gets bricks in proper order -Outlayer.prototype.reloadItems = function() { +proto.reloadItems = function() { // collection of item elements this.items = this._itemize( this.element.children ); }; @@ -2219,14 +1500,14 @@ Outlayer.prototype.reloadItems = function() { * @param {Array or NodeList or HTMLElement} elems * @returns {Array} items - collection of new Outlayer Items */ -Outlayer.prototype._itemize = function( elems ) { +proto._itemize = function( elems ) { var itemElems = this._filterFindItemElements( elems ); var Item = this.constructor.Item; // create new Outlayer Items for collection var items = []; - for ( var i=0, len = itemElems.length; i < len; i++ ) { + for ( var i=0; i < itemElems.length; i++ ) { var elem = itemElems[i]; var item = new Item( elem, this ); items.push( item ); @@ -2240,7 +1521,7 @@ Outlayer.prototype._itemize = function( elems ) { * @param {Array or NodeList or HTMLElement} elems * @returns {Array} items - item elements */ -Outlayer.prototype._filterFindItemElements = function( elems ) { +proto._filterFindItemElements = function( elems ) { return utils.filterFindElements( elems, this.options.itemSelector ); }; @@ -2248,12 +1529,10 @@ Outlayer.prototype._filterFindItemElements = function( elems ) { * getter method for getting item elements * @returns {Array} elems - collection of item elements */ -Outlayer.prototype.getItemElements = function() { - var elems = []; - for ( var i=0, len = this.items.length; i < len; i++ ) { - elems.push( this.items[i].element ); - } - return elems; +proto.getItemElements = function() { + return this.items.map( function( item ) { + return item.element; + }); }; // ----- init & layout ----- // @@ -2261,13 +1540,14 @@ Outlayer.prototype.getItemElements = function() { /** * lays out all items */ -Outlayer.prototype.layout = function() { +proto.layout = function() { this._resetLayout(); this._manageStamps(); // don't animate first layout - var isInstant = this.options.isLayoutInstant !== undefined ? - this.options.isLayoutInstant : !this._isLayoutInited; + var layoutInstant = this._getOption('layoutInstant'); + var isInstant = layoutInstant !== undefined ? + layoutInstant : !this._isLayoutInited; this.layoutItems( this.items, isInstant ); // flag for initalized @@ -2275,17 +1555,17 @@ Outlayer.prototype.layout = function() { }; // _init is alias for layout -Outlayer.prototype._init = Outlayer.prototype.layout; +proto._init = proto.layout; /** * logic before any new layout */ -Outlayer.prototype._resetLayout = function() { +proto._resetLayout = function() { this.getSize(); }; -Outlayer.prototype.getSize = function() { +proto.getSize = function() { this.size = getSize( this.element ); }; @@ -2299,7 +1579,7 @@ Outlayer.prototype.getSize = function() { * @param {String} size - width or height * @private */ -Outlayer.prototype._getMeasurement = function( measurement, size ) { +proto._getMeasurement = function( measurement, size ) { var option = this.options[ measurement ]; var elem; if ( !option ) { @@ -2307,9 +1587,9 @@ Outlayer.prototype._getMeasurement = function( measurement, size ) { this[ measurement ] = 0; } else { // use option as an element - if ( typeof option === 'string' ) { + if ( typeof option == 'string' ) { elem = this.element.querySelector( option ); - } else if ( utils.isElement( option ) ) { + } else if ( option instanceof HTMLElement ) { elem = option; } // use size of element, if element @@ -2321,7 +1601,7 @@ Outlayer.prototype._getMeasurement = function( measurement, size ) { * layout a collection of item elements * @api public */ -Outlayer.prototype.layoutItems = function( items, isInstant ) { +proto.layoutItems = function( items, isInstant ) { items = this._getItemsForLayout( items ); this._layoutItems( items, isInstant ); @@ -2335,15 +1615,10 @@ Outlayer.prototype.layoutItems = function( items, isInstant ) { * @param {Array} items * @returns {Array} items */ -Outlayer.prototype._getItemsForLayout = function( items ) { - var layoutItems = []; - for ( var i=0, len = items.length; i < len; i++ ) { - var item = items[i]; - if ( !item.isIgnored ) { - layoutItems.push( item ); - } - } - return layoutItems; +proto._getItemsForLayout = function( items ) { + return items.filter( function( item ) { + return !item.isIgnored; + }); }; /** @@ -2351,7 +1626,7 @@ Outlayer.prototype._getItemsForLayout = function( items ) { * @param {Array} items * @param {Boolean} isInstant */ -Outlayer.prototype._layoutItems = function( items, isInstant ) { +proto._layoutItems = function( items, isInstant ) { this._emitCompleteOnItems( 'layout', items ); if ( !items || !items.length ) { @@ -2361,15 +1636,14 @@ Outlayer.prototype._layoutItems = function( items, isInstant ) { var queue = []; - for ( var i=0, len = items.length; i < len; i++ ) { - var item = items[i]; + items.forEach( function( item ) { // get x/y object from method var position = this._getItemLayoutPosition( item ); // enqueue position.item = item; position.isInstant = isInstant || item.isLayoutInstant; queue.push( position ); - } + }, this ); this._processLayoutQueue( queue ); }; @@ -2379,7 +1653,7 @@ Outlayer.prototype._layoutItems = function( items, isInstant ) { * @param {Outlayer.Item} item * @returns {Object} x and y position */ -Outlayer.prototype._getItemLayoutPosition = function( /* item */ ) { +proto._getItemLayoutPosition = function( /* item */ ) { return { x: 0, y: 0 @@ -2392,11 +1666,22 @@ Outlayer.prototype._getItemLayoutPosition = function( /* item */ ) { * thx @paul_irish * @param {Array} queue */ -Outlayer.prototype._processLayoutQueue = function( queue ) { - for ( var i=0, len = queue.length; i < len; i++ ) { - var obj = queue[i]; - this._positionItem( obj.item, obj.x, obj.y, obj.isInstant ); +proto._processLayoutQueue = function( queue ) { + this.updateStagger(); + queue.forEach( function( obj, i ) { + this._positionItem( obj.item, obj.x, obj.y, obj.isInstant, i ); + }, this ); +}; + +// set stagger from option in milliseconds number +proto.updateStagger = function() { + var stagger = this.options.stagger; + if ( stagger === null || stagger === undefined ) { + this.stagger = 0; + return; } + this.stagger = getMilliseconds( stagger ); + return this.stagger; }; /** @@ -2406,11 +1691,12 @@ Outlayer.prototype._processLayoutQueue = function( queue ) { * @param {Number} y - vertical position * @param {Boolean} isInstant - disables transitions */ -Outlayer.prototype._positionItem = function( item, x, y, isInstant ) { +proto._positionItem = function( item, x, y, isInstant, i ) { if ( isInstant ) { // if not transition, just set CSS item.goTo( x, y ); } else { + item.stagger( i * this.stagger ); item.moveTo( x, y ); } }; @@ -2419,12 +1705,13 @@ Outlayer.prototype._positionItem = function( item, x, y, isInstant ) { * Any logic you want to do after each layout, * i.e. size the container */ -Outlayer.prototype._postLayout = function() { +proto._postLayout = function() { this.resizeContainer(); }; -Outlayer.prototype.resizeContainer = function() { - if ( !this.options.isResizingContainer ) { +proto.resizeContainer = function() { + var isResizingContainer = this._getOption('resizeContainer'); + if ( !isResizingContainer ) { return; } var size = this._getContainerSize(); @@ -2440,13 +1727,13 @@ Outlayer.prototype.resizeContainer = function() { * @param {Number} width * @param {Number} height */ -Outlayer.prototype._getContainerSize = noop; +proto._getContainerSize = noop; /** * @param {Number} measure - size of width or height * @param {Boolean} isWidth */ -Outlayer.prototype._setContainerMeasure = function( measure, isWidth ) { +proto._setContainerMeasure = function( measure, isWidth ) { if ( measure === undefined ) { return; } @@ -2469,7 +1756,7 @@ Outlayer.prototype._setContainerMeasure = function( measure, isWidth ) { * @param {String} eventName * @param {Array} items - Outlayer.Items */ -Outlayer.prototype._emitCompleteOnItems = function( eventName, items ) { +proto._emitCompleteOnItems = function( eventName, items ) { var _this = this; function onComplete() { _this.dispatchEvent( eventName + 'Complete', null, [ items ] ); @@ -2484,25 +1771,24 @@ Outlayer.prototype._emitCompleteOnItems = function( eventName, items ) { var doneCount = 0; function tick() { doneCount++; - if ( doneCount === count ) { + if ( doneCount == count ) { onComplete(); } } // bind callback - for ( var i=0, len = items.length; i < len; i++ ) { - var item = items[i]; + items.forEach( function( item ) { item.once( eventName, tick ); - } + }); }; /** - * emits events via eventEmitter and jQuery events + * emits events via EvEmitter and jQuery events * @param {String} type - name of event * @param {Event} event - original event * @param {Array} args - extra arguments */ -Outlayer.prototype.dispatchEvent = function( type, event, args ) { +proto.dispatchEvent = function( type, event, args ) { // add original event to arguments var emitArgs = event ? [ event ].concat( args ) : args; this.emitEvent( type, emitArgs ); @@ -2530,7 +1816,7 @@ Outlayer.prototype.dispatchEvent = function( type, event, args ) { * ignored items do not get skipped in layout * @param {Element} elem */ -Outlayer.prototype.ignore = function( elem ) { +proto.ignore = function( elem ) { var item = this.getItem( elem ); if ( item ) { item.isIgnored = true; @@ -2541,7 +1827,7 @@ Outlayer.prototype.ignore = function( elem ) { * return item to layout collection * @param {Element} elem */ -Outlayer.prototype.unignore = function( elem ) { +proto.unignore = function( elem ) { var item = this.getItem( elem ); if ( item ) { delete item.isIgnored; @@ -2552,7 +1838,7 @@ Outlayer.prototype.unignore = function( elem ) { * adds elements to stamps * @param {NodeList, Array, Element, or String} elems */ -Outlayer.prototype.stamp = function( elems ) { +proto.stamp = function( elems ) { elems = this._find( elems ); if ( !elems ) { return; @@ -2560,29 +1846,24 @@ Outlayer.prototype.stamp = function( elems ) { this.stamps = this.stamps.concat( elems ); // ignore - for ( var i=0, len = elems.length; i < len; i++ ) { - var elem = elems[i]; - this.ignore( elem ); - } + elems.forEach( this.ignore, this ); }; /** * removes elements to stamps * @param {NodeList, Array, or Element} elems */ -Outlayer.prototype.unstamp = function( elems ) { +proto.unstamp = function( elems ) { elems = this._find( elems ); if ( !elems ){ return; } - for ( var i=0, len = elems.length; i < len; i++ ) { - var elem = elems[i]; + elems.forEach( function( elem ) { // filter out removed stamp elements utils.removeFrom( this.stamps, elem ); this.unignore( elem ); - } - + }, this ); }; /** @@ -2590,33 +1871,30 @@ Outlayer.prototype.unstamp = function( elems ) { * @param {NodeList, Array, Element, or String} elems * @returns {Array} elems */ -Outlayer.prototype._find = function( elems ) { +proto._find = function( elems ) { if ( !elems ) { return; } // if string, use argument as selector string - if ( typeof elems === 'string' ) { + if ( typeof elems == 'string' ) { elems = this.element.querySelectorAll( elems ); } elems = utils.makeArray( elems ); return elems; }; -Outlayer.prototype._manageStamps = function() { +proto._manageStamps = function() { if ( !this.stamps || !this.stamps.length ) { return; } this._getBoundingRect(); - for ( var i=0, len = this.stamps.length; i < len; i++ ) { - var stamp = this.stamps[i]; - this._manageStamp( stamp ); - } + this.stamps.forEach( this._manageStamp, this ); }; // update boundingLeft / Top -Outlayer.prototype._getBoundingRect = function() { +proto._getBoundingRect = function() { // get bounding rect for container element var boundingRect = this.element.getBoundingClientRect(); var size = this.size; @@ -2631,14 +1909,14 @@ Outlayer.prototype._getBoundingRect = function() { /** * @param {Element} stamp **/ -Outlayer.prototype._manageStamp = noop; +proto._manageStamp = noop; /** * get x/y position of element relative to container element * @param {Element} elem * @returns {Object} offset - has left, top, right, bottom */ -Outlayer.prototype._getElementOffset = function( elem ) { +proto._getElementOffset = function( elem ) { var boundingRect = elem.getBoundingClientRect(); var thisRect = this._boundingRect; var size = getSize( elem ); @@ -2655,55 +1933,31 @@ Outlayer.prototype._getElementOffset = function( elem ) { // enable event handlers for listeners // i.e. resize -> onresize -Outlayer.prototype.handleEvent = function( event ) { - var method = 'on' + event.type; - if ( this[ method ] ) { - this[ method ]( event ); - } -}; +proto.handleEvent = utils.handleEvent; /** * Bind layout to window resizing */ -Outlayer.prototype.bindResize = function() { - // bind just one listener - if ( this.isResizeBound ) { - return; - } - eventie.bind( window, 'resize', this ); +proto.bindResize = function() { + window.addEventListener( 'resize', this ); this.isResizeBound = true; }; /** * Unbind layout to window resizing */ -Outlayer.prototype.unbindResize = function() { - if ( this.isResizeBound ) { - eventie.unbind( window, 'resize', this ); - } +proto.unbindResize = function() { + window.removeEventListener( 'resize', this ); this.isResizeBound = false; }; -// original debounce by John Hann -// http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/ - -// this fires every resize -Outlayer.prototype.onresize = function() { - if ( this.resizeTimeout ) { - clearTimeout( this.resizeTimeout ); - } - - var _this = this; - function delayed() { - _this.resize(); - delete _this.resizeTimeout; - } - - this.resizeTimeout = setTimeout( delayed, 100 ); +proto.onresize = function() { + this.resize(); }; -// debounced, layout on resize -Outlayer.prototype.resize = function() { +utils.debounceMethod( Outlayer, 'onresize', 100 ); + +proto.resize = function() { // don't trigger if size did not change // or if resize was unbound. See #9 if ( !this.isResizeBound || !this.needsResizeLayout() ) { @@ -2717,7 +1971,7 @@ Outlayer.prototype.resize = function() { * check if layout is needed post layout * @returns Boolean */ -Outlayer.prototype.needsResizeLayout = function() { +proto.needsResizeLayout = function() { var size = getSize( this.element ); // check that this.size and size are there // IE8 triggers resize on body size change, so they might not be @@ -2732,7 +1986,7 @@ Outlayer.prototype.needsResizeLayout = function() { * @param {Array or NodeList or Element} elems * @returns {Array} items - Outlayer.Items **/ -Outlayer.prototype.addItems = function( elems ) { +proto.addItems = function( elems ) { var items = this._itemize( elems ); // add items to collection if ( items.length ) { @@ -2745,7 +1999,7 @@ Outlayer.prototype.addItems = function( elems ) { * Layout newly-appended item elements * @param {Array or NodeList or Element} elems */ -Outlayer.prototype.appended = function( elems ) { +proto.appended = function( elems ) { var items = this.addItems( elems ); if ( !items.length ) { return; @@ -2759,7 +2013,7 @@ Outlayer.prototype.appended = function( elems ) { * Layout prepended elements * @param {Array or NodeList or Element} elems */ -Outlayer.prototype.prepended = function( elems ) { +proto.prepended = function( elems ) { var items = this._itemize( elems ); if ( !items.length ) { return; @@ -2781,35 +2035,39 @@ Outlayer.prototype.prepended = function( elems ) { * reveal a collection of items * @param {Array of Outlayer.Items} items */ -Outlayer.prototype.reveal = function( items ) { +proto.reveal = function( items ) { this._emitCompleteOnItems( 'reveal', items ); - - var len = items && items.length; - for ( var i=0; len && i < len; i++ ) { - var item = items[i]; - item.reveal(); + if ( !items || !items.length ) { + return; } + var stagger = this.updateStagger(); + items.forEach( function( item, i ) { + item.stagger( i * stagger ); + item.reveal(); + }); }; /** * hide a collection of items * @param {Array of Outlayer.Items} items */ -Outlayer.prototype.hide = function( items ) { +proto.hide = function( items ) { this._emitCompleteOnItems( 'hide', items ); - - var len = items && items.length; - for ( var i=0; len && i < len; i++ ) { - var item = items[i]; - item.hide(); + if ( !items || !items.length ) { + return; } + var stagger = this.updateStagger(); + items.forEach( function( item, i ) { + item.stagger( i * stagger ); + item.hide(); + }); }; /** * reveal item elements * @param {Array}, {Element}, {NodeList} items */ -Outlayer.prototype.revealItemElements = function( elems ) { +proto.revealItemElements = function( elems ) { var items = this.getItems( elems ); this.reveal( items ); }; @@ -2818,7 +2076,7 @@ Outlayer.prototype.revealItemElements = function( elems ) { * hide item elements * @param {Array}, {Element}, {NodeList} items */ -Outlayer.prototype.hideItemElements = function( elems ) { +proto.hideItemElements = function( elems ) { var items = this.getItems( elems ); this.hide( items ); }; @@ -2829,11 +2087,11 @@ Outlayer.prototype.hideItemElements = function( elems ) { * @param {Function} callback * @returns {Outlayer.Item} item */ -Outlayer.prototype.getItem = function( elem ) { +proto.getItem = function( elem ) { // loop through items to get the one that matches - for ( var i=0, len = this.items.length; i < len; i++ ) { + for ( var i=0; i < this.items.length; i++ ) { var item = this.items[i]; - if ( item.element === elem ) { + if ( item.element == elem ) { // return item return item; } @@ -2845,16 +2103,15 @@ Outlayer.prototype.getItem = function( elem ) { * @param {Array} elems * @returns {Array} items - Outlayer.Items */ -Outlayer.prototype.getItems = function( elems ) { +proto.getItems = function( elems ) { elems = utils.makeArray( elems ); var items = []; - for ( var i=0, len = elems.length; i < len; i++ ) { - var elem = elems[i]; + elems.forEach( function( elem ) { var item = this.getItem( elem ); if ( item ) { items.push( item ); } - } + }, this ); return items; }; @@ -2863,7 +2120,7 @@ Outlayer.prototype.getItems = function( elems ) { * remove element(s) from instance and DOM * @param {Array or NodeList or Element} elems */ -Outlayer.prototype.remove = function( elems ) { +proto.remove = function( elems ) { var removeItems = this.getItems( elems ); this._emitCompleteOnItems( 'remove', removeItems ); @@ -2873,28 +2130,26 @@ Outlayer.prototype.remove = function( elems ) { return; } - for ( var i=0, len = removeItems.length; i < len; i++ ) { - var item = removeItems[i]; + removeItems.forEach( function( item ) { item.remove(); // remove item from collection utils.removeFrom( this.items, item ); - } + }, this ); }; // ----- destroy ----- // // remove and disable Outlayer instance -Outlayer.prototype.destroy = function() { +proto.destroy = function() { // clean up dynamic styles var style = this.element.style; style.height = ''; style.position = ''; style.width = ''; // destroy items - for ( var i=0, len = this.items.length; i < len; i++ ) { - var item = this.items[i]; + this.items.forEach( function( item ) { item.destroy(); - } + }); this.unbindResize(); @@ -2930,34 +2185,18 @@ Outlayer.data = function( elem ) { */ Outlayer.create = function( namespace, options ) { // sub-class Outlayer - function Layout() { - Outlayer.apply( this, arguments ); - } - // inherit Outlayer prototype, use Object.create if there - if ( Object.create ) { - Layout.prototype = Object.create( Outlayer.prototype ); - } else { - utils.extend( Layout.prototype, Outlayer.prototype ); - } - // set contructor, used for namespace and Item - Layout.prototype.constructor = Layout; - + var Layout = subclass( Outlayer ); + // apply new options and compatOptions Layout.defaults = utils.extend( {}, Outlayer.defaults ); - // apply new options utils.extend( Layout.defaults, options ); - // keep prototype.settings for backwards compatibility (Packery v1.2.0) - Layout.prototype.settings = {}; + Layout.compatOptions = utils.extend( {}, Outlayer.compatOptions ); Layout.namespace = namespace; Layout.data = Outlayer.data; // sub-class Item - Layout.Item = function LayoutItem() { - Item.apply( this, arguments ); - }; - - Layout.Item.prototype = new Item(); + Layout.Item = subclass( Item ); // -------------------------- declarative -------------------------- // @@ -2973,6 +2212,42 @@ Outlayer.create = function( namespace, options ) { return Layout; }; +function subclass( Parent ) { + function SubClass() { + Parent.apply( this, arguments ); + } + + SubClass.prototype = Object.create( Parent.prototype ); + SubClass.prototype.constructor = SubClass; + + return SubClass; +} + +// ----- helpers ----- // + +// how many milliseconds are in each unit +var msUnits = { + ms: 1, + s: 1000 +}; + +// munge time-like parameter into millisecond number +// '0.4s' -> 40 +function getMilliseconds( time ) { + if ( typeof time == 'number' ) { + return time; + } + var matches = time.match( /(^\d*\.?\d*)(\w*)/ ); + var num = matches && matches[1]; + var unit = matches && matches[2]; + if ( !num.length ) { + return 0; + } + num = parseFloat( num ); + var mult = msUnits[ unit ] || 1; + return num * mult; +} + // ----- fin ----- // // back in global @@ -2982,21 +2257,20 @@ return Outlayer; })); - /** * Isotope Item **/ ( function( window, factory ) { -'use strict'; // universal module definition + /* jshint strict: false */ /*globals define, module, require */ if ( typeof define == 'function' && define.amd ) { // AMD - define( 'isotope/js/item',[ + define( 'isotope/item',[ 'outlayer/outlayer' ], factory ); - } else if ( typeof exports == 'object' ) { + } else if ( typeof module == 'object' && module.exports ) { // CommonJS module.exports = factory( require('outlayer') @@ -3019,16 +2293,17 @@ function Item() { Outlayer.Item.apply( this, arguments ); } -Item.prototype = new Outlayer.Item(); +var proto = Item.prototype = Object.create( Outlayer.Item.prototype ); -Item.prototype._create = function() { +var _create = proto._create; +proto._create = function() { // assign id, used for original-order sorting this.id = this.layout.itemGUID++; - Outlayer.Item.prototype._create.call( this ); + _create.call( this ); this.sortData = {}; }; -Item.prototype.updateSortData = function() { +proto.updateSortData = function() { if ( this.isIgnored ) { return; } @@ -3046,8 +2321,8 @@ Item.prototype.updateSortData = function() { } }; -var _destroy = Item.prototype.destroy; -Item.prototype.destroy = function() { +var _destroy = proto.destroy; +proto.destroy = function() { // call super _destroy.apply( this, arguments ); // reset display, #741 @@ -3065,17 +2340,16 @@ return Item; */ ( function( window, factory ) { - 'use strict'; // universal module definition - + /* jshint strict: false */ /*globals define, module, require */ if ( typeof define == 'function' && define.amd ) { // AMD - define( 'isotope/js/layout-mode',[ + define( 'isotope/layout-mode',[ 'get-size/get-size', 'outlayer/outlayer' ], factory ); - } else if ( typeof exports == 'object' ) { + } else if ( typeof module == 'object' && module.exports ) { // CommonJS module.exports = factory( require('get-size'), @@ -3105,36 +2379,32 @@ return Item; } } + var proto = LayoutMode.prototype; + /** * some methods should just defer to default Outlayer method * and reference the Isotope instance as `this` **/ - ( function() { - var facadeMethods = [ - '_resetLayout', - '_getItemLayoutPosition', - '_manageStamp', - '_getContainerSize', - '_getElementOffset', - 'needsResizeLayout' - ]; - - for ( var i=0, len = facadeMethods.length; i < len; i++ ) { - var methodName = facadeMethods[i]; - LayoutMode.prototype[ methodName ] = getOutlayerMethod( methodName ); - } - - function getOutlayerMethod( methodName ) { - return function() { - return Outlayer.prototype[ methodName ].apply( this.isotope, arguments ); - }; - } - })(); + var facadeMethods = [ + '_resetLayout', + '_getItemLayoutPosition', + '_manageStamp', + '_getContainerSize', + '_getElementOffset', + 'needsResizeLayout', + '_getOption' + ]; + + facadeMethods.forEach( function( methodName ) { + proto[ methodName ] = function() { + return Outlayer.prototype[ methodName ].apply( this.isotope, arguments ); + }; + }); // ----- ----- // // for horizontal layout modes, check vertical size - LayoutMode.prototype.needsVerticalResizeLayout = function() { + proto.needsVerticalResizeLayout = function() { // don't trigger if size did not change var size = getSize( this.isotope.element ); // check that this.size and size are there @@ -3145,15 +2415,15 @@ return Item; // ----- measurements ----- // - LayoutMode.prototype._getMeasurement = function() { + proto._getMeasurement = function() { this.isotope._getMeasurement.apply( this, arguments ); }; - LayoutMode.prototype.getColumnWidth = function() { + proto.getColumnWidth = function() { this.getSegmentSize( 'column', 'Width' ); }; - LayoutMode.prototype.getRowHeight = function() { + proto.getRowHeight = function() { this.getSegmentSize( 'row', 'Height' ); }; @@ -3162,7 +2432,7 @@ return Item; * segment: 'column' or 'row' * size 'Width' or 'Height' **/ - LayoutMode.prototype.getSegmentSize = function( segment, size ) { + proto.getSegmentSize = function( segment, size ) { var segmentName = segment + size; var outerSize = 'outer' + size; // columnWidth / outerWidth // rowHeight / outerHeight @@ -3178,18 +2448,18 @@ return Item; this.isotope.size[ 'inner' + size ]; }; - LayoutMode.prototype.getFirstItemSize = function() { + proto.getFirstItemSize = function() { var firstItem = this.isotope.filteredItems[0]; return firstItem && firstItem.element && getSize( firstItem.element ); }; // ----- methods that should reference isotope ----- // - LayoutMode.prototype.layout = function() { + proto.layout = function() { this.isotope.layout.apply( this.isotope, arguments ); }; - LayoutMode.prototype.getSize = function() { + proto.getSize = function() { this.isotope.getSize(); this.size = this.isotope.size; }; @@ -3204,7 +2474,8 @@ return Item; LayoutMode.apply( this, arguments ); } - Mode.prototype = new LayoutMode(); + Mode.prototype = Object.create( proto ); + Mode.prototype.constructor = Mode; // default options if ( options ) { @@ -3223,7 +2494,7 @@ return Item; })); /*! - * Masonry v3.3.1 + * Masonry v4.1.0 * Cascading grid layout library * http://masonry.desandro.com * MIT License @@ -3231,33 +2502,30 @@ return Item; */ ( function( window, factory ) { - 'use strict'; // universal module definition - if ( typeof define === 'function' && define.amd ) { + /* jshint strict: false */ /*globals define, module, require */ + if ( typeof define == 'function' && define.amd ) { // AMD define( 'masonry/masonry',[ 'outlayer/outlayer', - 'get-size/get-size', - 'fizzy-ui-utils/utils' + 'get-size/get-size' ], factory ); - } else if ( typeof exports === 'object' ) { + } else if ( typeof module == 'object' && module.exports ) { // CommonJS module.exports = factory( require('outlayer'), - require('get-size'), - require('fizzy-ui-utils') + require('get-size') ); } else { // browser global window.Masonry = factory( window.Outlayer, - window.getSize, - window.fizzyUIUtils + window.getSize ); } -}( window, function factory( Outlayer, getSize, utils ) { +}( window, function factory( Outlayer, getSize ) { @@ -3265,6 +2533,8 @@ return Item; // create an Outlayer layout class var Masonry = Outlayer.create('masonry'); + // isFitWidth -> fitWidth + Masonry.compatOptions.fitWidth = 'isFitWidth'; Masonry.prototype._resetLayout = function() { this.getSize(); @@ -3273,9 +2543,8 @@ return Item; this.measureColumns(); // reset column Y - var i = this.cols; this.colYs = []; - while (i--) { + for ( var i=0; i < this.cols; i++ ) { this.colYs.push( 0 ); } @@ -3309,7 +2578,8 @@ return Item; Masonry.prototype.getContainerWidth = function() { // container is parent if fit width - var container = this.options.isFitWidth ? this.element.parentNode : this.element; + var isFitWidth = this._getOption('fitWidth'); + var container = isFitWidth ? this.element.parentNode : this.element; // check that this.size and size are there // IE8 triggers resize on body size change, so they might not be var size = getSize( container ); @@ -3328,7 +2598,7 @@ return Item; var colGroup = this._getColGroup( colSpan ); // get the minimum Y value from the columns var minimumY = Math.min.apply( Math, colGroup ); - var shortColIndex = utils.indexOf( colGroup, minimumY ); + var shortColIndex = colGroup.indexOf( minimumY ); // position the brick var position = { @@ -3373,7 +2643,8 @@ return Item; var stampSize = getSize( stamp ); var offset = this._getElementOffset( stamp ); // get the columns that this stamp affects - var firstX = this.options.isOriginLeft ? offset.left : offset.right; + var isOriginLeft = this._getOption('originLeft'); + var firstX = isOriginLeft ? offset.left : offset.right; var lastX = firstX + stampSize.outerWidth; var firstCol = Math.floor( firstX / this.columnWidth ); firstCol = Math.max( 0, firstCol ); @@ -3382,7 +2653,9 @@ return Item; lastCol -= lastX % this.columnWidth ? 0 : 1; lastCol = Math.min( this.cols - 1, lastCol ); // set colYs to bottom of the stamp - var stampMaxY = ( this.options.isOriginTop ? offset.top : offset.bottom ) + + + var isOriginTop = this._getOption('originTop'); + var stampMaxY = ( isOriginTop ? offset.top : offset.bottom ) + stampSize.outerHeight; for ( var i = firstCol; i <= lastCol; i++ ) { this.colYs[i] = Math.max( stampMaxY, this.colYs[i] ); @@ -3395,7 +2668,7 @@ return Item; height: this.maxY }; - if ( this.options.isFitWidth ) { + if ( this._getOption('fitWidth') ) { size.width = this._getContainerFitWidth(); } @@ -3419,7 +2692,7 @@ return Item; Masonry.prototype.needsResizeLayout = function() { var previousWidth = this.containerWidth; this.getContainerWidth(); - return previousWidth !== this.containerWidth; + return previousWidth != this.containerWidth; }; return Masonry; @@ -3433,16 +2706,16 @@ return Item; */ ( function( window, factory ) { - 'use strict'; // universal module definition + /* jshint strict: false */ /*globals define, module, require */ if ( typeof define == 'function' && define.amd ) { // AMD - define( 'isotope/js/layout-modes/masonry',[ + define( 'isotope/layout-modes/masonry',[ '../layout-mode', 'masonry/masonry' ], factory ); - } else if ( typeof exports == 'object' ) { + } else if ( typeof module == 'object' && module.exports ) { // CommonJS module.exports = factory( require('../layout-mode'), @@ -3459,47 +2732,42 @@ return Item; }( window, function factory( LayoutMode, Masonry ) { 'use strict'; -// -------------------------- helpers -------------------------- // - -// extend objects -function extend( a, b ) { - for ( var prop in b ) { - a[ prop ] = b[ prop ]; - } - return a; -} - // -------------------------- masonryDefinition -------------------------- // // create an Outlayer layout class var MasonryMode = LayoutMode.create('masonry'); - // save on to these methods - var _getElementOffset = MasonryMode.prototype._getElementOffset; - var layout = MasonryMode.prototype.layout; - var _getMeasurement = MasonryMode.prototype._getMeasurement; + var proto = MasonryMode.prototype; - // sub-class Masonry - extend( MasonryMode.prototype, Masonry.prototype ); + var keepModeMethods = { + _getElementOffset: true, + layout: true, + _getMeasurement: true + }; - // set back, as it was overwritten by Masonry - MasonryMode.prototype._getElementOffset = _getElementOffset; - MasonryMode.prototype.layout = layout; - MasonryMode.prototype._getMeasurement = _getMeasurement; + // inherit Masonry prototype + for ( var method in Masonry.prototype ) { + // do not inherit mode methods + if ( !keepModeMethods[ method ] ) { + proto[ method ] = Masonry.prototype[ method ]; + } + } - var measureColumns = MasonryMode.prototype.measureColumns; - MasonryMode.prototype.measureColumns = function() { + var measureColumns = proto.measureColumns; + proto.measureColumns = function() { // set items, used if measuring first item this.items = this.isotope.filteredItems; measureColumns.call( this ); }; - // HACK copy over isOriginLeft/Top options - var _manageStamp = MasonryMode.prototype._manageStamp; - MasonryMode.prototype._manageStamp = function() { - this.options.isOriginLeft = this.isotope.options.isOriginLeft; - this.options.isOriginTop = this.isotope.options.isOriginTop; - _manageStamp.apply( this, arguments ); + // point to mode options for fitWidth + var _getOption = proto._getOption; + proto._getOption = function( option ) { + if ( option == 'fitWidth' ) { + return this.options.isFitWidth !== undefined ? + this.options.isFitWidth : this.options.fitWidth; + } + return _getOption.apply( this.isotope, arguments ); }; return MasonryMode; @@ -3511,11 +2779,11 @@ function extend( a, b ) { */ ( function( window, factory ) { - 'use strict'; // universal module definition + /* jshint strict: false */ /*globals define, module, require */ if ( typeof define == 'function' && define.amd ) { // AMD - define( 'isotope/js/layout-modes/fit-rows',[ + define( 'isotope/layout-modes/fit-rows',[ '../layout-mode' ], factory ); @@ -3536,14 +2804,16 @@ function extend( a, b ) { var FitRows = LayoutMode.create('fitRows'); -FitRows.prototype._resetLayout = function() { +var proto = FitRows.prototype; + +proto._resetLayout = function() { this.x = 0; this.y = 0; this.maxY = 0; this._getMeasurement( 'gutter', 'outerWidth' ); }; -FitRows.prototype._getItemLayoutPosition = function( item ) { +proto._getItemLayoutPosition = function( item ) { item.getSize(); var itemWidth = item.size.outerWidth + this.gutter; @@ -3565,7 +2835,7 @@ FitRows.prototype._getItemLayoutPosition = function( item ) { return position; }; -FitRows.prototype._getContainerSize = function() { +proto._getContainerSize = function() { return { height: this.maxY }; }; @@ -3578,15 +2848,15 @@ return FitRows; */ ( function( window, factory ) { - 'use strict'; // universal module definition + /* jshint strict: false */ /*globals define, module, require */ if ( typeof define == 'function' && define.amd ) { // AMD - define( 'isotope/js/layout-modes/vertical',[ + define( 'isotope/layout-modes/vertical',[ '../layout-mode' ], factory ); - } else if ( typeof exports == 'object' ) { + } else if ( typeof module == 'object' && module.exports ) { // CommonJS module.exports = factory( require('../layout-mode') @@ -3605,11 +2875,13 @@ var Vertical = LayoutMode.create( 'vertical', { horizontalAlignment: 0 }); -Vertical.prototype._resetLayout = function() { +var proto = Vertical.prototype; + +proto._resetLayout = function() { this.y = 0; }; -Vertical.prototype._getItemLayoutPosition = function( item ) { +proto._getItemLayoutPosition = function( item ) { item.getSize(); var x = ( this.isotope.size.innerWidth - item.size.outerWidth ) * this.options.horizontalAlignment; @@ -3618,7 +2890,7 @@ Vertical.prototype._getItemLayoutPosition = function( item ) { return { x: x, y: y }; }; -Vertical.prototype._getContainerSize = function() { +proto._getContainerSize = function() { return { height: this.y }; }; @@ -3627,37 +2899,36 @@ return Vertical; })); /*! - * Isotope v2.2.2 + * Isotope v3.0.0 * * Licensed GPLv3 for open source use * or Isotope Commercial License for commercial use * * http://isotope.metafizzy.co - * Copyright 2015 Metafizzy + * Copyright 2016 Metafizzy */ ( function( window, factory ) { - 'use strict'; // universal module definition - + /* jshint strict: false */ /*globals define, module, require */ if ( typeof define == 'function' && define.amd ) { // AMD define( [ 'outlayer/outlayer', 'get-size/get-size', - 'matches-selector/matches-selector', + 'desandro-matches-selector/matches-selector', 'fizzy-ui-utils/utils', - 'isotope/js/item', - 'isotope/js/layout-mode', + './item', + './layout-mode', // include default layout modes - 'isotope/js/layout-modes/masonry', - 'isotope/js/layout-modes/fit-rows', - 'isotope/js/layout-modes/vertical' + './layout-modes/masonry', + './layout-modes/fit-rows', + './layout-modes/vertical' ], function( Outlayer, getSize, matchesSelector, utils, Item, LayoutMode ) { return factory( window, Outlayer, getSize, matchesSelector, utils, Item, LayoutMode ); }); - } else if ( typeof exports == 'object' ) { + } else if ( typeof module == 'object' && module.exports ) { // CommonJS module.exports = factory( window, @@ -3704,21 +2975,11 @@ var trim = String.prototype.trim ? return str.replace( /^\s+|\s+$/g, '' ); }; -var docElem = document.documentElement; - -var getText = docElem.textContent ? - function( elem ) { - return elem.textContent; - } : - function( elem ) { - return elem.innerText; - }; - // -------------------------- isotopeDefinition -------------------------- // // create an Outlayer layout class var Isotope = Outlayer.create( 'isotope', { - layoutMode: "masonry", + layoutMode: 'masonry', isJQueryFiltering: true, sortAscending: true }); @@ -3726,7 +2987,9 @@ var getText = docElem.textContent ? Isotope.Item = Item; Isotope.LayoutMode = LayoutMode; - Isotope.prototype._create = function() { + var proto = Isotope.prototype; + + proto._create = function() { this.itemGUID = 0; // functions that sort items this._sorters = {}; @@ -3746,17 +3009,17 @@ var getText = docElem.textContent ? } }; - Isotope.prototype.reloadItems = function() { + proto.reloadItems = function() { // reset item ID counter this.itemGUID = 0; // call super Outlayer.prototype.reloadItems.call( this ); }; - Isotope.prototype._itemize = function() { + proto._itemize = function() { var items = Outlayer.prototype._itemize.apply( this, arguments ); // assign ID for original-order - for ( var i=0, len = items.length; i < len; i++ ) { + for ( var i=0; i < items.length; i++ ) { var item = items[i]; item.id = this.itemGUID++; } @@ -3767,7 +3030,7 @@ var getText = docElem.textContent ? // -------------------------- layout -------------------------- // - Isotope.prototype._initLayoutMode = function( name ) { + proto._initLayoutMode = function( name ) { var Mode = LayoutMode.modes[ name ]; // set mode options // HACK extend initial options, back-fill in default options @@ -3779,9 +3042,9 @@ var getText = docElem.textContent ? }; - Isotope.prototype.layout = function() { + proto.layout = function() { // if first time doing layout, do all magic - if ( !this._isLayoutInited && this.options.isInitLayout ) { + if ( !this._isLayoutInited && this._getOption('initLayout') ) { this.arrange(); return; } @@ -3789,7 +3052,7 @@ var getText = docElem.textContent ? }; // private method to be used in layout() & magic() - Isotope.prototype._layout = function() { + proto._layout = function() { // don't animate first layout var isInstant = this._getIsInstant(); // layout flow @@ -3802,7 +3065,7 @@ var getText = docElem.textContent ? }; // filter + sort + layout - Isotope.prototype.arrange = function( opts ) { + proto.arrange = function( opts ) { // set any options pass this.option( opts ); this._getIsInstant(); @@ -3812,39 +3075,39 @@ var getText = docElem.textContent ? var filtered = this._filter( this.items ); this.filteredItems = filtered.matches; - var _this = this; - function hideReveal() { - _this.reveal( filtered.needReveal ); - _this.hide( filtered.needHide ); - } - this._bindArrangeComplete(); if ( this._isInstant ) { - this._noTransition( hideReveal ); + this._noTransition( this._hideReveal, [ filtered ] ); } else { - hideReveal(); + this._hideReveal( filtered ); } this._sort(); this._layout(); }; // alias to _init for main plugin method - Isotope.prototype._init = Isotope.prototype.arrange; + proto._init = proto.arrange; + + proto._hideReveal = function( filtered ) { + this.reveal( filtered.needReveal ); + this.hide( filtered.needHide ); + }; // HACK // Don't animate/transition first layout // Or don't animate/transition other layouts - Isotope.prototype._getIsInstant = function() { - var isInstant = this.options.isLayoutInstant !== undefined ? - this.options.isLayoutInstant : !this._isLayoutInited; + proto._getIsInstant = function() { + var isLayoutInstant = this._getOption('layoutInstant'); + var isInstant = isLayoutInstant !== undefined ? isLayoutInstant : + !this._isLayoutInited; this._isInstant = isInstant; return isInstant; }; // listen for layoutComplete, hideComplete and revealComplete // to trigger arrangeComplete - Isotope.prototype._bindArrangeComplete = function() { + proto._bindArrangeComplete = function() { // listen for 3 events to trigger arrangeComplete var isLayoutComplete, isHideComplete, isRevealComplete; var _this = this; @@ -3869,7 +3132,7 @@ var getText = docElem.textContent ? // -------------------------- filter -------------------------- // - Isotope.prototype._filter = function( items ) { + proto._filter = function( items ) { var filter = this.options.filter; filter = filter || '*'; var matches = []; @@ -3879,7 +3142,7 @@ var getText = docElem.textContent ? var test = this._getFilterTest( filter ); // test each item - for ( var i=0, len = items.length; i < len; i++ ) { + for ( var i=0; i < items.length; i++ ) { var item = items[i]; if ( item.isIgnored ) { continue; @@ -3908,7 +3171,7 @@ var getText = docElem.textContent ? }; // get a jQuery, function, or a matchesSelector test given the filter - Isotope.prototype._getFilterTest = function( filter ) { + proto._getFilterTest = function( filter ) { if ( jQuery && this.options.isJQueryFiltering ) { // use jQuery return function( item ) { @@ -3933,7 +3196,7 @@ var getText = docElem.textContent ? * @params {Array} elems * @public */ - Isotope.prototype.updateSortData = function( elems ) { + proto.updateSortData = function( elems ) { // get items var items; if ( elems ) { @@ -3948,7 +3211,7 @@ var getText = docElem.textContent ? this._updateItemsSortData( items ); }; - Isotope.prototype._getSorters = function() { + proto._getSorters = function() { var getSortData = this.options.getSortData; for ( var key in getSortData ) { var sorter = getSortData[ key ]; @@ -3960,7 +3223,7 @@ var getText = docElem.textContent ? * @params {Array} items - of Isotope.Items * @private */ - Isotope.prototype._updateItemsSortData = function( items ) { + proto._updateItemsSortData = function( items ) { // do not update if no items var len = items && items.length; @@ -4008,20 +3271,18 @@ var getText = docElem.textContent ? // get an attribute getter, or get text of the querySelector function getValueGetter( attr, query ) { - var getValue; // if query looks like [foo-bar], get attribute if ( attr ) { - getValue = function( elem ) { + return function getAttribute( elem ) { return elem.getAttribute( attr ); }; - } else { - // otherwise, assume its a querySelector, and get its text - getValue = function( elem ) { - var child = elem.querySelector( query ); - return child && getText( child ); - }; } - return getValue; + + // otherwise, assume its a querySelector, and get its text + return function getChildText( elem ) { + var child = elem.querySelector( query ); + return child && child.textContent; + }; } return mungeSorter; @@ -4040,7 +3301,7 @@ var getText = docElem.textContent ? // ----- sort method ----- // // sort filteredItem order - Isotope.prototype._sort = function() { + proto._sort = function() { var sortByOpt = this.options.sortBy; if ( !sortByOpt ) { return; @@ -4061,7 +3322,7 @@ var getText = docElem.textContent ? function getItemSorter( sortBys, sortAsc ) { return function sorter( itemA, itemB ) { // cycle through all sortKeys - for ( var i = 0, len = sortBys.length; i < len; i++ ) { + for ( var i = 0; i < sortBys.length; i++ ) { var sortBy = sortBys[i]; var a = itemA.sortData[ sortBy ]; var b = itemB.sortData[ sortBy ]; @@ -4079,7 +3340,7 @@ var getText = docElem.textContent ? // -------------------------- methods -------------------------- // // get layout mode - Isotope.prototype._mode = function() { + proto._mode = function() { var layoutMode = this.options.layoutMode; var mode = this.modes[ layoutMode ]; if ( !mode ) { @@ -4092,32 +3353,32 @@ var getText = docElem.textContent ? return mode; }; - Isotope.prototype._resetLayout = function() { + proto._resetLayout = function() { // trigger original reset layout Outlayer.prototype._resetLayout.call( this ); this._mode()._resetLayout(); }; - Isotope.prototype._getItemLayoutPosition = function( item ) { + proto._getItemLayoutPosition = function( item ) { return this._mode()._getItemLayoutPosition( item ); }; - Isotope.prototype._manageStamp = function( stamp ) { + proto._manageStamp = function( stamp ) { this._mode()._manageStamp( stamp ); }; - Isotope.prototype._getContainerSize = function() { + proto._getContainerSize = function() { return this._mode()._getContainerSize(); }; - Isotope.prototype.needsResizeLayout = function() { + proto.needsResizeLayout = function() { return this._mode().needsResizeLayout(); }; // -------------------------- adding & removing -------------------------- // // HEADS UP overwrites default Outlayer appended - Isotope.prototype.appended = function( elems ) { + proto.appended = function( elems ) { var items = this.addItems( elems ); if ( !items.length ) { return; @@ -4129,7 +3390,7 @@ var getText = docElem.textContent ? }; // HEADS UP overwrites default Outlayer prepended - Isotope.prototype.prepended = function( elems ) { + proto.prepended = function( elems ) { var items = this._itemize( elems ); if ( !items.length ) { return; @@ -4146,7 +3407,7 @@ var getText = docElem.textContent ? this.items = items.concat( this.items ); }; - Isotope.prototype._filterRevealAdded = function( items ) { + proto._filterRevealAdded = function( items ) { var filtered = this._filter( items ); this.hide( filtered.needHide ); // reveal all new items @@ -4160,7 +3421,7 @@ var getText = docElem.textContent ? * Filter, sort, and layout newly-appended item elements * @param {Array or NodeList or Element} elems */ - Isotope.prototype.insert = function( elems ) { + proto.insert = function( elems ) { var items = this.addItems( elems ); if ( !items.length ) { return; @@ -4186,28 +3447,25 @@ var getText = docElem.textContent ? this.reveal( filteredInsertItems ); }; - var _remove = Isotope.prototype.remove; - Isotope.prototype.remove = function( elems ) { + var _remove = proto.remove; + proto.remove = function( elems ) { elems = utils.makeArray( elems ); var removeItems = this.getItems( elems ); // do regular thing _remove.call( this, elems ); // bail if no items to remove var len = removeItems && removeItems.length; - if ( !len ) { - return; - } // remove elems from filteredItems - for ( var i=0; i < len; i++ ) { + for ( var i=0; len && i < len; i++ ) { var item = removeItems[i]; // remove item from collection utils.removeFrom( this.filteredItems, item ); } }; - Isotope.prototype.shuffle = function() { + proto.shuffle = function() { // update random sortData - for ( var i=0, len = this.items.length; i < len; i++ ) { + for ( var i=0; i < this.items.length; i++ ) { var item = this.items[i]; item.sortData.random = Math.random(); } @@ -4220,16 +3478,17 @@ var getText = docElem.textContent ? * trigger fn without transition * kind of hacky to have this in the first place * @param {Function} fn + * @param {Array} args * @returns ret * @private */ - Isotope.prototype._noTransition = function( fn ) { + proto._noTransition = function( fn, args ) { // save transitionDuration before disabling var transitionDuration = this.options.transitionDuration; // disable transition this.options.transitionDuration = 0; // do it - var returnValue = fn.call( this ); + var returnValue = fn.apply( this, args ); // re-enable transition for reveal this.options.transitionDuration = transitionDuration; return returnValue; @@ -4241,12 +3500,10 @@ var getText = docElem.textContent ? * getter method for getting filtered item elements * @returns {Array} elems - collection of item elements */ - Isotope.prototype.getFilteredItemElements = function() { - var elems = []; - for ( var i=0, len = this.filteredItems.length; i < len; i++ ) { - elems.push( this.filteredItems[i].element ); - } - return elems; + proto.getFilteredItemElements = function() { + return this.filteredItems.map( function( item ) { + return item.element; + }); }; // ----- ----- // diff --git a/dist/isotope.pkgd.min.js b/dist/isotope.pkgd.min.js index 1a5e3fc..1935b4e 100644 --- a/dist/isotope.pkgd.min.js +++ b/dist/isotope.pkgd.min.js @@ -1,12 +1,12 @@ /*! - * Isotope PACKAGED v2.2.2 + * Isotope PACKAGED v3.0.0 * * Licensed GPLv3 for open source use * or Isotope Commercial License for commercial use * * http://isotope.metafizzy.co - * Copyright 2015 Metafizzy + * Copyright 2016 Metafizzy */ -!function(a){function b(){}function c(a){function c(b){b.prototype.option||(b.prototype.option=function(b){a.isPlainObject(b)&&(this.options=a.extend(!0,this.options,b))})}function e(b,c){a.fn[b]=function(e){if("string"==typeof e){for(var g=d.call(arguments,1),h=0,i=this.length;i>h;h++){var j=this[h],k=a.data(j,b);if(k)if(a.isFunction(k[e])&&"_"!==e.charAt(0)){var l=k[e].apply(k,g);if(void 0!==l)return l}else f("no such method '"+e+"' for "+b+" instance");else f("cannot call methods on "+b+" prior to initialization; attempted to call '"+e+"'")}return this}return this.each(function(){var d=a.data(this,b);d?(d.option(e),d._init()):(d=new c(this,e),a.data(this,b,d))})}}if(a){var f="undefined"==typeof console?b:function(a){console.error(a)};return a.bridget=function(a,b){c(b),e(a,b)},a.bridget}}var d=Array.prototype.slice;"function"==typeof define&&define.amd?define("jquery-bridget/jquery.bridget",["jquery"],c):c("object"==typeof exports?require("jquery"):a.jQuery)}(window),function(a){function b(b){var c=a.event;return c.target=c.target||c.srcElement||b,c}var c=document.documentElement,d=function(){};c.addEventListener?d=function(a,b,c){a.addEventListener(b,c,!1)}:c.attachEvent&&(d=function(a,c,d){a[c+d]=d.handleEvent?function(){var c=b(a);d.handleEvent.call(d,c)}:function(){var c=b(a);d.call(a,c)},a.attachEvent("on"+c,a[c+d])});var e=function(){};c.removeEventListener?e=function(a,b,c){a.removeEventListener(b,c,!1)}:c.detachEvent&&(e=function(a,b,c){a.detachEvent("on"+b,a[b+c]);try{delete a[b+c]}catch(d){a[b+c]=void 0}});var f={bind:d,unbind:e};"function"==typeof define&&define.amd?define("eventie/eventie",f):"object"==typeof exports?module.exports=f:a.eventie=f}(window),function(){"use strict";function a(){}function b(a,b){for(var c=a.length;c--;)if(a[c].listener===b)return c;return-1}function c(a){return function(){return this[a].apply(this,arguments)}}var d=a.prototype,e=this,f=e.EventEmitter;d.getListeners=function(a){var b,c,d=this._getEvents();if(a instanceof RegExp){b={};for(c in d)d.hasOwnProperty(c)&&a.test(c)&&(b[c]=d[c])}else b=d[a]||(d[a]=[]);return b},d.flattenListeners=function(a){var b,c=[];for(b=0;be;e++)if(b=c[e]+a,"string"==typeof d[b])return b}}var c="Webkit Moz ms Ms O".split(" "),d=document.documentElement.style;"function"==typeof define&&define.amd?define("get-style-property/get-style-property",[],function(){return b}):"object"==typeof exports?module.exports=b:a.getStyleProperty=b}(window),function(a,b){function c(a){var b=parseFloat(a),c=-1===a.indexOf("%")&&!isNaN(b);return c&&b}function d(){}function e(){for(var a={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},b=0,c=h.length;c>b;b++){var d=h[b];a[d]=0}return a}function f(b){function d(){if(!m){m=!0;var d=a.getComputedStyle;if(j=function(){var a=d?function(a){return d(a,null)}:function(a){return a.currentStyle};return function(b){var c=a(b);return c||g("Style returned "+c+". Are you running this code in a hidden iframe on Firefox? See http://bit.ly/getsizebug1"),c}}(),k=b("boxSizing")){var e=document.createElement("div");e.style.width="200px",e.style.padding="1px 2px 3px 4px",e.style.borderStyle="solid",e.style.borderWidth="1px 2px 3px 4px",e.style[k]="border-box";var f=document.body||document.documentElement;f.appendChild(e);var h=j(e);l=200===c(h.width),f.removeChild(e)}}}function f(a){if(d(),"string"==typeof a&&(a=document.querySelector(a)),a&&"object"==typeof a&&a.nodeType){var b=j(a);if("none"===b.display)return e();var f={};f.width=a.offsetWidth,f.height=a.offsetHeight;for(var g=f.isBorderBox=!(!k||!b[k]||"border-box"!==b[k]),m=0,n=h.length;n>m;m++){var o=h[m],p=b[o];p=i(a,p);var q=parseFloat(p);f[o]=isNaN(q)?0:q}var r=f.paddingLeft+f.paddingRight,s=f.paddingTop+f.paddingBottom,t=f.marginLeft+f.marginRight,u=f.marginTop+f.marginBottom,v=f.borderLeftWidth+f.borderRightWidth,w=f.borderTopWidth+f.borderBottomWidth,x=g&&l,y=c(b.width);y!==!1&&(f.width=y+(x?0:r+v));var z=c(b.height);return z!==!1&&(f.height=z+(x?0:s+w)),f.innerWidth=f.width-(r+v),f.innerHeight=f.height-(s+w),f.outerWidth=f.width+t,f.outerHeight=f.height+u,f}}function i(b,c){if(a.getComputedStyle||-1===c.indexOf("%"))return c;var d=b.style,e=d.left,f=b.runtimeStyle,g=f&&f.left;return g&&(f.left=b.currentStyle.left),d.left=c,c=d.pixelLeft,d.left=e,g&&(f.left=g),c}var j,k,l,m=!1;return f}var g="undefined"==typeof console?d:function(a){console.error(a)},h=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"];"function"==typeof define&&define.amd?define("get-size/get-size",["get-style-property/get-style-property"],f):"object"==typeof exports?module.exports=f(require("desandro-get-style-property")):a.getSize=f(a.getStyleProperty)}(window),function(a){function b(a){"function"==typeof a&&(b.isReady?a():g.push(a))}function c(a){var c="readystatechange"===a.type&&"complete"!==f.readyState;b.isReady||c||d()}function d(){b.isReady=!0;for(var a=0,c=g.length;c>a;a++){var d=g[a];d()}}function e(e){return"complete"===f.readyState?d():(e.bind(f,"DOMContentLoaded",c),e.bind(f,"readystatechange",c),e.bind(a,"load",c)),b}var f=a.document,g=[];b.isReady=!1,"function"==typeof define&&define.amd?define("doc-ready/doc-ready",["eventie/eventie"],e):"object"==typeof exports?module.exports=e(require("eventie")):a.docReady=e(a.eventie)}(window),function(a){"use strict";function b(a,b){return a[g](b)}function c(a){if(!a.parentNode){var b=document.createDocumentFragment();b.appendChild(a)}}function d(a,b){c(a);for(var d=a.parentNode.querySelectorAll(b),e=0,f=d.length;f>e;e++)if(d[e]===a)return!0;return!1}function e(a,d){return c(a),b(a,d)}var f,g=function(){if(a.matches)return"matches";if(a.matchesSelector)return"matchesSelector";for(var b=["webkit","moz","ms","o"],c=0,d=b.length;d>c;c++){var e=b[c],f=e+"MatchesSelector";if(a[f])return f}}();if(g){var h=document.createElement("div"),i=b(h,"div");f=i?b:e}else f=d;"function"==typeof define&&define.amd?define("matches-selector/matches-selector",[],function(){return f}):"object"==typeof exports?module.exports=f:window.matchesSelector=f}(Element.prototype),function(a,b){"use strict";"function"==typeof define&&define.amd?define("fizzy-ui-utils/utils",["doc-ready/doc-ready","matches-selector/matches-selector"],function(c,d){return b(a,c,d)}):"object"==typeof exports?module.exports=b(a,require("doc-ready"),require("desandro-matches-selector")):a.fizzyUIUtils=b(a,a.docReady,a.matchesSelector)}(window,function(a,b,c){var d={};d.extend=function(a,b){for(var c in b)a[c]=b[c];return a},d.modulo=function(a,b){return(a%b+b)%b};var e=Object.prototype.toString;d.isArray=function(a){return"[object Array]"==e.call(a)},d.makeArray=function(a){var b=[];if(d.isArray(a))b=a;else if(a&&"number"==typeof a.length)for(var c=0,e=a.length;e>c;c++)b.push(a[c]);else b.push(a);return b},d.indexOf=Array.prototype.indexOf?function(a,b){return a.indexOf(b)}:function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},d.removeFrom=function(a,b){var c=d.indexOf(a,b);-1!=c&&a.splice(c,1)},d.isElement="function"==typeof HTMLElement||"object"==typeof HTMLElement?function(a){return a instanceof HTMLElement}:function(a){return a&&"object"==typeof a&&1==a.nodeType&&"string"==typeof a.nodeName},d.setText=function(){function a(a,c){b=b||(void 0!==document.documentElement.textContent?"textContent":"innerText"),a[b]=c}var b;return a}(),d.getParent=function(a,b){for(;a!=document.body;)if(a=a.parentNode,c(a,b))return a},d.getQueryElement=function(a){return"string"==typeof a?document.querySelector(a):a},d.handleEvent=function(a){var b="on"+a.type;this[b]&&this[b](a)},d.filterFindElements=function(a,b){a=d.makeArray(a);for(var e=[],f=0,g=a.length;g>f;f++){var h=a[f];if(d.isElement(h))if(b){c(h,b)&&e.push(h);for(var i=h.querySelectorAll(b),j=0,k=i.length;k>j;j++)e.push(i[j])}else e.push(h)}return e},d.debounceMethod=function(a,b,c){var d=a.prototype[b],e=b+"Timeout";a.prototype[b]=function(){var a=this[e];a&&clearTimeout(a);var b=arguments,f=this;this[e]=setTimeout(function(){d.apply(f,b),delete f[e]},c||100)}},d.toDashed=function(a){return a.replace(/(.)([A-Z])/g,function(a,b,c){return b+"-"+c}).toLowerCase()};var f=a.console;return d.htmlInit=function(c,e){b(function(){for(var b=d.toDashed(e),g=document.querySelectorAll(".js-"+b),h="data-"+b+"-options",i=0,j=g.length;j>i;i++){var k,l=g[i],m=l.getAttribute(h);try{k=m&&JSON.parse(m)}catch(n){f&&f.error("Error parsing "+h+" on "+l.nodeName.toLowerCase()+(l.id?"#"+l.id:"")+": "+n);continue}var o=new c(l,k),p=a.jQuery;p&&p.data(l,e,o)}})},d}),function(a,b){"use strict";"function"==typeof define&&define.amd?define("outlayer/item",["eventEmitter/EventEmitter","get-size/get-size","get-style-property/get-style-property","fizzy-ui-utils/utils"],function(c,d,e,f){return b(a,c,d,e,f)}):"object"==typeof exports?module.exports=b(a,require("wolfy87-eventemitter"),require("get-size"),require("desandro-get-style-property"),require("fizzy-ui-utils")):(a.Outlayer={},a.Outlayer.Item=b(a,a.EventEmitter,a.getSize,a.getStyleProperty,a.fizzyUIUtils))}(window,function(a,b,c,d,e){"use strict";function f(a){for(var b in a)return!1;return b=null,!0}function g(a,b){a&&(this.element=a,this.layout=b,this.position={x:0,y:0},this._create())}function h(a){return a.replace(/([A-Z])/g,function(a){return"-"+a.toLowerCase()})}var i=a.getComputedStyle,j=i?function(a){return i(a,null)}:function(a){return a.currentStyle},k=d("transition"),l=d("transform"),m=k&&l,n=!!d("perspective"),o={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"otransitionend",transition:"transitionend"}[k],p=["transform","transition","transitionDuration","transitionProperty"],q=function(){for(var a={},b=0,c=p.length;c>b;b++){var e=p[b],f=d(e);f&&f!==e&&(a[e]=f)}return a}();e.extend(g.prototype,b.prototype),g.prototype._create=function(){this._transn={ingProperties:{},clean:{},onEnd:{}},this.css({position:"absolute"})},g.prototype.handleEvent=function(a){var b="on"+a.type;this[b]&&this[b](a)},g.prototype.getSize=function(){this.size=c(this.element)},g.prototype.css=function(a){var b=this.element.style;for(var c in a){var d=q[c]||c;b[d]=a[c]}},g.prototype.getPosition=function(){var a=j(this.element),b=this.layout.options,c=b.isOriginLeft,d=b.isOriginTop,e=a[c?"left":"right"],f=a[d?"top":"bottom"],g=this.layout.size,h=-1!=e.indexOf("%")?parseFloat(e)/100*g.width:parseInt(e,10),i=-1!=f.indexOf("%")?parseFloat(f)/100*g.height:parseInt(f,10);h=isNaN(h)?0:h,i=isNaN(i)?0:i,h-=c?g.paddingLeft:g.paddingRight,i-=d?g.paddingTop:g.paddingBottom,this.position.x=h,this.position.y=i},g.prototype.layoutPosition=function(){var a=this.layout.size,b=this.layout.options,c={},d=b.isOriginLeft?"paddingLeft":"paddingRight",e=b.isOriginLeft?"left":"right",f=b.isOriginLeft?"right":"left",g=this.position.x+a[d];c[e]=this.getXValue(g),c[f]="";var h=b.isOriginTop?"paddingTop":"paddingBottom",i=b.isOriginTop?"top":"bottom",j=b.isOriginTop?"bottom":"top",k=this.position.y+a[h];c[i]=this.getYValue(k),c[j]="",this.css(c),this.emitEvent("layout",[this])},g.prototype.getXValue=function(a){var b=this.layout.options;return b.percentPosition&&!b.isHorizontal?a/this.layout.size.width*100+"%":a+"px"},g.prototype.getYValue=function(a){var b=this.layout.options;return b.percentPosition&&b.isHorizontal?a/this.layout.size.height*100+"%":a+"px"},g.prototype._transitionTo=function(a,b){this.getPosition();var c=this.position.x,d=this.position.y,e=parseInt(a,10),f=parseInt(b,10),g=e===this.position.x&&f===this.position.y;if(this.setPosition(a,b),g&&!this.isTransitioning)return void this.layoutPosition();var h=a-c,i=b-d,j={};j.transform=this.getTranslate(h,i),this.transition({to:j,onTransitionEnd:{transform:this.layoutPosition},isCleaning:!0})},g.prototype.getTranslate=function(a,b){var c=this.layout.options;return a=c.isOriginLeft?a:-a,b=c.isOriginTop?b:-b,n?"translate3d("+a+"px, "+b+"px, 0)":"translate("+a+"px, "+b+"px)"},g.prototype.goTo=function(a,b){this.setPosition(a,b),this.layoutPosition()},g.prototype.moveTo=m?g.prototype._transitionTo:g.prototype.goTo,g.prototype.setPosition=function(a,b){this.position.x=parseInt(a,10),this.position.y=parseInt(b,10)},g.prototype._nonTransition=function(a){this.css(a.to),a.isCleaning&&this._removeStyles(a.to);for(var b in a.onTransitionEnd)a.onTransitionEnd[b].call(this)},g.prototype._transition=function(a){if(!parseFloat(this.layout.options.transitionDuration))return void this._nonTransition(a);var b=this._transn;for(var c in a.onTransitionEnd)b.onEnd[c]=a.onTransitionEnd[c];for(c in a.to)b.ingProperties[c]=!0,a.isCleaning&&(b.clean[c]=!0);if(a.from){this.css(a.from);var d=this.element.offsetHeight;d=null}this.enableTransition(a.to),this.css(a.to),this.isTransitioning=!0};var r="opacity,"+h(q.transform||"transform");g.prototype.enableTransition=function(){this.isTransitioning||(this.css({transitionProperty:r,transitionDuration:this.layout.options.transitionDuration}),this.element.addEventListener(o,this,!1))},g.prototype.transition=g.prototype[k?"_transition":"_nonTransition"],g.prototype.onwebkitTransitionEnd=function(a){this.ontransitionend(a)},g.prototype.onotransitionend=function(a){this.ontransitionend(a)};var s={"-webkit-transform":"transform","-moz-transform":"transform","-o-transform":"transform"};g.prototype.ontransitionend=function(a){if(a.target===this.element){var b=this._transn,c=s[a.propertyName]||a.propertyName;if(delete b.ingProperties[c],f(b.ingProperties)&&this.disableTransition(),c in b.clean&&(this.element.style[a.propertyName]="",delete b.clean[c]),c in b.onEnd){var d=b.onEnd[c];d.call(this),delete b.onEnd[c]}this.emitEvent("transitionEnd",[this])}},g.prototype.disableTransition=function(){this.removeTransitionStyles(),this.element.removeEventListener(o,this,!1),this.isTransitioning=!1},g.prototype._removeStyles=function(a){var b={};for(var c in a)b[c]="";this.css(b)};var t={transitionProperty:"",transitionDuration:""};return g.prototype.removeTransitionStyles=function(){this.css(t)},g.prototype.removeElem=function(){this.element.parentNode.removeChild(this.element),this.css({display:""}),this.emitEvent("remove",[this])},g.prototype.remove=function(){if(!k||!parseFloat(this.layout.options.transitionDuration))return void this.removeElem();var a=this;this.once("transitionEnd",function(){a.removeElem()}),this.hide()},g.prototype.reveal=function(){delete this.isHidden,this.css({display:""});var a=this.layout.options,b={},c=this.getHideRevealTransitionEndProperty("visibleStyle");b[c]=this.onRevealTransitionEnd,this.transition({from:a.hiddenStyle,to:a.visibleStyle,isCleaning:!0,onTransitionEnd:b})},g.prototype.onRevealTransitionEnd=function(){this.isHidden||this.emitEvent("reveal")},g.prototype.getHideRevealTransitionEndProperty=function(a){var b=this.layout.options[a];if(b.opacity)return"opacity";for(var c in b)return c},g.prototype.hide=function(){this.isHidden=!0,this.css({display:""});var a=this.layout.options,b={},c=this.getHideRevealTransitionEndProperty("hiddenStyle");b[c]=this.onHideTransitionEnd,this.transition({from:a.visibleStyle,to:a.hiddenStyle,isCleaning:!0,onTransitionEnd:b})},g.prototype.onHideTransitionEnd=function(){this.isHidden&&(this.css({display:"none"}),this.emitEvent("hide"))},g.prototype.destroy=function(){this.css({position:"",left:"",right:"",top:"",bottom:"",transition:"",transform:""})},g}),function(a,b){"use strict";"function"==typeof define&&define.amd?define("outlayer/outlayer",["eventie/eventie","eventEmitter/EventEmitter","get-size/get-size","fizzy-ui-utils/utils","./item"],function(c,d,e,f,g){return b(a,c,d,e,f,g)}):"object"==typeof exports?module.exports=b(a,require("eventie"),require("wolfy87-eventemitter"),require("get-size"),require("fizzy-ui-utils"),require("./item")):a.Outlayer=b(a,a.eventie,a.EventEmitter,a.getSize,a.fizzyUIUtils,a.Outlayer.Item)}(window,function(a,b,c,d,e,f){"use strict";function g(a,b){var c=e.getQueryElement(a);if(!c)return void(h&&h.error("Bad element for "+this.constructor.namespace+": "+(c||a)));this.element=c,i&&(this.$element=i(this.element)),this.options=e.extend({},this.constructor.defaults),this.option(b);var d=++k;this.element.outlayerGUID=d,l[d]=this,this._create(),this.options.isInitLayout&&this.layout()}var h=a.console,i=a.jQuery,j=function(){},k=0,l={};return g.namespace="outlayer",g.Item=f,g.defaults={containerStyle:{position:"relative"},isInitLayout:!0,isOriginLeft:!0,isOriginTop:!0,isResizeBound:!0,isResizingContainer:!0,transitionDuration:"0.4s",hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}},e.extend(g.prototype,c.prototype),g.prototype.option=function(a){e.extend(this.options,a)},g.prototype._create=function(){this.reloadItems(),this.stamps=[],this.stamp(this.options.stamp),e.extend(this.element.style,this.options.containerStyle),this.options.isResizeBound&&this.bindResize()},g.prototype.reloadItems=function(){this.items=this._itemize(this.element.children)},g.prototype._itemize=function(a){for(var b=this._filterFindItemElements(a),c=this.constructor.Item,d=[],e=0,f=b.length;f>e;e++){var g=b[e],h=new c(g,this);d.push(h)}return d},g.prototype._filterFindItemElements=function(a){return e.filterFindElements(a,this.options.itemSelector)},g.prototype.getItemElements=function(){for(var a=[],b=0,c=this.items.length;c>b;b++)a.push(this.items[b].element);return a},g.prototype.layout=function(){this._resetLayout(),this._manageStamps();var a=void 0!==this.options.isLayoutInstant?this.options.isLayoutInstant:!this._isLayoutInited;this.layoutItems(this.items,a),this._isLayoutInited=!0},g.prototype._init=g.prototype.layout,g.prototype._resetLayout=function(){this.getSize()},g.prototype.getSize=function(){this.size=d(this.element)},g.prototype._getMeasurement=function(a,b){var c,f=this.options[a];f?("string"==typeof f?c=this.element.querySelector(f):e.isElement(f)&&(c=f),this[a]=c?d(c)[b]:f):this[a]=0},g.prototype.layoutItems=function(a,b){a=this._getItemsForLayout(a),this._layoutItems(a,b),this._postLayout()},g.prototype._getItemsForLayout=function(a){for(var b=[],c=0,d=a.length;d>c;c++){var e=a[c];e.isIgnored||b.push(e)}return b},g.prototype._layoutItems=function(a,b){if(this._emitCompleteOnItems("layout",a),a&&a.length){for(var c=[],d=0,e=a.length;e>d;d++){var f=a[d],g=this._getItemLayoutPosition(f);g.item=f,g.isInstant=b||f.isLayoutInstant,c.push(g)}this._processLayoutQueue(c)}},g.prototype._getItemLayoutPosition=function(){return{x:0,y:0}},g.prototype._processLayoutQueue=function(a){for(var b=0,c=a.length;c>b;b++){var d=a[b];this._positionItem(d.item,d.x,d.y,d.isInstant)}},g.prototype._positionItem=function(a,b,c,d){d?a.goTo(b,c):a.moveTo(b,c)},g.prototype._postLayout=function(){this.resizeContainer()},g.prototype.resizeContainer=function(){if(this.options.isResizingContainer){var a=this._getContainerSize();a&&(this._setContainerMeasure(a.width,!0),this._setContainerMeasure(a.height,!1))}},g.prototype._getContainerSize=j,g.prototype._setContainerMeasure=function(a,b){if(void 0!==a){var c=this.size;c.isBorderBox&&(a+=b?c.paddingLeft+c.paddingRight+c.borderLeftWidth+c.borderRightWidth:c.paddingBottom+c.paddingTop+c.borderTopWidth+c.borderBottomWidth),a=Math.max(a,0),this.element.style[b?"width":"height"]=a+"px"}},g.prototype._emitCompleteOnItems=function(a,b){function c(){e.dispatchEvent(a+"Complete",null,[b])}function d(){g++,g===f&&c()}var e=this,f=b.length;if(!b||!f)return void c();for(var g=0,h=0,i=b.length;i>h;h++){var j=b[h];j.once(a,d)}},g.prototype.dispatchEvent=function(a,b,c){var d=b?[b].concat(c):c;if(this.emitEvent(a,d),i)if(this.$element=this.$element||i(this.element),b){var e=i.Event(b);e.type=a,this.$element.trigger(e,c)}else this.$element.trigger(a,c)},g.prototype.ignore=function(a){var b=this.getItem(a);b&&(b.isIgnored=!0)},g.prototype.unignore=function(a){var b=this.getItem(a);b&&delete b.isIgnored},g.prototype.stamp=function(a){if(a=this._find(a)){this.stamps=this.stamps.concat(a);for(var b=0,c=a.length;c>b;b++){var d=a[b];this.ignore(d)}}},g.prototype.unstamp=function(a){if(a=this._find(a))for(var b=0,c=a.length;c>b;b++){var d=a[b];e.removeFrom(this.stamps,d),this.unignore(d)}},g.prototype._find=function(a){return a?("string"==typeof a&&(a=this.element.querySelectorAll(a)),a=e.makeArray(a)):void 0},g.prototype._manageStamps=function(){if(this.stamps&&this.stamps.length){this._getBoundingRect();for(var a=0,b=this.stamps.length;b>a;a++){var c=this.stamps[a];this._manageStamp(c)}}},g.prototype._getBoundingRect=function(){var a=this.element.getBoundingClientRect(),b=this.size;this._boundingRect={left:a.left+b.paddingLeft+b.borderLeftWidth,top:a.top+b.paddingTop+b.borderTopWidth,right:a.right-(b.paddingRight+b.borderRightWidth),bottom:a.bottom-(b.paddingBottom+b.borderBottomWidth)}},g.prototype._manageStamp=j,g.prototype._getElementOffset=function(a){var b=a.getBoundingClientRect(),c=this._boundingRect,e=d(a),f={left:b.left-c.left-e.marginLeft,top:b.top-c.top-e.marginTop,right:c.right-b.right-e.marginRight,bottom:c.bottom-b.bottom-e.marginBottom};return f},g.prototype.handleEvent=function(a){var b="on"+a.type;this[b]&&this[b](a)},g.prototype.bindResize=function(){this.isResizeBound||(b.bind(a,"resize",this),this.isResizeBound=!0)},g.prototype.unbindResize=function(){this.isResizeBound&&b.unbind(a,"resize",this),this.isResizeBound=!1},g.prototype.onresize=function(){function a(){b.resize(),delete b.resizeTimeout}this.resizeTimeout&&clearTimeout(this.resizeTimeout);var b=this;this.resizeTimeout=setTimeout(a,100)},g.prototype.resize=function(){this.isResizeBound&&this.needsResizeLayout()&&this.layout()},g.prototype.needsResizeLayout=function(){var a=d(this.element),b=this.size&&a;return b&&a.innerWidth!==this.size.innerWidth},g.prototype.addItems=function(a){var b=this._itemize(a);return b.length&&(this.items=this.items.concat(b)),b},g.prototype.appended=function(a){var b=this.addItems(a);b.length&&(this.layoutItems(b,!0),this.reveal(b))},g.prototype.prepended=function(a){var b=this._itemize(a);if(b.length){var c=this.items.slice(0);this.items=b.concat(c),this._resetLayout(),this._manageStamps(),this.layoutItems(b,!0),this.reveal(b),this.layoutItems(c)}},g.prototype.reveal=function(a){this._emitCompleteOnItems("reveal",a);for(var b=a&&a.length,c=0;b&&b>c;c++){var d=a[c];d.reveal()}},g.prototype.hide=function(a){this._emitCompleteOnItems("hide",a);for(var b=a&&a.length,c=0;b&&b>c;c++){var d=a[c];d.hide()}},g.prototype.revealItemElements=function(a){var b=this.getItems(a);this.reveal(b)},g.prototype.hideItemElements=function(a){var b=this.getItems(a);this.hide(b)},g.prototype.getItem=function(a){for(var b=0,c=this.items.length;c>b;b++){var d=this.items[b];if(d.element===a)return d}},g.prototype.getItems=function(a){a=e.makeArray(a);for(var b=[],c=0,d=a.length;d>c;c++){var f=a[c],g=this.getItem(f);g&&b.push(g)}return b},g.prototype.remove=function(a){var b=this.getItems(a);if(this._emitCompleteOnItems("remove",b),b&&b.length)for(var c=0,d=b.length;d>c;c++){var f=b[c];f.remove(),e.removeFrom(this.items,f)}},g.prototype.destroy=function(){var a=this.element.style;a.height="",a.position="",a.width="";for(var b=0,c=this.items.length;c>b;b++){var d=this.items[b];d.destroy()}this.unbindResize();var e=this.element.outlayerGUID;delete l[e],delete this.element.outlayerGUID,i&&i.removeData(this.element,this.constructor.namespace)},g.data=function(a){a=e.getQueryElement(a);var b=a&&a.outlayerGUID;return b&&l[b]},g.create=function(a,b){function c(){g.apply(this,arguments)}return Object.create?c.prototype=Object.create(g.prototype):e.extend(c.prototype,g.prototype),c.prototype.constructor=c,c.defaults=e.extend({},g.defaults),e.extend(c.defaults,b),c.prototype.settings={},c.namespace=a,c.data=g.data,c.Item=function(){f.apply(this,arguments)},c.Item.prototype=new f,e.htmlInit(c,a),i&&i.bridget&&i.bridget(a,c),c},g.Item=f,g}),function(a,b){"use strict";"function"==typeof define&&define.amd?define("isotope/js/item",["outlayer/outlayer"],b):"object"==typeof exports?module.exports=b(require("outlayer")):(a.Isotope=a.Isotope||{},a.Isotope.Item=b(a.Outlayer))}(window,function(a){"use strict";function b(){a.Item.apply(this,arguments)}b.prototype=new a.Item,b.prototype._create=function(){this.id=this.layout.itemGUID++,a.Item.prototype._create.call(this),this.sortData={}},b.prototype.updateSortData=function(){if(!this.isIgnored){this.sortData.id=this.id,this.sortData["original-order"]=this.id,this.sortData.random=Math.random();var a=this.layout.options.getSortData,b=this.layout._sorters;for(var c in a){var d=b[c];this.sortData[c]=d(this.element,this)}}};var c=b.prototype.destroy;return b.prototype.destroy=function(){c.apply(this,arguments),this.css({display:""})},b}),function(a,b){"use strict";"function"==typeof define&&define.amd?define("isotope/js/layout-mode",["get-size/get-size","outlayer/outlayer"],b):"object"==typeof exports?module.exports=b(require("get-size"),require("outlayer")):(a.Isotope=a.Isotope||{},a.Isotope.LayoutMode=b(a.getSize,a.Outlayer))}(window,function(a,b){"use strict";function c(a){this.isotope=a,a&&(this.options=a.options[this.namespace],this.element=a.element,this.items=a.filteredItems,this.size=a.size)}return function(){function a(a){return function(){return b.prototype[a].apply(this.isotope,arguments)}}for(var d=["_resetLayout","_getItemLayoutPosition","_manageStamp","_getContainerSize","_getElementOffset","needsResizeLayout"],e=0,f=d.length;f>e;e++){var g=d[e];c.prototype[g]=a(g)}}(),c.prototype.needsVerticalResizeLayout=function(){var b=a(this.isotope.element),c=this.isotope.size&&b;return c&&b.innerHeight!=this.isotope.size.innerHeight},c.prototype._getMeasurement=function(){this.isotope._getMeasurement.apply(this,arguments)},c.prototype.getColumnWidth=function(){this.getSegmentSize("column","Width")},c.prototype.getRowHeight=function(){this.getSegmentSize("row","Height")},c.prototype.getSegmentSize=function(a,b){var c=a+b,d="outer"+b;if(this._getMeasurement(c,d),!this[c]){var e=this.getFirstItemSize();this[c]=e&&e[d]||this.isotope.size["inner"+b]}},c.prototype.getFirstItemSize=function(){var b=this.isotope.filteredItems[0];return b&&b.element&&a(b.element)},c.prototype.layout=function(){this.isotope.layout.apply(this.isotope,arguments)},c.prototype.getSize=function(){this.isotope.getSize(),this.size=this.isotope.size},c.modes={},c.create=function(a,b){function d(){c.apply(this,arguments)}return d.prototype=new c,b&&(d.options=b),d.prototype.namespace=a,c.modes[a]=d,d},c}),function(a,b){"use strict";"function"==typeof define&&define.amd?define("masonry/masonry",["outlayer/outlayer","get-size/get-size","fizzy-ui-utils/utils"],b):"object"==typeof exports?module.exports=b(require("outlayer"),require("get-size"),require("fizzy-ui-utils")):a.Masonry=b(a.Outlayer,a.getSize,a.fizzyUIUtils)}(window,function(a,b,c){var d=a.create("masonry");return d.prototype._resetLayout=function(){this.getSize(),this._getMeasurement("columnWidth","outerWidth"),this._getMeasurement("gutter","outerWidth"),this.measureColumns();var a=this.cols;for(this.colYs=[];a--;)this.colYs.push(0);this.maxY=0},d.prototype.measureColumns=function(){if(this.getContainerWidth(),!this.columnWidth){var a=this.items[0],c=a&&a.element;this.columnWidth=c&&b(c).outerWidth||this.containerWidth}var d=this.columnWidth+=this.gutter,e=this.containerWidth+this.gutter,f=e/d,g=d-e%d,h=g&&1>g?"round":"floor";f=Math[h](f),this.cols=Math.max(f,1)},d.prototype.getContainerWidth=function(){var a=this.options.isFitWidth?this.element.parentNode:this.element,c=b(a);this.containerWidth=c&&c.innerWidth},d.prototype._getItemLayoutPosition=function(a){a.getSize();var b=a.size.outerWidth%this.columnWidth,d=b&&1>b?"round":"ceil",e=Math[d](a.size.outerWidth/this.columnWidth);e=Math.min(e,this.cols);for(var f=this._getColGroup(e),g=Math.min.apply(Math,f),h=c.indexOf(f,g),i={x:this.columnWidth*h,y:g},j=g+a.size.outerHeight,k=this.cols+1-f.length,l=0;k>l;l++)this.colYs[h+l]=j;return i},d.prototype._getColGroup=function(a){if(2>a)return this.colYs;for(var b=[],c=this.cols+1-a,d=0;c>d;d++){var e=this.colYs.slice(d,d+a);b[d]=Math.max.apply(Math,e)}return b},d.prototype._manageStamp=function(a){var c=b(a),d=this._getElementOffset(a),e=this.options.isOriginLeft?d.left:d.right,f=e+c.outerWidth,g=Math.floor(e/this.columnWidth);g=Math.max(0,g);var h=Math.floor(f/this.columnWidth);h-=f%this.columnWidth?0:1,h=Math.min(this.cols-1,h);for(var i=(this.options.isOriginTop?d.top:d.bottom)+c.outerHeight,j=g;h>=j;j++)this.colYs[j]=Math.max(i,this.colYs[j])},d.prototype._getContainerSize=function(){this.maxY=Math.max.apply(Math,this.colYs);var a={height:this.maxY};return this.options.isFitWidth&&(a.width=this._getContainerFitWidth()),a},d.prototype._getContainerFitWidth=function(){for(var a=0,b=this.cols;--b&&0===this.colYs[b];)a++;return(this.cols-a)*this.columnWidth-this.gutter},d.prototype.needsResizeLayout=function(){var a=this.containerWidth;return this.getContainerWidth(),a!==this.containerWidth},d}),function(a,b){"use strict";"function"==typeof define&&define.amd?define("isotope/js/layout-modes/masonry",["../layout-mode","masonry/masonry"],b):"object"==typeof exports?module.exports=b(require("../layout-mode"),require("masonry-layout")):b(a.Isotope.LayoutMode,a.Masonry)}(window,function(a,b){"use strict";function c(a,b){for(var c in b)a[c]=b[c];return a}var d=a.create("masonry"),e=d.prototype._getElementOffset,f=d.prototype.layout,g=d.prototype._getMeasurement; -c(d.prototype,b.prototype),d.prototype._getElementOffset=e,d.prototype.layout=f,d.prototype._getMeasurement=g;var h=d.prototype.measureColumns;d.prototype.measureColumns=function(){this.items=this.isotope.filteredItems,h.call(this)};var i=d.prototype._manageStamp;return d.prototype._manageStamp=function(){this.options.isOriginLeft=this.isotope.options.isOriginLeft,this.options.isOriginTop=this.isotope.options.isOriginTop,i.apply(this,arguments)},d}),function(a,b){"use strict";"function"==typeof define&&define.amd?define("isotope/js/layout-modes/fit-rows",["../layout-mode"],b):"object"==typeof exports?module.exports=b(require("../layout-mode")):b(a.Isotope.LayoutMode)}(window,function(a){"use strict";var b=a.create("fitRows");return b.prototype._resetLayout=function(){this.x=0,this.y=0,this.maxY=0,this._getMeasurement("gutter","outerWidth")},b.prototype._getItemLayoutPosition=function(a){a.getSize();var b=a.size.outerWidth+this.gutter,c=this.isotope.size.innerWidth+this.gutter;0!==this.x&&b+this.x>c&&(this.x=0,this.y=this.maxY);var d={x:this.x,y:this.y};return this.maxY=Math.max(this.maxY,this.y+a.size.outerHeight),this.x+=b,d},b.prototype._getContainerSize=function(){return{height:this.maxY}},b}),function(a,b){"use strict";"function"==typeof define&&define.amd?define("isotope/js/layout-modes/vertical",["../layout-mode"],b):"object"==typeof exports?module.exports=b(require("../layout-mode")):b(a.Isotope.LayoutMode)}(window,function(a){"use strict";var b=a.create("vertical",{horizontalAlignment:0});return b.prototype._resetLayout=function(){this.y=0},b.prototype._getItemLayoutPosition=function(a){a.getSize();var b=(this.isotope.size.innerWidth-a.size.outerWidth)*this.options.horizontalAlignment,c=this.y;return this.y+=a.size.outerHeight,{x:b,y:c}},b.prototype._getContainerSize=function(){return{height:this.y}},b}),function(a,b){"use strict";"function"==typeof define&&define.amd?define(["outlayer/outlayer","get-size/get-size","matches-selector/matches-selector","fizzy-ui-utils/utils","isotope/js/item","isotope/js/layout-mode","isotope/js/layout-modes/masonry","isotope/js/layout-modes/fit-rows","isotope/js/layout-modes/vertical"],function(c,d,e,f,g,h){return b(a,c,d,e,f,g,h)}):"object"==typeof exports?module.exports=b(a,require("outlayer"),require("get-size"),require("desandro-matches-selector"),require("fizzy-ui-utils"),require("./item"),require("./layout-mode"),require("./layout-modes/masonry"),require("./layout-modes/fit-rows"),require("./layout-modes/vertical")):a.Isotope=b(a,a.Outlayer,a.getSize,a.matchesSelector,a.fizzyUIUtils,a.Isotope.Item,a.Isotope.LayoutMode)}(window,function(a,b,c,d,e,f,g){function h(a,b){return function(c,d){for(var e=0,f=a.length;f>e;e++){var g=a[e],h=c.sortData[g],i=d.sortData[g];if(h>i||i>h){var j=void 0!==b[g]?b[g]:b,k=j?1:-1;return(h>i?1:-1)*k}}return 0}}var i=a.jQuery,j=String.prototype.trim?function(a){return a.trim()}:function(a){return a.replace(/^\s+|\s+$/g,"")},k=document.documentElement,l=k.textContent?function(a){return a.textContent}:function(a){return a.innerText},m=b.create("isotope",{layoutMode:"masonry",isJQueryFiltering:!0,sortAscending:!0});m.Item=f,m.LayoutMode=g,m.prototype._create=function(){this.itemGUID=0,this._sorters={},this._getSorters(),b.prototype._create.call(this),this.modes={},this.filteredItems=this.items,this.sortHistory=["original-order"];for(var a in g.modes)this._initLayoutMode(a)},m.prototype.reloadItems=function(){this.itemGUID=0,b.prototype.reloadItems.call(this)},m.prototype._itemize=function(){for(var a=b.prototype._itemize.apply(this,arguments),c=0,d=a.length;d>c;c++){var e=a[c];e.id=this.itemGUID++}return this._updateItemsSortData(a),a},m.prototype._initLayoutMode=function(a){var b=g.modes[a],c=this.options[a]||{};this.options[a]=b.options?e.extend(b.options,c):c,this.modes[a]=new b(this)},m.prototype.layout=function(){return!this._isLayoutInited&&this.options.isInitLayout?void this.arrange():void this._layout()},m.prototype._layout=function(){var a=this._getIsInstant();this._resetLayout(),this._manageStamps(),this.layoutItems(this.filteredItems,a),this._isLayoutInited=!0},m.prototype.arrange=function(a){function b(){d.reveal(c.needReveal),d.hide(c.needHide)}this.option(a),this._getIsInstant();var c=this._filter(this.items);this.filteredItems=c.matches;var d=this;this._bindArrangeComplete(),this._isInstant?this._noTransition(b):b(),this._sort(),this._layout()},m.prototype._init=m.prototype.arrange,m.prototype._getIsInstant=function(){var a=void 0!==this.options.isLayoutInstant?this.options.isLayoutInstant:!this._isLayoutInited;return this._isInstant=a,a},m.prototype._bindArrangeComplete=function(){function a(){b&&c&&d&&e.dispatchEvent("arrangeComplete",null,[e.filteredItems])}var b,c,d,e=this;this.once("layoutComplete",function(){b=!0,a()}),this.once("hideComplete",function(){c=!0,a()}),this.once("revealComplete",function(){d=!0,a()})},m.prototype._filter=function(a){var b=this.options.filter;b=b||"*";for(var c=[],d=[],e=[],f=this._getFilterTest(b),g=0,h=a.length;h>g;g++){var i=a[g];if(!i.isIgnored){var j=f(i);j&&c.push(i),j&&i.isHidden?d.push(i):j||i.isHidden||e.push(i)}}return{matches:c,needReveal:d,needHide:e}},m.prototype._getFilterTest=function(a){return i&&this.options.isJQueryFiltering?function(b){return i(b.element).is(a)}:"function"==typeof a?function(b){return a(b.element)}:function(b){return d(b.element,a)}},m.prototype.updateSortData=function(a){var b;a?(a=e.makeArray(a),b=this.getItems(a)):b=this.items,this._getSorters(),this._updateItemsSortData(b)},m.prototype._getSorters=function(){var a=this.options.getSortData;for(var b in a){var c=a[b];this._sorters[b]=n(c)}},m.prototype._updateItemsSortData=function(a){for(var b=a&&a.length,c=0;b&&b>c;c++){var d=a[c];d.updateSortData()}};var n=function(){function a(a){if("string"!=typeof a)return a;var c=j(a).split(" "),d=c[0],e=d.match(/^\[(.+)\]$/),f=e&&e[1],g=b(f,d),h=m.sortDataParsers[c[1]];return a=h?function(a){return a&&h(g(a))}:function(a){return a&&g(a)}}function b(a,b){var c;return c=a?function(b){return b.getAttribute(a)}:function(a){var c=a.querySelector(b);return c&&l(c)}}return a}();m.sortDataParsers={parseInt:function(a){return parseInt(a,10)},parseFloat:function(a){return parseFloat(a)}},m.prototype._sort=function(){var a=this.options.sortBy;if(a){var b=[].concat.apply(a,this.sortHistory),c=h(b,this.options.sortAscending);this.filteredItems.sort(c),a!=this.sortHistory[0]&&this.sortHistory.unshift(a)}},m.prototype._mode=function(){var a=this.options.layoutMode,b=this.modes[a];if(!b)throw new Error("No layout mode: "+a);return b.options=this.options[a],b},m.prototype._resetLayout=function(){b.prototype._resetLayout.call(this),this._mode()._resetLayout()},m.prototype._getItemLayoutPosition=function(a){return this._mode()._getItemLayoutPosition(a)},m.prototype._manageStamp=function(a){this._mode()._manageStamp(a)},m.prototype._getContainerSize=function(){return this._mode()._getContainerSize()},m.prototype.needsResizeLayout=function(){return this._mode().needsResizeLayout()},m.prototype.appended=function(a){var b=this.addItems(a);if(b.length){var c=this._filterRevealAdded(b);this.filteredItems=this.filteredItems.concat(c)}},m.prototype.prepended=function(a){var b=this._itemize(a);if(b.length){this._resetLayout(),this._manageStamps();var c=this._filterRevealAdded(b);this.layoutItems(this.filteredItems),this.filteredItems=c.concat(this.filteredItems),this.items=b.concat(this.items)}},m.prototype._filterRevealAdded=function(a){var b=this._filter(a);return this.hide(b.needHide),this.reveal(b.matches),this.layoutItems(b.matches,!0),b.matches},m.prototype.insert=function(a){var b=this.addItems(a);if(b.length){var c,d,e=b.length;for(c=0;e>c;c++)d=b[c],this.element.appendChild(d.element);var f=this._filter(b).matches;for(c=0;e>c;c++)b[c].isLayoutInstant=!0;for(this.arrange(),c=0;e>c;c++)delete b[c].isLayoutInstant;this.reveal(f)}};var o=m.prototype.remove;return m.prototype.remove=function(a){a=e.makeArray(a);var b=this.getItems(a);o.call(this,a);var c=b&&b.length;if(c)for(var d=0;c>d;d++){var f=b[d];e.removeFrom(this.filteredItems,f)}},m.prototype.shuffle=function(){for(var a=0,b=this.items.length;b>a;a++){var c=this.items[a];c.sortData.random=Math.random()}this.options.sortBy="random",this._sort(),this._layout()},m.prototype._noTransition=function(a){var b=this.options.transitionDuration;this.options.transitionDuration=0;var c=a.call(this);return this.options.transitionDuration=b,c},m.prototype.getFilteredItemElements=function(){for(var a=[],b=0,c=this.filteredItems.length;c>b;b++)a.push(this.filteredItems[b].element);return a},m}); \ No newline at end of file +!function(t,e){"use strict";"function"==typeof define&&define.amd?define("jquery-bridget/jquery-bridget",["jquery"],function(i){e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("jquery")):t.jQueryBridget=e(t,t.jQuery)}(window,function(t,e){"use strict";function i(i,r,a){function u(t,e,n){var o,r="$()."+i+'("'+e+'")';return t.each(function(t,u){var h=a.data(u,i);if(!h)return void s(i+" not initialized. Cannot call methods, i.e. "+r);var d=h[e];if(!d||"_"==e.charAt(0))return void s(r+" is not a valid method");var l=d.apply(h,n);o=void 0===o?l:o}),void 0!==o?o:t}function h(t,e){t.each(function(t,n){var o=a.data(n,i);o?(o.option(e),o._init()):(o=new r(n,e),a.data(n,i,o))})}a=a||e||t.jQuery,a&&(r.prototype.option||(r.prototype.option=function(t){a.isPlainObject(t)&&(this.options=a.extend(!0,this.options,t))}),a.fn[i]=function(t){if("string"==typeof t){var e=o.call(arguments,1);return u(this,t,e)}return h(this,t),this},n(a))}function n(t){!t||t&&t.bridget||(t.bridget=i)}var o=Array.prototype.slice,r=t.console,s="undefined"==typeof r?function(){}:function(t){r.error(t)};return n(e||t.jQuery),i}),function(t,e){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",e):"object"==typeof module&&module.exports?module.exports=e():t.EvEmitter=e()}(this,function(){function t(){}var e=t.prototype;return e.on=function(t,e){if(t&&e){var i=this._events=this._events||{},n=i[t]=i[t]||[];return-1==n.indexOf(e)&&n.push(e),this}},e.once=function(t,e){if(t&&e){this.on(t,e);var i=this._onceEvents=this._onceEvents||{},n=i[t]=i[t]||{};return n[e]=!0,this}},e.off=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var n=i.indexOf(e);return-1!=n&&i.splice(n,1),this}},e.emitEvent=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var n=0,o=i[n];e=e||[];for(var r=this._onceEvents&&this._onceEvents[t];o;){var s=r&&r[o];s&&(this.off(t,o),delete r[o]),o.apply(this,e),n+=s?0:1,o=i[n]}return this}},t}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("get-size/get-size",[],function(){return e()}):"object"==typeof module&&module.exports?module.exports=e():t.getSize=e()}(window,function(){"use strict";function t(t){var e=parseFloat(t),i=-1==t.indexOf("%")&&!isNaN(e);return i&&e}function e(){}function i(){for(var t={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},e=0;h>e;e++){var i=u[e];t[i]=0}return t}function n(t){var e=getComputedStyle(t);return e||a("Style returned "+e+". Are you running this code in a hidden iframe on Firefox? See http://bit.ly/getsizebug1"),e}function o(){if(!d){d=!0;var e=document.createElement("div");e.style.width="200px",e.style.padding="1px 2px 3px 4px",e.style.borderStyle="solid",e.style.borderWidth="1px 2px 3px 4px",e.style.boxSizing="border-box";var i=document.body||document.documentElement;i.appendChild(e);var o=n(e);r.isBoxSizeOuter=s=200==t(o.width),i.removeChild(e)}}function r(e){if(o(),"string"==typeof e&&(e=document.querySelector(e)),e&&"object"==typeof e&&e.nodeType){var r=n(e);if("none"==r.display)return i();var a={};a.width=e.offsetWidth,a.height=e.offsetHeight;for(var d=a.isBorderBox="border-box"==r.boxSizing,l=0;h>l;l++){var f=u[l],c=r[f],m=parseFloat(c);a[f]=isNaN(m)?0:m}var p=a.paddingLeft+a.paddingRight,y=a.paddingTop+a.paddingBottom,g=a.marginLeft+a.marginRight,v=a.marginTop+a.marginBottom,_=a.borderLeftWidth+a.borderRightWidth,I=a.borderTopWidth+a.borderBottomWidth,z=d&&s,x=t(r.width);x!==!1&&(a.width=x+(z?0:p+_));var S=t(r.height);return S!==!1&&(a.height=S+(z?0:y+I)),a.innerWidth=a.width-(p+_),a.innerHeight=a.height-(y+I),a.outerWidth=a.width+g,a.outerHeight=a.height+v,a}}var s,a="undefined"==typeof console?e:function(t){console.error(t)},u=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],h=u.length,d=!1;return r}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("desandro-matches-selector/matches-selector",e):"object"==typeof module&&module.exports?module.exports=e():t.matchesSelector=e()}(window,function(){"use strict";var t=function(){var t=Element.prototype;if(t.matches)return"matches";if(t.matchesSelector)return"matchesSelector";for(var e=["webkit","moz","ms","o"],i=0;is?"round":"floor";r=Math[a](r),this.cols=Math.max(r,1)},i.prototype.getContainerWidth=function(){var t=this._getOption("fitWidth"),i=t?this.element.parentNode:this.element,n=e(i);this.containerWidth=n&&n.innerWidth},i.prototype._getItemLayoutPosition=function(t){t.getSize();var e=t.size.outerWidth%this.columnWidth,i=e&&1>e?"round":"ceil",n=Math[i](t.size.outerWidth/this.columnWidth);n=Math.min(n,this.cols);for(var o=this._getColGroup(n),r=Math.min.apply(Math,o),s=o.indexOf(r),a={x:this.columnWidth*s,y:r},u=r+t.size.outerHeight,h=this.cols+1-o.length,d=0;h>d;d++)this.colYs[s+d]=u;return a},i.prototype._getColGroup=function(t){if(2>t)return this.colYs;for(var e=[],i=this.cols+1-t,n=0;i>n;n++){var o=this.colYs.slice(n,n+t);e[n]=Math.max.apply(Math,o)}return e},i.prototype._manageStamp=function(t){var i=e(t),n=this._getElementOffset(t),o=this._getOption("originLeft"),r=o?n.left:n.right,s=r+i.outerWidth,a=Math.floor(r/this.columnWidth);a=Math.max(0,a);var u=Math.floor(s/this.columnWidth);u-=s%this.columnWidth?0:1,u=Math.min(this.cols-1,u);for(var h=this._getOption("originTop"),d=(h?n.top:n.bottom)+i.outerHeight,l=a;u>=l;l++)this.colYs[l]=Math.max(d,this.colYs[l])},i.prototype._getContainerSize=function(){this.maxY=Math.max.apply(Math,this.colYs);var t={height:this.maxY};return this._getOption("fitWidth")&&(t.width=this._getContainerFitWidth()),t},i.prototype._getContainerFitWidth=function(){for(var t=0,e=this.cols;--e&&0===this.colYs[e];)t++;return(this.cols-t)*this.columnWidth-this.gutter},i.prototype.needsResizeLayout=function(){var t=this.containerWidth;return this.getContainerWidth(),t!=this.containerWidth},i}),function(t,e){"function"==typeof define&&define.amd?define("isotope/layout-modes/masonry",["../layout-mode","masonry/masonry"],e):"object"==typeof module&&module.exports?module.exports=e(require("../layout-mode"),require("masonry-layout")):e(t.Isotope.LayoutMode,t.Masonry)}(window,function(t,e){"use strict";var i=t.create("masonry"),n=i.prototype,o={_getElementOffset:!0,layout:!0,_getMeasurement:!0};for(var r in e.prototype)o[r]||(n[r]=e.prototype[r]);var s=n.measureColumns;n.measureColumns=function(){this.items=this.isotope.filteredItems,s.call(this)};var a=n._getOption;return n._getOption=function(t){return"fitWidth"==t?void 0!==this.options.isFitWidth?this.options.isFitWidth:this.options.fitWidth:a.apply(this.isotope,arguments)},i}),function(t,e){"function"==typeof define&&define.amd?define("isotope/layout-modes/fit-rows",["../layout-mode"],e):"object"==typeof exports?module.exports=e(require("../layout-mode")):e(t.Isotope.LayoutMode)}(window,function(t){"use strict";var e=t.create("fitRows"),i=e.prototype;return i._resetLayout=function(){this.x=0,this.y=0,this.maxY=0,this._getMeasurement("gutter","outerWidth")},i._getItemLayoutPosition=function(t){t.getSize();var e=t.size.outerWidth+this.gutter,i=this.isotope.size.innerWidth+this.gutter;0!==this.x&&e+this.x>i&&(this.x=0,this.y=this.maxY);var n={x:this.x,y:this.y};return this.maxY=Math.max(this.maxY,this.y+t.size.outerHeight),this.x+=e,n},i._getContainerSize=function(){return{height:this.maxY}},e}),function(t,e){"function"==typeof define&&define.amd?define("isotope/layout-modes/vertical",["../layout-mode"],e):"object"==typeof module&&module.exports?module.exports=e(require("../layout-mode")):e(t.Isotope.LayoutMode)}(window,function(t){"use strict";var e=t.create("vertical",{horizontalAlignment:0}),i=e.prototype;return i._resetLayout=function(){this.y=0},i._getItemLayoutPosition=function(t){t.getSize();var e=(this.isotope.size.innerWidth-t.size.outerWidth)*this.options.horizontalAlignment,i=this.y;return this.y+=t.size.outerHeight,{x:e,y:i}},i._getContainerSize=function(){return{height:this.y}},e}),function(t,e){"function"==typeof define&&define.amd?define(["outlayer/outlayer","get-size/get-size","desandro-matches-selector/matches-selector","fizzy-ui-utils/utils","./item","./layout-mode","./layout-modes/masonry","./layout-modes/fit-rows","./layout-modes/vertical"],function(i,n,o,r,s,a){return e(t,i,n,o,r,s,a)}):"object"==typeof module&&module.exports?module.exports=e(t,require("outlayer"),require("get-size"),require("desandro-matches-selector"),require("fizzy-ui-utils"),require("./item"),require("./layout-mode"),require("./layout-modes/masonry"),require("./layout-modes/fit-rows"),require("./layout-modes/vertical")):t.Isotope=e(t,t.Outlayer,t.getSize,t.matchesSelector,t.fizzyUIUtils,t.Isotope.Item,t.Isotope.LayoutMode)}(window,function(t,e,i,n,o,r,s){function a(t,e){return function(i,n){for(var o=0;oa||a>s){var u=void 0!==e[r]?e[r]:e,h=u?1:-1;return(s>a?1:-1)*h}}return 0}}var u=t.jQuery,h=String.prototype.trim?function(t){return t.trim()}:function(t){return t.replace(/^\s+|\s+$/g,"")},d=e.create("isotope",{layoutMode:"masonry",isJQueryFiltering:!0,sortAscending:!0});d.Item=r,d.LayoutMode=s;var l=d.prototype;l._create=function(){this.itemGUID=0,this._sorters={},this._getSorters(),e.prototype._create.call(this),this.modes={},this.filteredItems=this.items,this.sortHistory=["original-order"];for(var t in s.modes)this._initLayoutMode(t)},l.reloadItems=function(){this.itemGUID=0,e.prototype.reloadItems.call(this)},l._itemize=function(){for(var t=e.prototype._itemize.apply(this,arguments),i=0;ii;i++){var n=t[i];n.updateSortData()}};var f=function(){function t(t){if("string"!=typeof t)return t;var i=h(t).split(" "),n=i[0],o=n.match(/^\[(.+)\]$/),r=o&&o[1],s=e(r,n),a=d.sortDataParsers[i[1]];return t=a?function(t){return t&&a(s(t))}:function(t){return t&&s(t)}}function e(t,e){return t?function(e){return e.getAttribute(t)}:function(t){var i=t.querySelector(e); +return i&&i.textContent}}return t}();d.sortDataParsers={parseInt:function(t){return parseInt(t,10)},parseFloat:function(t){return parseFloat(t)}},l._sort=function(){var t=this.options.sortBy;if(t){var e=[].concat.apply(t,this.sortHistory),i=a(e,this.options.sortAscending);this.filteredItems.sort(i),t!=this.sortHistory[0]&&this.sortHistory.unshift(t)}},l._mode=function(){var t=this.options.layoutMode,e=this.modes[t];if(!e)throw new Error("No layout mode: "+t);return e.options=this.options[t],e},l._resetLayout=function(){e.prototype._resetLayout.call(this),this._mode()._resetLayout()},l._getItemLayoutPosition=function(t){return this._mode()._getItemLayoutPosition(t)},l._manageStamp=function(t){this._mode()._manageStamp(t)},l._getContainerSize=function(){return this._mode()._getContainerSize()},l.needsResizeLayout=function(){return this._mode().needsResizeLayout()},l.appended=function(t){var e=this.addItems(t);if(e.length){var i=this._filterRevealAdded(e);this.filteredItems=this.filteredItems.concat(i)}},l.prepended=function(t){var e=this._itemize(t);if(e.length){this._resetLayout(),this._manageStamps();var i=this._filterRevealAdded(e);this.layoutItems(this.filteredItems),this.filteredItems=i.concat(this.filteredItems),this.items=e.concat(this.items)}},l._filterRevealAdded=function(t){var e=this._filter(t);return this.hide(e.needHide),this.reveal(e.matches),this.layoutItems(e.matches,!0),e.matches},l.insert=function(t){var e=this.addItems(t);if(e.length){var i,n,o=e.length;for(i=0;o>i;i++)n=e[i],this.element.appendChild(n.element);var r=this._filter(e).matches;for(i=0;o>i;i++)e[i].isLayoutInstant=!0;for(this.arrange(),i=0;o>i;i++)delete e[i].isLayoutInstant;this.reveal(r)}};var c=l.remove;return l.remove=function(t){t=o.makeArray(t);var e=this.getItems(t);c.call(this,t);for(var i=e&&e.length,n=0;i&&i>n;n++){var r=e[n];o.removeFrom(this.filteredItems,r)}},l.shuffle=function(){for(var t=0;t