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

42 lines
15 KiB
JavaScript

/*
* Copyright 2011 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 i(a){return function(){return this[a]}}var j;function n(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 o(a,b){this.C=a;this.c=b}o.prototype.createElement=function(a,b,c){a=this.C.createElement(a);if(b)for(var d in b)if(b.hasOwnProperty(d))if(d=="style"&&this.c.getName()=="MSIE")a.style.cssText=b[d];else a.setAttribute(d,b[d]);c&&a.appendChild(this.C.createTextNode(c));return a};function p(a,b,c){a=a.C.getElementsByTagName(b)[0];if(!a)a=document.documentElement;if(a&&a.lastChild){a.insertBefore(c,a.lastChild);return true}return false}
function aa(a,b){function c(){document.body?b():setTimeout(c,0)}c()}function q(a,b){if(b.parentNode){b.parentNode.removeChild(b);return true}return false}function r(a,b){return a.createElement("link",{rel:"stylesheet",href:b})}function s(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 t(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 u(a,b,c){a=b.className.split(/\s+/);b=0;for(var d=a.length;b<d;b++)if(a[b]==c)return true;return false};function v(a,b,c,d,e,f,g,h){this.ta=a;this.Ba=b;this.ea=c;this.da=d;this.ya=e;this.xa=f;this.ca=g;this.Ca=h}j=v.prototype;j.getName=i("ta");j.oa=i("Ba");j.ka=i("ea");j.la=i("da");j.ma=i("ya");j.na=i("xa");j.ja=i("ca");j.v=i("Ca");function x(a,b){this.c=a;this.m=b}var ba=new v("Unknown","Unknown","Unknown","Unknown","Unknown","Unknown",undefined,false);x.prototype.parse=function(){return this.c.indexOf("MSIE")!=-1?ca(this):this.c.indexOf("Opera")!=-1?da(this):this.c.indexOf("AppleWebKit")!=-1?ea(this):this.c.indexOf("Gecko")!=-1?fa(this):ba};
function y(a){var b=z(a,a.c,/(iPod|iPad|iPhone|Android)/,1);if(b!="")return b;a=z(a,a.c,/(Linux|Mac_PowerPC|Macintosh|Windows)/,1);if(a!=""){if(a=="Mac_PowerPC")a="Macintosh";return a}return"Unknown"}function A(a){var b=z(a,a.c,/(OS X|Windows NT|Android) ([^;)]+)/,2);if(b)return b;if(b=z(a,a.c,/(iPhone )?OS ([\d_]+)/,2))return b;if(a=z(a,a.c,/Linux ([i\d]+)/,1))return a;return"Unknown"}
function ca(a){var b=z(a,a.c,/(MSIE [\d\w\.]+)/,1);if(b!=""){var c=b.split(" ");b=c[0];c=c[1];return new v(b,c,b,c,y(a),A(a),B(a,a.m),C(a,c)>=6)}return new v("MSIE","Unknown","MSIE","Unknown",y(a),A(a),B(a,a.m),false)}
function da(a){var b="Unknown",c="Unknown",d=z(a,a.c,/(Presto\/[\d\w\.]+)/,1);if(d!=""){c=d.split("/");b=c[0];c=c[1]}else{if(a.c.indexOf("Gecko")!=-1)b="Gecko";d=z(a,a.c,/rv:([^\)]+)/,1);if(d!="")c=d}if(a.c.indexOf("Version/")!=-1){d=z(a,a.c,/Version\/([\d\.]+)/,1);if(d!="")return new v("Opera",d,b,c,y(a),A(a),B(a,a.m),C(a,d)>=10)}d=z(a,a.c,/Opera[\/ ]([\d\.]+)/,1);if(d!="")return new v("Opera",d,b,c,y(a),A(a),B(a,a.m),C(a,d)>=10);return new v("Opera","Unknown",b,c,y(a),A(a),B(a,a.m),false)}
function ea(a){var b=y(a),c=A(a),d=z(a,a.c,/AppleWebKit\/([\d\.\+]+)/,1);if(d=="")d="Unknown";var e="Unknown";if(a.c.indexOf("Chrome")!=-1)e="Chrome";else if(a.c.indexOf("Safari")!=-1)e="Safari";else if(a.c.indexOf("AdobeAIR")!=-1)e="AdobeAIR";var f="Unknown";if(a.c.indexOf("Version/")!=-1)f=z(a,a.c,/Version\/([\d\.\w]+)/,1);else if(e=="Chrome")f=z(a,a.c,/Chrome\/([\d\.]+)/,1);else if(e=="AdobeAIR")f=z(a,a.c,/AdobeAIR\/([\d\.]+)/,1);var g=false;if(e=="AdobeAIR"){g=z(a,f,/\d+\.(\d+)/,1);g=C(a,f)>2||
C(a,f)==2&&parseInt(g,10)>=5}else{g=z(a,d,/\d+\.(\d+)/,1);g=C(a,d)>=526||C(a,d)>=525&&parseInt(g,10)>=13}return new v(e,f,"AppleWebKit",d,b,c,B(a,a.m),g)}
function fa(a){var b="Unknown",c="Unknown",d=false;if(a.c.indexOf("Firefox")!=-1){b="Firefox";var e=z(a,a.c,/Firefox\/([\d\w\.]+)/,1);if(e!=""){d=z(a,e,/\d+\.(\d+)/,1);c=e;d=e!=""&&C(a,e)>=3&&parseInt(d,10)>=5}}else if(a.c.indexOf("Mozilla")!=-1)b="Mozilla";e=z(a,a.c,/rv:([^\)]+)/,1);if(e=="")e="Unknown";else if(!d){d=C(a,e);var f=parseInt(z(a,e,/\d+\.(\d+)/,1),10),g=parseInt(z(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 v(b,c,"Gecko",e,y(a),A(a),B(a,a.m),d)}function C(a,b){a=z(a,b,/(\d+)/,1);if(a!="")return parseInt(a,10);return-1}function z(a,b,c,d){if((a=b.match(c))&&a[d])return a[d];return""}function B(a,b){if(b.documentMode)return b.documentMode};function ga(a,b,c,d){this.a=a;this.f=b;this.L=c;this.j=d||ha;this.g=new D("-")}var ha="wf";function E(a){s(a.a,a.f,a.g.e(a.j,"loading"));G(a,"loading")}function H(a){t(a.a,a.f,a.g.e(a.j,"loading"));u(a.a,a.f,a.g.e(a.j,"active"))||s(a.a,a.f,a.g.e(a.j,"inactive"));G(a,"inactive")}function ia(a){t(a.a,a.f,a.g.e(a.j,"loading"));t(a.a,a.f,a.g.e(a.j,"inactive"));s(a.a,a.f,a.g.e(a.j,"active"));G(a,"active")}function G(a,b,c,d){a.L[b]&&a.L[b](c,d)};function ja(){this.V={}}function ka(a,b){var c=[];for(var d in b)if(b.hasOwnProperty(d)){var e=a.V[d];e&&c.push(e(b[d]))}return c};function I(a,b,c,d,e){this.a=a;this.s=b;this.t=c;this.p=d;this.F=e;this.N=0;this.$=this.U=false}I.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.N+=b[g].length}if(d)this.U=d;for(f=0;f<e;f++){g=a[f];d=b[g];for(var h=c[g],m=0,k=d.length;m<k;m++){var l=d[m],w=this.s,F=g;s(w.a,w.f,w.g.e(w.j,F,l,"loading"));G(w,"fontloading",F,l);w=n(this,this.ga);F=n(this,this.ha);new J(w,F,this.a,this.t,this.p,this.F,g,l,h)}}};
I.prototype.ga=function(a,b){var c=this.s;t(c.a,c.f,c.g.e(c.j,a,b,"loading"));t(c.a,c.f,c.g.e(c.j,a,b,"inactive"));s(c.a,c.f,c.g.e(c.j,a,b,"active"));G(c,"fontactive",a,b);this.$=true;K(this)};I.prototype.ha=function(a,b){var c=this.s;t(c.a,c.f,c.g.e(c.j,a,b,"loading"));u(c.a,c.f,c.g.e(c.j,a,b,"active"))||s(c.a,c.f,c.g.e(c.j,a,b,"inactive"));G(c,"fontinactive",a,b);K(this)};function K(a){if(--a.N==0&&a.U)a.$?ia(a.s):H(a.s)};function J(a,b,c,d,e,f,g,h,m){this.ba=a;this.pa=b;this.a=c;this.t=d;this.p=e;this.F=f;this.sa=new L;this.q=new M;this.Q=g;this.P=h;this.ia=m||N;this.va=O(this,P);this.wa=O(this,Q);this.Y=R(this,P);this.Z=R(this,Q);this.Aa=f();this.M()}var P="arial,'URW Gothic L',sans-serif",Q="Georgia,'Century Schoolbook L',serif",N="BESs";J.prototype.M=function(){var a=this.t.G(this.Y),b=this.t.G(this.Z);if(this.va!=a||this.wa!=b)S(this,this.ba);else this.F()-this.Aa<5E3?la(this):S(this,this.pa)};
function la(a){a.p(function(b,c){return function(){c.call(b)}}(a,a.M),50)}function S(a,b){q(a.a,a.Y);q(a.a,a.Z);b(a.Q,a.P)}function O(a,b){b=R(a,b,true);var c=a.t.G(b);q(a.a,b);return c}function R(a,b,c){var d=a.q.expand(a.P);b=a.a.createElement("span",{style:"position:absolute;top:-999px;font-size:300px;width:auto;height:auto;line-height:normal;margin:0;padding:0;font-variant:normal;font-family:"+(c?"":a.sa.quote(a.Q)+",")+b+";"+d},a.ia);p(a.a,"body",b);return b};function T(a,b,c,d,e){this.a=a;this.R=b;this.f=c;this.p=d;this.c=e;this.H=this.I=0}T.prototype.o=function(a,b){this.R.V[a]=b};T.prototype.load=function(a){var b=new ga(this.a,this.f,a);this.c.v()?ma(this,b,a):H(b)};T.prototype.qa=function(a,b,c,d){if(d)a.load(n(this,this.ua,b,c));else{a=--this.I==0;this.H--;if(a)this.H==0?H(b):E(b);c.watch([],{},{},a)}};T.prototype.ua=function(a,b,c,d,e){var f=--this.I==0;f&&E(a);this.p(n(this,function(g,h,m,k,l){g.watch(h,m||{},k||{},l)},b,c,d,e,f))};
function ma(a,b,c){c=ka(a.R,c);a.H=a.I=c.length;for(var d=new I(a.a,b,{G:function(h){return h.offsetWidth}},a.p,function(){return(new Date).getTime()}),e=0,f=c.length;e<f;e++){var g=c[e];g.w(a.c,n(a,a.qa,g,b,d))}};function D(a){this.ra=a||na}var na="-";D.prototype.e=function(){for(var a=[],b=0;b<arguments.length;b++)a.push(arguments[b].replace(/[\W_]+/g,"").toLowerCase());return a.join(this.ra)};function L(){this.X="'"}L.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.X+d+this.X)}return b.join(",")};function M(){this.A=oa;this.k=pa}var oa=["font-style","font-weight"],pa={"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.S=a;this.za=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.S]=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.S]=this.za+":"+this.k[c][1];return}};M.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.A.length;g++)if(e==this.A[g]){e=new U(g,e,this.k[e]);break a}e=null}e&&e.compact(b,f)}}return b.join("")};
M.prototype.expand=function(a){if(a.length!=2)return null;for(var b=[null,null],c=0,d=this.A.length;c<d;c++){var e=this.A[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 x(navigator.userAgent,document)).parse();return new T(new o(document,a),new ja,document.documentElement,function(b,c){setTimeout(b,c)},a)}();window.WebFont.load=window.WebFont.load;window.WebFont.addModule=window.WebFont.o;v.prototype.getName=v.prototype.getName;v.prototype.getVersion=v.prototype.oa;v.prototype.getEngine=v.prototype.ka;v.prototype.getEngineVersion=v.prototype.la;v.prototype.getPlatform=v.prototype.ma;v.prototype.getPlatformVersion=v.prototype.na;
v.prototype.getDocumentMode=v.prototype.ja;v.prototype.isSupportingWebFont=v.prototype.v;function V(a,b){this.a=a;this.d=b}var qa={regular:"n4",bold:"n7",italic:"i4",bolditalic:"i7",r:"n4",b:"n7",i:"i4",bi:"i7"};V.prototype.w=function(a,b){return b(a.v())};
V.prototype.load=function(a){p(this.a,"head",r(this.a,("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 h=void 0;h=void 0;h=b[f].split(":");e=h[0];h=h[1]?ra(this,h[1]):["n4"];e={O:e,K:h};c.push(e.O);d[e.O]=e.K}b={fa:c,K:d};a(b.fa,b.K)};
function ra(a,b){a=b.split(",");b=[];for(var c=0,d=a.length;c<d;c++){var e=a[c];if(e){var f=qa[e];b.push(f?f:e)}}return b}window.WebFont.o("ascender",function(a){var b=(new x(navigator.userAgent,document)).parse();return new V(new o(document,b),a)});function W(a){this.B=a?a:("https:"==window.location.protocol?"https:":"http:")+sa;this.h=[];this.J=[]}var sa="//fonts.googleapis.com/css";W.prototype.e=function(){if(this.h.length==0)throw new Error("No fonts to load !");if(this.B.indexOf("kit=")!=-1)return this.B;for(var a=this.h.length,b=[],c=0;c<a;c++)b.push(this.h[c].replace(/ /g,"+"));a=this.B+"?family="+b.join("%7C");if(this.J.length>0)a+="&subset="+this.J.join(",");return a};function ta(a){this.h=a;this.W=[];this.aa={};this.z={};this.q=new M}var ua={ultralight:"n2",light:"n3",regular:"n4",bold:"n7",italic:"i4",bolditalic:"i7",ul:"n2",l:"n3",r:"n4",b:"n7",i:"i4",bi:"i7"},va={latin:N,cyrillic:"&#1081;&#1103;&#1046;",greek:"&#945;&#946;&#931;",khmer:"&#x1780;&#x1781;&#x1782;",Hanuman:"&#x1780;&#x1781;&#x1782;"};
ta.prototype.parse=function(){for(var a=this.h.length,b=0;b<a;b++){var c=this.h[b].split(":"),d=c[0],e=["n4"];if(c.length>=2){var f=c[1],g=[];if(f){f=f.split(",");for(var h=f.length,m=0;m<h;m++){var k;k=f[m];if(k.match(/^[\w ]+$/)){var l=ua[k];if(l)k=l;else{l=k.match(/^(\d*)(\w*)$/);k=l[1];l=l[2];k=(k=this.q.expand([l?l:"n",k?k.substr(0,1):"4"].join("")))?this.q.compact(k):null}}else k="";k&&g.push(k)}}if(g.length>0)e=g;if(c.length==3){c=c[2];g=[];c=c?c.split(","):g;if(c.length>0)if(c=va[c[0]])this.z[d]=
c}}if(!this.z[d])if(c=va[d])this.z[d]=c;this.W.push(d);this.aa[d]=e}};function X(a,b,c){this.c=a;this.a=b;this.d=c}X.prototype.w=function(a,b){b(a.v())};X.prototype.load=function(a){var b=this.a;this.c.getName()=="MSIE"&&this.d.blocking!=true?aa(b,n(this,this.T,a)):this.T(a)};X.prototype.T=function(a){for(var b=this.a,c=new W(this.d.api),d=this.d.families,e=d.length,f=0;f<e;f++){var g=d[f].split(":");g.length==3&&c.J.push(g.pop());c.h.push(g.join(":"))}d=new ta(d);d.parse();p(b,"head",r(b,c.e()));a(d.W,d.aa,d.z)};
window.WebFont.o("google",function(a){var b=(new x(navigator.userAgent,document)).parse();return new X(b,new o(document,b),a)});function Y(a,b){this.a=a;this.d=b}Y.prototype.load=function(a){for(var b=this.d.urls||[],c=this.d.families||[],d=0,e=b.length;d<e;d++)p(this.a,"head",r(this.a,b[d]));a(c)};Y.prototype.w=function(a,b){return b(a.v())};window.WebFont.o("custom",function(a){var b=(new x(navigator.userAgent,document)).parse();return new Y(new o(document,b),a)});function Z(a,b,c){this.n=a;this.a=b;this.d=c;this.h=[];this.u={};this.q=new M}Z.prototype.D=function(a){return(this.d.api||"http://fontdeck.com/api/v1/project-info?")+"project="+a+"&domain="+document.location.hostname+"&callback=window.__webfontfontdeckmodule__["+a+"]"};
Z.prototype.w=function(a,b){a=this.d.id;var c=this.d.families||null,d=this;if(a){this.n.__webfontfontdeckmodule__||(this.n.__webfontfontdeckmodule__={});this.n.__webfontfontdeckmodule__[a]=function(e){p(d.a,"head",r(d.a,e.css));for(var f=0,g=e.provides.length;f<g;++f){var h=e.provides[f];d.h.push(h.name);d.u[h.name]=[d.q.compact("font-weight:"+h.weight+";font-style:"+h.style)]}if(c!==null)d.h=c;b(true)};p(this.a,"head",this.a.createElement("script",{src:this.D(a)}))}else b(true)};
Z.prototype.load=function(a){a(this.h,this.u)};window.WebFont.o("fontdeck",function(a){var b=(new x(navigator.userAgent,document)).parse();return new Z(window,new o(document,b),a)});function $(a,b,c){this.n=a;this.a=b;this.d=c;this.h=[];this.u={}}$.prototype.D=function(a){return(this.d.api||"http://use.typekit.com")+"/"+a+".js"};$.prototype.w=function(a,b){var c=this.d.id,d=this.d,e=this;if(c){this.n.__webfonttypekitmodule__||(this.n.__webfonttypekitmodule__={});this.n.__webfonttypekitmodule__[c]=function(f){f(a,d,function(g,h,m){e.h=h;e.u=m;b(g)})};p(this.a,"head",this.a.createElement("script",{src:this.D(c)}))}else b(true)};$.prototype.load=function(a){a(this.h,this.u)};
window.WebFont.o("typekit",function(a){var b=(new x(navigator.userAgent,document)).parse();return new $(window,new o(document,b),a)});window.WebFontConfig&&window.WebFont.load(window.WebFontConfig);
})(this,document);