picturefill
Version:
A responsive image polyfill.
5 lines • 940 B
JavaScript
/*! picturefill - v3.0.2 - 2016-02-12
* https://scottjehl.github.io/picturefill/
* Copyright (c) 2016 https://github.com/scottjehl/picturefill/blob/master/Authors.txt; Licensed MIT
*/
!function(a){"use strict";var b,c=0,d=function(){window.picturefill&&a(window.picturefill),(window.picturefill||c>9999)&&clearInterval(b),c++};b=setInterval(d,8),d()}(function(a){"use strict";if(window.addEventListener){var b,c,d,e=window.matchMedia&&matchMedia("print")||{matches:!1},f=a._,g=function(a){return a?-1!==a.indexOf("print")?!0:b?b.apply(this,arguments):void 0:!0},h=function(){e.matches||b||(b=f.matchesMedia,f.matchesMedia=g),!c&&!d&&f.DPR<1.5&&f.cfg.xQuant<1.5&&(c=f.cfg.xQuant,d=f.DPR,f.DPR=1.5,f.cfg.xQuant=1.5),a({reselect:!0})},i=function(){b&&(f.matchesMedia=b,b=!1),c&&(f.cfg.xQuant=c,c=!1),d&&(f.DPR=d,d=!1),a({reselect:!0})};"onbeforeprint"in window&&(addEventListener("beforeprint",h,!1),addEventListener("afterprint",i,!1))}});