/*! holder - client side image placeholders version 2.6.0+51ebp ? 2015 ivan malopinsky - http://imsky.co site: http://holderjs.com issues: https://github.com/imsky/holder/issues license: http://opensource.org/licenses/mit */ !function(a,b){"object"==typeof exports&&"object"==typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):"object"==typeof exports?exports.holder=b():a.holder=b()}(this,function(){return function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={exports:{},id:d,loaded:!1};return a[d].call(e.exports,e,e.exports,b),e.loaded=!0,e.exports}var c={};return b.m=a,b.c=c,b.p="",b(0)}([function(a,b,c){(function(b){function d(a,b,c,d){var g=e(c.substr(c.lastindexof(a.domain)),a);g&&f({mode:null,el:d,flags:g,enginesettings:b})}function e(a,b){for(var c={theme:y(k.settings.themes.gray,null),stylesheets:b.stylesheets,holderurl:[]},d=!1,e=string.fromcharcode(11),f=a.replace(/([^\\])\//g,"$1"+e).split(e),g=/%[0-9a-f]{2}/gi,h=f.length,i=0;h>i;i++){var j=f[i];if(j.match(g))try{j=decodeuricomponent(j)}catch(k){j=f[i]}var l=!1;if(k.flags.dimensions.match(j))d=!0,c.dimensions=k.flags.dimensions.output(j),l=!0;else if(k.flags.fluid.match(j))d=!0,c.dimensions=k.flags.fluid.output(j),c.fluid=!0,l=!0;else if(k.flags.textmode.match(j))c.textmode=k.flags.textmode.output(j),l=!0;else if(k.flags.colors.match(j)){var m=k.flags.colors.output(j);c.theme=y(c.theme,m),l=!0}else if(b.themes[j])b.themes.hasownproperty(j)&&(c.theme=y(b.themes[j],null)),l=!0;else if(k.flags.font.match(j))c.font=k.flags.font.output(j),l=!0;else if(k.flags.auto.match(j))c.auto=!0,l=!0;else if(k.flags.text.match(j))c.text=k.flags.text.output(j),l=!0;else if(k.flags.size.match(j))c.size=k.flags.size.output(j),l=!0;else if(k.flags.random.match(j)){null==k.vars.cache.themekeys&&(k.vars.cache.themekeys=object.keys(b.themes));var n=k.vars.cache.themekeys[0|math.random()*k.vars.cache.themekeys.length];c.theme=y(b.themes[n],null),l=!0}l&&c.holderurl.push(j)}return c.holderurl.unshift(b.domain),c.holderurl=c.holderurl.join("/"),d?c:!1}function f(a){var b=a.mode,c=a.el,d=a.flags,e=a.enginesettings,f=d.dimensions,h=d.theme,i=f.width+"x"+f.height;if(b=null==b?d.fluid?"fluid":"image":b,null!=d.text&&(h.text=d.text,"object"===c.nodename.tolowercase())){for(var l=h.text.split("\\n"),m=0;m1){var l=0,m=0,n=a.width*k.setup.linewrapratio,o=0;k=new e.group("line"+o);for(var p=0;p=n||r===!0)&&(b(g,k,l,g.properties.leading),l=0,m+=g.properties.leading,o+=1,k=new e.group("line"+o),k.y=m),r!==!0&&(j.moveto(l,0),l+=h.spacewidth+q.width,k.add(j))}b(g,k,l,g.properties.leading);for(var s in g.children)k=g.children[s],k.moveto((g.width-k.width)/2,null,null);g.moveto((a.width-g.width)/2,(a.height-g.height)/2,null),(a.height-g.height)/2<0&&g.moveto(null,0,null)}else j=new e.text(a.text),k=new e.group("line0"),k.add(j),g.add(k),g.moveto((a.width-h.boundingbox.width)/2,(a.height-h.boundingbox.height)/2,null);return d}function i(a,b,c){var d=parseint(a,10),e=parseint(b,10),f=math.max(d,e),g=math.min(d,e),h=.8*math.min(g,f*k.defaults.scale);return math.round(math.max(c,h))}function j(a){var b;b=null==a||null==a.nodetype?k.vars.resizableimages:[a];for(var c=0,d=b.length;d>c;c++){var e=b[c];if(e.holderdata){var f=e.holderdata.flags,h=e(e);if(h){if(!e.holderdata.resizeupdate)continue;if(f.fluid&&f.auto){var i=e.holderdata.fluidconfig;switch(i.mode){case"width":h.height=h.width/i.ratio;break;case"height":h.width=h.height*i.ratio}}var j={mode:"image",holdersettings:{dimensions:h,theme:f.theme,flags:f},el:e,enginesettings:e.holderdata.enginesettings};"exact"==f.textmode&&(f.exactdimensions=h,j.holdersettings.dimensions=f.dimensions),g(j)}else n(e)}}}function k(a){if(a.holderdata){var b=e(a);if(b){var c=a.holderdata.flags,d={fluidheight:"%"==c.dimensions.height.slice(-1),fluidwidth:"%"==c.dimensions.width.slice(-1),mode:null,initialdimensions:b};d.fluidwidth&&!d.fluidheight?(d.mode="width",d.ratio=d.initialdimensions.width/parsefloat(c.dimensions.height)):!d.fluidwidth&&d.fluidheight&&(d.mode="height",d.ratio=parsefloat(c.dimensions.width)/d.initialdimensions.height),a.holderdata.fluidconfig=d}else n(a)}}function l(){for(var a,c=[],d=object.keys(k.vars.invisibleimages),e=0,f=d.length;f>e;e++)a=k.vars.invisibleimages[d[e]],e(a)&&"img"==a.nodename.tolowercase()&&(c.push(a),delete k.vars.invisibleimages[d[e]]);c.length&&j.run({images:c}),b.requestanimationframe(l)}function m(){k.vars.visibilitycheckstarted||(b.requestanimationframe(l),k.vars.visibilitycheckstarted=!0)}function n(a){a.holderdata.invisibleid||(k.vars.invisibleid+=1,k.vars.invisibleimages["i"+k.vars.invisibleid]=a,a.holderdata.invisibleid=k.vars.invisibleid)}function o(a,b){return null==b?document.createelement(a):document.createelementns(b,a)}function p(a,b){for(var c in b)a.setattribute(c,b[c])}function q(a,b,c){var d,e;null==a?(a=o("svg",f),d=o("defs",f),e=o("style",f),p(e,{type:"text/css"}),d.appendchild(e),a.appendchild(d)):e=a.queryselector("style"),a.webkitmatchesselector&&a.setattribute("xmlns",f);for(var f=0;f=0;h--){var i=g.createprocessinginstruction("xml-stylesheet",'href="'+f[h]+'" rel="stylesheet"');g.insertbefore(i,g.firstchild)}var j=g.createprocessinginstruction("xml",'version="1.0" encoding="utf-8" standalone="yes"');g.insertbefore(j,g.firstchild),g.removechild(g.documentelement),e=d.serializetostring(g)}var k=d.serializetostring(a);return k=k.replace(/\&(\#[0-9]{2,}\;)/g,"&$1"),e+k}}function s(){return b.domparser?(new domparser).parsefromstring("","application/xml"):void 0}function t(a){k.vars.debouncetimer||a.call(this),k.vars.debouncetimer&&b.cleartimeout(k.vars.debouncetimer),k.vars.debouncetimer=b.settimeout(function(){k.vars.debouncetimer=null,a.call(this)},k.setup.debounce)}function u(){t(function(){j(null)})}var v=c(1),w=c(2),x=c(3),y=x.extend,z=x.cssprops,a=x.encodehtmlentity,b=x.decodehtmlentity,c=x.imageexists,d=x.getnodearray,e=x.dimensioncheck,f="http://www.w3.org/2000/svg",g=8,h="2.6.0",i="\ncreated with holder.js "+h+".\nlearn more at http://holderjs.com\n(c) 2012-2015 ivan malopinsky - http://imsky.co\n",j={version:h,addtheme:function(a,b){return null!=a&&null!=b&&(k.settings.themes[a]=b),delete k.vars.cache.themekeys,this},addimage:function(a,b){var c=document.queryselectorall(b);if(c.length)for(var d=0,e=c.length;e>d;d++){var f=o("img"),g={};g[k.vars.dataattr]=a,p(f,g),c[d].appendchild(f)}return this},setresizeupdate:function(a,b){a.holderdata&&(a.holderdata.resizeupdate=!!b,a.holderdata.resizeupdate&&j(a))},run:function(a){a=a||{};var c={},g=y(k.settings,a);k.vars.preempted=!0,k.vars.dataattr=g.dataattr||k.vars.dataattr,c.renderer=g.renderer?g.renderer:k.setup.renderer,-1===k.setup.renderers.join(",").indexof(c.renderer)&&(c.renderer=k.setup.supportssvg?"svg":k.setup.supportscanvas?"canvas":"html");var h=d(g.images),i=d(g.bgnodes),j=d(g.stylenodes),k=d(g.objects);c.stylesheets=[],c.svgxmlstylesheet=!0,c.nofontfallback=g.nofontfallback?g.nofontfallback:!1;for(var l=0;l1){c.nodevalue="";for(var u=0;u=0?b:1)}function f(a){v?e(a):w.push(a)}null==document.readystate&&document.addeventlistener&&(document.addeventlistener("domcontentloaded",function y(){document.removeeventlistener("domcontentloaded",y,!1),document.readystate="complete"},!1),document.readystate="loading");var g=a.document,h=g.documentelement,i="load",j=!1,k="on"+i,l="complete",m="readystate",n="attachevent",o="detachevent",p="addeventlistener",q="domcontentloaded",r="onreadystatechange",s="removeeventlistener",t=p in g,u=j,v=j,w=[];if(g[m]===l)e(b);else if(t)g[p](q,c,j),a[p](i,c,j);else{g[n](r,c),a[n](k,c);try{u=null==a.frameelement&&h}catch(x){}u&&u.doscroll&&!function z(){if(!v){try{u.doscroll("left")}catch(a){return e(z,50)}d(),b()}}()}return f.version="1.4.0",f.isready=function(){return v},f}a.exports="undefined"!=typeof window&&b(window)},function(a,b,c){var d=c(4),e=function(a){function b(a,b){for(var c in b)a[c]=b[c];return a}var c=1,e=d.defclass({constructor:function(a){c++,this.parent=null,this.children={},this.id=c,this.name="n"+c,null!=a&&(this.name=a),this.x=0,this.y=0,this.z=0,this.width=0,this.height=0},resize:function(a,b){null!=a&&(this.width=a),null!=b&&(this.height=b)},moveto:function(a,b,c){this.x=null!=a?a:this.x,this.y=null!=b?b:this.y,this.z=null!=c?c:this.z},add:function(a){var b=a.name;if(null!=this.children[b])throw"scenegraph: child with that name already exists: "+b;this.children[b]=a,a.parent=this}}),f=d(e,function(b){this.constructor=function(){b.constructor.call(this,"root"),this.properties=a}}),g=d(e,function(a){function c(c,d){if(a.constructor.call(this,c),this.properties={fill:"#000"},null!=d)b(this.properties,d);else if(null!=c&&"string"!=typeof c)throw"scenegraph: invalid node name"}this.group=d.extend(this,{constructor:c,type:"group"}),this.rect=d.extend(this,{constructor:c,type:"rect"}),this.text=d.extend(this,{constructor:function(a){c.call(this),this.properties.text=a},type:"text"})}),h=new f;return this.shape=g,this.root=h,this};a.exports=e},function(a,b){(function(a){b.extend=function(a,b){var c={};for(var d in a)a.hasownproperty(d)&&(c[d]=a[d]);if(null!=b)for(var e in b)b.hasownproperty(e)&&(c[e]=b[e]);return c},b.cssprops=function(a){var b=[];for(var c in a)a.hasownproperty(c)&&b.push(c+":"+a[c]);return b.join(";")},b.encodehtmlentity=function(a){for(var b=[],c=0,d=a.length-1;d>=0;d--)c=a.charcodeat(d),b.unshift(c>128?["&#",c,";"].join(""):a[d]);return b.join("")},b.getnodearray=function(b){var c=null;return"string"==typeof b?c=document.queryselectorall(b):a.nodelist&&b instanceof a.nodelist?c=b:a.node&&b instanceof a.node?c=[b]:a.htmlcollection&&b instanceof a.htmlcollection?c=b:b instanceof array?c=b:null===b&&(c=[]),c},b.imageexists=function(a,b){var c=new image;c.onerror=function(){b.call(this,!1)},c.onload=function(){b.call(this,!0)},c.src=a},b.decodehtmlentity=function(a){return a.replace(/&#(\d+);/g,function(a,b){return string.fromcharcode(b)})},b.dimensioncheck=function(a){var b={height:a.clientheight,width:a.clientwidth};return b.height&&b.width?b:!1}}).call(b,function(){return this}())},function(a){var b=function(){},c=array.prototype.slice,d=function(a,d){var e=b.prototype="function"==typeof a?a.prototype:a,f=new b,g=d.apply(f,c.call(arguments,2).concat(e));if("object"==typeof g)for(var h in g)f[h]=g[h];if(!f.hasownproperty("constructor"))return f;var i=f.constructor;return i.prototype=f,i};d.defclass=function(a){var b=a.constructor;return b.prototype=a,b},d.extend=function(a,b){return d(a,function(a){return this.uber=a,b})},a.exports=d}])});