1
0
mirror of https://codeberg.org/nobody/LocalCDN.git synced 2025-02-08 16:18:37 +01:00
2020-02-27 13:45:29 +01:00

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