1 line
30 KiB
JavaScript
1 line
30 KiB
JavaScript
(function(t){function e(){}function n(a){if(a){var h="undefined"==typeof console?e:function(t){console.error(t)};return a.bridget=function(t,e){var r,s,n;(n=e).prototype.option||(n.prototype.option=function(t){a.isPlainObject(t)&&(this.options=a.extend(!0,this.options,t))}),r=t,s=e,a.fn[r]=function(e){if("string"!=typeof e)return this.each(function(){var t=a.data(this,r);t?(t.option(e),t._init()):(t=new s(this,e),a.data(this,r,t))});for(var t=u.call(arguments,1),n=0,i=this.length;n<i;n++){var o=this[n],o=a.data(o,r);if(o)if(a.isFunction(o[e])&&"_"!==e.charAt(0)){o=o[e].apply(o,t);if(void 0!==o)return o}else h("no such method '"+e+"' for "+r+" instance");else h("cannot call methods on "+r+" prior to initialization; attempted to call '"+e+"'")}return this}},a.bridget}}var u=Array.prototype.slice;"function"==typeof define&&define.amd?define("jquery-bridget/jquery.bridget",["jquery"],n):n(t.jQuery)})(window),function(n){function i(t){var e=n.event;return e.target=e.target||e.srcElement||t,e}var t=document.documentElement,e=function(){};t.addEventListener?e=function(t,e,n){t.addEventListener(e,n,!1)}:t.attachEvent&&(e=function(e,t,n){e[t+n]=n.handleEvent?function(){var t=i(e);n.handleEvent.call(n,t)}:function(){var t=i(e);n.call(e,t)},e.attachEvent("on"+t,e[t+n])});var o=function(){};t.removeEventListener?o=function(t,e,n){t.removeEventListener(e,n,!1)}:t.detachEvent&&(o=function(e,n,i){e.detachEvent("on"+n,e[n+i]);try{delete e[n+i]}catch(t){e[n+i]=void 0}}),o={bind:e,unbind:o},"function"==typeof define&&define.amd?define("eventie/eventie",o):"object"==typeof exports?module.exports=o:n.eventie=o}(this),function(e){function i(t){"function"==typeof t&&(i.isReady?t():r.push(t))}function n(t){t="readystatechange"===t.type&&"complete"!==o.readyState;if(!i.isReady&&!t){i.isReady=!0;for(var e=0,n=r.length;e<n;e++)(0,r[e])()}}function t(t){return t.bind(o,"DOMContentLoaded",n),t.bind(o,"readystatechange",n),t.bind(e,"load",n),i}var o=e.document,r=[];i.isReady=!1,"function"==typeof define&&define.amd?(i.isReady="function"==typeof requirejs,define("doc-ready/doc-ready",["eventie/eventie"],t)):e.docReady=t(e.eventie)}(this),function(){function t(){}function r(t,e){for(var n=t.length;n--;)if(t[n].listener===e)return n;return-1}function e(t){return function(){return this[t].apply(this,arguments)}}var n=t.prototype,i=this,o=i.EventEmitter;n.getListeners=function(t){var e,n,i=this._getEvents();if(t instanceof RegExp)for(n in e={},i)i.hasOwnProperty(n)&&t.test(n)&&(e[n]=i[n]);else e=i[t]||(i[t]=[]);return e},n.flattenListeners=function(t){for(var e=[],n=0;t.length>n;n+=1)e.push(t[n].listener);return e},n.getListenersAsObject=function(t){var e,n=this.getListeners(t);return n instanceof Array&&((e={})[t]=n),e||n},n.addListener=function(t,e){var n,i=this.getListenersAsObject(t),o="object"==typeof e;for(n in i)i.hasOwnProperty(n)&&-1===r(i[n],e)&&i[n].push(o?e:{listener:e,once:!1});return this},n.on=e("addListener"),n.addOnceListener=function(t,e){return this.addListener(t,{listener:e,once:!0})},n.once=e("addOnceListener"),n.defineEvent=function(t){return this.getListeners(t),this},n.defineEvents=function(t){for(var e=0;t.length>e;e+=1)this.defineEvent(t[e]);return this},n.removeListener=function(t,e){var n,i,o=this.getListenersAsObject(t);for(i in o)o.hasOwnProperty(i)&&(n=r(o[i],e),-1!==n&&o[i].splice(n,1));return this},n.off=e("removeListener"),n.addListeners=function(t,e){return this.manipulateListeners(!1,t,e)},n.removeListeners=function(t,e){return this.manipulateListeners(!0,t,e)},n.manipulateListeners=function(t,e,n){var i,o,r=t?this.removeListener:this.addListener,s=t?this.removeListeners:this.addListeners;if("object"!=typeof e||e instanceof RegExp)for(i=n.length;i--;)r.call(this,e,n[i]);else for(i in e)e.hasOwnProperty(i)&&(o=e[i])&&("function"==typeof o?r:s).call(this,i,o);return this},n.removeEvent=function(t){var e,n=typeof t,i=this._getEvents();if("string"==n)delete i[t];else if(t instanceof RegExp)for(e in i)i.hasOwnProperty(e)&&t.test(e)&&delete i[e];else delete this._events;return this},n.removeAllListeners=e("removeEvent"),n.emitEvent=function(t,e){var n,i,o,r,s=this.getListenersAsObject(t);for(o in s)if(s.hasOwnProperty(o))for(i=s[o].length;i--;)n=s[o][i],!0===n.once&&this.removeListener(t,n.listener),r=n.listener.apply(this,e||[]),r===this._getOnceReturnValue()&&this.removeListener(t,n.listener);return this},n.trigger=e("emitEvent"),n.emit=function(t){var e=Array.prototype.slice.call(arguments,1);return this.emitEvent(t,e)},n.setOnceReturnValue=function(t){return this._onceReturnValue=t,this},n._getOnceReturnValue=function(){return!this.hasOwnProperty("_onceReturnValue")||this._onceReturnValue},n._getEvents=function(){return this._events||(this._events={})},t.noConflict=function(){return i.EventEmitter=o,t},"function"==typeof define&&define.amd?define("eventEmitter/EventEmitter",[],function(){return t}):"object"==typeof module&&module.exports?module.exports=t:this.EventEmitter=t}.call(this),function(t){function e(t){if(t){if("string"==typeof r[t])return t;t=t.charAt(0).toUpperCase()+t.slice(1);for(var e,n=0,i=o.length;n<i;n++)if(e=o[n]+t,"string"==typeof r[e])return e}}var o="Webkit Moz ms Ms O".split(" "),r=document.documentElement.style;"function"==typeof define&&define.amd?define("get-style-property/get-style-property",[],function(){return e}):"object"==typeof exports?module.exports=e:t.getStyleProperty=e}(window),function(t){function g(t){var e=parseFloat(t);return-1===t.indexOf("%")&&!isNaN(e)&&e}function e(t){var m,e,n,y=t("boxSizing");return y&&((e=document.createElement("div")).style.width="200px",e.style.padding="1px 2px 3px 4px",e.style.borderStyle="solid",e.style.borderWidth="1px 2px 3px 4px",e.style[y]="border-box",(n=document.body||document.documentElement).appendChild(e),t=E(e),m=200===g(t.width),n.removeChild(e)),function(t){if((t="string"==typeof t?document.querySelector(t):t)&&"object"==typeof t&&t.nodeType){var e=E(t);if("none"===e.display)return function(){for(var t={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},e=0,n=L.length;e<n;e++)t[L[e]]=0;return t}();var n={};n.width=t.offsetWidth,n.height=t.offsetHeight;for(var i=n.isBorderBox=!(!y||!e[y]||"border-box"!==e[y]),o=0,r=L.length;o<r;o++){var s=L[o],a=function(t,e){if(v||-1===e.indexOf("%"))return e;var n=t.style,i=n.left,o=t.runtimeStyle,r=o&&o.left;return r&&(o.left=t.currentStyle.left),n.left=e,e=n.pixelLeft,n.left=i,r&&(o.left=r),e}(t,a=e[s]),a=parseFloat(a);n[s]=isNaN(a)?0:a}var h=n.paddingLeft+n.paddingRight,u=n.paddingTop+n.paddingBottom,p=n.marginLeft+n.marginRight,f=n.marginTop+n.marginBottom,c=n.borderLeftWidth+n.borderRightWidth,d=n.borderTopWidth+n.borderBottomWidth,l=i&&m,i=g(e.width);!1!==i&&(n.width=i+(l?0:h+c));i=g(e.height);return!1!==i&&(n.height=i+(l?0:u+d)),n.innerWidth=n.width-(h+c),n.innerHeight=n.height-(u+d),n.outerWidth=n.width+p,n.outerHeight=n.height+f,n}}}var v=t.getComputedStyle,E=v?function(t){return v(t,null)}:function(t){return t.currentStyle},L=["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"],e):"object"==typeof exports?module.exports=e(require("get-style-property")):t.getSize=e(t.getStyleProperty)}(window),function(o){function n(t,e){return t[i](e)}function r(t){t.parentNode||document.createDocumentFragment().appendChild(t)}var t,i=function(){if(o.matchesSelector)return"matchesSelector";for(var t=["webkit","moz","ms","o"],e=0,n=t.length;e<n;e++){var i=t[e]+"MatchesSelector";if(o[i])return i}}();t=i?n(document.createElement("div"),"div")?n:function(t,e){return r(t),n(t,e)}:function(t,e){r(t);for(var n=t.parentNode.querySelectorAll(e),i=0,o=n.length;i<o;i++)if(n[i]===t)return!0;return!1},"function"==typeof define&&define.amd?define("matches-selector/matches-selector",[],function(){return t}):window.matchesSelector=t}(Element.prototype),function(t){function e(t,e,r){function n(t,e){t&&(this.element=t,this.layout=e,this.position={x:0,y:0},this._create())}var i=r("transition"),o=r("transform"),s=i&&o,a=!!r("perspective"),h={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"otransitionend",transition:"transitionend"}[i],u=["transform","transition","transitionDuration","transitionProperty"],p=function(){for(var t={},e=0,n=u.length;e<n;e++){var i=u[e],o=r(i);o&&o!==i&&(t[i]=o)}return t}();(function(t,e){for(var n in e)t[n]=e[n]})(n.prototype,t.prototype),n.prototype._create=function(){this._transn={ingProperties:{},clean:{},onEnd:{}},this.css({position:"absolute"})},n.prototype.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},n.prototype.getSize=function(){this.size=e(this.element)},n.prototype.css=function(t){var e,n=this.element.style;for(e in t)n[p[e]||e]=t[e]},n.prototype.getPosition=function(){var t=m(this.element),e=this.layout.options,n=e.isOriginLeft,i=e.isOriginTop,o=parseInt(t[n?"left":"right"],10),e=parseInt(t[i?"top":"bottom"],10),o=isNaN(o)?0:o,e=isNaN(e)?0:e,t=this.layout.size;o-=n?t.paddingLeft:t.paddingRight,e-=i?t.paddingTop:t.paddingBottom,this.position.x=o,this.position.y=e},n.prototype.layoutPosition=function(){var t=this.layout.size,e=this.layout.options,n={};e.isOriginLeft?(n.left=this.position.x+t.paddingLeft+"px",n.right=""):(n.right=this.position.x+t.paddingRight+"px",n.left=""),e.isOriginTop?(n.top=this.position.y+t.paddingTop+"px",n.bottom=""):(n.bottom=this.position.y+t.paddingBottom+"px",n.top=""),this.css(n),this.emitEvent("layout",[this])};var f=a?function(t,e){return"translate3d("+t+"px, "+e+"px, 0)"}:function(t,e){return"translate("+t+"px, "+e+"px)"};n.prototype._transitionTo=function(t,e){this.getPosition();var n=this.position.x,i=this.position.y,o=parseInt(t,10),r=parseInt(e,10),r=o===this.position.x&&r===this.position.y;this.setPosition(t,e),!r||this.isTransitioning?(t-=n,n=e-i,e={},t=(i=this.layout.options).isOriginLeft?t:-t,n=i.isOriginTop?n:-n,e.transform=f(t,n),this.transition({to:e,onTransitionEnd:{transform:this.layoutPosition},isCleaning:!0})):this.layoutPosition()},n.prototype.goTo=function(t,e){this.setPosition(t,e),this.layoutPosition()},n.prototype.moveTo=s?n.prototype._transitionTo:n.prototype.goTo,n.prototype.setPosition=function(t,e){this.position.x=parseInt(t,10),this.position.y=parseInt(e,10)},n.prototype._nonTransition=function(t){for(var e in this.css(t.to),t.isCleaning&&this._removeStyles(t.to),t.onTransitionEnd)t.onTransitionEnd[e].call(this)},n.prototype._transition=function(t){if(parseFloat(this.layout.options.transitionDuration)){var e,n=this._transn;for(e in t.onTransitionEnd)n.onEnd[e]=t.onTransitionEnd[e];for(e in t.to)n.ingProperties[e]=!0,t.isCleaning&&(n.clean[e]=!0);t.from&&(this.css(t.from),this.element.offsetHeight,0),this.enableTransition(t.to),this.css(t.to),this.isTransitioning=!0}else this._nonTransition(t)};var c=o&&o.replace(/([A-Z])/g,function(t){return"-"+t.toLowerCase()})+",opacity";n.prototype.enableTransition=function(){this.isTransitioning||(this.css({transitionProperty:c,transitionDuration:this.layout.options.transitionDuration}),this.element.addEventListener(h,this,!1))},n.prototype.transition=n.prototype[i?"_transition":"_nonTransition"],n.prototype.onwebkitTransitionEnd=function(t){this.ontransitionend(t)},n.prototype.onotransitionend=function(t){this.ontransitionend(t)};var d={"-webkit-transform":"transform","-moz-transform":"transform","-o-transform":"transform"};n.prototype.ontransitionend=function(t){var e,n;t.target===this.element&&(e=this._transn,n=d[t.propertyName]||t.propertyName,delete e.ingProperties[n],function(t){for(var e in t)return;return 1}(e.ingProperties)&&this.disableTransition(),n in e.clean&&(this.element.style[t.propertyName]="",delete e.clean[n]),n in e.onEnd&&(e.onEnd[n].call(this),delete e.onEnd[n]),this.emitEvent("transitionEnd",[this]))},n.prototype.disableTransition=function(){this.removeTransitionStyles(),this.element.removeEventListener(h,this,!1),this.isTransitioning=!1},n.prototype._removeStyles=function(t){var e,n={};for(e in t)n[e]="";this.css(n)};var l={transitionProperty:"",transitionDuration:""};return n.prototype.removeTransitionStyles=function(){this.css(l)},n.prototype.removeElem=function(){this.element.parentNode.removeChild(this.element),this.emitEvent("remove",[this])},n.prototype.remove=function(){var t;i&&parseFloat(this.layout.options.transitionDuration)?((t=this).on("transitionEnd",function(){return t.removeElem(),!0}),this.hide()):this.removeElem()},n.prototype.reveal=function(){delete this.isHidden,this.css({display:""});var t=this.layout.options;this.transition({from:t.hiddenStyle,to:t.visibleStyle,isCleaning:!0})},n.prototype.hide=function(){this.isHidden=!0,this.css({display:""});var t=this.layout.options;this.transition({from:t.visibleStyle,to:t.hiddenStyle,isCleaning:!0,onTransitionEnd:{opacity:function(){this.isHidden&&this.css({display:"none"})}}})},n.prototype.destroy=function(){this.css({position:"",left:"",right:"",top:"",bottom:"",transition:"",transform:""})},n}var n=document.defaultView,m=n&&n.getComputedStyle?function(t){return n.getComputedStyle(t,null)}:function(t){return t.currentStyle};"function"==typeof define&&define.amd?define("outlayer/item",["eventEmitter/EventEmitter","get-size/get-size","get-style-property/get-style-property"],e):(t.Outlayer={},t.Outlayer.Item=e(t.EventEmitter,t.getSize,t.getStyleProperty))}(window),function(h){function f(t,e){for(var n in e)t[n]=e[n];return t}function p(t){var e,n=[];if(e=t,"[object Array]"===r.call(e))n=t;else if(t&&"number"==typeof t.length)for(var i=0,o=t.length;i<o;i++)n.push(t[i]);else n.push(t);return n}function c(t,e){t=n(e,t);-1!==t&&e.splice(t,1)}function t(t,n,e,o,u,i){function r(t,e){(t="string"==typeof t?l.querySelector(t):t)&&g(t)?(this.element=t,this.options=f({},this.options),this.option(e),e=++s,this.element.outlayerGUID=e,(a[e]=this)._create(),this.options.isInitLayout&&this.layout()):m&&m.error("Bad "+this.constructor.namespace+" element: "+t)}var s=0,a={};return r.namespace="outlayer",r.Item=i,r.prototype.options={containerStyle:{position:"relative"},isInitLayout:!0,isOriginLeft:!0,isOriginTop:!0,isResizeBound:!0,transitionDuration:"0.4s",hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}},f(r.prototype,e.prototype),r.prototype.option=function(t){f(this.options,t)},r.prototype._create=function(){this.reloadItems(),this.stamps=[],this.stamp(this.options.stamp),f(this.element.style,this.options.containerStyle),this.options.isResizeBound&&this.bindResize()},r.prototype.reloadItems=function(){this.items=this._itemize(this.element.children)},r.prototype._itemize=function(t){for(var e=this._filterFindItemElements(t),n=this.constructor.Item,i=[],o=0,r=e.length;o<r;o++){var s=new n(e[o],this);i.push(s)}return i},r.prototype._filterFindItemElements=function(t){t=p(t);for(var e=this.options.itemSelector,n=[],i=0,o=t.length;i<o;i++){var r=t[i];if(g(r))if(e){u(r,e)&&n.push(r);for(var s=r.querySelectorAll(e),a=0,h=s.length;a<h;a++)n.push(s[a])}else n.push(r)}return n},r.prototype.getItemElements=function(){for(var t=[],e=0,n=this.items.length;e<n;e++)t.push(this.items[e].element);return t},r.prototype._init=r.prototype.layout=function(){this._resetLayout(),this._manageStamps();var t=void 0!==this.options.isLayoutInstant?this.options.isLayoutInstant:!this._isLayoutInited;this.layoutItems(this.items,t),this._isLayoutInited=!0},r.prototype._resetLayout=function(){this.getSize()},r.prototype.getSize=function(){this.size=o(this.element)},r.prototype._getMeasurement=function(t,e){var n,i=this.options[t];i?("string"==typeof i?n=this.element.querySelector(i):g(i)&&(n=i),this[t]=n?o(n)[e]:i):this[t]=0},r.prototype.layoutItems=function(t,e){t=this._getItemsForLayout(t),this._layoutItems(t,e),this._postLayout()},r.prototype._getItemsForLayout=function(t){for(var e=[],n=0,i=t.length;n<i;n++){var o=t[n];o.isIgnored||e.push(o)}return e},r.prototype._layoutItems=function(t,e){function n(){i.emitEvent("layoutComplete",[i,t])}var i=this;if(t&&t.length){this._itemsOn(t,"layout",n);for(var o=[],r=0,s=t.length;r<s;r++){var a=t[r],h=this._getItemLayoutPosition(a);h.item=a,h.isInstant=e||a.isLayoutInstant,o.push(h)}this._processLayoutQueue(o)}else n()},r.prototype._getItemLayoutPosition=function(){return{x:0,y:0}},r.prototype._processLayoutQueue=function(t){for(var e=0,n=t.length;e<n;e++){var i=t[e];this._positionItem(i.item,i.x,i.y,i.isInstant)}},r.prototype._positionItem=function(t,e,n,i){i?t.goTo(e,n):t.moveTo(e,n)},r.prototype._postLayout=function(){var t=this._getContainerSize();t&&(this._setContainerMeasure(t.width,!0),this._setContainerMeasure(t.height,!1))},r.prototype._getContainerSize=d,r.prototype._setContainerMeasure=function(t,e){var n;void 0!==t&&((n=this.size).isBorderBox&&(t+=e?n.paddingLeft+n.paddingRight+n.borderLeftWidth+n.borderRightWidth:n.paddingBottom+n.paddingTop+n.borderTopWidth+n.borderBottomWidth),t=Math.max(t,0),this.element.style[e?"width":"height"]=t+"px")},r.prototype._itemsOn=function(t,e,n){function i(){return++o===r&&n.call(s),!0}for(var o=0,r=t.length,s=this,a=0,h=t.length;a<h;a++)t[a].on(e,i)},r.prototype.ignore=function(t){t=this.getItem(t);t&&(t.isIgnored=!0)},r.prototype.unignore=function(t){t=this.getItem(t);t&&delete t.isIgnored},r.prototype.stamp=function(t){if(t=this._find(t)){this.stamps=this.stamps.concat(t);for(var e=0,n=t.length;e<n;e++){var i=t[e];this.ignore(i)}}},r.prototype.unstamp=function(t){if(t=this._find(t))for(var e=0,n=t.length;e<n;e++){var i=t[e];c(i,this.stamps),this.unignore(i)}},r.prototype._find=function(t){return t?p(t="string"==typeof t?this.element.querySelectorAll(t):t):void 0},r.prototype._manageStamps=function(){if(this.stamps&&this.stamps.length){this._getBoundingRect();for(var t=0,e=this.stamps.length;t<e;t++){var n=this.stamps[t];this._manageStamp(n)}}},r.prototype._getBoundingRect=function(){var t=this.element.getBoundingClientRect(),e=this.size;this._boundingRect={left:t.left+e.paddingLeft+e.borderLeftWidth,top:t.top+e.paddingTop+e.borderTopWidth,right:t.right-(e.paddingRight+e.borderRightWidth),bottom:t.bottom-(e.paddingBottom+e.borderBottomWidth)}},r.prototype._manageStamp=d,r.prototype._getElementOffset=function(t){var e=t.getBoundingClientRect(),n=this._boundingRect,t=o(t);return{left:e.left-n.left-t.marginLeft,top:e.top-n.top-t.marginTop,right:n.right-e.right-t.marginRight,bottom:n.bottom-e.bottom-t.marginBottom}},r.prototype.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},r.prototype.bindResize=function(){this.isResizeBound||(t.bind(h,"resize",this),this.isResizeBound=!0)},r.prototype.unbindResize=function(){t.unbind(h,"resize",this),this.isResizeBound=!1},r.prototype.onresize=function(){this.resizeTimeout&&clearTimeout(this.resizeTimeout);var t=this;this.resizeTimeout=setTimeout(function(){t.resize(),delete t.resizeTimeout},100)},r.prototype.resize=function(){var t=o(this.element);this.size&&t&&t.innerWidth===this.size.innerWidth||this.layout()},r.prototype.addItems=function(t){t=this._itemize(t);return t.length&&(this.items=this.items.concat(t)),t},r.prototype.appended=function(t){t=this.addItems(t);t.length&&(this.layoutItems(t,!0),this.reveal(t))},r.prototype.prepended=function(t){var e=this._itemize(t);e.length&&(t=this.items.slice(0),this.items=e.concat(t),this._resetLayout(),this._manageStamps(),this.layoutItems(e,!0),this.reveal(e),this.layoutItems(t))},r.prototype.reveal=function(t){var e=t&&t.length;if(e)for(var n=0;n<e;n++)t[n].reveal()},r.prototype.hide=function(t){var e=t&&t.length;if(e)for(var n=0;n<e;n++)t[n].hide()},r.prototype.getItem=function(t){for(var e=0,n=this.items.length;e<n;e++){var i=this.items[e];if(i.element===t)return i}},r.prototype.getItems=function(t){if(t&&t.length){for(var e=[],n=0,i=t.length;n<i;n++){var o=t[n],o=this.getItem(o);o&&e.push(o)}return e}},r.prototype.remove=function(t){t=p(t);var e=this.getItems(t);if(e&&e.length){this._itemsOn(e,"remove",function(){this.emitEvent("removeComplete",[this,e])});for(var n=0,i=e.length;n<i;n++){var o=e[n];o.remove(),c(o,this.items)}}},r.prototype.destroy=function(){var t=this.element.style;t.height="",t.position="",t.width="";for(var e=0,n=this.items.length;e<n;e++)this.items[e].destroy();this.unbindResize(),delete this.element.outlayerGUID,y&&y.removeData(this.element,this.constructor.namespace)},r.data=function(t){t=t&&t.outlayerGUID;return t&&a[t]},r.create=function(u,t){function p(){r.apply(this,arguments)}return Object.create?p.prototype=Object.create(r.prototype):f(p.prototype,r.prototype),e="options",(p.prototype.constructor=p).prototype[e]=f({},r.prototype[e]),f(p.prototype.options,t),p.namespace=u,p.data=r.data,(p.Item=function(){i.apply(this,arguments)}).prototype=new i,n(function(){for(var t=u.replace(/(.)([A-Z])/g,function(t,e,n){return e+"-"+n}).toLowerCase(),e=l.querySelectorAll(".js-"+t),n="data-"+t+"-options",i=0,o=e.length;i<o;i++){var r,s=e[i],a=s.getAttribute(n);try{r=a&&JSON.parse(a)}catch(t){m&&m.error("Error parsing "+n+" on "+s.nodeName.toLowerCase()+(s.id?"#"+s.id:"")+": "+t);continue}var h=new p(s,r);y&&y.data(s,u,h)}}),y&&y.bridget&&y.bridget(u,p),p;var e},r.Item=i,r}function d(){}var l=h.document,m=h.console,y=h.jQuery,r=Object.prototype.toString,g="object"==typeof HTMLElement?function(t){return t instanceof HTMLElement}:function(t){return t&&"object"==typeof t&&1===t.nodeType&&"string"==typeof t.nodeName},n=Array.prototype.indexOf?function(t,e){return t.indexOf(e)}:function(t,e){for(var n=0,i=t.length;n<i;n++)if(t[n]===e)return n;return-1};"function"==typeof define&&define.amd?define("outlayer/outlayer",["eventie/eventie","doc-ready/doc-ready","eventEmitter/EventEmitter","get-size/get-size","matches-selector/matches-selector","./item"],t):h.Outlayer=t(h.eventie,h.docReady,h.EventEmitter,h.getSize,h.matchesSelector,h.Outlayer.Item)}(window),function(t){function e(t,a){t=t.create("masonry");return t.prototype._resetLayout=function(){this.getSize(),this._getMeasurement("columnWidth","outerWidth"),this._getMeasurement("gutter","outerWidth"),this.measureColumns();var t=this.cols;for(this.colYs=[];t--;)this.colYs.push(0);this.maxY=0},t.prototype.measureColumns=function(){var t;this.getContainerWidth(),this.columnWidth||(t=(t=this.items[0])&&t.element,this.columnWidth=t&&a(t).outerWidth||this.containerWidth),this.columnWidth+=this.gutter,this.cols=Math.floor((this.containerWidth+this.gutter)/this.columnWidth),this.cols=Math.max(this.cols,1)},t.prototype.getContainerWidth=function(){var t=this.options.isFitWidth?this.element.parentNode:this.element,t=a(t);this.containerWidth=t&&t.innerWidth},t.prototype._getItemLayoutPosition=function(t){t.getSize();for(var e=t.size.outerWidth%this.columnWidth,n=Math[e&&e<1?"round":"ceil"](t.size.outerWidth/this.columnWidth),n=Math.min(n,this.cols),i=this._getColGroup(n),e=Math.min.apply(Math,i),o=h(i,e),n={x:this.columnWidth*o,y:e},r=e+t.size.outerHeight,s=this.cols+1-i.length,a=0;a<s;a++)this.colYs[o+a]=r;return n},t.prototype._getColGroup=function(t){if(t<2)return this.colYs;for(var e=[],n=this.cols+1-t,i=0;i<n;i++){var o=this.colYs.slice(i,i+t);e[i]=Math.max.apply(Math,o)}return e},t.prototype._manageStamp=function(t){var e=a(t),n=this._getElementOffset(t),i=this.options.isOriginLeft?n.left:n.right,t=i+e.outerWidth,i=Math.floor(i/this.columnWidth),i=Math.max(0,i),o=Math.floor(t/this.columnWidth);o-=t%this.columnWidth?0:1,o=Math.min(this.cols-1,o);for(var r=(this.options.isOriginTop?n.top:n.bottom)+e.outerHeight,s=i;s<=o;s++)this.colYs[s]=Math.max(r,this.colYs[s])},t.prototype._getContainerSize=function(){this.maxY=Math.max.apply(Math,this.colYs);var t={height:this.maxY};return this.options.isFitWidth&&(t.width=this._getContainerFitWidth()),t},t.prototype._getContainerFitWidth=function(){for(var t=0,e=this.cols;--e&&0===this.colYs[e];)t++;return(this.cols-t)*this.columnWidth-this.gutter},t.prototype.resize=function(){var t=this.containerWidth;this.getContainerWidth(),t!==this.containerWidth&&this.layout()},t}var h=Array.prototype.indexOf?function(t,e){return t.indexOf(e)}:function(t,e){for(var n=0,i=t.length;n<i;n++)if(t[n]===e)return n;return-1};"function"==typeof define&&define.amd?define(["outlayer/outlayer","get-size/get-size"],e):t.Masonry=e(t.Outlayer,t.getSize)}(window),function(){function t(){}function r(t,e){for(var n=t.length;n--;)if(t[n].listener===e)return n;return-1}function e(t){return function(){return this[t].apply(this,arguments)}}var n=t.prototype,i=this,o=i.EventEmitter;n.getListeners=function(t){var e,n,i=this._getEvents();if("object"==typeof t)for(n in e={},i)i.hasOwnProperty(n)&&t.test(n)&&(e[n]=i[n]);else e=i[t]||(i[t]=[]);return e},n.flattenListeners=function(t){for(var e=[],n=0;t.length>n;n+=1)e.push(t[n].listener);return e},n.getListenersAsObject=function(t){var e,n=this.getListeners(t);return n instanceof Array&&((e={})[t]=n),e||n},n.addListener=function(t,e){var n,i=this.getListenersAsObject(t),o="object"==typeof e;for(n in i)i.hasOwnProperty(n)&&-1===r(i[n],e)&&i[n].push(o?e:{listener:e,once:!1});return this},n.on=e("addListener"),n.addOnceListener=function(t,e){return this.addListener(t,{listener:e,once:!0})},n.once=e("addOnceListener"),n.defineEvent=function(t){return this.getListeners(t),this},n.defineEvents=function(t){for(var e=0;t.length>e;e+=1)this.defineEvent(t[e]);return this},n.removeListener=function(t,e){var n,i,o=this.getListenersAsObject(t);for(i in o)o.hasOwnProperty(i)&&(n=r(o[i],e),-1!==n&&o[i].splice(n,1));return this},n.off=e("removeListener"),n.addListeners=function(t,e){return this.manipulateListeners(!1,t,e)},n.removeListeners=function(t,e){return this.manipulateListeners(!0,t,e)},n.manipulateListeners=function(t,e,n){var i,o,r=t?this.removeListener:this.addListener,s=t?this.removeListeners:this.addListeners;if("object"!=typeof e||e instanceof RegExp)for(i=n.length;i--;)r.call(this,e,n[i]);else for(i in e)e.hasOwnProperty(i)&&(o=e[i])&&("function"==typeof o?r:s).call(this,i,o);return this},n.removeEvent=function(t){var e,n=typeof t,i=this._getEvents();if("string"==n)delete i[t];else if("object"==n)for(e in i)i.hasOwnProperty(e)&&t.test(e)&&delete i[e];else delete this._events;return this},n.removeAllListeners=e("removeEvent"),n.emitEvent=function(t,e){var n,i,o,r,s=this.getListenersAsObject(t);for(o in s)if(s.hasOwnProperty(o))for(i=s[o].length;i--;)n=s[o][i],!0===n.once&&this.removeListener(t,n.listener),r=n.listener.apply(this,e||[]),r===this._getOnceReturnValue()&&this.removeListener(t,n.listener);return this},n.trigger=e("emitEvent"),n.emit=function(t){var e=Array.prototype.slice.call(arguments,1);return this.emitEvent(t,e)},n.setOnceReturnValue=function(t){return this._onceReturnValue=t,this},n._getOnceReturnValue=function(){return!this.hasOwnProperty("_onceReturnValue")||this._onceReturnValue},n._getEvents=function(){return this._events||(this._events={})},t.noConflict=function(){return i.EventEmitter=o,t},"function"==typeof define&&define.amd?define("eventEmitter/EventEmitter",[],function(){return t}):"object"==typeof module&&module.exports?module.exports=t:this.EventEmitter=t}.call(this),function(n){function i(t){var e=n.event;return e.target=e.target||e.srcElement||t,e}var t=document.documentElement,e=function(){};t.addEventListener?e=function(t,e,n){t.addEventListener(e,n,!1)}:t.attachEvent&&(e=function(e,t,n){e[t+n]=n.handleEvent?function(){var t=i(e);n.handleEvent.call(n,t)}:function(){var t=i(e);n.call(e,t)},e.attachEvent("on"+t,e[t+n])});var o=function(){};t.removeEventListener?o=function(t,e,n){t.removeEventListener(e,n,!1)}:t.detachEvent&&(o=function(e,n,i){e.detachEvent("on"+n,e[n+i]);try{delete e[n+i]}catch(t){e[n+i]=void 0}}),o={bind:e,unbind:o},"function"==typeof define&&define.amd?define("eventie/eventie",o):n.eventie=o}(this),function(n,i){"function"==typeof define&&define.amd?define(["eventEmitter/EventEmitter","eventie/eventie"],function(t,e){return i(n,t,e)}):"object"==typeof exports?module.exports=i(n,require("eventEmitter"),require("eventie")):n.imagesLoaded=i(n,n.EventEmitter,n.eventie)}(this,function(t,e,n){function o(t,e){for(var n in e)t[n]=e[n];return t}function r(t){var e,n=[];if(e=t,"[object Array]"===f.call(e))n=t;else if("number"==typeof t.length)for(var i=0,o=t.length;i<o;i++)n.push(t[i]);else n.push(t);return n}function s(t,e,n){if(!(this instanceof s))return new s(t,e);"string"==typeof t&&(t=document.querySelectorAll(t)),this.elements=r(t),this.options=o({},this.options),"function"==typeof e?n=e:o(this.options,e),n&&this.on("always",n),this.getImages(),h&&(this.jqDeferred=new h.Deferred);var i=this;setTimeout(function(){i.check()})}function i(t){this.img=t}function a(t){this.src=t,c[t]=this}var h=t.jQuery,u=t.console,p=void 0!==u,f=Object.prototype.toString;(s.prototype=new e).options={},s.prototype.getImages=function(){this.images=[];for(var t=0,e=this.elements.length;t<e;t++){var n=this.elements[t];"IMG"===n.nodeName&&this.addImage(n);for(var i=n.querySelectorAll("img"),o=0,r=i.length;o<r;o++){var s=i[o];this.addImage(s)}}},s.prototype.addImage=function(t){t=new i(t);this.images.push(t)},s.prototype.check=function(){function t(t,e){return n.options.debug&&p&&u.log("confirm",t,e),n.progress(t),++i===o&&n.complete(),!0}var n=this,i=0,o=this.images.length;if(this.hasAnyBroken=!1,o)for(var e=0;e<o;e++){var r=this.images[e];r.on("confirm",t),r.check()}else this.complete()},s.prototype.progress=function(t){this.hasAnyBroken=this.hasAnyBroken||!t.isLoaded;var e=this;setTimeout(function(){e.emit("progress",e,t),e.jqDeferred&&e.jqDeferred.notify&&e.jqDeferred.notify(e,t)})},s.prototype.complete=function(){var e=this.hasAnyBroken?"fail":"done";this.isComplete=!0;var n=this;setTimeout(function(){var t;n.emit(e,n),n.emit("always",n),n.jqDeferred&&(t=n.hasAnyBroken?"reject":"resolve",n.jqDeferred[t](n))})},h&&(h.fn.imagesLoaded=function(t,e){return new s(this,t,e).jqDeferred.promise(h(this))}),(i.prototype=new e).check=function(){var n,t=c[this.img.src]||new a(this.img.src);t.isConfirmed?this.confirm(t.isLoaded,"cached was confirmed"):this.img.complete&&void 0!==this.img.naturalWidth?this.confirm(0!==this.img.naturalWidth,"naturalWidth"):(n=this,t.on("confirm",function(t,e){return n.confirm(t.isLoaded,e),!0}),t.check())},i.prototype.confirm=function(t,e){this.isLoaded=t,this.emit("confirm",this,e)};var c={};return(a.prototype=new e).check=function(){var t;this.isChecked||(t=new Image,n.bind(t,"load",this),n.bind(t,"error",this),t.src=this.src,this.isChecked=!0)},a.prototype.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},a.prototype.onload=function(t){this.confirm(!0,"onload"),this.unbindProxyEvents(t)},a.prototype.onerror=function(t){this.confirm(!1,"onerror"),this.unbindProxyEvents(t)},a.prototype.confirm=function(t,e){this.isConfirmed=!0,this.isLoaded=t,this.emit("confirm",this,e)},a.prototype.unbindProxyEvents=function(t){n.unbind(t.target,"load",this),n.unbind(t.target,"error",this)},s}); |