Skip to content

Instantly share code, notes, and snippets.

@4aficiona2
Last active August 29, 2015 14:08
Show Gist options
  • Save 4aficiona2/617841a0dd4db3cd1ff5 to your computer and use it in GitHub Desktop.
Save 4aficiona2/617841a0dd4db3cd1ff5 to your computer and use it in GitHub Desktop.
Web Font Loader v1.5.6 - Monotype Build only
/* Web Font Loader v1.5.6 - Monotype Build only - (c) Adobe Systems, Google. License: Apache 2.0 */
;(function(window,document,undefined){var j=!0,k=null,m=!1;function n(a){return function(){return this[a]}}var p=this;function q(a,b){var c=a.split("."),d=p;!(c[0]in d)&&d.execScript&&d.execScript("var "+c[0]);for(var e;c.length&&(e=c.shift());)!c.length&&void 0!==b?d[e]=b:d=d[e]?d[e]:d[e]={}}function aa(a,b,c){return a.call.apply(a.bind,arguments)}
function ba(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}}function r(a,b,c){r=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?aa:ba;return r.apply(k,arguments)}var s=Date.now||function(){return+new Date};function t(a,b){this.s=a;this.A=b||a;this.r=this.A.document}t.prototype.createElement=function(a,b,c){a=this.r.createElement(a);if(b)for(var d in b)b.hasOwnProperty(d)&&("style"==d?a.style.cssText=b[d]:a.setAttribute(d,b[d]));c&&a.appendChild(this.r.createTextNode(c));return a};function v(a,b){var c=a.r.getElementsByTagName("body")[0];c||(c=document.documentElement);c&&c.lastChild&&c.insertBefore(b,c.lastChild)}
function x(a,b,c){b=b||[];c=c||[];for(var d=a.className.split(/\s+/),e=0;e<b.length;e+=1){for(var h=m,f=0;f<d.length;f+=1)if(b[e]===d[f]){h=j;break}h||d.push(b[e])}b=[];for(e=0;e<d.length;e+=1){h=m;for(f=0;f<c.length;f+=1)if(d[e]===c[f]){h=j;break}h||b.push(d[e])}a.className=b.join(" ").replace(/\s+/g," ").replace(/^\s+|\s+$/,"")}function y(a,b){for(var c=a.className.split(/\s+/),d=0,e=c.length;d<e;d++)if(c[d]==b)return j;return m};function z(a,b,c){this.P=a;this.F=b;this.ma=c}q("webfont.BrowserInfo",z);z.prototype.ba=n("P");z.prototype.hasWebFontSupport=z.prototype.ba;z.prototype.ca=n("F");z.prototype.hasWebKitFallbackBug=z.prototype.ca;z.prototype.da=n("ma");z.prototype.hasWebKitMetricsBug=z.prototype.da;function A(a,b,c,d){this.b=a!=k?a:k;this.j=b!=k?b:k;this.N=c!=k?c:k;this.d=d!=k?d:k}var ca=/^([0-9]+)(?:[\._-]([0-9]+))?(?:[\._-]([0-9]+))?(?:[\._+-]?(.*))?$/;A.prototype.toString=function(){return[this.b,this.j||"",this.N||"",this.d||""].join("")};
function B(a){a=ca.exec(a);var b=k,c=k,d=k,e=k;a&&(a[1]!==k&&a[1]&&(b=parseInt(a[1],10)),a[2]!==k&&a[2]&&(c=parseInt(a[2],10)),a[3]!==k&&a[3]&&(d=parseInt(a[3],10)),a[4]!==k&&a[4]&&(e=/^[0-9]+$/.test(a[4])?parseInt(a[4],10):a[4]));return new A(b,c,d,e)};function C(a,b,c,d,e,h,f,g,l,u,D){this.t=a;this.sa=b;this.la=c;this.S=d;this.qa=e;this.R=h;this.ia=f;this.ra=g;this.ha=l;this.Q=u;this.g=D}q("webfont.UserAgent",C);C.prototype.getName=n("t");C.prototype.getName=C.prototype.getName;C.prototype.aa=n("la");C.prototype.getVersion=C.prototype.aa;C.prototype.X=n("S");C.prototype.getEngine=C.prototype.X;C.prototype.Y=n("R");C.prototype.getEngineVersion=C.prototype.Y;C.prototype.Z=n("ia");C.prototype.getPlatform=C.prototype.Z;C.prototype.$=n("ha");
C.prototype.getPlatformVersion=C.prototype.$;C.prototype.W=n("Q");C.prototype.getDocumentMode=C.prototype.W;C.prototype.V=n("g");C.prototype.getBrowserInfo=C.prototype.V;function E(a,b){this.a=a;this.q=b}var da=new C("Unknown",new A,"Unknown","Unknown",new A,"Unknown","Unknown",new A,"Unknown",void 0,new z(m,m,m));
E.prototype.parse=function(){var a;if(-1!=this.a.indexOf("MSIE")||-1!=this.a.indexOf("Trident/")){a=F(this);var b=G(this),c=B(b),d=k,e=k,h=k,f=k,g=H(this.a,/Trident\/([\d\w\.]+)/,1),l=J(this.q),d=-1!=this.a.indexOf("MSIE")?H(this.a,/MSIE ([\d\w\.]+)/,1):H(this.a,/rv:([\d\w\.]+)/,1),e=B(d);""!=g?(h="Trident",f=B(g)):(h="Unknown",f=new A,g="Unknown");a=new C("MSIE",e,d,h,f,g,a,c,b,l,new z("Windows"==a&&6<=e.b||"Windows Phone"==a&&8<=c.b,m,m))}else if(-1!=this.a.indexOf("Opera"))a:if(a="Unknown",b=H(this.a,
/Presto\/([\d\w\.]+)/,1),c=B(b),d=G(this),e=B(d),h=J(this.q),c.b!==k?a="Presto":(-1!=this.a.indexOf("Gecko")&&(a="Gecko"),b=H(this.a,/rv:([^\)]+)/,1),c=B(b)),-1!=this.a.indexOf("Opera Mini/"))f=H(this.a,/Opera Mini\/([\d\.]+)/,1),g=B(f),a=new C("OperaMini",g,f,a,c,b,F(this),e,d,h,new z(m,m,m));else{if(-1!=this.a.indexOf("Version/")&&(f=H(this.a,/Version\/([\d\.]+)/,1),g=B(f),g.b!==k)){a=new C("Opera",g,f,a,c,b,F(this),e,d,h,new z(10<=g.b,m,m));break a}f=H(this.a,/Opera[\/ ]([\d\.]+)/,1);g=B(f);a=
g.b!==k?new C("Opera",g,f,a,c,b,F(this),e,d,h,new z(10<=g.b,m,m)):new C("Opera",new A,"Unknown",a,c,b,F(this),e,d,h,new z(m,m,m))}else/OPR\/[\d.]+/.test(this.a)?a=K(this):/AppleWeb(K|k)it/.test(this.a)?a=K(this):-1!=this.a.indexOf("Gecko")?(a="Unknown",b=new A,c="Unknown",d=G(this),e=B(d),h=m,-1!=this.a.indexOf("Firefox")?(a="Firefox",c=H(this.a,/Firefox\/([\d\w\.]+)/,1),b=B(c),h=3<=b.b&&5<=b.j):-1!=this.a.indexOf("Mozilla")&&(a="Mozilla"),f=H(this.a,/rv:([^\)]+)/,1),g=B(f),h||(h=1<g.b||1==g.b&&9<
g.j||1==g.b&&9==g.j&&2<=g.N||f.match(/1\.9\.1b[123]/)!=k||f.match(/1\.9\.1\.[\d\.]+/)!=k),a=new C(a,b,c,"Gecko",g,f,F(this),e,d,J(this.q),new z(h,m,m))):a=da;return a};function F(a){var b=H(a.a,/(iPod|iPad|iPhone|Android|Windows Phone|BB\d{2}|BlackBerry)/,1);if(""!=b)return/BB\d{2}/.test(b)&&(b="BlackBerry"),b;a=H(a.a,/(Linux|Mac_PowerPC|Macintosh|Windows|CrOS|PlayStation|CrKey)/,1);return""!=a?("Mac_PowerPC"==a?a="Macintosh":"PlayStation"==a&&(a="Linux"),a):"Unknown"}
function G(a){var b=H(a.a,/(OS X|Windows NT|Android) ([^;)]+)/,2);if(b||(b=H(a.a,/Windows Phone( OS)? ([^;)]+)/,2))||(b=H(a.a,/(iPhone )?OS ([\d_]+)/,2)))return b;if(b=H(a.a,/(?:Linux|CrOS|CrKey) ([^;)]+)/,1))for(var b=b.split(/\s/),c=0;c<b.length;c+=1)if(/^[\d\._]+$/.test(b[c]))return b[c];return(a=H(a.a,/(BB\d{2}|BlackBerry).*?Version\/([^\s]*)/,2))?a:"Unknown"}
function K(a){var b=F(a),c=G(a),d=B(c),e=H(a.a,/AppleWeb(?:K|k)it\/([\d\.\+]+)/,1),h=B(e),f="Unknown",g=new A,l="Unknown",u=m;/OPR\/[\d.]+/.test(a.a)?f="Opera":-1!=a.a.indexOf("Chrome")||-1!=a.a.indexOf("CrMo")||-1!=a.a.indexOf("CriOS")?f="Chrome":/Silk\/\d/.test(a.a)?f="Silk":"BlackBerry"==b||"Android"==b?f="BuiltinBrowser":-1!=a.a.indexOf("PhantomJS")?f="PhantomJS":-1!=a.a.indexOf("Safari")?f="Safari":-1!=a.a.indexOf("AdobeAIR")?f="AdobeAIR":-1!=a.a.indexOf("PlayStation")&&(f="BuiltinBrowser");
"BuiltinBrowser"==f?l="Unknown":"Silk"==f?l=H(a.a,/Silk\/([\d\._]+)/,1):"Chrome"==f?l=H(a.a,/(Chrome|CrMo|CriOS)\/([\d\.]+)/,2):-1!=a.a.indexOf("Version/")?l=H(a.a,/Version\/([\d\.\w]+)/,1):"AdobeAIR"==f?l=H(a.a,/AdobeAIR\/([\d\.]+)/,1):"Opera"==f?l=H(a.a,/OPR\/([\d.]+)/,1):"PhantomJS"==f&&(l=H(a.a,/PhantomJS\/([\d.]+)/,1));g=B(l);u="AdobeAIR"==f?2<g.b||2==g.b&&5<=g.j:"BlackBerry"==b?10<=d.b:"Android"==b?2<d.b||2==d.b&&1<d.j:526<=h.b||525<=h.b&&13<=h.j;return new C(f,g,l,"AppleWebKit",h,e,b,d,c,J(a.q),
new z(u,536>h.b||536==h.b&&11>h.j,"iPhone"==b||"iPad"==b||"iPod"==b||"Macintosh"==b))}function H(a,b,c){return(a=a.match(b))&&a[c]?a[c]:""}function J(a){if(a.documentMode)return a.documentMode};function L(a){this.ga=a||"-"}L.prototype.d=function(a){for(var b=[],c=0;c<arguments.length;c++)b.push(arguments[c].replace(/[\W_]+/g,"").toLowerCase());return b.join(this.ga)};function M(a,b){this.t=a;this.G=4;this.u="n";var c=(b||"n4").match(/^([nio])([1-9])$/i);c&&(this.u=c[1],this.G=parseInt(c[2],10))}M.prototype.getName=n("t");function N(a){return a.u+a.G};function ea(a,b,c){this.c=a;this.i=b;this.v=c;this.f="wf";this.e=new L("-")}function O(a){var b=y(a.i,a.e.d(a.f,"active")),c=[],d=[a.e.d(a.f,"loading")];b||c.push(a.e.d(a.f,"inactive"));x(a.i,c,d);P(a,"inactive")}function P(a,b,c){if(a.v[b])if(c)a.v[b](c.getName(),N(c));else a.v[b]()};function fa(){this.M={}};function Q(a,b){this.c=a;this.o=b;this.h=this.c.createElement("span",{"aria-hidden":"true"},this.o)}
function R(a,b){for(var c=[],d=b.t.split(/,\s*/),e=0;e<d.length;e++){var h=d[e].replace(/['"]/g,"");-1==h.indexOf(" ")?c.push(h):c.push("'"+h+"'")}c="display:block;position:absolute;top:-999px;left:-999px;font-size:300px;width:auto;height:auto;line-height:normal;margin:0;padding:0;font-variant:normal;white-space:nowrap;font-family:"+c.join(",")+";";d="normal";e=b.G+"00";"o"===b.u?d="oblique":"i"===b.u&&(d="italic");a.h.style.cssText=c+("font-style:"+d+";font-weight:"+e+";")}
Q.prototype.remove=function(){var a=this.h;a.parentNode&&a.parentNode.removeChild(a)};function S(a,b,c,d,e,h,f,g){this.H=a;this.ea=b;this.c=c;this.k=d;this.o=g||"BESbswy";this.g=e;this.p={};this.D=h||5E3;this.L=f||k;this.n=this.m=k;a=new Q(this.c,this.o);v(a.c,a.h);for(var l in T)T.hasOwnProperty(l)&&(R(a,new M(T[l],N(this.k))),this.p[T[l]]=a.h.offsetWidth);a.remove()}var T={pa:"serif",oa:"sans-serif",na:"monospace"};
S.prototype.start=function(){var a=this.m=new Q(this.c,this.o);v(a.c,a.h);a=this.n=new Q(this.c,this.o);v(a.c,a.h);this.ja=s();R(this.m,new M(this.k.getName()+",serif",N(this.k)));R(this.n,new M(this.k.getName()+",sans-serif",N(this.k)));U(this)};function V(a,b,c){for(var d in T)if(T.hasOwnProperty(d)&&b===a.p[T[d]]&&c===a.p[T[d]])return j;return m}
function U(a){var b=a.m.h.offsetWidth,c=a.n.h.offsetWidth;b===a.p.serif&&c===a.p["sans-serif"]||a.g.F&&V(a,b,c)?s()-a.ja>=a.D?a.g.F&&V(a,b,c)&&(a.L===k||a.L.hasOwnProperty(a.k.getName()))?W(a,a.H):W(a,a.ea):setTimeout(r(function(){U(this)},a),25):W(a,a.H)}function W(a,b){a.m.remove();a.n.remove();b(a.k)};function X(a,b,c,d){this.c=b;this.l=c;this.z=0;this.O=this.K=m;this.D=d;this.g=a.g}function Y(a,b,c,d,e){if(0===b.length&&e)O(a.l);else{a.z+=b.length;e&&(a.K=e);for(e=0;e<b.length;e++){var h=b[e],f=c[h.getName()],g=a.l,l=h;x(g.i,[g.e.d(g.f,l.getName(),N(l).toString(),"loading")]);P(g,"fontloading",l);(new S(r(a.T,a),r(a.U,a),a.c,h,a.g,a.D,d,f)).start()}}}
X.prototype.T=function(a){var b=this.l;x(b.i,[b.e.d(b.f,a.getName(),N(a).toString(),"active")],[b.e.d(b.f,a.getName(),N(a).toString(),"loading"),b.e.d(b.f,a.getName(),N(a).toString(),"inactive")]);P(b,"fontactive",a);this.O=j;ga(this)};X.prototype.U=function(a){var b=this.l,c=y(b.i,b.e.d(b.f,a.getName(),N(a).toString(),"active")),d=[],e=[b.e.d(b.f,a.getName(),N(a).toString(),"loading")];c||d.push(b.e.d(b.f,a.getName(),N(a).toString(),"inactive"));x(b.i,d,e);P(b,"fontinactive",a);ga(this)};
function ga(a){0==--a.z&&a.K&&(a.O?(a=a.l,x(a.i,[a.e.d(a.f,"active")],[a.e.d(a.f,"loading"),a.e.d(a.f,"inactive")]),P(a,"active")):O(a.l))};function Z(a){this.s=a;this.I=new fa;this.ka=new E(a.navigator.userAgent,a.document);this.a=this.ka.parse();this.B=this.C=0}
Z.prototype.load=function(a){var b=a.context||this.s;this.c=new t(this.s,b);var b=new ea(this.c,b.document.documentElement,a),c=[],d=a.timeout;x(b.i,[b.e.d(b.f,"loading")]);P(b,"loading");var c=this.I,e=this.c,h=[],f;for(f in a)if(a.hasOwnProperty(f)){var g=c.M[f];g&&h.push(g(a[f],e))}c=h;this.B=this.C=c.length;a=new X(this.a,this.c,b,d);f=0;for(d=c.length;f<d;f++)e=c[f],ha(e,this.a,r(this.fa,this,e,b,a))};
Z.prototype.fa=function(a,b,c,d){var e=this;d?a.load(function(a,b,d){var l=0==--e.C;setTimeout(function(){Y(c,a,b||{},d||k,l)},0)}):(a=0==--this.C,this.B--,a&&0==this.B?O(b):Y(c,[],{},k,a))};function ia(a,b){this.c=a;this.w=b;this.J=[]}
function ha(a,b,c){var d=a.w.projectId,e=a.w.version;if(d){var h=a.c.A,f=a.c,g;g=a.c;var l=g.A.location.protocol;"about:"==l&&(l=g.s.location.protocol);g="https:"==l?"https:":"http:";l=(a.w.api||"fast.fonts.net/jsapi").replace(/^.*http(s?):(\/\/)?/,"");var u=function(e){if(e)c(m);else{if(h["__mti_fntLst"+d]&&(e=h["__mti_fntLst"+d]()))for(var f=0;f<e.length;f++)a.J.push(new M(e[f].fontfamily));c(b.g.P)}},D=f.r.getElementsByTagName("head")[0];if(D){var w=f.createElement("script",{src:g+"//"+l+"/"+d+
".js"+(e?"?v="+e:"")}),I=m;w.onload=w.onreadystatechange=function(){if(!I&&(!this.readyState||"loaded"==this.readyState||"complete"==this.readyState))I=j,u&&u(k),w.onload=w.onreadystatechange=k,"HEAD"==w.parentNode.tagName&&D.removeChild(w)};D.appendChild(w);window.setTimeout(function(){I||(I=j,u&&u(Error("Script load timeout")))},5E3);e=w}else e=k;e.id="__MonotypeAPIScript__"+d}else c(m)}ia.prototype.load=function(a){a(this.J)};var $=new Z(p);$.I.M.monotype=function(a,b){return new ia(b,a)};p.WebFont||(p.WebFont={},p.WebFont.load=r($.load,$),p.WebFontConfig&&$.load(p.WebFontConfig));})(this,document);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment