/* Modernizr 2.8.3 (Custom Build) | MIT & BSD
* Build: http://modernizr.com/download/#-shiv-cssclasses-load
*/
;window.Modernizr=function(a,b,c){function u(a){j.cssText=a}function v(a,b){return u(prefixes.join(a+";")+(b||""))}function w(a,b){return typeof a===b}function x(a,b){return!!~(""+a).indexOf(b)}function y(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:w(f,"function")?f.bind(d||b):f}return!1}var d="2.8.3",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={}.toString,m={},n={},o={},p=[],q=p.slice,r,s={}.hasOwnProperty,t;!w(s,"undefined")&&!w(s.call,"undefined")?t=function(a,b){return s.call(a,b)}:t=function(a,b){return b in a&&w(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=q.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(q.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(q.call(arguments)))};return e});for(var z in m)t(m,z)&&(r=z.toLowerCase(),e[r]=m[z](),p.push((e[r]?"":"no-")+r));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)t(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},u(""),i=k=null,function(a,b){function l(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x",d.insertBefore(c.lastChild,d.firstChild)}function m(){var a=s.elements;return typeof a=="string"?a.split(" "):a}function n(a){var b=j[a[h]];return b||(b={},i++,a[h]=i,j[i]=b),b}function o(a,c,d){c||(c=b);if(k)return c.createElement(a);d||(d=n(c));var g;return d.cache[a]?g=d.cache[a].cloneNode():f.test(a)?g=(d.cache[a]=d.createElem(a)).cloneNode():g=d.createElem(a),g.canHaveChildren&&!e.test(a)&&!g.tagUrn?d.frag.appendChild(g):g}function p(a,c){a||(a=b);if(k)return a.createDocumentFragment();c=c||n(a);var d=c.frag.cloneNode(),e=0,f=m(),g=f.length;for(;e",g="hidden"in a,k=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){g=!0,k=!0}})();var s={elements:d.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video",version:c,shivCSS:d.shivCSS!==!1,supportsUnknownElements:k,shivMethods:d.shivMethods!==!1,type:"default",shivDocument:r,createElement:o,createDocumentFragment:p};a.html5=s,r(b)}(this,b),e._version=d,g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+p.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f -1 === false && ( parseFloat( length ) > 0 || length.indexOf( "calc(" ) > -1 )) ) {
return false;
}
/**
* If length is specified in `vw` units, use `%` instead since the div we’re measuring
* is injected at the top of the document.
*
* TODO: maybe we should put this behind a feature test for `vw`? The risk of doing this is possible browser inconsistancies with vw vs %
*/
length = length.replace( "vw", "%" );
// Create a cached element for getting length value widths
if ( !pf.lengthEl ) {
pf.lengthEl = doc.createElement( "div" );
// Positioning styles help prevent padding/margin/width on `html` or `body` from throwing calculations off.
pf.lengthEl.style.cssText = "border:0;display:block;font-size:1em;left:0;margin:0;padding:0;position:absolute;visibility:hidden";
// Add a class, so that everyone knows where this element comes from
pf.lengthEl.className = "helper-from-picturefill-js";
}
pf.lengthEl.style.width = "0px";
try {
pf.lengthEl.style.width = length;
} catch ( e ) {}
doc.body.appendChild(pf.lengthEl);
cssValue = pf.lengthEl.offsetWidth;
if ( cssValue <= 0 ) {
cssValue = false;
}
doc.body.removeChild( pf.lengthEl );
return cssValue;
};
pf.detectTypeSupport = function( type, typeUri ) {
// based on Modernizr's lossless img-webp test
// note: asynchronous
var image = new w.Image();
image.onerror = function() {
pf.types[ type ] = false;
picturefill();
};
image.onload = function() {
pf.types[ type ] = image.width === 1;
picturefill();
};
image.src = typeUri;
return "pending";
};
// container of supported mime types that one might need to qualify before using
pf.types = pf.types || {};
pf.initTypeDetects = function() {
// Add support for standard mime types
pf.types[ "image/jpeg" ] = true;
pf.types[ "image/gif" ] = true;
pf.types[ "image/png" ] = true;
pf.types[ "image/svg+xml" ] = doc.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Image", "1.1");
pf.types[ "image/webp" ] = pf.detectTypeSupport("image/webp", "data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA=");
};
pf.verifyTypeSupport = function( source ) {
var type = source.getAttribute( "type" );
// if type attribute exists, return test result, otherwise return true
if ( type === null || type === "" ) {
return true;
} else {
var pfType = pf.types[ type ];
// if the type test is a function, run it and return "pending" status. The function will rerun picturefill on pending elements once finished.
if ( typeof pfType === "string" && pfType !== "pending") {
pf.types[ type ] = pf.detectTypeSupport( type, pfType );
return "pending";
} else if ( typeof pfType === "function" ) {
pfType();
return "pending";
} else {
return pfType;
}
}
};
// Parses an individual `size` and returns the length, and optional media query
pf.parseSize = function( sourceSizeStr ) {
var match = /(\([^)]+\))?\s*(.+)/g.exec( sourceSizeStr );
return {
media: match && match[1],
length: match && match[2]
};
};
// Takes a string of sizes and returns the width in pixels as a number
pf.findWidthFromSourceSize = function( sourceSizeListStr ) {
// Split up source size list, ie ( max-width: 30em ) 100%, ( max-width: 50em ) 50%, 33%
// or (min-width:30em) calc(30% - 15px)
var sourceSizeList = pf.trim( sourceSizeListStr ).split( /\s*,\s*/ ),
winningLength;
for ( var i = 0, len = sourceSizeList.length; i < len; i++ ) {
// Match ? length, ie ( min-width: 50em ) 100%
var sourceSize = sourceSizeList[ i ],
// Split "( min-width: 50em ) 100%" into separate strings
parsedSize = pf.parseSize( sourceSize ),
length = parsedSize.length,
media = parsedSize.media;
if ( !length ) {
continue;
}
// if there is no media query or it matches, choose this as our winning length
if ( (!media || pf.matchesMedia( media )) &&
// pass the length to a method that can properly determine length
// in pixels based on these formats: http://dev.w3.org/csswg/css-values-3/#length-value
(winningLength = pf.getWidthFromLength( length )) ) {
break;
}
}
//if we have no winningLength fallback to 100vw
return winningLength || Math.max(w.innerWidth || 0, doc.documentElement.clientWidth);
};
pf.parseSrcset = function( srcset ) {
/**
* A lot of this was pulled from Boris Smus’ parser for the now-defunct WHATWG `srcset`
* https://github.com/borismus/srcset-polyfill/blob/master/js/srcset-info.js
*
* 1. Let input (`srcset`) be the value passed to this algorithm.
* 2. Let position be a pointer into input, initially pointing at the start of the string.
* 3. Let raw candidates be an initially empty ordered list of URLs with associated
* unparsed descriptors. The order of entries in the list is the order in which entries
* are added to the list.
*/
var candidates = [];
while ( srcset !== "" ) {
srcset = srcset.replace( /^\s+/g, "" );
// 5. Collect a sequence of characters that are not space characters, and let that be url.
var pos = srcset.search(/\s/g),
url, descriptor = null;
if ( pos !== -1 ) {
url = srcset.slice( 0, pos );
var last = url.slice(-1);
// 6. If url ends with a U+002C COMMA character (,), remove that character from url
// and let descriptors be the empty string. Otherwise, follow these substeps
// 6.1. If url is empty, then jump to the step labeled descriptor parser.
if ( last === "," || url === "" ) {
url = url.replace( /,+$/, "" );
descriptor = "";
}
srcset = srcset.slice( pos + 1 );
// 6.2. Collect a sequence of characters that are not U+002C COMMA characters (,), and
// let that be descriptors.
if ( descriptor === null ) {
var descpos = srcset.indexOf( "," );
if ( descpos !== -1 ) {
descriptor = srcset.slice( 0, descpos );
srcset = srcset.slice( descpos + 1 );
} else {
descriptor = srcset;
srcset = "";
}
}
} else {
url = srcset;
srcset = "";
}
// 7. Add url to raw candidates, associated with descriptors.
if ( url || descriptor ) {
candidates.push({
url: url,
descriptor: descriptor
});
}
}
return candidates;
};
pf.parseDescriptor = function( descriptor, sizesattr ) {
// 11. Descriptor parser: Let candidates be an initially empty source set. The order of entries in the list
// is the order in which entries are added to the list.
var sizes = sizesattr || "100vw",
sizeDescriptor = descriptor && descriptor.replace( /(^\s+|\s+$)/g, "" ),
widthInCssPixels = pf.findWidthFromSourceSize( sizes ),
resCandidate;
if ( sizeDescriptor ) {
var splitDescriptor = sizeDescriptor.split(" ");
for (var i = splitDescriptor.length - 1; i >= 0; i--) {
var curr = splitDescriptor[ i ],
lastchar = curr && curr.slice( curr.length - 1 );
if ( ( lastchar === "h" || lastchar === "w" ) && !pf.sizesSupported ) {
resCandidate = parseFloat( ( parseInt( curr, 10 ) / widthInCssPixels ) );
} else if ( lastchar === "x" ) {
var res = curr && parseFloat( curr, 10 );
resCandidate = res && !isNaN( res ) ? res : 1;
}
}
}
return resCandidate || 1;
};
/**
* Takes a srcset in the form of url/
* ex. "images/pic-medium.png 1x, images/pic-medium-2x.png 2x" or
* "images/pic-medium.png 400w, images/pic-medium-2x.png 800w" or
* "images/pic-small.png"
* Get an array of image candidates in the form of
* {url: "/foo/bar.png", resolution: 1}
* where resolution is http://dev.w3.org/csswg/css-values-3/#resolution-value
* If sizes is specified, resolution is calculated
*/
pf.getCandidatesFromSourceSet = function( srcset, sizes ) {
var candidates = pf.parseSrcset( srcset ),
formattedCandidates = [];
for ( var i = 0, len = candidates.length; i < len; i++ ) {
var candidate = candidates[ i ];
formattedCandidates.push({
url: candidate.url,
resolution: pf.parseDescriptor( candidate.descriptor, sizes )
});
}
return formattedCandidates;
};
/**
* if it's an img element and it has a srcset property,
* we need to remove the attribute so we can manipulate src
* (the property's existence infers native srcset support, and a srcset-supporting browser will prioritize srcset's value over our winning picture candidate)
* this moves srcset's value to memory for later use and removes the attr
*/
pf.dodgeSrcset = function( img ) {
if ( img.srcset ) {
img[ pf.ns ].srcset = img.srcset;
img.srcset = "";
img.setAttribute( "data-pfsrcset", img[ pf.ns ].srcset );
}
};
// Accept a source or img element and process its srcset and sizes attrs
pf.processSourceSet = function( el ) {
var srcset = el.getAttribute( "srcset" ),
sizes = el.getAttribute( "sizes" ),
candidates = [];
// if it's an img element, use the cached srcset property (defined or not)
if ( el.nodeName.toUpperCase() === "IMG" && el[ pf.ns ] && el[ pf.ns ].srcset ) {
srcset = el[ pf.ns ].srcset;
}
if ( srcset ) {
candidates = pf.getCandidatesFromSourceSet( srcset, sizes );
}
return candidates;
};
pf.backfaceVisibilityFix = function( picImg ) {
// See: https://github.com/scottjehl/picturefill/issues/332
var style = picImg.style || {},
WebkitBackfaceVisibility = "webkitBackfaceVisibility" in style,
currentZoom = style.zoom;
if (WebkitBackfaceVisibility) {
style.zoom = ".999";
WebkitBackfaceVisibility = picImg.offsetWidth;
style.zoom = currentZoom;
}
};
pf.setIntrinsicSize = (function() {
var urlCache = {};
var setSize = function( picImg, width, res ) {
if ( width ) {
picImg.setAttribute( "width", parseInt(width / res, 10) );
}
};
return function( picImg, bestCandidate ) {
var img;
if ( !picImg[ pf.ns ] || w.pfStopIntrinsicSize ) {
return;
}
if ( picImg[ pf.ns ].dims === undefined ) {
picImg[ pf.ns].dims = picImg.getAttribute("width") || picImg.getAttribute("height");
}
if ( picImg[ pf.ns].dims ) { return; }
if ( bestCandidate.url in urlCache ) {
setSize( picImg, urlCache[bestCandidate.url], bestCandidate.resolution );
} else {
img = doc.createElement( "img" );
img.onload = function() {
urlCache[bestCandidate.url] = img.width;
//IE 10/11 don't calculate width for svg outside document
if ( !urlCache[bestCandidate.url] ) {
try {
doc.body.appendChild( img );
urlCache[bestCandidate.url] = img.width || img.offsetWidth;
doc.body.removeChild( img );
} catch(e){}
}
if ( picImg.src === bestCandidate.url ) {
setSize( picImg, urlCache[bestCandidate.url], bestCandidate.resolution );
}
picImg = null;
img.onload = null;
img = null;
};
img.src = bestCandidate.url;
}
};
})();
pf.applyBestCandidate = function( candidates, picImg ) {
var candidate,
length,
bestCandidate;
candidates.sort( pf.ascendingSort );
length = candidates.length;
bestCandidate = candidates[ length - 1 ];
for ( var i = 0; i < length; i++ ) {
candidate = candidates[ i ];
if ( candidate.resolution >= pf.getDpr() ) {
bestCandidate = candidate;
break;
}
}
if ( bestCandidate ) {
bestCandidate.url = pf.makeUrl( bestCandidate.url );
if ( picImg.src !== bestCandidate.url ) {
if ( pf.restrictsMixedContent() && bestCandidate.url.substr(0, "http:".length).toLowerCase() === "http:" ) {
if ( window.console !== undefined ) {
console.warn( "Blocked mixed content image " + bestCandidate.url );
}
} else {
picImg.src = bestCandidate.url;
// currentSrc attribute and property to match
// http://picture.responsiveimages.org/#the-img-element
picImg.currentSrc = picImg.src;
pf.backfaceVisibilityFix( picImg );
}
}
pf.setIntrinsicSize(picImg, bestCandidate);
}
};
pf.ascendingSort = function( a, b ) {
return a.resolution - b.resolution;
};
/**
* In IE9,