File: respond.min.js

package info (click to toggle)
r-cran-shiny 1.5.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 8,224 kB
  • sloc: javascript: 17,081; sh: 28; makefile: 21
file content (9 lines) | stat: -rw-r--r-- 4,433 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
(function(c){c.matchMedia=c.matchMedia||function(c,e){var h,r=c.documentElement,t=r.firstElementChild||r.firstChild,m=c.createElement("body"),f=c.createElement("div");f.id="mq-test-1";f.style.cssText="position:absolute;top:-100em";m.style.background="none";m.appendChild(f);return function(c){f.innerHTML='&shy;<style media="'+c+'"> #mq-test-1 { width: 42px; }</style>';r.insertBefore(m,t);h=42===f.offsetWidth;r.removeChild(m);return{matches:h,media:c}}}(c.document)})(this);
(function(c){function D(){y(!0)}var e={};c.respond=e;e.update=function(){};var h=[],r=function(){var d=!1;try{d=new c.XMLHttpRequest}catch(b){d=new c.ActiveXObject("Microsoft.XMLHTTP")}return function(){return d}}(),t=function(d,b){var a=r();a&&(a.open("GET",d,!0),a.onreadystatechange=function(){4!==a.readyState||200!==a.status&&304!==a.status||b(a.responseText)},4!==a.readyState&&a.send(null))},m=function(d){return d.replace(e.regex.minmaxwh,"").match(e.regex.other)};e.ajax=t;e.queue=h;e.unsupportedmq=
m;e.regex={media:/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,keyframes:/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,comments:/\/\*[^*]*\*+([^/][^*]*\*+)*\//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*\)/,minmaxwh:/\(\s*m(in|ax)\-(height|width)\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/gi,
other:/\([^\)]*\)/g};e.mediaQueriesSupported=c.matchMedia&&null!==c.matchMedia("only all")&&c.matchMedia("only all").matches;if(!e.mediaQueriesSupported){var f=c.document,k=f.documentElement,u=[],v=[],n=[],z={},w=f.getElementsByTagName("head")[0]||k,I=f.getElementsByTagName("base")[0],x=w.getElementsByTagName("link"),A,E,B,C=function(){var d,b=f.createElement("div"),a=f.body,c=k.style.fontSize,e=a&&a.style.fontSize,g=!1;b.style.cssText="position:absolute;font-size:1em;width:1em";a||(a=g=f.createElement("body"),
a.style.background="none");k.style.fontSize="100%";a.style.fontSize="100%";a.appendChild(b);g&&k.insertBefore(a,k.firstChild);d=b.offsetWidth;g?k.removeChild(a):a.removeChild(b);k.style.fontSize=c;e&&(a.style.fontSize=e);return d=B=parseFloat(d)},y=function(d){var b=k.clientWidth,a="CSS1Compat"===f.compatMode&&b||f.body.clientWidth||b,b={},e=x[x.length-1],q=(new Date).getTime();if(d&&A&&30>q-A)c.clearTimeout(E),E=c.setTimeout(y,30);else{A=q;for(var g in u)if(u.hasOwnProperty(g)){d=u[g];var q=d.minw,
s=d.maxw,l=null===q,h=null===s;q&&(q=parseFloat(q)*(-1<q.indexOf("em")?B||C():1));s&&(s=parseFloat(s)*(-1<s.indexOf("em")?B||C():1));if(!d.hasquery||(!l||!h)&&(l||a>=q)&&(h||a<=s))b[d.media]||(b[d.media]=[]),b[d.media].push(v[d.rules])}for(var p in n)n.hasOwnProperty(p)&&n[p]&&n[p].parentNode===w&&w.removeChild(n[p]);n.length=0;for(var m in b)b.hasOwnProperty(m)&&(g=f.createElement("style"),p=b[m].join("\n"),g.type="text/css",g.media=m,w.insertBefore(g,e.nextSibling),g.styleSheet?g.styleSheet.cssText=
p:g.appendChild(f.createTextNode(p)),n.push(g))}},F=function(d,b,a){var c=d.replace(e.regex.comments,"").replace(e.regex.keyframes,"").match(e.regex.media),f=c&&c.length||0;b=b.substring(0,b.lastIndexOf("/"));var g=!f&&a;b.length&&(b+="/");g&&(f=1);for(var h=0;h<f;h++){var l,k,p;g?(l=a,v.push(d.replace(e.regex.urls,"$1"+b+"$2$3"))):(l=c[h].match(e.regex.findStyles)&&RegExp.$1,v.push(RegExp.$2&&RegExp.$2.replace(e.regex.urls,"$1"+b+"$2$3")));k=l.split(",");p=k.length;for(var n=0;n<p;n++)l=k[n],m(l)||
u.push({media:l.split("(")[0].match(e.regex.only)&&RegExp.$2||"all",rules:v.length-1,hasquery:-1<l.indexOf("("),minw:l.match(e.regex.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:l.match(e.regex.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}y()},G=function(){if(h.length){var d=h.shift();t(d.href,function(b){F(b,d.href,d.media);z[d.href]=!0;c.setTimeout(function(){G()},0)})}},H=function(){for(var d=0;d<x.length;d++){var b=x[d],a=b.href,e=b.media,f=b.rel&&"stylesheet"===b.rel.toLowerCase();if(a&&
f&&!z[a])if(b.styleSheet&&b.styleSheet.rawCssText)F(b.styleSheet.rawCssText,a,e),z[a]=!0;else if(!/^([a-zA-Z:]*\/\/)/.test(a)&&!I||a.replace(RegExp.$1,"").split("/")[0]===c.location.host)"//"===a.substring(0,2)&&(a=c.location.protocol+a),h.push({href:a,media:e})}G()};H();e.update=H;e.getEmValue=C;c.addEventListener?c.addEventListener("resize",D,!1):c.attachEvent&&c.attachEvent("onresize",D)}})(this);