All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.bsf.js.respond.js Maven / Gradle / Ivy

The newest version!
/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */
/*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */
window.matchMedia=window.matchMedia||function(a){var c,d=a.documentElement,e=d.firstElementChild||d.firstChild,f=a.createElement("body"),g=a.createElement("div");return g.id="mq-test-1",g.style.cssText="position:absolute;top:-100em",f.style.background="none",f.appendChild(g),function(b){return g.innerHTML='­',d.insertBefore(f,e),c=42===g.offsetWidth,d.removeChild(f),{matches:c,media:b}}}(document);
/*! Respond.js v1.3.0: min/max-width media query polyfill. (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs  */
(function(a){function o(){w(!0)}var b={};if(a.respond=b,b.update=function(){},b.mediaQueriesSupported=a.matchMedia&&a.matchMedia("only all").matches,!b.mediaQueriesSupported){var s,t,v,c=a.document,d=c.documentElement,e=[],f=[],g=[],h={},i=30,j=c.getElementsByTagName("head")[0]||d,k=c.getElementsByTagName("base")[0],m=j.getElementsByTagName("link"),n=[],p=function(){for(var y=0;m.length>y;y++){var z=m[y],A=z.href,B=z.media,C=z.rel&&"stylesheet"===z.rel.toLowerCase();A&&C&&!h[A]&&(z.styleSheet&&z.styleSheet.rawCssText?(r(z.styleSheet.rawCssText,A,B),h[A]=!0):(!/^([a-zA-Z:]*\/\/)/.test(A)&&!k||A.replace(RegExp.$1,"").split("/")[0]===a.location.host)&&n.push({href:A,media:B}))}q()},q=function(){if(n.length){var y=n.shift();x(y.href,function(z){r(z,y.href,y.media),h[y.href]=!0,a.setTimeout(function(){q()},0)})}},r=function(B,C,F){var G=B.match(/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi),H=G&&G.length||0;C=C.substring(0,C.lastIndexOf("/"));var I=function(L){return L.replace(/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,"$1"+C+"$2$3")},J=!H&&F;C.length&&(C+="/"),J&&(H=1);for(var K=0;H>K;K++){var y,z,A,D;J?(y=F,f.push(I(B))):(y=G[K].match(/@media *([^\{]+)\{([\S\s]+?)$/)&&RegExp.$1,f.push(RegExp.$2&&I(RegExp.$2))),A=y.split(","),D=A.length;for(var E=0;D>E;E++){z=A[E],e.push({media:z.split("(")[0].match(/(only\s+)?([a-zA-Z]+)\s?/)&&RegExp.$2||"all",rules:f.length-1,hasquery:z.indexOf("(")>-1,minw:z.match(/\(\s*min\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:z.match(/\(\s*max\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}}w()},u=function(){var A,B=c.createElement("div"),y=c.body,z=!1;return B.style.cssText="position:absolute;font-size:1em;width:1em",y||(y=z=c.createElement("body"),y.style.background="none"),y.appendChild(B),d.insertBefore(y,d.firstChild),A=B.offsetWidth,z?d.removeChild(y):y.removeChild(B),A=v=parseFloat(A)},w=function(y){var z="clientWidth",A=d[z],B="CSS1Compat"===c.compatMode&&A||c.body[z]||A,C={},D=m[m.length-1],E=(new Date).getTime();if(y&&s&&i>E-s){return a.clearTimeout(t),t=a.setTimeout(w,i),void 0}s=E;for(var L in e){if(e.hasOwnProperty(L)){var M=e[L],N=M.minw,O=M.maxw,P=null===N,F=null===O,G="em";N&&(N=parseFloat(N)*(N.indexOf(G)>-1?v||u():1)),O&&(O=parseFloat(O)*(O.indexOf(G)>-1?v||u():1)),M.hasquery&&(P&&F||!(P||B>=N)||!(F||O>=B))||(C[M.media]||(C[M.media]=[]),C[M.media].push(f[M.rules]))}}for(var H in g){g.hasOwnProperty(H)&&g[H]&&g[H].parentNode===j&&j.removeChild(g[H])}for(var I in C){if(C.hasOwnProperty(I)){var J=c.createElement("style"),K=C[I].join("\n");J.type="text/css",J.media=I,j.insertBefore(J,D.nextSibling),J.styleSheet?J.styleSheet.cssText=K:J.appendChild(c.createTextNode(K)),g.push(J)}}},x=function(z,A){var y=l();y&&(y.open("GET",z,!0),y.onreadystatechange=function(){4!==y.readyState||200!==y.status&&304!==y.status||A(y.responseText)},4!==y.readyState&&y.send(null))},l=function(){var y=!1;try{y=new a.XMLHttpRequest}catch(z){y=new a.ActiveXObject("Microsoft.XMLHTTP")}return function(){return y}}();p(),b.update=p,a.addEventListener?a.addEventListener("resize",o,!1):a.attachEvent&&a.attachEvent("onresize",o)}})(this);




© 2015 - 2024 Weber Informatics LLC | Privacy Policy