/*! * salvattore 1.0.8 by @rnmp and @ppold * https://github.com/rnmp/salvattore */ !function(e,t){"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?module.exports=t():e.salvattore=t()}(this,function(){/*! matchmedia() polyfill - test a css media type/query in js. authors & copyright (c) 2012: scott jehl, paul irish, nicholas zakas, david knight. dual mit/bsd license */ window.matchmedia||(window.matchmedia=function(){"use strict";var e=window.stylemedia||window.media;if(!e){var t=document.createelement("style"),n=document.getelementsbytagname("script")[0],r=null;t.type="text/css",t.id="matchmediajs-test",n.parentnode.insertbefore(t,n),r="getcomputedstyle"in window&&window.getcomputedstyle(t,null)||t.currentstyle,e={matchmedium:function(e){var n="@media "+e+"{ #matchmediajs-test { width: 1px; } }";return t.stylesheet?t.stylesheet.csstext=n:t.textcontent=n,"1px"===r.width}}}return function(t){return{matches:e.matchmedium(t||"all"),media:t||"all"}}}()),/*! matchmedia() polyfill addlistener/removelistener extension. author & copyright (c) 2012: scott jehl. dual mit/bsd license */ function(){"use strict";if(window.matchmedia&&window.matchmedia("all").addlistener)return!1;var e=window.matchmedia,t=e("only all").matches,n=!1,r=0,a=[],i=function(t){cleartimeout(r),r=settimeout(function(){for(var t=0,n=a.length;n>t;t++){var r=a[t].mql,i=a[t].listeners||[],o=e(r.media).matches;if(o!==r.matches){r.matches=o;for(var c=0,l=i.length;l>c;c++)i[c].call(window,r)}}},30)};window.matchmedia=function(r){var o=e(r),c=[],l=0;return o.addlistener=function(e){t&&(n||(n=!0,window.addeventlistener("resize",i,!0)),0===l&&(l=a.push({mql:o,listeners:c})),c.push(e))},o.removelistener=function(e){for(var t=0,n=c.length;n>t;t++)c[t]===e&&c.splice(t,1)},o}}(),function(){"use strict";for(var e=0,t=["ms","moz","webkit","o"],n=0;n *:nth-child("+o+"n-"+d+")",s.push(n.queryselectorall(a));s.foreach(function(e){var n=t.createelement("div"),r=t.createdocumentfragment();n.classname=l.join(" "),array.prototype.foreach.call(e,function(e){r.appendchild(e)}),n.appendchild(r),u.appendchild(n)}),e.appendchild(u),c(e,"columns",o)},r.removecolumns=function(n){var r=t.createrange();r.selectnodecontents(n);var a=array.prototype.filter.call(r.extractcontents().childnodes,function(t){return t instanceof e.htmlelement}),i=a.length,o=a[0].childnodes.length,l=new array(o*i);array.prototype.foreach.call(a,function(e,t){array.prototype.foreach.call(e.children,function(e,n){l[n*i+t]=e})});var s=t.createelement("div");return c(s,"columns",0),l.filter(function(e){return!!e}).foreach(function(e){s.appendchild(e)}),s},r.recreatecolumns=function(t){e.requestanimationframe(function(){r.addcolumns(t,r.removecolumns(t));var e=new customevent("columnschange");t.dispatchevent(e)})},r.mediaquerychange=function(e){e.matches&&array.prototype.foreach.call(a,r.recreatecolumns)},r.getcssrules=function(e){var t;try{t=e.sheet.cssrules||e.sheet.rules}catch(n){return[]}return t||[]},r.getstylesheets=function(){var e=array.prototype.slice.call(t.queryselectorall("style"));return e.foreach(function(t,n){"text/css"!==t.type&&""!==t.type&&e.splice(n,1)}),array.prototype.concat.call(e,array.prototype.slice.call(t.queryselectorall("link[rel='stylesheet']")))},r.mediarulehascolumnsselector=function(e){var t,n;try{t=e.length}catch(r){t=0}for(;t--;)if(n=e[t],n.selectortext&&n.selectortext.match(/\[data-columns\](.*)::?before$/))return!0;return!1},r.scanmediaqueries=function(){var t=[];if(e.matchmedia){r.getstylesheets().foreach(function(e){array.prototype.foreach.call(r.getcssrules(e),function(e){try{e.media&&e.cssrules&&r.mediarulehascolumnsselector(e.cssrules)&&t.push(e)}catch(n){}})});var n=i.filter(function(e){return-1===t.indexof(e)});o.filter(function(e){return-1!==n.indexof(e.rule)}).foreach(function(e){e.mql.removelistener(r.mediaquerychange)}),o=o.filter(function(e){return-1===n.indexof(e.rule)}),t.filter(function(e){return-1==i.indexof(e)}).foreach(function(t){var n=e.matchmedia(t.media.mediatext);n.addlistener(r.mediaquerychange),o.push({rule:t,mql:n})}),i.length=0,i=t}},r.rescanmediaqueries=function(){r.scanmediaqueries(),array.prototype.foreach.call(a,r.recreatecolumns)},r.nextelementcolumnindex=function(e,t){var n,r,a,i=e.children,o=i.length,c=0,l=0;for(a=0;o>a;a++)n=i[a],r=n.children.length+(t[a].children||t[a].childnodes).length,0===c&&(c=r),c>r&&(l=a,c=r);return l},r.createfragmentslist=function(e){for(var n=new array(e),r=0;r!==e;)n[r]=t.createdocumentfragment(),r++;return n},r.appendelements=function(e,t){var n=e.children,a=n.length,i=r.createfragmentslist(a);array.prototype.foreach.call(t,function(t){var n=r.nextelementcolumnindex(e,i);i[n].appendchild(t)}),array.prototype.foreach.call(n,function(e,t){e.appendchild(i[t])})},r.prependelements=function(e,n){var a=e.children,i=a.length,o=r.createfragmentslist(i),c=i-1;n.foreach(function(e){var t=o[c];t.insertbefore(e,t.firstchild),0===c?c=i-1:c--}),array.prototype.foreach.call(a,function(e,t){e.insertbefore(o[t],e.firstchild)});for(var l=t.createdocumentfragment(),s=n.length%i;0!==s--;)l.appendchild(e.lastchild);e.insertbefore(l,e.firstchild)},r.registergrid=function(n){if("none"!==e.getcomputedstyle(n).display){var i=t.createrange();i.selectnodecontents(n);var o=t.createelement("div");o.appendchild(i.extractcontents()),c(o,"columns",0),r.addcolumns(n,o),a.push(n)}},r.init=function(){var e=t.createelement("style");e.innerhtml="[data-columns]::before{display:block;visibility:hidden;position:absolute;font-size:1px;}",t.head.appendchild(e);var n=t.queryselectorall("[data-columns]");array.prototype.foreach.call(n,r.registergrid),r.scanmediaqueries()},r.init(),{appendelements:r.appendelements,prependelements:r.prependelements,registergrid:r.registergrid,recreatecolumns:r.recreatecolumns,rescanmediaqueries:r.rescanmediaqueries,init:r.init,append_elements:r.appendelements,prepend_elements:r.prependelements,register_grid:r.registergrid,recreate_columns:r.recreatecolumns,rescan_media_queries:r.rescanmediaqueries}}(window,window.document);return e});