text: var Holder=Holder||{};!function(t,e){function n(t,e){var n="complete",a="readystatechange",r=!1,i=r,o=!0,l=t.document,d=l.documentElement,s=l.addEventListener?"addEventListener":"attachEvent",u=l.addEventListener?"removeEventListener":"detachEvent",h=l.addEventListener?"":"on",g=function(o){(o.type!=a||l.readyState==n)&&(("load"==o.type?t:l)[u](h+o.type,g,r),!i&&(i=!0)&&e.call(t,null))},c=function(){try{d.doScroll("left")}catch(t){return void setTimeout(c,50)}g("poll")};if(l.readyState==n)e.call(t,"lazy");else{if(l.createEventObject&&d.doScroll){try{o=!t.frameElement}catch(f){}o&&c()}l[s](h+"DOMContentLoaded",g,r),l[s](h+a,g,r),t[s](h+"load",g,r)}}function a(t){t=t.match(/^(\W)?(.*)/);var e=document["getElement"+(t[1]?"#"==t[1]?"ById":"sByClassName":"sByTagName")](t[2]),n=[];return null!=e&&(n=e.length?e:0==e.length?e:[e]),n}function r(t,e){var n={};for(var a in t)n[a]=t[a];for(var r in e)n[r]=e[r];return n}function i(t,e,n){var a=[e.height,e.width].sort(),r=Math.round(a[1]/16),i=Math.round(a[0]/16),o=Math.max(n.size,r);d.width=e.width,d.height=e.height,t.textAlign="center",t.textBaseline="middle",t.fillStyle=n.background,t.fillRect(0,0,e.width,e.height),t.fillStyle=n.foreground,t.font="bold "+o+"px sans-serif";var l=n.text?n.text:e.width+"x"+e.height;return Math.round(t.measureText(l).width)/e.width>1&&(o=Math.max(i,n.size)),t.font="bold "+o+"px sans-serif",t.fillText(l,e.width/2,e.height/2,e.width),d.toDataURL("image/png")}var o=!1,l=!1,d=document.createElement("canvas");if(d.getContext)if(d.toDataURL("image/png").indexOf("data:image/png")<0)l=!0;else var s=d.getContext("2d");else l=!0;var u={domain:"holder.js",images:"img",themes:{gray:{background:"#eee",foreground:"#aaa",size:12},social:{background:"#3a5a97",foreground:"#fff",size:12},industrial:{background:"#434A52",foreground:"#C2F200",size:12}}};t.flags={dimensions:{regex:/([0-9]+)x([0-9]+)/,output:function(t){var e=this.regex.exec(t);return{width:+e[1],height:+e[2]}}},colors:{regex:/#([0-9a-f]{3,})\:#([0-9a-f]{3,})/i,output:function(t){var e=this.regex.exec(t);return{size:u.themes.gray.size,foreground:"#"+e[2],background:"#"+e[1]}}},text:{regex:/text\:(.*)/,output:function(t){return this.regex.exec(t)[1]}}};for(var h in t.flags)t.flags[h].match=function(t){return t.match(this.regex)};t.add_theme=function(e,n){return null!=e&&null!=n&&(u.themes[e]=n),t},t.add_image=function(e,n){var r=a(n);if(r.length)for(var i=0,o=r.length;o>i;i++){var l=document.createElement("img");l.setAttribute("data-src",e),r[i].appendChild(l)}return t},t.run=function(e){for(var n=r(u,e),o=a(n.images),d=o.length,h=0;d>h;h++){var g=u.themes.gray,c=o[h].getAttribute("data-src")||o[h].getAttribute("src");if(~c.indexOf(n.domain)){var f=!1,m=null,x=null,v=c.substr(c.indexOf(n.domain)+n.domain.length+1).split("/");for(sl=v.length,j=0;sl>j;j++)t.flags.dimensions.match(v[j])?(f=!0,m=t.flags.dimensions.output(v[j])):t.flags.colors.match(v[j])?g=t.flags.colors.output(v[j]):n.themes[v[j]]?g=n.themes[v[j]]:t.flags.text.match(v[j])&&(x=t.flags.text.output(v[j]));if(f){o[h].setAttribute("data-src",c);var p=m.width+"x"+m.height;o[h].setAttribute("alt",x?x:g.text?g.text+" ["+p+"]":p),o[h].style.width=m.width+"px",o[h].style.height=m.height+"px",o[h].style.backgroundColor=g.background;var g=x?r(g,{text:x}):g;l||o[h].setAttribute("src",i(s,m,g))}}}return t},n(e,function(){o||t.run()})}(Holder,window);