formstone
Version:
Library of modular front end components.
1 lines • 5.15 kB
JavaScript
!function(e,t,n){function o(e,t){return typeof e===t}function r(e){var t=S.className,n=v._config.classPrefix||"";if(w&&(t=t.baseVal),v._config.enableJSClass){var o=new RegExp("(^|\\s)"+n+"no-js(\\s|$)");t=t.replace(o,"$1"+n+"js$2")}v._config.enableClasses&&(t+=" "+n+e.join(" "+n),w?S.className.baseVal=t:S.className=t)}function s(e,t){if("object"==typeof e)for(var n in e)g(e,n)&&s(n,e[n]);else{var o=(e=e.toLowerCase()).split("."),i=v[o[0]];if(2==o.length&&(i=i[o[1]]),void 0!==i)return v;t="function"==typeof t?t():t,1==o.length?v[o[0]]=t:(!v[o[0]]||v[o[0]]instanceof Boolean||(v[o[0]]=new Boolean(v[o[0]])),v[o[0]][o[1]]=t),r([(t&&0!=t?"":"no-")+o.join("-")]),v._trigger(e,t)}return v}function i(e,t){return!!~(""+e).indexOf(t)}function l(){return"function"!=typeof t.createElement?t.createElement(arguments[0]):w?t.createElementNS.call(t,"http://www.w3.org/2000/svg",arguments[0]):t.createElement.apply(t,arguments)}function a(){var e=t.body;return e||((e=l(w?"svg":"body")).fake=!0),e}function u(e,n,o,r){var s,i,u,f,c="modernizr",p=l("div"),d=a();if(parseInt(o,10))for(;o--;)(u=l("div")).id=r?r[o]:c+(o+1),p.appendChild(u);return s=l("style"),s.type="text/css",s.id="s"+c,(d.fake?d:p).appendChild(s),d.appendChild(p),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(t.createTextNode(e)),p.id=c,d.fake&&(d.style.background="",d.style.overflow="hidden",f=S.style.overflow,S.style.overflow="hidden",S.appendChild(d)),i=n(p,e),d.fake?(d.parentNode.removeChild(d),S.style.overflow=f,S.offsetHeight):p.parentNode.removeChild(p),!!i}function f(e){return e.replace(/([A-Z])/g,function(e,t){return"-"+t.toLowerCase()}).replace(/^ms-/,"-ms-")}function c(t,n,o){var r;if("getComputedStyle"in e){r=getComputedStyle.call(e,t,n);var s=e.console;null!==r?o&&(r=r.getPropertyValue(o)):s&&s[s.error?"error":"log"].call(s,"getComputedStyle returning null, its possible modernizr test results are inaccurate")}else r=!n&&t.currentStyle&&t.currentStyle[o];return r}function p(t,o){var r=t.length;if("CSS"in e&&"supports"in e.CSS){for(;r--;)if(e.CSS.supports(f(t[r]),o))return!0;return!1}if("CSSSupportsRule"in e){for(var s=[];r--;)s.push("("+f(t[r])+":"+o+")");return s=s.join(" or "),u("@supports ("+s+") { #modernizr { position: absolute; } }",function(e){return"absolute"==c(e,null,"position")})}return n}function d(e){return e.replace(/([a-z])-([a-z])/g,function(e,t,n){return t+n.toUpperCase()}).replace(/^-/,"")}function h(e,t,r,s){function a(){f&&(delete T.style,delete T.modElem)}if(s=!o(s,"undefined")&&s,!o(r,"undefined")){var u=p(e,r);if(!o(u,"undefined"))return u}for(var f,c,h,m,y,v=["modernizr","tspan","samp"];!T.style&&v.length;)f=!0,T.modElem=l(v.shift()),T.style=T.modElem.style;for(h=e.length,c=0;c<h;c++)if(m=e[c],y=T.style[m],i(m,"-")&&(m=d(m)),T.style[m]!==n){if(s||o(r,"undefined"))return a(),"pfx"!=t||m;try{T.style[m]=r}catch(e){}if(T.style[m]!=y)return a(),"pfx"!=t||m}return a(),!1}var m=[],y={_version:"3.6.0",_config:{classPrefix:"",enableClasses:!0,enableJSClass:!0,usePrefixes:!0},_q:[],on:function(e,t){var n=this;setTimeout(function(){t(n[e])},0)},addTest:function(e,t,n){m.push({name:e,fn:t,options:n})},addAsyncTest:function(e){m.push({name:null,fn:e})}},v=function(){};v.prototype=y,v=new v;var g,C=[],S=t.documentElement,w="svg"===S.nodeName.toLowerCase();!function(){var e={}.hasOwnProperty;g=o(e,"undefined")||o(e.call,"undefined")?function(e,t){return t in e&&o(e.constructor.prototype[t],"undefined")}:function(t,n){return e.call(t,n)}}(),y._l={},y.on=function(e,t){this._l[e]||(this._l[e]=[]),this._l[e].push(t),v.hasOwnProperty(e)&&setTimeout(function(){v._trigger(e,v[e])},0)},y._trigger=function(e,t){if(this._l[e]){var n=this._l[e];setTimeout(function(){var e;for(e=0;e<n.length;e++)(0,n[e])(t)},0),delete this._l[e]}},v._q.push(function(){y.addTest=s});var _={elem:l("modernizr")};v._q.push(function(){delete _.elem});var T={style:_.elem.style};v._q.unshift(function(){delete T.style});y.testProp=function(e,t,o){return h([e],n,t,o)};var b=y._config.usePrefixes?" -webkit- -moz- -o- -ms- ".split(" "):["",""];y._prefixes=b;var x=y.testStyles=u;v.addTest("touchevents",function(){var n;if("ontouchstart"in e||e.DocumentTouch&&t instanceof DocumentTouch)n=!0;else{var o=["@media (",b.join("touch-enabled),("),"heartz",")","{#modernizr{top:9px;position:absolute}}"].join("");x(o,function(e){n=9===e.offsetTop})}return n}),v.addTest("opacity",function(){var e=l("a").style;return e.cssText=b.join("opacity:.55;"),/^0.55$/.test(e.opacity)});var z="CSS"in e&&"supports"in e.CSS,j="supportsCSS"in e;v.addTest("supports",z||j),function(){var e,t,n,r,s,i;for(var l in m)if(m.hasOwnProperty(l)){if(e=[],(t=m[l]).name&&(e.push(t.name.toLowerCase()),t.options&&t.options.aliases&&t.options.aliases.length))for(n=0;n<t.options.aliases.length;n++)e.push(t.options.aliases[n].toLowerCase());for(r=o(t.fn,"function")?t.fn():t.fn,s=0;s<e.length;s++)1===(i=e[s].split(".")).length?v[i[0]]=r:(!v[i[0]]||v[i[0]]instanceof Boolean||(v[i[0]]=new Boolean(v[i[0]])),v[i[0]][i[1]]=r),C.push((r?"":"no-")+i.join("-"))}}(),r(C),delete y.addTest,delete y.addAsyncTest;for(var E=0;E<v._q.length;E++)v._q[E]();e.Modernizr=v}(window,document);