agenda-libre-ruby/public/webshims/1.15.10/shims/picture.js

7 lines
16 KiB
JavaScript
Raw Normal View History

/*! Respimg - Responsive Images that work today.
* Author: Alexander Farkas, 2014
* Author: Scott Jehl, Filament Group, 2012 ( new proposal implemented by Shawn Jansepar )
* License: MIT
* Spec: http://picture.responsiveimages.org/
*/
!function(a,b,c){"use strict";function d(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function e(){var b;T=!1,W=a.devicePixelRatio,U={},V={},b=(W||1)*E.xQuant,E.uT||(E.maxX=Math.max(1.3,E.maxX),b=Math.min(b,E.maxX),w.DPR=b),X.width=Math.max(a.innerWidth||0,C.clientWidth),X.height=Math.max(a.innerHeight||0,C.clientHeight),X.vw=X.width/100,X.vh=X.height/100,X.em=w.getEmValue(),X.rem=X.em,o=E.lazyFactor/2,o=o*b+o,q=.4+.1*b,l=.5+.2*b,m=.5+.25*b,p=b+1.3,(n=X.width>X.height)||(o*=.9),J&&(o*=.9),v=[X.width,X.height,b].join("-")}function f(a,b,c){var d=b*Math.pow(a-.4,1.9);return n||(d/=1.3),a+=d,a>c}function g(a){var b,c=w.getSet(a),d=!1;"pending"!=c&&(d=v,c&&(b=w.setRes(c),d=w.applySetCandidate(b,a))),a[w.ns].evaled=d}function h(a,b){return a.res-b.res}function i(a,b,c){var d;return!c&&b&&(c=a[w.ns].sets,c=c&&c[c.length-1]),d=j(b,c),d&&(b=w.makeUrl(b),a[w.ns].curSrc=b,a[w.ns].curCan=d,d.res||cb(d,d.set.sizes)),d}function j(a,b){var c,d,e;if(a&&b)for(e=w.parseSet(b),a=w.makeUrl(a),c=0;c<e.length;c++)if(a==w.makeUrl(e[c].url)){d=e[c];break}return d}function k(a,c){var d,e,f,g,h=a.getElementsByTagName("source");for(d=0,e=h.length;e>d;d++)f=h[d],f[w.ns]=!0,g=f.getAttribute("srcset"),RIDEBUG&&9!=b.documentMode&&f.parentNode!=a&&r("all source elements have to be a child of the picture element. For IE9 support wrap them in an audio/video element, BUT with conditional comments"),g&&c.push({srcset:g,media:f.getAttribute("media"),type:f.getAttribute("type"),sizes:f.getAttribute("sizes")}),RIDEBUG&&f.getAttribute("src")&&r("`src` on `source` invalid, use `srcset`.");if(RIDEBUG){var i=w.qsa(a,"source, img");"SOURCE"==i[i.length-1].nodeName.toUpperCase()&&r("all sources inside picture have to precede the img element")}}"undefined"==typeof RIDEBUG&&(a.RIDEBUG=!0);var l,m,n,o,p,q,r,s,t,u,v,w={},x=function(){},y=b.createElement("img"),z=y.getAttribute,A=y.setAttribute,B=y.removeAttribute,C=b.documentElement,D={},E={xQuant:1,lazyFactor:.4,maxX:2},F="data-risrc",G=F+"set",H="webkitBackfaceVisibility"in C.style,I=navigator.userAgent,J=/rident/.test(I)||/ecko/.test(I)&&I.match(/rv\:(\d+)/)&&RegExp.$1>35,K="currentSrc",L=/\s+\+?\d+(e\d+)?w/,M=/((?:\([^)]+\)(?:\s*and\s*|\s*or\s*|\s*not\s*)?)+)?\s*(.+)/,N=/^([\+eE\d\.]+)(w|x)$/,O=/\s*\d+h\s*/,P=a.respimgCFG,Q="https:"==location.protocol,R="position:absolute;left:0;visibility:hidden;display:block;padding:0;border:none;font-size:1em;width:1em;overflow:hidden;clip:rect(0px, 0px, 0px, 0px)",S="font-size:100%!important;",T=!0,U={},V={},W=a.devicePixelRatio,X={px:1,"in":96},Y=b.createElement("a"),Z=!1,$=function(a,b,c,d){a.addEventListener?a.addEventListener(b,c,d||!1):a.attachEvent&&a.attachEvent("on"+b,c)},_=function(a,b,c,d){a.removeEventListener?a.removeEventListener(b,c,d||!1):a.detachEvent&&a.detachEvent("on"+b,c)},ab=function(a){var b={};return function(c){return c in b||(b[c]=a(c)),b[c]}},bb=function(){var a=/^([\d\.]+)(em|vw|px)$/,b=function(){for(var a=arguments,b=0,c=a[0];++b in a;)c=c.replace(a[b],a[++b]);return c},c=ab(function(a){return"return "+b((a||"").toLowerCase(),/\band\b/g,"&&",/,/g,"||",/min-([a-z-\s]+):/g,"e.$1>=",/max-([a-z-\s]+):/g,"e.$1<=",/calc([^)]+)/g,"($1)",/(\d+[\.]*[\d]*)([a-z]+)/g,"($1 * e.$2)",/^(?!(e.[a-z]|[0-9\.&=|><\+\-\*\(\)\/])).*/gi,"")});return function(b,d){var e;if(!(b in U))if(U[b]=!1,d&&(e=b.match(a)))U[b]=e[1]*X[e[2]];else try{U[b]=new Function("e",c(b))(X)}catch(f){}return U[b]}}(),cb=function(a,b){return a.w?(a.cWidth=w.calcListLength(b||"100vw"),a.res=a.w/a.cWidth):a.res=a.x,a},db=function(c){var d,e,f,g=c||{};if(g.elements&&1==g.elements.nodeType&&("IMG"==g.elements.nodeName.toUpperCase()?g.elements=[g.elements]:(g.context=g.elements,g.elements=null)),g.reparse&&(g.reevaluate=!0,a.console&&console.warn&&console.warn("reparse was renamed to reevaluate!")),d=g.elements||w.qsa(g.context||b,g.reevaluate||g.reselect?w.sel:w.selShort),f=d.length){for(w.setupRun(g),Z=!0,e=0;f>e;e++)w.fillImg(d[e],g);w.teardownRun(g)}},eb=ab(function(a){var b=[1,"x"],c=d(a||"");return c&&(c=c.replace(O,""),c.match(N)?(b=[1*RegExp.$1,RegExp.$2],RIDEBUG&&(b[0]<0||isNaN(b[0]