From 5766e7b3bf390cc8ee569cf0f192c5237ce47dc3 Mon Sep 17 00:00:00 2001 From: Timotei Date: Mon, 17 Jun 2024 18:13:00 +0300 Subject: [PATCH] Update webfontloader to latest code I copied the updated code from repository https://github.com/typekit/webfontloader/tree/master and it fixed: https://github.com/litespeedtech/lscache_wp/issues/679 --- assets/js/webfontloader.js | 2 +- assets/js/webfontloader.min.js | 2 +- src/optimize.cls.php | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/assets/js/webfontloader.js b/assets/js/webfontloader.js index d1e856a2e..44a1eaf3d 100644 --- a/assets/js/webfontloader.js +++ b/assets/js/webfontloader.js @@ -14,4 +14,4 @@ function wa(a){if(0==a.a.length)throw Error("No fonts to load!");if(-1!=a.c.inde var za={latin:"BESbswy","latin-ext":"\u00e7\u00f6\u00fc\u011f\u015f",cyrillic:"\u0439\u044f\u0416",greek:"\u03b1\u03b2\u03a3",khmer:"\u1780\u1781\u1782",Hanuman:"\u1780\u1781\u1782"},Aa={thin:"1",extralight:"2","extra-light":"2",ultralight:"2","ultra-light":"2",light:"3",regular:"4",book:"4",medium:"5","semi-bold":"6",semibold:"6","demi-bold":"6",demibold:"6",bold:"7","extra-bold":"8",extrabold:"8","ultra-bold":"8",ultrabold:"8",black:"9",heavy:"9",l:"3",r:"4",b:"7"},Ba={i:"i",italic:"i",n:"n",normal:"n"}, Ca=/^(thin|(?:(?:extra|ultra)-?)?light|regular|book|medium|(?:(?:semi|demi|extra|ultra)-?)?bold|black|heavy|l|r|b|[1-9]00)?(n|i|normal|italic)?$/; function Da(a){for(var b=a.f.length,c=0;c=a.f?e():o.fonts.load((t=a.a,j(t)+" "+t.f+"00 300px "+b(t.c)),a.h).then(function(t){1<=t.length?i():setTimeout(n,25)},function(){e()})}()}),i=null,n=new Promise(function(t,n){i=setTimeout(n,a.f)});Promise.race([n,t]).then(function(){i&&(clearTimeout(i),i=null),a.g(a.a)},function(){a.j(a.a)})};var F={D:"serif",C:"sans-serif"},I=null;function O(){if(null===I){var t=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent);I=!!t&&(parseInt(t[1],10)<536||536===parseInt(t[1],10)&&parseInt(t[2],10)<=11)}return I}function P(t,n,i){for(var e in F)if(F.hasOwnProperty(e)&&n===t.f[F[e]]&&i===t.f[F[e]])return!0;return!1}function B(t){var n,i=t.g.a.offsetWidth,e=t.h.a.offsetWidth;(n=i===t.f.serif&&e===t.f["sans-serif"])||(n=O()&&P(t,i,e)),n?r()-t.A>=t.w?O()&&P(t,i,e)&&(null===t.u||t.u.hasOwnProperty(t.a.c))?L(t,t.v):L(t,t.B):setTimeout(d(function(){B(this)},t),50):L(t,t.v)}function L(t,n){setTimeout(d(function(){i(this.g.a),i(this.h.a),i(this.j.a),i(this.m.a),n(this.a)},t),0)}function D(t,n,i){this.c=t,this.a=n,this.f=0,this.m=this.j=!1,this.s=i}W.prototype.start=function(){this.f.serif=this.j.a.offsetWidth,this.f["sans-serif"]=this.m.a.offsetWidth,this.A=r(),B(this)};var $=null;function q(t){0==--t.f&&t.j&&(t.m?((t=t.a).g&&g(t.f,[t.a.c("wf","active")],[t.a.c("wf","loading"),t.a.c("wf","inactive")]),T(t,"active")):k(t.a))}function t(t){this.j=t,this.a=new S,this.h=0,this.f=this.g=!0}function H(t,n){this.c=t,this.a=n}function M(t,n){this.c=t,this.a=n}function z(t,n){this.c=t||"https://fonts.googleapis.com/css",this.a=[],this.f=[],this.g=n||""}D.prototype.g=function(t){var n=this.a;n.g&&g(n.f,[n.a.c("wf",t.c,x(t).toString(),"active")],[n.a.c("wf",t.c,x(t).toString(),"loading"),n.a.c("wf",t.c,x(t).toString(),"inactive")]),T(n,"fontactive",t),this.m=!0,q(this)},D.prototype.h=function(t){var n=this.a;if(n.g){var i=a(n.f,n.a.c("wf",t.c,x(t).toString(),"active")),e=[],o=[n.a.c("wf",t.c,x(t).toString(),"loading")];i||e.push(n.a.c("wf",t.c,x(t).toString(),"inactive")),g(n.f,e,o)}T(n,"fontinactive",t),q(this)},t.prototype.load=function(t){this.c=new n(this.j,t.context||this.j),this.g=!1!==t.events,this.f=!1!==t.classes,function(o,t,n){var i=[],e=n.timeout;a=t,a.g&&g(a.f,[a.a.c("wf","loading")]),T(a,"loading");var a;var i=function(t,n,i){var e,o=[];for(e in n)if(n.hasOwnProperty(e)){var a=t.c[e];a&&o.push(a(n[e],i))}return o}(o.a,n,o.c),s=new D(o.c,t,e);for(o.h=i.length,t=0,n=i.length;t=n.f?a():t.fonts.load(function(t){return x(t)+" "+t.f+"00 300px "+y(t.c)}(n.a),n.h).then((function(t){1<=t.length?o():setTimeout(s,25)}),(function(){a()}))}()})),a=null,s=new Promise((function(t,i){a=setTimeout(i,n.f)}));Promise.race([s,o]).then((function(){a&&(clearTimeout(a),a=null),n.g(n.a)}),(function(){n.j(n.a)}))};var F={D:"serif",C:"sans-serif"},I=null;function O(){if(null===I){var t=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent);I=!!t&&(536>parseInt(t[1],10)||536===parseInt(t[1],10)&&11>=parseInt(t[2],10))}return I}function P(t,n,i){for(var e in F)if(F.hasOwnProperty(e)&&n===t.f[F[e]]&&i===t.f[F[e]])return!0;return!1}function B(t){var n,o=t.g.a.offsetWidth,a=t.h.a.offsetWidth;(n=o===t.f.serif&&a===t.f["sans-serif"])||(n=O()&&P(t,o,a)),n?e()-t.A>=t.w?O()&&P(t,o,a)&&(null===t.u||t.u.hasOwnProperty(t.a.c))?L(t,t.v):L(t,t.B):function(t){setTimeout(i((function(){B(this)}),t),50)}(t):L(t,t.v)}function L(t,n){setTimeout(i((function(){f(this.g.a),f(this.h.a),f(this.j.a),f(this.m.a),n(this.a)}),t),0)}function D(t,n,i){this.c=t,this.a=n,this.f=0,this.m=this.j=!1,this.s=i}W.prototype.start=function(){this.f.serif=this.j.a.offsetWidth,this.f["sans-serif"]=this.m.a.offsetWidth,this.A=e(),B(this)};var $=null;function q(t){0==--t.f&&t.j&&(t.m?((t=t.a).g&&c(t.f,[t.a.c("wf","active")],[t.a.c("wf","loading"),t.a.c("wf","inactive")]),T(t,"active")):k(t.a))}function H(t){this.j=t,this.a=new S,this.h=0,this.f=this.g=!0}function M(t,n,e,o,a){var s=0==--t.h;(t.f||t.g)&&setTimeout((function(){var t=a||null,r=o||{};if(0===e.length&&s)k(n.a);else{n.f+=e.length,s&&(n.j=s);var f,h=[];for(f=0;f * * -> family: PT Sans:400,700|PT Sans Narrow:400|Montserrat:600 * + * + * CSS API V2 + * + * + * */ $script = 'WebFontConfig={google:{families:[';