/*! Gray v1.6.0 https://github.com/karlhorky/gray) | MIT */ /*! Modernizr 2.8.3 (Custom Build) | MIT & BSD */ if(window.Modernizr=function(e,t,i){function r(e){c.cssText=e}function n(e,t){return typeof e===t}var s,o,a,d="2.8.3",l={},h=t.documentElement,g="modernizr",u=t.createElement(g),c=u.style,f=({}.toString," -webkit- -moz- -o- -ms- ".split(" ")),p={svg:"http://www.w3.org/2000/svg"},m={},y=[],v=y.slice,w={}.hasOwnProperty;a=n(w,"undefined")||n(w.call,"undefined")?function(e,t){return t in e&&n(e.constructor.prototype[t],"undefined")}:function(e,t){return w.call(e,t)},Function.prototype.bind||(Function.prototype.bind=function(e){var t=this;if("function"!=typeof t)throw new TypeError;var i=v.call(arguments,1),r=function(){if(this instanceof r){var n=function(){};n.prototype=t.prototype;var s=new n,o=t.apply(s,i.concat(v.call(arguments)));return Object(o)===o?o:s}return t.apply(e,i.concat(v.call(arguments)))};return r}),m.inlinesvg=function(){var e=t.createElement("div");return e.innerHTML="",(e.firstChild&&e.firstChild.namespaceURI)==p.svg};for(var b in m)a(m,b)&&(o=b.toLowerCase(),l[o]=m[b](),y.push((l[o]?"":"no-")+o));return l.addTest=function(e,t){if("object"==typeof e)for(var r in e)a(e,r)&&l.addTest(r,e[r]);else{if(e=e.toLowerCase(),l[e]!==i)return l;t="function"==typeof t?t():t,"undefined"!=typeof enableClasses&&enableClasses&&(h.className+=" "+(t?"":"no-")+e),l[e]=t}return l},r(""),u=s=null,l._version=d,l._prefixes=f,l}(this,this.document),!window.Modernizr._prefixes)throw Error("jquery-gray: Modernizr._prefixes not set!\n\nPlease add the necessary feature detects:\nhttps://github.com/karlhorky/gray#modernizr");Modernizr.addTest("cssfilters",function(){var e=document.createElement("div");return e.style.cssText=Modernizr._prefixes.join("filter:blur(2px); "),!!e.style.length&&(void 0===document.documentMode||document.documentMode>9)}),Modernizr.addTest("svgfilters",function(){var e=!1;try{e=void 0!==typeof SVGFEColorMatrixElement&&2==SVGFEColorMatrixElement.SVG_FECOLORMATRIX_TYPE_SATURATE}catch(t){}return e}),function(e,t){function i(t,i){var o,a;i=i||{},o=i.classes||{},a=o.fade||n.classes.fade,i.fade=i.fade||t.className.indexOf(a)>-1,this.element=t,this.elementId=s++,this.settings=e.extend({},n,i),this._defaults=n,this._name=r,this.init()}var r="gray",n={fade:!1,classes:{fade:"grayscale-fade"}},s=0;e.extend(i.prototype,{init:function(){var t;!Modernizr.cssfilters&&Modernizr.inlinesvg&&Modernizr.svgfilters&&(t=e(this.element),(this.cssFilterDeprecated(t)||this.settings.fade)&&this.switchImage(t))},cssFilterDeprecated:function(e){return"none"===e.css("filter")},elementType:function(e){return"IMG"===e.prop("tagName")?"Img":"Bg"},pxToNumber:function(e){return parseInt(e.replace("px",""))},getComputedStyle:function(e){var i={},r={};i=t.getComputedStyle(e,null);for(var n=0,s=i.length;s>n;n++){var o=i[n],a=i.getPropertyValue(o);r[o]=a}return r},extractUrl:function(e){var t;return startRegex=/^url\(["']?/,endRegex=/["']?\)$/,t=e.replace(startRegex,"").replace(endRegex,"")},positionToNegativeMargin:function(e){var t,i,r;return t=e.match(/^(-?\d+\S+)/)[0],i=e.match(/\s(-?\d+\S+)$/)[0],r="margin:"+i+" 0 0 "+t},getBgSize:function(t,i){var r,n,s,o,a,d,l;if(r=new Image,r.src=t,"auto"!==i&&"cover"!==i&&"contain"!==i&&"inherit"!==i){var h=e(this.element);n=r.width/r.height,o=parseInt((i.match(/^(\d+)px/)||[0,0])[1]),d=parseInt((i.match(/\s(\d+)px$/)||[0,0])[1]),s=h.height()*n,a=h.width()/n,o=o||s,d=d||a}return l=o||d?{width:o,height:d}:{width:r.width,height:r.height}},getImgParams:function(e){var t={};t.styles=this.getComputedStyle(e[0]);var i={top:this.pxToNumber(t.styles["padding-top"]),right:this.pxToNumber(t.styles["padding-right"]),bottom:this.pxToNumber(t.styles["padding-bottom"]),left:this.pxToNumber(t.styles["padding-left"])},r={top:this.pxToNumber(t.styles["border-top-width"]),right:this.pxToNumber(t.styles["border-right-width"]),bottom:this.pxToNumber(t.styles["border-bottom-width"]),left:this.pxToNumber(t.styles["border-left-width"])};return t.image={width:this.pxToNumber(t.styles.width),height:this.pxToNumber(t.styles.height)},t.svg={url:e[0].src,padding:i,borderWidth:r,width:t.image.width+i.left+i.right+r.left+r.right,height:t.image.height+i.top+i.bottom+r.top+r.bottom,offset:""},t},getBgParams:function(t){var i,r={};return i=this.extractUrl(t.css("background-image")),bgSize=this.getBgSize(i,t.css("background-size")),offset=this.positionToNegativeMargin(t.css("background-position")),r.styles=this.getComputedStyle(t[0]),r.svg=e.extend({url:i},bgSize,{offset:offset}),r.image={width:r.svg.width,height:r.svg.height},r},setStyles:function(e,t,i,r){return t.display="inline-block",t.overflow=t["overflow-x"]=t["overflow-y"]="hidden",t["background-image"]='url("'+i.url+'")',t["background-size"]=r.width+"px "+r.height+"px","Img"===e&&(t["background-repeat"]="no-repeat",t["background-position"]=i.padding.left+"px "+i.padding.top+"px",t.width=i.width,t.height=i.height),delete t.filter,t},addSVGFilterOnce:function(){$body=e("body"),$body.data("plugin_"+r+"_has_filter")||$body.data("plugin_"+r+"_has_filter","true").append('')},switchImage:function(t){var i,r,n,s,o,a;i=this.elementType(t),r=this["get"+i+"Params"](t),n=this.settings.fade?this.settings.classes.fade:"",s=t[0].alt?' aria-labelledby="gray-title-'+this.elementId+'"':"",o=t[0].alt?''+t[0].alt+"":"",a=e('
"+o+'
'),r.styles=this.setStyles(i,r.styles,r.svg,r.image),a.css(r.styles),this.addSVGFilterOnce(),t.replaceWith(a)}}),e.fn[r]=function(t){return this.each(function(){e.data(this,"plugin_"+r)||e.data(this,"plugin_"+r,new i(this,t))}),this},e(t).on("load",function(){e(".grayscale:not(.grayscale-replaced)")[r]()})}(jQuery,window,document);