/*! * Masonry PACKAGED v3.1.5 * Cascading grid layout library * http://masonry.desandro.com * MIT License * by David DeSandro */ !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(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}(this),function(a){function b(a){"function"==typeof a&&(b.isReady?a():f.push(a))}function c(a){var c="readystatechange"===a.type&&"complete"!==e.readyState;if(!b.isReady&&!c){b.isReady=!0;for(var d=0,g=f.length;g>d;d++){var h=f[d];h()}}}function d(d){return d.bind(e,"DOMContentLoaded",c),d.bind(e,"readystatechange",c),d.bind(a,"load",c),b}var e=a.document,f=[];b.isReady=!1,"function"==typeof define&&define.amd?(b.isReady="function"==typeof requirejs,define("doc-ready/doc-ready",["eventie/eventie"],d)):a.docReady=d(a.eventie)}(this),function(){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){function b(a){var b=parseFloat(a),c=-1===a.indexOf("%")&&!isNaN(b);return c&&b}function c(){for(var a={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},b=0,c=g.length;c>b;b++){var d=g[b];a[d]=0}return a}function d(a){function d(a){if("string"==typeof a&&(a=document.querySelector(a)),a&&"object"==typeof a&&a.nodeType){var d=f(a);if("none"===d.display)return c();var e={};e.width=a.offsetWidth,e.height=a.offsetHeight;for(var k=e.isBorderBox=!(!j||!d[j]||"border-box"!==d[j]),l=0,m=g.length;m>l;l++){var n=g[l],o=d[n];o=h(a,o);var p=parseFloat(o);e[n]=isNaN(p)?0:p}var q=e.paddingLeft+e.paddingRight,r=e.paddingTop+e.paddingBottom,s=e.marginLeft+e.marginRight,t=e.marginTop+e.marginBottom,u=e.borderLeftWidth+e.borderRightWidth,v=e.borderTopWidth+e.borderBottomWidth,w=k&&i,x=b(d.width);x!==!1&&(e.width=x+(w?0:q+u));var y=b(d.height);return y!==!1&&(e.height=y+(w?0:r+v)),e.innerWidth=e.width-(q+u),e.innerHeight=e.height-(r+v),e.outerWidth=e.width+s,e.outerHeight=e.height+t,e}}function h(a,b){if(e||-1===b.indexOf("%"))return b;var c=a.style,d=c.left,f=a.runtimeStyle,g=f&&f.left;return g&&(f.left=a.currentStyle.left),c.left=b,b=c.pixelLeft,c.left=d,g&&(f.left=g),b}var i,j=a("boxSizing");return function(){if(j){var a=document.createElement("div");a.style.width="200px",a.style.padding="1px 2px 3px 4px",a.style.borderStyle="solid",a.style.borderWidth="1px 2px 3px 4px",a.style[j]="border-box";var c=document.body||document.documentElement;c.appendChild(a);var d=f(a);i=200===b(d.width),c.removeChild(a)}}(),d}var e=a.getComputedStyle,f=e?function(a){return e(a,null)}:function(a){return a.currentStyle},g=["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"],d):"object"==typeof exports?module.exports=d(require("get-style-property")):a.getSize=d(a.getStyleProperty)}(window),function(a,b){function c(a,b){return a[h](b)}function d(a){if(!a.parentNode){var b=document.createDocumentFragment();b.appendChild(a)}}function e(a,b){d(a);for(var c=a.parentNode.querySelectorAll(b),e=0,f=c.length;f>e;e++)if(c[e]===a)return!0;return!1}function f(a,b){return d(a),c(a,b)}var g,h=function(){if(b.matchesSelector)return"matchesSelector";for(var a=["webkit","moz","ms","o"],c=0,d=a.length;d>c;c++){var e=a[c],f=e+"MatchesSelector";if(b[f])return f}}();if(h){var i=document.createElement("div"),j=c(i,"div");g=j?c:f}else g=e;"function"==typeof define&&define.amd?define("matches-selector/matches-selector",[],function(){return g}):window.matchesSelector=g}(this,Element.prototype),function(a){function b(a,b){for(var c in b)a[c]=b[c];return a}function c(a){for(var b in a)return!1;return b=null,!0}function d(a){return a.replace(/([A-Z])/g,function(a){return"-"+a.toLowerCase()})}function e(a,e,f){function h(a,b){a&&(this.element=a,this.layout=b,this.position={x:0,y:0},this._create())}var i=f("transition"),j=f("transform"),k=i&&j,l=!!f("perspective"),m={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"otransitionend",transition:"transitionend"}[i],n=["transform","transition","transitionDuration","transitionProperty"],o=function(){for(var a={},b=0,c=n.length;c>b;b++){var d=n[b],e=f(d);e&&e!==d&&(a[d]=e)}return a}();b(h.prototype,a.prototype),h.prototype._create=function(){this._transn={ingProperties:{},clean:{},onEnd:{}},this.css({position:"absolute"})},h.prototype.handleEvent=function(a){var b="on"+a.type;this[b]&&this[b](a)},h.prototype.getSize=function(){this.size=e(this.element)},h.prototype.css=function(a){var b=this.element.style;for(var c in a){var d=o[c]||c;b[d]=a[c]}},h.prototype.getPosition=function(){var a=g(this.element),b=this.layout.options,c=b.isOriginLeft,d=b.isOriginTop,e=parseInt(a[c?"left":"right"],10),f=parseInt(a[d?"top":"bottom"],10);e=isNaN(e)?0:e,f=isNaN(f)?0:f;var h=this.layout.size;e-=c?h.paddingLeft:h.paddingRight,f-=d?h.paddingTop:h.paddingBottom,this.position.x=e,this.position.y=f},h.prototype.layoutPosition=function(){var a=this.layout.size,b=this.layout.options,c={};b.isOriginLeft?(c.left=this.position.x+a.paddingLeft+"px",c.right=""):(c.right=this.position.x+a.paddingRight+"px",c.left=""),b.isOriginTop?(c.top=this.position.y+a.paddingTop+"px",c.bottom=""):(c.bottom=this.position.y+a.paddingBottom+"px",c.top=""),this.css(c),this.emitEvent("layout",[this])};var p=l?function(a,b){return"translate3d("+a+"px, "+b+"px, 0)"}:function(a,b){return"translate("+a+"px, "+b+"px)"};h.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={},k=this.layout.options;h=k.isOriginLeft?h:-h,i=k.isOriginTop?i:-i,j.transform=p(h,i),this.transition({to:j,onTransitionEnd:{transform:this.layoutPosition},isCleaning:!0})},h.prototype.goTo=function(a,b){this.setPosition(a,b),this.layoutPosition()},h.prototype.moveTo=k?h.prototype._transitionTo:h.prototype.goTo,h.prototype.setPosition=function(a,b){this.position.x=parseInt(a,10),this.position.y=parseInt(b,10)},h.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)},h.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 q=j&&d(j)+",opacity";h.prototype.enableTransition=function(){this.isTransitioning||(this.css({transitionProperty:q,transitionDuration:this.layout.options.transitionDuration}),this.element.addEventListener(m,this,!1))},h.prototype.transition=h.prototype[i?"_transition":"_nonTransition"],h.prototype.onwebkitTransitionEnd=function(a){this.ontransitionend(a)},h.prototype.onotransitionend=function(a){this.ontransitionend(a)};var r={"-webkit-transform":"transform","-moz-transform":"transform","-o-transform":"transform"};h.prototype.ontransitionend=function(a){if(a.target===this.element){var b=this._transn,d=r[a.propertyName]||a.propertyName;if(delete b.ingProperties[d],c(b.ingProperties)&&this.disableTransition(),d in b.clean&&(this.element.style[a.propertyName]="",delete b.clean[d]),d in b.onEnd){var e=b.onEnd[d];e.call(this),delete b.onEnd[d]}this.emitEvent("transitionEnd",[this])}},h.prototype.disableTransition=function(){this.removeTransitionStyles(),this.element.removeEventListener(m,this,!1),this.isTransitioning=!1},h.prototype._removeStyles=function(a){var b={};for(var c in a)b[c]="";this.css(b)};var s={transitionProperty:"",transitionDuration:""};return h.prototype.removeTransitionStyles=function(){this.css(s)},h.prototype.removeElem=function(){this.element.parentNode.removeChild(this.element),this.emitEvent("remove",[this])},h.prototype.remove=function(){if(!i||!parseFloat(this.layout.options.transitionDuration))return void this.removeElem();var a=this;this.on("transitionEnd",function(){return a.removeElem(),!0}),this.hide()},h.prototype.reveal=function(){delete this.isHidden,this.css({display:""});var a=this.layout.options;this.transition({from:a.hiddenStyle,to:a.visibleStyle,isCleaning:!0})},h.prototype.hide=function(){this.isHidden=!0,this.css({display:""});var a=this.layout.options;this.transition({from:a.visibleStyle,to:a.hiddenStyle,isCleaning:!0,onTransitionEnd:{opacity:function(){this.isHidden&&this.css({display:"none"})}}})},h.prototype.destroy=function(){this.css({position:"",left:"",right:"",top:"",bottom:"",transition:"",transform:""})},h}var f=a.getComputedStyle,g=f?function(a){return f(a,null)}:function(a){return a.currentStyle};"function"==typeof define&&define.amd?define("outlayer/item",["eventEmitter/EventEmitter","get-size/get-size","get-style-property/get-style-property"],e):(a.Outlayer={},a.Outlayer.Item=e(a.EventEmitter,a.getSize,a.getStyleProperty))}(window),function(a){function b(a,b){for(var c in b)a[c]=b[c];return a}function c(a){return"[object Array]"===l.call(a)}function d(a){var b=[];if(c(a))b=a;else if(a&&"number"==typeof a.length)for(var d=0,e=a.length;e>d;d++)b.push(a[d]);else b.push(a);return b}function e(a,b){var c=n(b,a);-1!==c&&b.splice(c,1)}function f(a){return a.replace(/(.)([A-Z])/g,function(a,b,c){return b+"-"+c}).toLowerCase()}function g(c,g,l,n,o,p){function q(a,c){if("string"==typeof a&&(a=h.querySelector(a)),!a||!m(a))return void(i&&i.error("Bad "+this.constructor.namespace+" element: "+a));this.element=a,this.options=b({},this.constructor.defaults),this.option(c);var d=++r;this.element.outlayerGUID=d,s[d]=this,this._create(),this.options.isInitLayout&&this.layout()}var r=0,s={};return q.namespace="outlayer",q.Item=p,q.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)"}},b(q.prototype,l.prototype),q.prototype.option=function(a){b(this.options,a)},q.prototype._create=function(){this.reloadItems(),this.stamps=[],this.stamp(this.options.stamp),b(this.element.style,this.options.containerStyle),this.options.isResizeBound&&this.bindResize()},q.prototype.reloadItems=function(){this.items=this._itemize(this.element.children)},q.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},q.prototype._filterFindItemElements=function(a){a=d(a);for(var b=this.options.itemSelector,c=[],e=0,f=a.length;f>e;e++){var g=a[e];if(m(g))if(b){o(g,b)&&c.push(g);for(var h=g.querySelectorAll(b),i=0,j=h.length;j>i;i++)c.push(h[i])}else c.push(g)}return c},q.prototype.getItemElements=function(){for(var a=[],b=0,c=this.items.length;c>b;b++)a.push(this.items[b].element);return a},q.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},q.prototype._init=q.prototype.layout,q.prototype._resetLayout=function(){this.getSize()},q.prototype.getSize=function(){this.size=n(this.element)},q.prototype._getMeasurement=function(a,b){var c,d=this.options[a];d?("string"==typeof d?c=this.element.querySelector(d):m(d)&&(c=d),this[a]=c?n(c)[b]:d):this[a]=0},q.prototype.layoutItems=function(a,b){a=this._getItemsForLayout(a),this._layoutItems(a,b),this._postLayout()},q.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},q.prototype._layoutItems=function(a,b){function c(){d.emitEvent("layoutComplete",[d,a])}var d=this;if(!a||!a.length)return void c();this._itemsOn(a,"layout",c);for(var e=[],f=0,g=a.length;g>f;f++){var h=a[f],i=this._getItemLayoutPosition(h);i.item=h,i.isInstant=b||h.isLayoutInstant,e.push(i)}this._processLayoutQueue(e)},q.prototype._getItemLayoutPosition=function(){return{x:0,y:0}},q.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)}},q.prototype._positionItem=function(a,b,c,d){d?a.goTo(b,c):a.moveTo(b,c)},q.prototype._postLayout=function(){this.resizeContainer()},q.prototype.resizeContainer=function(){if(this.options.isResizingContainer){var a=this._getContainerSize();a&&(this._setContainerMeasure(a.width,!0),this._setContainerMeasure(a.height,!1))}},q.prototype._getContainerSize=k,q.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"}},q.prototype._itemsOn=function(a,b,c){function d(){return e++,e===f&&c.call(g),!0}for(var e=0,f=a.length,g=this,h=0,i=a.length;i>h;h++){var j=a[h];j.on(b,d)}},q.prototype.ignore=function(a){var b=this.getItem(a);b&&(b.isIgnored=!0)},q.prototype.unignore=function(a){var b=this.getItem(a);b&&delete b.isIgnored},q.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)}}},q.prototype.unstamp=function(a){if(a=this._find(a))for(var b=0,c=a.length;c>b;b++){var d=a[b];e(d,this.stamps),this.unignore(d)}},q.prototype._find=function(a){return a?("string"==typeof a&&(a=this.element.querySelectorAll(a)),a=d(a)):void 0},q.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)}}},q.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)}},q.prototype._manageStamp=k,q.prototype._getElementOffset=function(a){var b=a.getBoundingClientRect(),c=this._boundingRect,d=n(a),e={left:b.left-c.left-d.marginLeft,top:b.top-c.top-d.marginTop,right:c.right-b.right-d.marginRight,bottom:c.bottom-b.bottom-d.marginBottom};return e},q.prototype.handleEvent=function(a){var b="on"+a.type;this[b]&&this[b](a)},q.prototype.bindResize=function(){this.isResizeBound||(c.bind(a,"resize",this),this.isResizeBound=!0)},q.prototype.unbindResize=function(){this.isResizeBound&&c.unbind(a,"resize",this),this.isResizeBound=!1},q.prototype.onresize=function(){function a(){b.resize(),delete b.resizeTimeout}this.resizeTimeout&&clearTimeout(this.resizeTimeout);var b=this;this.resizeTimeout=setTimeout(a,100)},q.prototype.resize=function(){this.isResizeBound&&this.needsResizeLayout()&&this.layout()},q.prototype.needsResizeLayout=function(){var a=n(this.element),b=this.size&&a;return b&&a.innerWidth!==this.size.innerWidth},q.prototype.addItems=function(a){var b=this._itemize(a);return b.length&&(this.items=this.items.concat(b)),b},q.prototype.appended=function(a){var b=this.addItems(a);b.length&&(this.layoutItems(b,!0),this.reveal(b))},q.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)}},q.prototype.reveal=function(a){var b=a&&a.length;if(b)for(var c=0;b>c;c++){var d=a[c];d.reveal()}},q.prototype.hide=function(a){var b=a&&a.length;if(b)for(var c=0;b>c;c++){var d=a[c];d.hide()}},q.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}},q.prototype.getItems=function(a){if(a&&a.length){for(var b=[],c=0,d=a.length;d>c;c++){var e=a[c],f=this.getItem(e);f&&b.push(f)}return b}},q.prototype.remove=function(a){a=d(a);var b=this.getItems(a);if(b&&b.length){this._itemsOn(b,"remove",function(){this.emitEvent("removeComplete",[this,b])});for(var c=0,f=b.length;f>c;c++){var g=b[c];g.remove(),e(g,this.items)}}},q.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(),delete this.element.outlayerGUID,j&&j.removeData(this.element,this.constructor.namespace)},q.data=function(a){var b=a&&a.outlayerGUID;return b&&s[b]},q.create=function(a,c){function d(){q.apply(this,arguments)}return Object.create?d.prototype=Object.create(q.prototype):b(d.prototype,q.prototype),d.prototype.constructor=d,d.defaults=b({},q.defaults),b(d.defaults,c),d.prototype.settings={},d.namespace=a,d.data=q.data,d.Item=function(){p.apply(this,arguments)},d.Item.prototype=new p,g(function(){for(var b=f(a),c=h.querySelectorAll(".js-"+b),e="data-"+b+"-options",g=0,k=c.length;k>g;g++){var l,m=c[g],n=m.getAttribute(e);try{l=n&&JSON.parse(n)}catch(o){i&&i.error("Error parsing "+e+" on "+m.nodeName.toLowerCase()+(m.id?"#"+m.id:"")+": "+o);continue}var p=new d(m,l);j&&j.data(m,a,p)}}),j&&j.bridget&&j.bridget(a,d),d},q.Item=p,q}var h=a.document,i=a.console,j=a.jQuery,k=function(){},l=Object.prototype.toString,m="object"==typeof HTMLElement?function(a){return a instanceof HTMLElement}:function(a){return a&&"object"==typeof a&&1===a.nodeType&&"string"==typeof a.nodeName},n=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};"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"],g):a.Outlayer=g(a.eventie,a.docReady,a.EventEmitter,a.getSize,a.matchesSelector,a.Outlayer.Item)}(window),function(a){function b(a,b){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}this.columnWidth+=this.gutter,this.cols=Math.floor((this.containerWidth+this.gutter)/this.columnWidth),this.cols=Math.max(this.cols,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(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}var c=Array.prototype.indexOf?function(a,b){return a.indexOf(b)}:function(a,b){for(var c=0,d=a.length;d>c;c++){var e=a[c];if(e===b)return c}return-1};"function"==typeof define&&define.amd?define(["outlayer/outlayer","get-size/get-size"],b):a.Masonry=b(a.Outlayer,a.getSize)}(window);; /*! jQuery Color v@2.1.2 http://github.com/jquery/jquery-color | jquery.org/license */ (function(a,b){function m(a,b,c){var d=h[b.type]||{};return a==null?c||!b.def?null:b.def:(a=d.floor?~~a:parseFloat(a),isNaN(a)?b.def:d.mod?(a+d.mod)%d.mod:0>a?0:d.max")[0],k,l=a.each;j.style.cssText="background-color:rgba(1,1,1,.5)",i.rgba=j.style.backgroundColor.indexOf("rgba")>-1,l(g,function(a,b){b.cache="_"+a,b.props.alpha={idx:3,type:"percent",def:1}}),f.fn=a.extend(f.prototype,{parse:function(c,d,e,h){if(c===b)return this._rgba=[null,null,null,null],this;if(c.jquery||c.nodeType)c=a(c).css(d),d=b;var i=this,j=a.type(c),o=this._rgba=[];d!==b&&(c=[c,d,e,h],j="array");if(j==="string")return this.parse(n(c)||k._default);if(j==="array")return l(g.rgba.props,function(a,b){o[b.idx]=m(c[b.idx],b)}),this;if(j==="object")return c instanceof f?l(g,function(a,b){c[b.cache]&&(i[b.cache]=c[b.cache].slice())}):l(g,function(b,d){var e=d.cache;l(d.props,function(a,b){if(!i[e]&&d.to){if(a==="alpha"||c[a]==null)return;i[e]=d.to(i._rgba)}i[e][b.idx]=m(c[a],b,!0)}),i[e]&&a.inArray(null,i[e].slice(0,3))<0&&(i[e][3]=1,d.from&&(i._rgba=d.from(i[e])))}),this},is:function(a){var b=f(a),c=!0,d=this;return l(g,function(a,e){var f,g=b[e.cache];return g&&(f=d[e.cache]||e.to&&e.to(d._rgba)||[],l(e.props,function(a,b){if(g[b.idx]!=null)return c=g[b.idx]===f[b.idx],c})),c}),c},_space:function(){var a=[],b=this;return l(g,function(c,d){b[d.cache]&&a.push(c)}),a.pop()},transition:function(a,b){var c=f(a),d=c._space(),e=g[d],i=this.alpha()===0?f("transparent"):this,j=i[e.cache]||e.to(i._rgba),k=j.slice();return c=c[e.cache],l(e.props,function(a,d){var e=d.idx,f=j[e],g=c[e],i=h[d.type]||{};if(g===null)return;f===null?k[e]=g:(i.mod&&(g-f>i.mod/2?f+=i.mod:f-g>i.mod/2&&(f-=i.mod)),k[e]=m((g-f)*b+f,d))}),this[d](k)},blend:function(b){if(this._rgba[3]===1)return this;var c=this._rgba.slice(),d=c.pop(),e=f(b)._rgba;return f(a.map(c,function(a,b){return(1-d)*e[b]+d*a}))},toRgbaString:function(){var b="rgba(",c=a.map(this._rgba,function(a,b){return a==null?b>2?1:0:a});return c[3]===1&&(c.pop(),b="rgb("),b+c.join()+")"},toHslaString:function(){var b="hsla(",c=a.map(this.hsla(),function(a,b){return a==null&&(a=b>2?1:0),b&&b<3&&(a=Math.round(a*100)+"%"),a});return c[3]===1&&(c.pop(),b="hsl("),b+c.join()+")"},toHexString:function(b){var c=this._rgba.slice(),d=c.pop();return b&&c.push(~~(d*255)),"#"+a.map(c,function(a){return a=(a||0).toString(16),a.length===1?"0"+a:a}).join("")},toString:function(){return this._rgba[3]===0?"transparent":this.toRgbaString()}}),f.fn.parse.prototype=f.fn,g.hsla.to=function(a){if(a[0]==null||a[1]==null||a[2]==null)return[null,null,null,a[3]];var b=a[0]/255,c=a[1]/255,d=a[2]/255,e=a[3],f=Math.max(b,c,d),g=Math.min(b,c,d),h=f-g,i=f+g,j=i*.5,k,l;return g===f?k=0:b===f?k=60*(c-d)/h+360:c===f?k=60*(d-b)/h+120:k=60*(b-c)/h+240,h===0?l=0:j<=.5?l=h/i:l=h/(2-i),[Math.round(k)%360,l,j,e==null?1:e]},g.hsla.from=function(a){if(a[0]==null||a[1]==null||a[2]==null)return[null,null,null,a[3]];var b=a[0]/360,c=a[1],d=a[2],e=a[3],f=d<=.5?d*(1+c):d+c-d*c,g=2*d-f;return[Math.round(o(g,f,b+1/3)*255),Math.round(o(g,f,b)*255),Math.round(o(g,f,b-1/3)*255),e]},l(g,function(c,e){var g=e.props,h=e.cache,i=e.to,j=e.from;f.fn[c]=function(c){i&&!this[h]&&(this[h]=i(this._rgba));if(c===b)return this[h].slice();var d,e=a.type(c),k=e==="array"||e==="object"?c:arguments,n=this[h].slice();return l(g,function(a,b){var c=k[e==="object"?a:b.idx];c==null&&(c=n[b.idx]),n[b.idx]=m(c,b)}),j?(d=f(j(n)),d[h]=n,d):f(n)},l(g,function(b,e){if(f.fn[b])return;f.fn[b]=function(f){var g=a.type(f),h=b==="alpha"?this._hsla?"hsla":"rgba":c,i=this[h](),j=i[e.idx],k;return g==="undefined"?j:(g==="function"&&(f=f.call(this,j),g=a.type(f)),f==null&&e.empty?this:(g==="string"&&(k=d.exec(f),k&&(f=j+parseFloat(k[2])*(k[1]==="+"?1:-1))),i[e.idx]=f,this[h](i)))}})}),f.hook=function(b){var c=b.split(" ");l(c,function(b,c){a.cssHooks[c]={set:function(b,d){var e,g,h="";if(d!=="transparent"&&(a.type(d)!=="string"||(e=n(d)))){d=f(e||d);if(!i.rgba&&d._rgba[3]!==1){g=c==="backgroundColor"?b.parentNode:b;while((h===""||h==="transparent")&&g&&g.style)try{h=a.css(g,"backgroundColor"),g=g.parentNode}catch(j){}d=d.blend(h&&h!=="transparent"?h:"_default")}d=d.toRgbaString()}try{b.style[c]=d}catch(j){}}},a.fx.step[c]=function(b){b.colorInit||(b.start=f(b.elem,c),b.end=f(b.end),b.colorInit=!0),a.cssHooks[c].set(b.elem,b.start.transition(b.end,b.pos))}})},f.hook(c),a.cssHooks.borderColor={expand:function(a){var b={};return l(["Top","Right","Bottom","Left"],function(c,d){b["border"+d+"Color"]=a}),b}},k=a.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}})(jQuery);; /* HTML5 Placeholder jQuery Plugin - v2.1.2 * Copyright (c)2015 Mathias Bynens * 2015-06-09 */ !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof module&&module.exports?require("jquery"):jQuery)}(function(a){function b(b){var c={},d=/^jQuery\d+$/;return a.each(b.attributes,function(a,b){b.specified&&!d.test(b.name)&&(c[b.name]=b.value)}),c}function c(b,c){var d=this,f=a(d);if(d.value==f.attr("placeholder")&&f.hasClass(m.customClass))if(f.data("placeholder-password")){if(f=f.hide().nextAll('input[type="password"]:first').show().attr("id",f.removeAttr("id").data("placeholder-id")),b===!0)return f[0].value=c;f.focus()}else d.value="",f.removeClass(m.customClass),d==e()&&d.select()}function d(){var d,e=this,f=a(e),g=this.id;if(""===e.value){if("password"===e.type){if(!f.data("placeholder-textinput")){try{d=f.clone().prop({type:"text"})}catch(h){d=a("").attr(a.extend(b(this),{type:"text"}))}d.removeAttr("name").data({"placeholder-password":f,"placeholder-id":g}).bind("focus.placeholder",c),f.data({"placeholder-textinput":d,"placeholder-id":g}).before(d)}f=f.removeAttr("id").hide().prevAll('input[type="text"]:first').attr("id",g).show()}f.addClass(m.customClass),f[0].value=f.attr("placeholder")}else f.removeClass(m.customClass)}function e(){try{return document.activeElement}catch(a){}}var f,g,h="[object OperaMini]"==Object.prototype.toString.call(window.operamini),i="placeholder"in document.createElement("input")&&!h,j="placeholder"in document.createElement("textarea")&&!h,k=a.valHooks,l=a.propHooks;if(i&&j)g=a.fn.placeholder=function(){return this},g.input=g.textarea=!0;else{var m={};g=a.fn.placeholder=function(b){var e={customClass:"placeholder"};m=a.extend({},e,b);var f=this;return f.filter((i?"textarea":":input")+"[placeholder]").not("."+m.customClass).bind({"focus.placeholder":c,"blur.placeholder":d}).data("placeholder-enabled",!0).trigger("blur.placeholder"),f},g.input=i,g.textarea=j,f={get:function(b){var c=a(b),d=c.data("placeholder-password");return d?d[0].value:c.data("placeholder-enabled")&&c.hasClass(m.customClass)?"":b.value},set:function(b,f){var g=a(b),h=g.data("placeholder-password");return h?h[0].value=f:g.data("placeholder-enabled")?(""===f?(b.value=f,b!=e()&&d.call(b)):g.hasClass(m.customClass)?c.call(b,!0,f)||(b.value=f):b.value=f,g):b.value=f}},i||(k.input=f,l.value=f),j||(k.textarea=f,l.value=f),a(function(){a(document).delegate("form","submit.placeholder",function(){var b=a("."+m.customClass,this).each(c);setTimeout(function(){b.each(d)},10)})}),a(window).bind("beforeunload.placeholder",function(){a("."+m.customClass).each(function(){this.value=""})})}});; (function ($) { /** * The recommended way for producing HTML markup through JavaScript is to write * theming functions. These are similiar to the theming functions that you might * know from 'phptemplate' (the default PHP templating engine used by most * Drupal themes including Omega). JavaScript theme functions accept arguments * and can be overriden by sub-themes. * * In most cases, there is no good reason to NOT wrap your markup producing * JavaScript in a theme function. */ Drupal.theme.prototype.kbExampleButton = function (path, title) { // Create an anchor element with jQuery. return $('' + title + ''); }; /** * Behaviors are Drupal's way of applying JavaScript to a page. In short, the * advantage of Behaviors over a simple 'document.ready()' lies in how it * interacts with content loaded through Ajax. Opposed to the * 'document.ready()' event which is only fired once when the page is * initially loaded, behaviors get re-executed whenever something is added to * the page through Ajax. * * You can attach as many behaviors as you wish. In fact, instead of overloading * a single behavior with multiple, completely unrelated tasks you should create * a separate behavior for every separate task. * * In most cases, there is no good reason to NOT wrap your JavaScript code in a * behavior. * * @param context * The context for which the behavior is being executed. This is either the * full page or a piece of HTML that was just added through Ajax. * @param settings * An array of settings (added through drupal_add_js()). Instead of accessing * Drupal.settings directly you should use this because of potential * modifications made by the Ajax callback that also produced 'context'. */ Drupal.behaviors.kbExampleBehavior = { attach: function (context, settings) { // By using the 'context' variable we make sure that our code only runs on // the relevant HTML. Furthermore, by using jQuery.once() we make sure that // we don't run the same piece of code for an HTML snippet that we already // processed previously. By using .once('foo') all processed elements will // get tagged with a 'foo-processed' class, causing all future invocations // of this behavior to ignore them. $('.some-selector', context).once('foo', function () { // Now, we are invoking the previously declared theme function using two // settings as arguments. var $anchor = Drupal.theme('kbExampleButton', settings.myExampleLinkPath, settings.myExampleLinkTitle); // The anchor is then appended to the current element. $anchor.appendTo(this); }); } }; // The $window objects is used by multiple behaviors and functions. var $window = $(window); Drupal.behaviors.kbMenu = { attach: function (context, settings) { // Site menu var $sitemenu = $('.l-branding .block--menu-block'); // Check if the current page is . is_front = $('body').is('.front'); $siteMenuH2 = $sitemenu.find('h2'); $siteMenuH2.before( '' ).addClass('closed'); var $siteMenuTrigger = $sitemenu.find('.menu-trigger'); $($siteMenuH2).add($siteMenuTrigger).on('click', function (e) { var $p = $(this).parent(); if ($(this).hasClass('closed')) { // Show the menu items. // On mobile we need to actively animate the height. toggleClass // does not work because of responsive css. $p.find('.menu-block-wrapper').animate({'height': 'auto'}, 100); $siteMenuTrigger.removeClass('closed'); $siteMenuH2.removeClass('closed'); $p.find('.menu-block-wrapper').toggleClass('closed', 300); } else { // Close the menu again. $p.find('.menu-block-wrapper').toggleClass('closed', 300).parent(); $siteMenuTrigger.addClass('closed', 300); $siteMenuH2.addClass('closed', 300); } }) $window.bind('changeMQ',function (e, currentMQ) { // Set initial media query status. currentMQ = getActiveMediaQuery(); // Close the menu. Only do this when javascript is enabled and home on desktop is displayed. if (currentMQ != 'wide' || !is_front) { $sitemenu.addClass('closed'); $siteMenuTrigger.addClass('closed'); $siteMenuH2.addClass('closed'); $sitemenu.find('.menu-block-wrapper').addClass('closed'); } else { // open menu $sitemenu.removeClass('closed').find('H2').removeClass('closed'); $sitemenu.find('.menu-block-wrapper').removeClass('closed'); } }); } }; // Code for folding in bread crumb menu, when not enough space is available. Drupal.behaviors.breadCrumbFolding = { attach: function (context, settings) { // Define Breadcrumb function, to attach to breadcrumb menu. $.fn.Breadcrumb = function (options) { var settings = $.extend({ maxWidth : $('header .l-region--navigation > .l-container').outerWidth() - 50, collapsedWidth: 30 }, options); // for all breadcrumbs... return this.each(function () { var totalWidth = 0; var currentWidth = 0; var liEls = $(this).children("li"); // These are the collapsed casualties that had to make room for // an expanded version of an originally collapsed item. var casualties = []; /// var increaseSize = function (el) { var self = $(el); currentWidth = currentWidth - settings.collapsedWidth + self.data("bc-orig-width"); // Make some room var els = $.makeArray(liEls); while (currentWidth > settings.maxWidth && els.length > 0) { var e = $(els.pop()); casualties.push(e); e.addClass("collapsed"); if ($(e).is(':last-child')) { // add class to parent $(e).parent().addClass('darker'); } currentWidth = currentWidth + settings.collapsedWidth - e.data("bc-orig-width"); } self.children(':first').css('width', self.data("bc-orig-width")).parent().removeClass("collapsed"); }; /// var decreaseSize = function (el) { var self = $(el); currentWidth = currentWidth + settings.collapsedWidth - self.data("bc-orig-width"); // Clean up the casualties var e; while (e = casualties.pop()) { e.removeClass("collapsed"); if ($(e).is(':last-child')) { // add class to parent $(e).parent().removeClass('darker'); } currentWidth = currentWidth - settings.collapsedWidth + e.data("bc-orig-width"); } self.children(':first').css('width', settings.collapsedWidth); self.addClass("collapsed"); }; // Set extra width so we can measure $(this).css('width', 10000); liEls.each(function (index) { // wrap me once, don't wrap me twice var self = $(this); var w = self.outerWidth(); self.data("bc-orig-width", w); totalWidth = totalWidth + w; }); var els = $.makeArray(liEls); currentWidth = totalWidth; var i = 0; // Chop off Home item els.shift(); while (currentWidth > settings.maxWidth && els.length > 0) { i += 1; var cLiEl = $(els.shift()); var w = cLiEl.data("bc-orig-width"); currentWidth -= w; // bind hover actions to collapsed items // find link element a = cLiEl.first(); cLiEl.on('mouseenter', function () { increaseSize(this); }) .on('mouseleave', function () { decreaseSize(this); }); cLiEl.addClass("collapsed"); currentWidth += settings.collapsedWidth; // The width of the collapser } if ($('html').hasClass('ie8')) { $(this).children('li:last-child').addClass('last'); } $(this).css('width', 'auto'); }); }; $window.bind('changeMQ',function (e, currentMQ) { // Apply Breadcrumb function to breadcrumb menu. // Only on desktop ActiveMediaQuery = getActiveMediaQuery(); if (ActiveMediaQuery == 'desktop' || ActiveMediaQuery == 'wide') { $('.breadcrumb-menu').Breadcrumb(null); $('.has-dropdown').each(function () { // calculate the offset. var offset = $(this).offset(); // correct for location of menu. var menu_offset = $('#block-breadcrumb-menu-breadcrumb-menu').offset(); offset = offset.left - menu_offset.left; if ($(this).is(':not(:first-child)')) { offset = offset; } // calculate width width = $(window).width() - offset; // calculate offset and correct for arrow and set the width $(this).find('ul').css('margin-left', offset + 2).css('width', width); }); } $('.breadcrumb-menu > li.has-dropdown a.expander').once(function () { $(this).on('touchstart', function (e) { // e.preventDefault(); // close all $('.breadcrumb-menu li').removeClass('is-open'); $(this).parents('li').addClass('is-open'); }); }); }); } } /** * Toggle for displaying the site search box. */ Drupal.behaviors.searchblock = { attach: function(context, settings) { $('.block--search-form div#search-button').click(function() { $(this).toggleClass('active'); $('.block--search-form form#search-block-form').toggle(0); }); } }; /** * Fix placeholder text display in IE9 using jQuery pluign */ Drupal.behaviors.searchblockplaceholder = { attach: function(context, settings) { $('input[type=text]').placeholder(); } }; /** * Toggle for displaying the search facets on mobile. */ Drupal.behaviors.searchFacetsToggle = { attach: function(context, settings) { $('a.facetapi-mobile-trigger').click(function(e) { e.preventDefault(); $(this).parent().toggleClass('active'); }); } }; Drupal.behaviors.searchFacetsClasses = { attach: function(context, settings) { $('.block--facetapi a.facetapi-inactive').parent().addClass('facetapi-inactive-parent'); $('.block--facetapi a.facetapi-active').parent().addClass('facetapi-active-parent'); $('.facetapi-active-parent').each(function() { $parent = $(this); if($('div.item-list', $parent).length == 0) { $parent.addClass('no-children'); } // Check if we're nested $grandparent = $parent.parent().parent().parent(); if($grandparent.hasClass('facetapi-inactive-parent')) { $grandparent.removeClass('facetapi-inactive-parent'); $grandparent.addClass('facetapi-active-parent'); } }); } }; Drupal.behaviors.backgroundScroll = { attach: function(context, settings) { // Only doe this on desktop // Background node. $backgroundNode = $('.l-container-wrapper'); // Inititate variable. This will be overridden in onLoad event if this // is a thema page with an integer. $contentMarginTop = false; // Set the initial background color, so we can animate back to the initial color. initialBackgroundColor = $backgroundNode.css("background-color"); // Set scroll treshold, minus admin toolbar for logged in users - padding of container. scrollTreshold = $backgroundNode.offset().top - $('#admin-menu').outerHeight() - parseInt($backgroundNode.css('padding-top')) - parseInt($backgroundNode.css('margin-top')); var isTouchDevice = 'ontouchstart' in document.documentElement; $(window).scroll(function () { if (!isTouchDevice) { // When scroll point is reached, remove color overlay from background image. if ($(this).scrollTop() >= scrollTreshold) { if ($contentMarginTop) { // Set offset to contentcontainer and add it back tot the flow. $contentNode.css('margin-top', $contentMarginTop + scrollTreshold).css('position', 'static'); $backgroundNode.css('height', 'auto'); } $backgroundNode.animate({ backgroundColor: "transparent" }, { queue : false, duration: 700 }); } else { if ($contentMarginTop) { // Make contentcontainer fixed, so bg scrolls first. $contentNode.css('position', 'fixed').css('margin-top', $contentMarginTop); $backgroundNode.css('height', $backgroundHeight); } $backgroundNode.animate({ backgroundColor: initialBackgroundColor }, { queue : false, duration: 700 }); } } else { // Remove backgroundcolor, when on bronnenwijzer, set it to white. // Remove backgroundcolor, when on bronnenwijzer, set it to white. if ($('body').hassClass('page-bronnenwijzer')) { $backgroundNode.css('background-color', 'white'); } else { $backgroundNode.css('background-color', 'transparent'); } } }); } }; // We do this on the onLoad because we need the real height, with images (function($) { $(window).bind('load', function() { // Background node. $backgroundNode = $('.l-container-wrapper'); $contentNode = $backgroundNode.find('.l-page'); // Set the initial background color, so we can animate back to the initial color. initialBackgroundColor = $backgroundNode.css("background-color"); $thema = $('body').hasClass('node-type-themapagina'); if ($thema) { // Get margins for later use. $contentMarginTop = parseInt($contentNode.css('margin-top')); $contentMarginBottom = parseInt($contentNode.css('margin-bottom')); // Get heights. $backgroundHeight = $backgroundNode.outerHeight() + $contentMarginBottom; $contentHeight = $backgroundNode.find('.l-page').outerHeight(); // Set the height in css so it won't collapse when making the content // position fixed. $backgroundNode.css('height', $backgroundHeight); $contentNode.css('height', $contentHeight); } }); })(jQuery); Drupal.behaviors.masonry = { attach: function(context, settings) { $window.bind('changeMQ',function (e, currentMQ) { var side = 'right'; var selector = 'body.node-type-landingspagina .paragraphs-items'; var itemSelector = '.field--pagina-elementen'; if ($('body').hasClass('front')) { var side = 'left'; var selector = 'body.front .paragraphs-items'; var itemSelector = '.banner-rechts'; } if ($('body').hasClass('node-type-bloghoofdpagina')) { var side = 'left'; var selector = 'body.node-type-bloghoofdpagina .paragraphs-items'; var itemSelector = '.banner-rechts'; } var msnry = $(selector); if (currentMQ == 'tab') { if (msnry.data('masonry')) { msnry.masonry('destroy'); } // first move the sidebar elements to the masonry container (article); var elements = $('.l-container.' + side).detach().prependTo($('.paragraphs-items')).addClass('field--pagina-elementen'); $('.page-content').width('100%'); msnry.masonry({ stamp: '.l-container.' + side, columnWidth: 260, gutter: 40, isResizable: false, isAnimated: true }); } else { // If the sidebar was attached to the content for masonry, fix that and // put it back where it belongs. var elements = $('.paragraphs-items .l-container.' + side).detach().prependTo($('.l-main > .l-content')); if (msnry.data('masonry')) { msnry.masonry('destroy'); } if (currentMQ == 'desktop' || currentMQ == 'wide') { $('.page-content').width('600px'); msnry.masonry(); } if (currentMQ == 'small') { $('.page-content').css('width', '100%'); if (msnry.data('masonry')) { msnry.masonry('destroy'); } } } }); } }; Drupal.behaviors.gallery = { attach: function(context, settings) { // First we hide all the desciptions of images. Those are shown in the image detail. $('.paragraphs-item-galerieplaatje').addClass('js-hidden'); // We need to do this on media query change. $window.bind('changeMQ',function (e, currentMQ) { // Remove all containers first. $('.gallery-image-detail').remove(); // set container width. var container_width = $('.paragraphs-item-galerie').first().width(); $('.paragraphs-item-galerie').each(function(){ // Add detail image container for each row. counter = 0; var container = ''; if (currentMQ == 'small') { var divider = 1; } if (currentMQ == 'tab') { var divider = 3; } if (currentMQ == 'desktop') { var divider = 4; } // Add container before each row. items = $(this).find('.paragraphs-item-galerieplaatje'); items.each(function(index, value) { if (counter >= divider || counter == 0) { $(this).before(container); // reset counter. We start over. counter = 0; } if($(this).hasClass('portrait')) { counter += 1; } else if ($(this).hasClass('landscape')) { counter += 2; } // Reset tje counter if the next item does not fit anymore. if ($(items.eq(index + 1)).hasClass('landscape')) { if (counter + 2 > divider) { counter = 0; } } // reset counter if we are at the end of an gallery. if ($(this).is(':last-child')) { counter = divider; } }); }); }); // Get the widht of the container to fix jumping in slideDown. See http://www.bennadel.com/blog/2263-use-jquery-s-slidedown-with-fixed-width-elements-to-prevent-jumping.htm var container_width = $('.paragraphs-item-galerie').first().width(); // Add gallery functionality to gallery images. $('.paragraphs-item-galerieplaatje img').on('click', function(e){ e.preventDefault(); // Store parent container. var parent = $(this).parents('.paragraphs-item-galerieplaatje'); // Remove any open image gallery image. $('.gallery-image-detail').hide().find('.content').html(''); // Create large image. img = $(''); img.attr('src', $(this).parents('a').attr('href')); img.attr('alt', $(this).attr('alt')); img.attr('title', $(this).attr('title')); img.load(function(){ // Create a clone of the description to add below the image. desc = parent.find('.field--onderschriftje').clone(); link = parent.find('.original-image').clone(); // Add image. galleryDetail = parent.prevAll('.gallery-image-detail:first'); galleryDetail.find('.content').append(img).append(desc).append(link); galleryDetail.width(container_width).height('auto'); galleryDetail.slideDown('300', 'easeInOutSine').find('.close').addClass('visible').on('click', function(){ $(this).parent().slideUp(); }); // Slide the top of the image in view. $('html, body').animate({ scrollTop: galleryDetail.offset().top - 100 }, 200, 'easeInOutSine'); }); }); } }; Drupal.behaviors.kolombreed_plaatje = { attach: function(context, settings) { $imageToggle = $( '
' ); $('.paragraphs-item-kolombreed-plaatje div.field--plaatje').append($imageToggle); $('.image-toggle').once().on('click', function() { if ($(this).hasClass('expanded')) { // The expanded picture is being displayed. $(this).removeClass('expanded'); // Find relating picture. $image = $(this).prev('img'); // Find container $container = $(this).parent(); // Set height fixed for animation later $container.height($image.height()); // Change img url from full to cropped. image_url = $image.attr('src'); image_url_cropped = image_url.replace('plaatje_560px', 'plaatje_560px_uitsnede'); // Get height of image if it was opened expanded. if (!$container.data('height') > 0 ) { var tmpImg = new Image(); tmpImg.src = image_url_cropped; $(tmpImg).on('load',function(){ $container.data('height', tmpImg.height); $container.animate({height: $container.data('height')}, 500, 'easeInOutCirc', function(){ // Show cropped picture. $image.attr('src', image_url_cropped); }); }); } else { $container.stop(true, true).animate({height: $container.data('height')}, 500, 'easeInOutCirc', function(){ // Show cropped picture. $image.attr('src', image_url_cropped); }); } } else { // The cropped images is being displayed // Add expanded class to indicate the image is expanded. $(this).addClass('expanded'); // Find relating picture. $image = $(this).prev('img'); // Find container $container = $(this).parent(); // Set height fixed for animation later. Store in data-attr. $container.height($image.height()).data('height',$image.height()); // Change img url from cropped to full. image_url_cropped = $image.attr('src'); image_url_full = image_url_cropped.replace('plaatje_560px_uitsnede', 'plaatje_560px'); // Show expanded picture and remove height and width. $image.removeAttr('height'); $image.removeAttr('width'); $image.attr('src', image_url_full); $image.once().on('load', function() { // Set new height of image container with animation when nog on load. $container.animate({height: $image.height()}, 500, 'easeInOutCirc'); }); } }); // Open all "show open" images. $('.paragraphs-item-kolombreed-plaatje.show-open .field--plaatje .image-toggle').each(function() { $(this).addClass('expanded'); $container = $(this).parent(); // Find relating picture. $image = $(this).prev('img'); // Find container $container = $(this).parent(); // Show expanded picture and remove height and width. $image.removeAttr('height'); $image.removeAttr('width'); $container.height($image.height()); } ); } }; /** * In the CSS, we have set min-width values on the body to d etect the active media query. * "0px" -> "default" * "1px" -> "small" * "2px" -> "large" * This is the only reliable cross-browser method. */ function getActiveMediaQuery() { var bodyMinWidth = $('body').css('min-width'); switch (bodyMinWidth) { case '0px': return 'small'; break; case '1px': return 'tab'; break; case '2px': return 'desktop'; break; case '3px': return 'wide'; break; } }; /** * Define a custom event "changeMQ", which is triggered when the CSS switches * from one media query to another. */ var currentMQ = getActiveMediaQuery(); var newMQ = ''; $window.resize(function (event) { newMQ = getActiveMediaQuery(); if (currentMQ != newMQ) { currentMQ = newMQ; $window.trigger("changeMQ", [currentMQ]); } }); // In this function we trigger the media query change once! Do not do this in // other functions again. $(window).load(function(){ $window.trigger('changeMQ', getActiveMediaQuery()); }); })(jQuery); ;