2 lines
6.3 KiB
JavaScript
2 lines
6.3 KiB
JavaScript
|
/*! UIkit 2.27.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
||
|
!function(t){var i;window.UIkit2&&(i=t(UIkit2)),"function"==typeof define&&define.amd&&define("uikit-grid",["uikit"],function(){return i||t(UIkit2)})}(function(t){"use strict";function i(){function t(t){if(t){if("string"==typeof u[t])return t;t=t.charAt(0).toUpperCase()+t.slice(1);for(var i,e=0,n=h.length;n>e;e++)if(i=h[e]+t,"string"==typeof u[i])return i}}function i(t){var i=parseFloat(t),e=-1===t.indexOf("%")&&!isNaN(i);return e&&i}function e(){}function n(){for(var t={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},i=0,e=c.length;e>i;i++){var n=c[i];t[n]=0}return t}function r(){if(!f){f=!0;var e=window.getComputedStyle;if(s=function(){var t=e?function(t){return e(t,null)}:function(t){return t.currentStyle};return function(i){var e=t(i);return e||l("Style returned "+e+". Are you running this code in a hidden iframe on Firefox? See http://bit.ly/getsizebug1"),e}}(),a=t("boxSizing")){var n=document.createElement("div");n.style.width="200px",n.style.padding="1px 2px 3px 4px",n.style.borderStyle="solid",n.style.borderWidth="1px 2px 3px 4px",n.style[a]="border-box";var r=document.body||document.documentElement;r.appendChild(n);var o=s(n);d=200===i(o.width),r.removeChild(n)}}}function o(t){if(r(),"string"==typeof t&&(t=document.querySelector(t)),t&&"object"==typeof t&&t.nodeType){var e=s(t);if("none"===e.display)return n();var o={};o.width=t.offsetWidth,o.height=t.offsetHeight;for(var h=o.isBorderBox=!(!a||!e[a]||"border-box"!==e[a]),u=0,l=c.length;l>u;u++){var f=c[u],p=e[f],g=parseFloat(p);o[f]=isNaN(g)?0:g}var m=o.paddingLeft+o.paddingRight,v=o.paddingTop+o.paddingBottom,b=o.marginLeft+o.marginRight,y=o.marginTop+o.marginBottom,k=o.borderLeftWidth+o.borderRightWidth,w=o.borderTopWidth+o.borderBottomWidth,x=h&&d,W=i(e.width);W!==!1&&(o.width=W+(x?0:m+k));var $=i(e.height);return $!==!1&&(o.height=$+(x?0:v+w)),o.innerWidth=o.width-(m+k),o.innerHeight=o.height-(v+w),o.outerWidth=o.width+b,o.outerHeight=o.height+y,o}}var s,a,d,h="Webkit Moz ms Ms O".split(" "),u=document.documentElement.style,l="undefined"==typeof console?e:function(t){console.error(t)},c=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],f=!1;return o}function e(t){return i()(t)}t.component("grid",{defaults:{colwidth:"auto",animation:!0,duration:300,gutter:0,controls:!1,filter:!1,origin:t.langdirection},boot:function(){t.ready(function(i){t.$("[data-uk-grid]",i).each(function(){var i=t.$(this);i.data("grid")||t.grid(i,t.Utils.options(i.attr("data-uk-grid")))})})},init:function(){var i=this,e=String(this.options.gutter).trim().split(" ");this.gutterv=parseInt(e[0],10),this.gutterh=parseInt(e[1]||e[0],10),this.element.css({position:"relative"}),this.controls=null,this.origin=this.options.origin,this.options.controls&&(this.controls=t.$(this.options.controls),this.controls.on("click","[data-uk-filter]",function(e){e.preventDefault(),i.filter(t.$(this).attr("data-uk-filter"))}),this.controls.on("click","[data-uk-sort]",function(e){e.preventDefault();var n=t.$(this).attr("data-uk-sort").split(":");i.sort(n[0],n[1])})),t.$win.on("load resize orientationchange",t.Utils.debounce(function(){i.currentfilter?i.filter(i.currentfilter):this.update()}.bind(this),100)),this.on("display.uk.check",function(){i.element.is(":visible")&&i.update()}),t.domObserve(this.element,function(){i.update()}),this.options.filter!==!1?this.filter(this.options.filter):this.update()},_prepareElements:function(){var t,i=this.element.children(":not([data-grid-prepared])");i.length&&(t={position:"absolute",boxSizing:"border-box",width:"auto"==this.options.colwidth?"":this.options.colwidth},this.options.gutter&&(t["padding-"+this.origin]=this.gutterh,t["padding-bottom"]=this.gutterv,this.element.css("margin-"+this.origin,-1*this.gutterh)),i.attr("data-grid-prepared","true").css(t))},update:function(i){var n=this;this._prepareElements(),i=i||this.element.children(":visible");var r,o,s,a,d,h,u,l,c,f=i,p=this.element.width()+2*this.gutterh+
|