-
Notifications
You must be signed in to change notification settings - Fork 314
/
Copy pathskel-layout.min.js
2 lines (2 loc) · 9.9 KB
/
skel-layout.min.js
1
2
/* skel-layout.js v3.0.1 | (c) skel.io | MIT licensed */
!function(e){"use strict";var t={config:{breakpoints:{},boxModel:!1,conditionals:!1,containers:!1,grid:!1,href:!1,reset:!1},css:{bm:"*,*:before,*:after{-moz-box-sizing:&-box;-webkit-box-sizing:&-box;box-sizing:&-box}",n:"html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}",r:"html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}table{border-collapse:collapse;border-spacing:0}body{-webkit-text-size-adjust:none}",gc:function(e){return".\\31 2u"+e+",.\\31 2u\\24"+e+"{width:100%;clear:none;margin-left:0}.\\31 1u"+e+",.\\31 1u\\24"+e+"{width:91.6666666667%;clear:none;margin-left:0}.\\31 0u"+e+",.\\31 0u\\24"+e+"{width:83.3333333333%;clear:none;margin-left:0}.\\39 u"+e+",.\\39 u\\24"+e+"{width:75%;clear:none;margin-left:0}.\\38 u"+e+",.\\38 u\\24"+e+"{width:66.6666666667%;clear:none;margin-left:0}.\\37 u"+e+",.\\37 u\\24"+e+"{width:58.3333333333%;clear:none;margin-left:0}.\\36 u"+e+",.\\36 u\\24"+e+"{width:50%;clear:none;margin-left:0}.\\35 u"+e+",.\\35 u\\24"+e+"{width:41.6666666667%;clear:none;margin-left:0}.\\34 u"+e+",.\\34 u\\24"+e+"{width:33.3333333333%;clear:none;margin-left:0}.\\33 u"+e+",.\\33 u\\24"+e+"{width:25%;clear:none;margin-left:0}.\\32 u"+e+",.\\32 u\\24"+e+"{width:16.6666666667%;clear:none;margin-left:0}.\\31 u"+e+",.\\31 u\\24"+e+"{width:8.3333333333%;clear:none;margin-left:0}.\\31 2u\\24"+e+"+*,.\\31 1u\\24"+e+"+*,.\\31 0u\\24"+e+"+*,.\\39 u\\24"+e+"+*,.\\38 u\\24"+e+"+*,.\\37 u\\24"+e+"+*,.\\36 u\\24"+e+"+*,.\\35 u\\24"+e+"+*,.\\34 u\\24"+e+"+*,.\\33 u\\24"+e+"+*,.\\32 u\\24"+e+"+*,.\\31 u\\24"+e+"+*{clear:left;}.\\-11u"+e+"{margin-left:91.6666666667%}.\\-10u"+e+"{margin-left:83.3333333333%}.\\-9u"+e+"{margin-left:75%}.\\-8u"+e+"{margin-left:66.6666666667%}.\\-7u"+e+"{margin-left:58.3333333333%}.\\-6u"+e+"{margin-left:50%}.\\-5u"+e+"{margin-left:41.6666666667%}.\\-4u"+e+"{margin-left:33.3333333333%}.\\-3u"+e+"{margin-left:25%}.\\-2u"+e+"{margin-left:16.6666666667%}.\\-1u"+e+"{margin-left:8.3333333333%}"}},gridLevelMap:{k:{},v:{}},gridLevelMax:1,stateConfigs:{},applyGridTransforms:function(){var n,i,r=t.stateConfigs[e.stateId],o="_skel_important",a=[];for(n=1;n<=t.gridLevelMax;n++)i=document.querySelectorAll(".important\\28 "+t.gridLevelMap.k[n]+"\\29"),e.iterate(i,function(e){a.push(i[e])});e.iterate(a,function(e){if("length"!==e){var n,i,s,l=a[e],d=l.parentNode,g=!1;if(d)if(Object.prototype.hasOwnProperty.call(l,o)&&l[o]!==!1){if(n=l[o].placeholder,g=l[o].mode,"l"==g&&l[o].level<=r.grid.level)return;d.insertBefore(l,n.nextSibling),l[o]=!1}else{if(l.className.match(/important\((.+)\)/)&&(s=parseInt(t.gridLevelMap.v[RegExp.$1]))<=r.grid.level&&(g="l"),!g)return;for(i="previousSibling",n=l[i];n&&"#text"==n.nodeName;)n=n[i];if(!n)return;d.insertBefore(l,d.firstChild),l[o]={placeholder:n,mode:g,level:s}}}})},init:function(n){e.extend(t.config,n),e.addStateHandler("layout",t.stateHandler);var i={};e.iterate(e.obj.breakpoints,function(n){i[n]={},n in t.config.breakpoints&&e.extend(i[n],t.config.breakpoints[n])}),t.config.breakpoints=i,t.config.containers&&t.config.containers===!0&&(t.config.containers=960),t.config.grid&&(t.config.grid===!0&&(t.config.grid={level:1,gutters:40}),e.iterate(t.config.breakpoints,function(e){var n=t.config.breakpoints[e];t.gridLevelMax++,"grid"in n||(n.grid={}),n.grid.level=t.gridLevelMax,t.gridLevelMap.k[t.gridLevelMax]=e,t.gridLevelMap.v[e]=t.gridLevelMax}),e.on("change",function(){t.applyGridTransforms()}));var r="";switch(t.config.reset){case"full":r+=t.css.r;break;case"normalize":r+=t.css.n}return t.config.boxModel&&(r+=t.css.bm.split("&").join(t.config.boxModel)),t.config.grid&&(r+='.row{border-bottom:solid 1px transparent;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.row>*{float:left;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.row:after,.row:before{content:"";display:block;clear:both;height:0}.row.uniform>*>:first-child{margin-top:0}.row.uniform>*>:last-child{margin-bottom:0}'+t.css.gc("")),""!=r&&e.attach(e.newAttachment("sB",e.newStyle(r),2,!0)),t.config.href&&e.attach(e.newAttachment("ss",t.newStyleSheet(t.config.href),3,!0)),e},newStyleSheet:function(e){var t=document.createElement("link");return t.rel="stylesheet",t.type="text/css",t.href=e,t},parseMeasurement:function(e){var t,n;if("string"!=typeof e)t=[e,"px"];else if("fluid"==e)t=[100,"%"];else{var n;n=e.match(/([0-9\.]+)([^\s]*)/),t=n.length<3||!n[2]?[parseFloat(e),"px"]:[parseFloat(n[1]),n[2]]}return t},stateHandler:function(){var n,i,r,o,a,s,l,d,g,u,c,p,f=[];if(n=e.generateStateConfig({containers:t.config.containers,grid:t.config.grid},t.config.breakpoints),t.config.grid&&"gutters"in n.grid&&!e.isArray(n.grid.gutters)&&(n.grid.gutters=[n.grid.gutters,0]),t.config.containers){var m=!1;i=t.parseMeasurement(n.containers),g=i[0],u=i[1],a="sC-"+g+u,"!"==u.substr(-1)&&(m=!0,u=u.substr(0,u.length-1)),(o=e.attachment(a))||(o=e.newAttachment(a,e.newStyle(".container{margin-left:auto;margin-right:auto;width:"+1*g+u+(m?"!important;max-width:none!important;min-width:0!important}":"}.container.\\31 25\\25{width:100%;max-width:"+1.25*g+u+";min-width:"+g+u+"}.container.\\37 5\\25{width:"+.75*g+u+"}.container.\\35 0\\25{width:"+.5*g+u+"}.container.\\32 5\\25{width:"+.25*g+u+"}")),2)),f.push(o)}if(t.config.grid&&(a="sG-"+n.grid.gutters[0]+"-"+n.grid.gutters[1],(o=e.attachment(a))||(i=t.parseMeasurement(n.grid.gutters[0]),g=i[0],u=i[1],i=t.parseMeasurement(n.grid.gutters[1]),c=i[0],p=i[1],o=e.newAttachment(a,e.newStyle(".row>*{padding:"+1*c+p+" 0 0 "+1*g+u+"}.row{margin:"+-1*c+p+" 0 -1px "+-1*g+u+"}.row.uniform>*{padding:"+1*g+u+" 0 0 "+1*g+u+"}.row.uniform{margin:"+-1*g+u+" 0 -1px "+-1*g+u+"}.row.\\32 00\\25>*{padding:"+2*c+p+" 0 0 "+2*g+u+"}.row.\\32 00\\25{margin:"+-2*c+p+" 0 -1px "+-2*g+u+"}.row.uniform.\\32 00\\25>*{padding:"+2*g+u+" 0 0 "+2*g+u+"}.row.uniform.\\32 00\\25{margin:"+-2*g+u+" 0 -1px "+-2*g+u+"}.row.\\31 50\\25>*{padding:"+1.5*c+p+" 0 0 "+1.5*g+u+"}.row.\\31 50\\25{margin:"+-1.5*c+p+" 0 -1px "+-1.5*g+u+"}.row.uniform.\\31 50\\25>*{padding:"+1.5*g+u+" 0 0 "+1.5*g+u+"}.row.uniform.\\31 50\\25{margin:"+-1.5*g+u+" 0 -1px "+-1.5*g+u+"}.row.\\35 0\\25>*{padding:"+.5*c+p+" 0 0 "+.5*g+u+"}.row.\\35 0\\25{margin:"+c*-.5+p+" 0 -1px "+g*-.5+u+"}.row.uniform.\\35 0\\25>*{padding:"+.5*g+u+" 0 0 "+.5*g+u+"}.row.uniform.\\35 0\\25{margin:"+g*-.5+u+" 0 -1px "+g*-.5+u+"}.row.\\32 5\\25>*{padding:"+.25*c+p+" 0 0 "+.25*g+u+"}.row.\\32 5\\25{margin:"+c*-.25+p+" 0 -1px "+g*-.25+u+"}.row.uniform.\\32 5\\25>*{padding:"+.25*g+u+" 0 0 "+.25*g+u+"}.row.uniform.\\32 5\\25{margin:"+g*-.25+u+" 0 -1px "+g*-.25+u+"}.row.\\30 \\25>*{padding:0}.row.\\30 \\25{margin:0 0 -1px 0}"),3)),f.push(o),n.grid.level>1)){if(a="sgR-"+n.grid.level,!(o=e.attachment(a))){for(l="",r=2;r<=n.grid.level;r++)l+=t.css.gc("\\28 "+t.gridLevelMap.k[r]+"\\29");o=e.newAttachment(a,e.newStyle(l),4)}f.push(o)}return t.config.conditionals&&(a="sCd-"+e.stateId,(o=e.attachment(a))||(l=[],d=[],e.iterate(e.obj.breakpoints,function(t){-1!==e.indexOf(e.breakpointIds,t)?l.push(".not-"+t):d.push(".only-"+t)}),s=(l.length>0?l.join(",")+"{display:none!important}":"")+(d.length>0?d.join(",")+"{display:none!important}":""),o=e.newAttachment(a,e.newStyle(s.replace(/\.([0-9])/,".\\3$1 ")),5)),f.push(o)),r=6,i=e.breakpointIds,e.iterate(i,function(n){i[n]in t.config.breakpoints&&t.config.breakpoints[i[n]].href&&(a="ss-"+i[n]+"-"+e.stateId,(o=e.attachment(a))||(o=e.newAttachment(a,t.newStyleSheet(t.config.breakpoints[i[n]].href),r++)),f.push(o))}),t.stateConfigs[e.stateId]=n,f}};e.layout=t.init}(skel);