/*! * Freetile.js v0.3.1 * A dynamic layout plugin for jQuery. */ (function(b){b.fn.freetile=function(c){if(typeof a[c]==="function"){return a[c].apply(this,Array.prototype.slice.call(arguments,1))}else{if(typeof c==="object"||!c){return a.init.apply(this,arguments)}else{b.error("Method "+c+" does not exist on jQuery.Freetile")}}return this};var a={init:function(e){var d=this,f=a.setupOptions(d,e),g=a.newContent(f.contentToAppend);if(!f.tiled){a.setupContainerBindings(d,f)}if(f.tiled&&g){d.append(g);g.filter(f.selector||"*").filter(f.loadCheckSelector).imagesLoaded(function(){a.positionAll(d,f)})}else{d.children(f.loadCheckSelector).imagesLoaded(function(){a.positionAll(d,f)})}return d},append:function(e){var d=this,f=a.setupOptions(d,e),g=a.newContent(f.contentToAppend);if(f.tiled&&g){d.append(g);g.filter(f.loadCheckSelector).imagesLoaded(function(){a.positionAll(d,f)})}return d},layout:function(d){var c=this,e=a.setupOptions(c,d);a.positionAll(c,e);return c},destroy:function(){var c=this,d=c.data("FreetileData");a.resetElementsStyle(c,d);b(window).off("resize",this.windowResizeCallback);c.off(d.customEvents,this.customEventsCallback);return true},setupOptions:function(d,e){var c=d.data("FreetileData");var f=b.extend(true,{},this.defaults,c,this.reset,e);d.data("FreetileData",f);f.tiled=(c!==undefined);f._animate=f.animate&&f.tiled&&b.isEmptyObject(f.contentToAppend);this.reset.callback=f.persistentCallback&&f.callback?f.callback:function(){};return f},windowResizeCallback:function(c,d,e){clearTimeout(c.data("FreetileTimeout"));c.data("FreetileTimeout",setTimeout(function(){var h=b(window),g=h.width(),f=h.height();if(g!=d||f!=e){d=g,e=f;c.freetile("layout")}},400))},customEventsCallback:function(c){clearTimeout(c.data("FreetileTimeout"));c.data("FreetileTimeout",setTimeout(function(){c.freetile("layout")},400))},setupContainerBindings:function(c,f){if(f.containerResize){var e=b(window),d=e.width(),g=e.height();e.resize(b.proxy(this.windowResizeCallback,c,c,d,g))}if(f.customEvents){c.bind(f.customEvents,b.proxy(this.customEventsCallback,c,c))}return c},newContent:function(c){if((typeof c==="object"&&!b.isEmptyObject(c))||(typeof c==="string"&&b(c).length)){return b(c)}return false},calculatePositions:function(c,d,e){d.each(function(o){var p=b(this),n=0;e.ElementWidth=p.outerWidth(true);e.ElementHeight=p.outerHeight(true);e.ElementTop=0;e.ElementIndex=o;e.IndexStart=0;e.IndexEnd=0;e.BestScore=0;e.TestedTop=0;e.TestedLeft=0;e.TestedTop=e.currentPos[0].top;for(n=1;ne.BestScore){e.IndexStart=o;e.IndexEnd=n;e.ElementTop=e.TestedTop;e.BestScore=l}}var h=p.position(),q={left:e.currentPos[e.IndexStart].left+e.xPadding,top:e.ElementTop+e.yPadding};if(h.top!=q.top||h.left!=q.left){var k={el:p,f:"css",d:0};if(e._animate&&!p.hasClass("noanim")){var f=p.offset(),m={left:q.left+(f.left-h.left),top:q.top+(f.top-h.top)};if((f.top+e.ElementHeight>e.viewportY&&f.tope.viewportY&&m.top0){h.width=g.containerWidthStep*(parseInt(c.width()/g.containerWidthStep,10))}c.css(h);var e=b.map(g.currentPos,function(l,k){return l.top});h={height:Math.max.apply(Math,e)};if(g._animate&&g.containerAnimate){c.stop().animate(h,b.extend(true,{},g.animationOptions))}else{c.css(h)}if(g.iteration<=0){g.callback(g)}c.data("FreetilePos",g.currentPos);j.addClass("tiled");return c},resetElementsStyle:function(c,d){var e;if(b.isEmptyObject(d.contentToAppend)){e=d.selector?c.children(d.selector):c.children()}else{e=d.selector?d.contentToAppend.filter(d.selector):d.contentToAppend}e.each(function(){b(this).attr("style","")})},defaults:{selector:"*",animate:false,elementDelay:0,containerResize:true,containerAnimate:false,customEvents:"",persistentCallback:false,forceWidth:false,containerWidthStep:1,loadCheckSelector:":not(.ignore-load-check)",scoreFunction:function(c){return -(c.TestedTop)}},reset:{animationOptions:{complete:function(){}},callback:function(){},contentToAppend:{}}}})(jQuery); /*! * imagesLoaded PACKAGED v3.0.2 * JavaScript is all like "You images are done yet or what?" */ (function(d){function b(){}function f(h,g){if(c){return g.indexOf(h)}for(var i=g.length;i--;){if(g[i]===h){return i}}return -1}var a=b.prototype,c=Array.prototype.indexOf?!0:!1;a._getEvents=function(){return this._events||(this._events={})},a.getListeners=function(j){var h,k,g=this._getEvents();if("object"==typeof j){h={};for(k in g){g.hasOwnProperty(k)&&j.test(k)&&(h[k]=g[k])}}else{h=g[j]||(g[j]=[])}return h},a.getListenersAsObject=function(h){var g,i=this.getListeners(h);return i instanceof Array&&(g={},g[h]=i),g||i},a.addListener=function(k,h){var g,j=this.getListenersAsObject(k);for(g in j){j.hasOwnProperty(g)&&-1===f(h,j[g])&&j[g].push(h)}return this},a.on=a.addListener,a.defineEvent=function(g){return this.getListeners(g),this},a.defineEvents=function(h){for(var g=0;h.length>g;g+=1){this.defineEvent(h[g])}return this},a.removeListener=function(l,h){var g,k,j=this.getListenersAsObject(l);for(k in j){j.hasOwnProperty(k)&&(g=f(h,j[k]),-1!==g&&j[k].splice(g,1))}return this},a.off=a.removeListener,a.addListeners=function(h,g){return this.manipulateListeners(!1,h,g)},a.removeListeners=function(h,g){return this.manipulateListeners(!0,h,g)},a.manipulateListeners=function(l,h,p){var g,k,j=l?this.removeListener:this.addListener,m=l?this.removeListeners:this.addListeners;if("object"!=typeof h||h instanceof RegExp){for(g=p.length;g--;){j.call(this,h,p[g])}}else{for(g in h){h.hasOwnProperty(g)&&(k=h[g])&&("function"==typeof k?j.call(this,g,k):m.call(this,g,k))}}return this},a.removeEvent=function(j){var h,k=typeof j,g=this._getEvents();if("string"===k){delete g[j]}else{if("object"===k){for(h in g){g.hasOwnProperty(h)&&j.test(h)&&delete g[h]}}else{delete this._events}}return this},a.emitEvent=function(l,h){var m,g,k,j=this.getListenersAsObject(l);for(g in j){if(j.hasOwnProperty(g)){for(m=j[g].length;m--;){k=h?j[g][m].apply(null,h):j[g][m](),k===!0&&this.removeListener(l,j[g][m])}}}return this},a.trigger=a.emitEvent,a.emit=function(h){var g=Array.prototype.slice.call(arguments,1);return this.emitEvent(h,g)},"function"==typeof define&&define.amd?define(function(){return b}):d.EventEmitter=b})(this),function(d){var b=document.documentElement,f=function(){};b.addEventListener?f=function(h,g,i){h.addEventListener(g,i,!1)}:b.attachEvent&&(f=function(g,h,e){g[h+e]=e.handleEvent?function(){var i=d.event;i.target=i.target||i.srcElement,e.handleEvent.call(e,i)}:function(){var i=d.event;i.target=i.target||i.srcElement,e.call(g,i)},g.attachEvent("on"+h,g[h+e])});var a=function(){};b.removeEventListener?a=function(h,g,i){h.removeEventListener(g,i,!1)}:b.detachEvent&&(a=function(j,h,k){j.detachEvent("on"+h,j[h+k]);try{delete j[h+k]}catch(g){j[h+k]=void 0}});var c={bind:f,unbind:a};"function"==typeof define&&define.amd?define(c):d.eventie=c}(this),function(j){function l(h,a){for(var i in a){h[i]=a[i]}return h}function d(a){return"[object Array]"===k.call(a)}function f(o){var h=[];if(d(o)){h=o}else{if("number"==typeof o.length){for(var a=0,n=o.length;n>a;a++){h.push(o[a])}}else{h.push(o)}}return h}function b(p,q){function i(r,t,s){if(!(this instanceof i)){return new i(r,t)}"string"==typeof r&&(r=document.querySelectorAll(r)),this.elements=f(r),this.options=l({},this.options),"function"==typeof t?s=t:l(this.options,t),s&&this.on("always",s),this.getImages(),m&&(this.jqDeferred=new m.Deferred);var a=this;setTimeout(function(){a.check()})}function h(a){this.img=a}i.prototype=new p,i.prototype.options={},i.prototype.getImages=function(){this.images=[];for(var x=0,u=this.elements.length;u>x;x++){var z=this.elements[x];"IMG"===z.nodeName&&this.addImage(z);for(var a=z.querySelectorAll("img"),w=0,v=a.length;v>w;w++){var y=a[w];this.addImage(y)}}},i.prototype.addImage=function(n){var a=new h(n);this.images.push(a)},i.prototype.check=function(){function x(s,n){return u.options.debug&&g&&c.log("confirm",s,n),u.progress(s),y++,y===a&&u.complete(),!0}var u=this,y=0,a=this.images.length;if(this.hasAnyBroken=!1,!a){return this.complete(),void 0}for(var w=0;a>w;w++){var v=this.images[w];v.on("confirm",x),v.check()}},i.prototype.progress=function(a){this.hasAnyBroken=this.hasAnyBroken||!a.isLoaded,this.emit("progress",this,a),this.jqDeferred&&this.jqDeferred.notify(this,a)},i.prototype.complete=function(){var n=this.hasAnyBroken?"fail":"done";if(this.isComplete=!0,this.emit(n,this),this.emit("always",this),this.jqDeferred){var a=this.hasAnyBroken?"reject":"resolve";this.jqDeferred[a](this)}},m&&(m.fn.imagesLoaded=function(r,a){var s=new i(this,r,a);return s.jqDeferred.promise(m(this))});var o={};return h.prototype=new p,h.prototype.check=function(){var n=o[this.img.src];if(n){return this.useCached(n),void 0}if(o[this.img.src]=this,this.img.complete&&void 0!==this.img.naturalWidth){return this.confirm(0!==this.img.naturalWidth,"naturalWidth"),void 0}var a=this.proxyImage=new Image;q.bind(a,"load",this),q.bind(a,"error",this),a.src=this.img.src},h.prototype.useCached=function(n){if(n.isConfirmed){this.confirm(n.isLoaded,"cached was confirmed")}else{var a=this;n.on("confirm",function(r){return a.confirm(r.isLoaded,"cache emitted confirmed"),!0})}},h.prototype.confirm=function(n,a){this.isConfirmed=!0,this.isLoaded=n,this.emit("confirm",this,a)},h.prototype.handleEvent=function(n){var a="on"+n.type;this[a]&&this[a](n)},h.prototype.onload=function(){this.confirm(!0,"onload"),this.unbindProxyEvents()},h.prototype.onerror=function(){this.confirm(!1,"onerror"),this.unbindProxyEvents()},h.prototype.unbindProxyEvents=function(){q.unbind(this.proxyImage,"load",this),q.unbind(this.proxyImage,"error",this)},i}var m=j.jQuery,c=j.console,g=c!==void 0,k=Object.prototype.toString;"function"==typeof define&&define.amd?define(["eventEmitter","eventie"],b):j.imagesLoaded=b(j.EventEmitter,j.eventie)}(window);