LocalCDN-Firefox-Chrome-Brave/resources/webfont/1.0.15/webfont.jsm

40 lines
13 KiB
JavaScript

/*
* Copyright 2010 Small Batch, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
;(function(window,document,undefined){
function h(a){return function(){return this[a]}}var j;function m(a,b){var c=arguments.length>2?Array.prototype.slice.call(arguments,2):[];return function(){c.push.apply(c,arguments);return b.apply(a,c)}};function n(a,b){this.w=a;this.a=b}n.prototype.createElement=function(a,b,c){a=this.w.createElement(a);if(b)for(var d in b)if(b.hasOwnProperty(d))if(d=="style"&&this.a.getName()=="MSIE")a.style.cssText=b[d];else a.setAttribute(d,b[d]);c&&a.appendChild(this.w.createTextNode(c));return a};function p(a,b,c){a=a.w.getElementsByTagName(b)[0];if(!a)a=document.documentElement;if(a&&a.lastChild){a.insertBefore(c,a.lastChild);return true}return false}
function s(a,b){function c(){document.body?b():setTimeout(c,0)}c()}function t(a,b){if(b.parentNode){b.parentNode.removeChild(b);return true}return false}function u(a,b){return a.createElement("link",{rel:"stylesheet",href:b})}function v(a,b,c){a=b.className.split(/\s+/);for(var d=0,e=a.length;d<e;d++)if(a[d]==c)return;a.push(c);b.className=a.join(" ").replace(/^\s+/,"")}
function w(a,b,c){a=b.className.split(/\s+/);for(var d=[],e=0,f=a.length;e<f;e++)a[e]!=c&&d.push(a[e]);b.className=d.join(" ").replace(/^\s+/,"").replace(/\s+$/,"")};function x(a,b,c,d,e,f,g,i){this.ia=a;this.na=b;this.Z=c;this.Y=d;this.la=e;this.ka=f;this.X=g;this.oa=i}j=x.prototype;j.getName=h("ia");j.ea=h("na");j.ba=h("Z");j.ca=h("Y");j.N=h("la");j.da=h("ka");j.aa=h("X");j.p=h("oa");function y(a,b){this.a=a;this.m=b}var z=new x("Unknown","Unknown","Unknown","Unknown","Unknown","Unknown",undefined,false);y.prototype.parse=function(){return this.a.indexOf("MSIE")!=-1?A(this):this.a.indexOf("Opera")!=-1?B(this):this.a.indexOf("AppleWebKit")!=-1?aa(this):this.a.indexOf("Gecko")!=-1?ba(this):z};
function C(a){var b=D(a,a.a,/(iPod|iPad|iPhone|Android)/,1);if(b!="")return b;a=D(a,a.a,/(Linux|Mac_PowerPC|Macintosh|Windows)/,1);if(a!=""){if(a=="Mac_PowerPC")a="Macintosh";return a}return"Unknown"}function E(a){var b=D(a,a.a,/(OS X|Windows NT|Android) ([^;)]+)/,2);if(b)return b;if(b=D(a,a.a,/(iPhone )?OS ([\d_]+)/,2))return b;if(a=D(a,a.a,/Linux ([i\d]+)/,1))return a;return"Unknown"}
function A(a){var b=D(a,a.a,/(MSIE [\d\w\.]+)/,1);if(b!=""){var c=b.split(" ");b=c[0];c=c[1];return new x(b,c,b,c,C(a),E(a),F(a,a.m),G(a,c)>=6)}return new x("MSIE","Unknown","MSIE","Unknown",C(a),E(a),F(a,a.m),false)}
function B(a){var b="Unknown",c="Unknown",d=D(a,a.a,/(Presto\/[\d\w\.]+)/,1);if(d!=""){c=d.split("/");b=c[0];c=c[1]}else{if(a.a.indexOf("Gecko")!=-1)b="Gecko";d=D(a,a.a,/rv:([^\)]+)/,1);if(d!="")c=d}if(a.a.indexOf("Version/")!=-1){d=D(a,a.a,/Version\/([\d\.]+)/,1);if(d!="")return new x("Opera",d,b,c,C(a),E(a),F(a,a.m),G(a,d)>=10)}d=D(a,a.a,/Opera[\/ ]([\d\.]+)/,1);if(d!="")return new x("Opera",d,b,c,C(a),E(a),F(a,a.m),G(a,d)>=10);return new x("Opera","Unknown",b,c,C(a),E(a),F(a,a.m),false)}
function aa(a){var b=C(a),c=E(a),d=D(a,a.a,/AppleWebKit\/([\d\.\+]+)/,1);if(d=="")d="Unknown";var e="Unknown";if(a.a.indexOf("Chrome")!=-1)e="Chrome";else if(a.a.indexOf("Safari")!=-1)e="Safari";else if(a.a.indexOf("AdobeAIR")!=-1)e="AdobeAIR";var f="Unknown";if(a.a.indexOf("Version/")!=-1)f=D(a,a.a,/Version\/([\d\.\w]+)/,1);else if(e=="Chrome")f=D(a,a.a,/Chrome\/([\d\.]+)/,1);else if(e=="AdobeAIR")f=D(a,a.a,/AdobeAIR\/([\d\.]+)/,1);var g=false;if(e=="AdobeAIR"){g=D(a,f,/\d+\.(\d+)/,1);g=G(a,f)>2||
G(a,f)==2&&parseInt(g,10)>=5}else{g=D(a,d,/\d+\.(\d+)/,1);g=G(a,d)>=526||G(a,d)>=525&&parseInt(g,10)>=13}return new x(e,f,"AppleWebKit",d,b,c,F(a,a.m),g)}
function ba(a){var b="Unknown",c="Unknown",d=false;if(a.a.indexOf("Firefox")!=-1){b="Firefox";var e=D(a,a.a,/Firefox\/([\d\w\.]+)/,1);if(e!=""){d=D(a,e,/\d+\.(\d+)/,1);c=e;d=e!=""&&G(a,e)>=3&&parseInt(d,10)>=5}}else if(a.a.indexOf("Mozilla")!=-1)b="Mozilla";e=D(a,a.a,/rv:([^\)]+)/,1);if(e=="")e="Unknown";else if(!d){d=G(a,e);var f=parseInt(D(a,e,/\d+\.(\d+)/,1),10),g=parseInt(D(a,e,/\d+\.\d+\.(\d+)/,1),10);d=d>1||d==1&&f>9||d==1&&f==9&&g>=2||e.match(/1\.9\.1b[123]/)!=null||e.match(/1\.9\.1\.[\d\.]+/)!=
null}return new x(b,c,"Gecko",e,C(a),E(a),F(a,a.m),d)}function G(a,b){a=D(a,b,/(\d+)/,1);if(a!="")return parseInt(a,10);return-1}function D(a,b,c,d){if((a=b.match(c))&&a[d])return a[d];return""}function F(a,b){if(b.documentMode)return b.documentMode};function ca(a,b,c,d){this.c=a;this.f=b;this.H=c;this.j=d||da;this.g=new H("-")}var da="wf";function I(a){v(a.c,a.f,a.g.e(a.j,"loading"));J(a,"loading")}function K(a,b,c){w(a.c,a.f,a.g.e(a.j,b,c,"loading"));v(a.c,a.f,a.g.e(a.j,b,c,"active"));J(a,"fontactive",b,c)}function L(a){w(a.c,a.f,a.g.e(a.j,"loading"));v(a.c,a.f,a.g.e(a.j,"inactive"));J(a,"inactive")}function ea(a){w(a.c,a.f,a.g.e(a.j,"loading"));v(a.c,a.f,a.g.e(a.j,"active"));J(a,"active")}function J(a,b,c,d){a.H[b]&&a.H[b](c,d)};function fa(){this.S={}}function ga(a,b){var c=[];for(var d in b)if(b.hasOwnProperty(d)){var e=a.S[d];e&&c.push(e(b[d]))}return c};function M(a,b,c,d,e){this.c=a;this.n=b;this.z=c;this.q=d;this.O=e;this.I=0;this.F=this.R=false;this.ha=new N;this.s=new O}
M.prototype.watch=function(a,b,c,d){for(var e=a.length,f=0;f<e;f++){var g=a[f];b[g]||(b[g]=["n4"]);this.I+=b[g].length}if(d)this.R=d;for(f=0;f<e;f++){g=a[f];d=b[g];for(var i=c[g]||"Mm",k=0,l=d.length;k<l;k++){var q=d[k],r=P(this,"_,arial,helvetica",q,i),T=this.z.A(r);t(this.c,r);r=g;var o=this.n;v(o.c,o.f,o.g.e(o.j,r,q,"loading"));J(o,"fontloading",r,q);o=P(this,this.ha.quote(r),q,i);if(T!=this.z.A(o)){t(this.c,o);K(this.n,r,q);this.F=true;Q(this)}else R(this,this.O(),T,o,r,q)}}};
function Q(a){if(--a.I==0&&a.R)a.F?ea(a.n):L(a.n)}M.prototype.W=function(a,b,c,d,e){if(b!=this.z.A(c)){t(this.c,c);K(this.n,d,e);this.F=true;Q(this)}else if(this.O()-a<5E3)R(this,a,b,c,d,e);else{t(this.c,c);a=this.n;w(a.c,a.f,a.g.e(a.j,d,e,"loading"));v(a.c,a.f,a.g.e(a.j,d,e,"inactive"));J(a,"fontinactive",d,e);Q(this)}};function R(a,b,c,d,e,f){a.q(function(g,i){return function(){i.call(g,b,c,d,e,f)}}(a,a.W),50)}
function P(a,b,c,d){c=a.s.expand(c);b=a.c.createElement("span",{style:"position:absolute;top:-999px;font-size:300px;font-family:"+b+",_,arial,helvetica;"+c},d);p(a.c,"body",b);return b};function S(a,b,c,d,e){this.c=a;this.K=b;this.f=c;this.q=d;this.a=e;this.C=this.D=0}S.prototype.o=function(a,b){this.K.S[a]=b};S.prototype.load=function(a){var b=new ca(this.c,this.f,a);this.a.p()?ha(this,b,a):L(b)};S.prototype.fa=function(a,b,c,d){if(d)a.load(m(this,this.ja,b,c));else{a=--this.D==0;this.C--;if(a)this.C==0?L(b):I(b);c.watch([],{},{},a)}};S.prototype.ja=function(a,b,c,d,e){var f=--this.D==0;f&&I(a);this.q(m(this,function(g,i,k,l,q){g.watch(i,k||{},l||{},q)},b,c,d,e,f))};
function ha(a,b,c){c=ga(a.K,c);a.C=a.D=c.length;for(var d=new M(a.c,b,{A:function(i){return i.offsetWidth}},a.q,function(){return(new Date).getTime()}),e=0,f=c.length;e<f;e++){var g=c[e];g.u(a.a,m(a,a.fa,g,b,d))}};function H(a){this.ga=a||ia}var ia="-";H.prototype.e=function(){for(var a=[],b=0;b<arguments.length;b++)a.push(arguments[b].replace(/[\W_]+/g,"").toLowerCase());return a.join(this.ga)};function N(){this.U='"'}N.prototype.quote=function(a){var b=[];a=a.split(/,\s*/);for(var c=0;c<a.length;c++){var d=a[c].replace(/['"]/g,"");d.indexOf(" ")==-1?b.push(d):b.push(this.U+d+this.U)}return b.join(",")};function O(){this.t=ja;this.k=ka}var ja=["font-style","font-weight"],ka={"font-style":[["n","normal"],["i","italic"],["o","oblique"]],"font-weight":[["1","100"],["2","200"],["3","300"],["4","400"],["5","500"],["6","600"],["7","700"],["8","800"],["9","900"],["4","normal"],["7","bold"]]};function U(a,b,c){this.P=a;this.ma=b;this.k=c}U.prototype.compact=function(a,b){for(var c=0;c<this.k.length;c++)if(b==this.k[c][1]){a[this.P]=this.k[c][0];return}};
U.prototype.expand=function(a,b){for(var c=0;c<this.k.length;c++)if(b==this.k[c][0]){a[this.P]=this.ma+":"+this.k[c][1];return}};O.prototype.compact=function(a){var b=["n","4"];a=a.split(";");for(var c=0,d=a.length;c<d;c++){var e=a[c].replace(/\s+/g,"").split(":");if(e.length==2){var f=e[1];a:{e=e[0];for(var g=0;g<this.t.length;g++)if(e==this.t[g]){e=new U(g,e,this.k[e]);break a}e=null}e&&e.compact(b,f)}}return b.join("")};
O.prototype.expand=function(a){if(a.length!=2)return null;for(var b=[null,null],c=0,d=this.t.length;c<d;c++){var e=this.t[c],f=a.substr(c,1);(new U(c,e,this.k[e])).expand(b,f)}return b[0]&&b[1]?b.join(";")+";":null};window.WebFont=function(){var a=(new y(navigator.userAgent,document)).parse();return new S(new n(document,a),new fa,document.documentElement,function(b,c){setTimeout(b,c)},a)}();window.WebFont.load=window.WebFont.load;window.WebFont.addModule=window.WebFont.o;x.prototype.getName=x.prototype.getName;x.prototype.getVersion=x.prototype.ea;x.prototype.getEngine=x.prototype.ba;x.prototype.getEngineVersion=x.prototype.ca;x.prototype.getPlatform=x.prototype.N;x.prototype.getPlatformVersion=x.prototype.da;
x.prototype.getDocumentMode=x.prototype.aa;x.prototype.isSupportingWebFont=x.prototype.p;function V(a,b){this.c=a;this.d=b}var la={regular:"n4",bold:"n7",italic:"i4",bolditalic:"i7",r:"n4",b:"n7",i:"i4",bi:"i7"};V.prototype.u=function(a,b){return b(a.p())};
V.prototype.load=function(a){p(this.c,"head",u(this.c,("https:"==document.location.protocol?"https:":"http:")+"//webfonts.fontslive.com/css/"+this.d.key+".css"));var b;b=this.d.families;var c,d,e;c=[];d={};for(var f=0,g=b.length;f<g;f++){e=void 0;var i=void 0;i=void 0;i=b[f].split(":");e=i[0];i=i[1]?ma(this,i[1]):["n4"];e={J:e,G:i};c.push(e.J);d[e.J]=e.G}b={$:c,G:d};a(b.$,b.G)};
function ma(a,b){a=b.split(",");b=[];for(var c=0,d=a.length;c<d;c++){var e=a[c];if(e){var f=la[e];b.push(f?f:e)}}return b}window.WebFont.o("ascender",function(a){var b=(new y(navigator.userAgent,document)).parse();return new V(new n(document,b),a)});function W(a){this.v=a?a:("https:"==window.location.protocol?"https:":"http:")+na;this.h=null}var na="//fonts.googleapis.com/css";W.prototype.e=function(){if(!this.h)throw new Error("No fonts to load !");if(this.v.indexOf("kit=")!=-1)return this.v;for(var a=this.h.length,b=[],c=0;c<a;c++)b.push(this.h[c].replace(/ /g,"+"));return this.v+"?family="+b.join("%7C")};function X(a){this.h=a;this.T=[];this.V={};this.L={};this.s=new O}var oa={ultralight:"n2",light:"n3",regular:"n4",bold:"n7",italic:"i4",bolditalic:"i7",ul:"n2",l:"n3",r:"n4",b:"n7",i:"i4",bi:"i7"},pa={Hanuman:"&#x1780;&#x1781;&#x1782;"};
X.prototype.parse=function(){for(var a=this.h.length,b=0;b<a;b++){var c=this.h[b].split(":"),d=c[0],e=null;if(c.length==2){var f=[];c=c[1].split(",");for(var g=c.length,i=0;i<g;i++){var k;k=c[i];if(k.match(/^[\w ]+$/)){var l=oa[k];if(l)k=l;else{l=k.match(/^(\d*)(\w*)$/);k=l[1];l=l[2];k=(k=this.s.expand([l?l:"n",k?k.substr(0,1):"4"].join("")))?this.s.compact(k):null}}else k="";k&&f.push(k)}if(f.length>0)e=f}else e=["n4"];this.T.push(d);if(f=pa[d])this.L[d]=f;this.V[d]=e}};function Y(a,b,c){this.a=a;this.c=b;this.d=c}Y.prototype.u=function(a,b){a.N().match(/iPad|iPod|iPhone/)!=null&&b(false);return b(a.p())};Y.prototype.load=function(a){var b=this.c;this.a.getName()=="MSIE"&&this.d.blocking!=true?s(b,m(this,this.Q,a)):this.Q(a)};Y.prototype.Q=function(a){var b=this.c,c=new W(this.d.api),d=this.d.families;c.h=d;d=new X(d);d.parse();p(b,"head",u(b,c.e()));a(d.T,d.V,d.L)};
window.WebFont.o("google",function(a){var b=(new y(navigator.userAgent,document)).parse();return new Y(b,new n(document,b),a)});function Z(a,b){this.c=a;this.d=b}Z.prototype.load=function(a){for(var b=this.d.urls||[],c=this.d.families||[],d=0,e=b.length;d<e;d++)p(this.c,"head",u(this.c,b[d]));a(c)};Z.prototype.u=function(a,b){return b(a.p())};window.WebFont.o("custom",function(a){var b=(new y(navigator.userAgent,document)).parse();return new Z(new n(document,b),a)});function $(a,b,c){this.B=a;this.c=b;this.d=c;this.h=[];this.M={}}$.prototype.u=function(a,b){var c=this.d.id,d=this.d,e=this;if(c){this.B.__webfonttypekitmodule__||(this.B.__webfonttypekitmodule__={});this.B.__webfonttypekitmodule__[c]=function(f){f(a,d,function(g,i,k){e.h=i;e.M=k;b(g)})};p(this.c,"head",this.c.createElement("script",{src:(this.d.api||"http://use.typekit.com")+"/"+c+".js"}))}else b(true)};$.prototype.load=function(a){a(this.h,this.M)};
window.WebFont.o("typekit",function(a){var b=(new y(navigator.userAgent,document)).parse();return new $(window,new n(document,b),a)});window.WebFontConfig&&window.WebFont.load(window.WebFontConfig);
})(this,document);