1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/webtrees_ynh.git synced 2024-09-03 18:26:37 +02:00
webtrees_ynh/sources/packages/respond-1.4.2/respond.min.js

1 line
4.1 KiB
JavaScript
Raw Normal View History

!function(a){a.matchMedia=a.matchMedia||function(j){var i,g=j.documentElement,d=g.firstElementChild||g.firstChild,f=j.createElement("body"),b=j.createElement("div");return b.id="mq-test-1",b.style.cssText="position:absolute;top:-100em",f.style.background="none",f.appendChild(b),function(e){return b.innerHTML='&shy;<style media="'+e+'"> #mq-test-1 { width: 42px; }</style>',g.insertBefore(f,d),i=42===b.offsetWidth,g.removeChild(f),{matches:i,media:e}}}(a.document)}(this);(function(T){function K(){d(!0)}var S={};T.respond=S;S.update=function(){};var Q=[],i=function(){var e=!1;try{e=new T.XMLHttpRequest}catch(c){e=new T.ActiveXObject("Microsoft.XMLHTTP")}return function(){return e}}(),P=function(f,c){var e=i();e&&(e.open("GET",f,!0),e.onreadystatechange=function(){4!==e.readyState||200!==e.status&&304!==e.status||c(e.responseText)},4!==e.readyState&&e.send(null))};if(S.ajax=P,S.queue=Q,S.regex={media:/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,keyframes:/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\([\s]*min\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/,maxw:/\([\s]*max\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/},S.mediaQueriesSupported=T.matchMedia&&null!==T.matchMedia("only all")&&T.matchMedia("only all").matches,!S.mediaQueriesSupported){var O,J,b,R=T.document,N=R.documentElement,I=[],D=[],L=[],a={},p=R.getElementsByTagName("head")[0]||N,g=R.getElementsByTagName("base")[0],l=p.getElementsByTagName("link"),M=function(){var n,f=R.createElement("div"),h=R.body,q=N.style.fontSize,m=h&&h.style.fontSize,k=!1;return f.style.cssText="position:absolute;font-size:1em;width:1em",h||(h=k=R.createElement("body"),h.style.background="none"),N.style.fontSize="100%",h.style.fontSize="100%",h.appendChild(f),k&&N.insertBefore(h,N.firstChild),n=f.offsetWidth,k?N.removeChild(h):h.removeChild(f),N.style.fontSize=q,m&&(h.style.fontSize=m),b=parseFloat(n)},d=function(v){var w=N.clientWidth,x="CSS1Compat"===R.compatMode&&w||R.body.clientWidth||w,w={},u=l[l.length-1],n=(new Date).getTime();if(v&&O&&30>n-O){return T.clearTimeout(J),J=T.setTimeout(d,30),void 0}O=n;for(var t in I){if(I.hasOwnProperty(t)){v=I[t];var n=v.minw,f=v.maxw,s=null===n,c=null===f;n&&(n=parseFloat(n)*(-1<n.indexOf("em")?b||M():1));f&&(f=parseFloat(f)*(-1<f.indexOf("em")?b||M():1));v.hasquery&&(s&&c||!(s||x>=n)||!(c||f>=x))||(w[v.media]||(w[v.media]=[]),w[v.media].push(D[v.rules]))}}for(var m in L){L.hasOwnProperty(m)&&L[m]&&L[m].parentNode===p&&p.removeChild(L[m])}L.length=0;for(var q in w){w.hasOwnProperty(q)&&(t=R.createElement("style"),m=w[q].join("\n"),t.type="text/css",t.media=q,p.insertBefore(t,u.nextSibling),t.styleSheet?t.styleSheet.cssText=m:t.appendChild(R.createTextNode(m)),L.push(t))}},r=function(y,A,B){var z=y.replace(S.regex.keyframes,"").match(S.regex.media),t=z&&z.length||0;A=A.substring(0,A.lastIndexOf("/"));var w=!t&&B;A.length&&(A+="/");w&&(t=1);for(var v=0;t>v;v++){var u,x,e,s;w?(u=B,D.push(y.replace(S.regex.urls,"$1"+A+"$2$3"))):(u=z[v].match(S.regex.findStyles)&&RegExp.$1,D.push(RegExp.$2&&RegExp.$2.replace(S.regex.urls,"$1"+A+"$2$3")));e=u.split(",");s=e.length;for(var q=0;s>q;q++){x=e[q],I.push({media:x.split("(")[0].match(S.regex.only)&&RegExp.$2||"all",rules:D.length-1,hasquery:-1<x.indexOf("("),minw:x.match(S.regex.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:x.match(S.regex.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}}d()},o=function(){if(Q.length){var c=Q.shift();P(c.href,function(e){r(e,c.href,c.media);a[c.href]=!0;T.setTimeout(function(){o()},0)})}},j=function(){for(var n=0;n<l.length;n++){var c=l[n],h=c.href,m=c.media,k=c.rel&&"stylesheet"===c.rel.toLowerCase();h&&k&&!a[h]&&(c.styleSheet&&c.styleSheet.rawCssText?(r(c.styleSheet.rawCssText,h,m),a[h]=!0):(!/^([a-zA-Z:]*\/\/)/.test(h)&&!g||h.replace(RegExp.$1,"").split("/")[0]===T.location.host)&&("//"===h.substring(0,2)&&(h=T.location.protocol+h),Q.push({href:h,media:m})))}o()};j();S.update=j;S.getEmValue=M;T.addEventListen