From bc8a02a003fc32b713c779e9e93948c1cdca3c2c Mon Sep 17 00:00:00 2001 From: Olawanle Joel <57611810+olawanlejoel@users.noreply.github.com> Date: Tue, 5 May 2020 17:19:08 +0000 Subject: [PATCH] Fix 'fontfaceobserver.standalone.js' 404 error Fixing issue #351. --- js/src/fonts-loader.js | 3 ++- js/wikimedia-design-style-guide.concat.js | 3 ++- js/wikimedia-design-style-guide.concat.js.map.json | 2 +- js/wikimedia-design-style-guide.min.js | 2 +- js/wikimedia-design-style-guide.min.js.map.json | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/js/src/fonts-loader.js b/js/src/fonts-loader.js index 019a873c..8e391417 100644 --- a/js/src/fonts-loader.js +++ b/js/src/fonts-loader.js @@ -8,7 +8,8 @@ html.classList.add( 'fonts-loaded' ); } else { var script = document.createElement( 'script' ); - script.src = './js/vendor/fontfaceobserver/fontfaceobserver.standalone.js'; + // Use absolute path to address root files and /components/ directory ones. + script.src = '/style-guide/js/vendor/fontfaceobserver/fontfaceobserver.standalone.js'; script.onload = function () { var serif = new FontFaceObserver( 'Charter' ); /* eslint-disable-line no-undef */ diff --git a/js/wikimedia-design-style-guide.concat.js b/js/wikimedia-design-style-guide.concat.js index 1325165f..98a4f4ee 100644 --- a/js/wikimedia-design-style-guide.concat.js +++ b/js/wikimedia-design-style-guide.concat.js @@ -8,7 +8,8 @@ html.classList.add( 'fonts-loaded' ); } else { var script = document.createElement( 'script' ); - script.src = './js/vendor/fontfaceobserver/fontfaceobserver.standalone.js'; + // Use absolute path to address root files and /components/ directory ones. + script.src = '/style-guide/js/vendor/fontfaceobserver/fontfaceobserver.standalone.js'; script.onload = function () { var serif = new FontFaceObserver( 'Charter' ); /* eslint-disable-line no-undef */ diff --git a/js/wikimedia-design-style-guide.concat.js.map.json b/js/wikimedia-design-style-guide.concat.js.map.json index b7f3a647..3a5d2cf4 100644 --- a/js/wikimedia-design-style-guide.concat.js.map.json +++ b/js/wikimedia-design-style-guide.concat.js.map.json @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AAI,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE;AACrD,KAAK,KAAK,CAAC,IAAI,EAAE;AACjB,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AAC3B,KAAK,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE;AAC1C,KAAK,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE;AAChD,IAAI,CAAC,CAAC,EAAE;AACR,GAAG,EAAE;AACL,GAAG,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,EAAE;AACvC,EAAE,CAAC;AACH,CAAC,CAAC;AACF,GAAG,CAAC,EAAE","file":"wikimedia-design-style-guide.concat.js","sourcesContent":["/* eslint-disable vars-on-top, one-var */\n( function () {\n\n\tif ( document.head && 'Promise' in window ) {\n\t\tvar html = document.documentElement;\n\n\t\tif ( sessionStorage.getItem( 'fontsLoaded' ) ) {\n\t\t\thtml.classList.add( 'fonts-loaded' );\n\t\t} else {\n\t\t\tvar script = document.createElement( 'script' );\n\t\t\tscript.src = './js/vendor/fontfaceobserver/fontfaceobserver.standalone.js';\n\n\t\t\tscript.onload = function () {\n\t\t\t\tvar serif = new FontFaceObserver( 'Charter' ); /* eslint-disable-line no-undef */\n\n\t\t\t\tPromise.all( [ /* eslint-disable-line no-undef */\n\t\t\t\t\tserif.load()\n\t\t\t\t] ).then( function () {\n\t\t\t\t\thtml.classList.add( 'fonts-loaded' );\n\t\t\t\t\tsessionStorage.setItem( 'fontsLoaded', 1 );\n\t\t\t\t} );\n\t\t\t};\n\t\t\tdocument.head.appendChild( script );\n\t\t}\n\t}\n}() );\n"]} \ No newline at end of file +{"version":3,"sources":["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,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE;AACrF;AACA,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE;AACrD,KAAK,KAAK,CAAC,IAAI,EAAE;AACjB,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AAC3B,KAAK,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE;AAC1C,KAAK,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE;AAChD,IAAI,CAAC,CAAC,EAAE;AACR,GAAG,EAAE;AACL,GAAG,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,EAAE;AACvC,EAAE,CAAC;AACH,CAAC,CAAC;AACF,GAAG,CAAC,EAAE","file":"wikimedia-design-style-guide.concat.js","sourcesContent":["/* eslint-disable vars-on-top, one-var */\n( function () {\n\n\tif ( document.head && 'Promise' in window ) {\n\t\tvar html = document.documentElement;\n\n\t\tif ( sessionStorage.getItem( 'fontsLoaded' ) ) {\n\t\t\thtml.classList.add( 'fonts-loaded' );\n\t\t} else {\n\t\t\tvar script = document.createElement( 'script' );\n\t\t\t// Use absolute path to address root files and /components/ directory ones.\n\t\t\tscript.src = '/style-guide/js/vendor/fontfaceobserver/fontfaceobserver.standalone.js';\n\n\t\t\tscript.onload = function () {\n\t\t\t\tvar serif = new FontFaceObserver( 'Charter' ); /* eslint-disable-line no-undef */\n\n\t\t\t\tPromise.all( [ /* eslint-disable-line no-undef */\n\t\t\t\t\tserif.load()\n\t\t\t\t] ).then( function () {\n\t\t\t\t\thtml.classList.add( 'fonts-loaded' );\n\t\t\t\t\tsessionStorage.setItem( 'fontsLoaded', 1 );\n\t\t\t\t} );\n\t\t\t};\n\t\t\tdocument.head.appendChild( script );\n\t\t}\n\t}\n}() );\n"]} \ No newline at end of file diff --git a/js/wikimedia-design-style-guide.min.js b/js/wikimedia-design-style-guide.min.js index 76c44d60..a412b7d8 100644 --- a/js/wikimedia-design-style-guide.min.js +++ b/js/wikimedia-design-style-guide.min.js @@ -1,2 +1,2 @@ -!function(){if(document.head&&"Promise"in window){var o=document.documentElement;if(sessionStorage.getItem("fontsLoaded"))o.classList.add("fonts-loaded");else{var e=document.createElement("script");e.src="./js/vendor/fontfaceobserver/fontfaceobserver.standalone.js",e.onload=function(){var e=new FontFaceObserver("Charter");Promise.all([e.load()]).then(function(){o.classList.add("fonts-loaded"),sessionStorage.setItem("fontsLoaded",1)})},document.head.appendChild(e)}}}(); +!function(){if(document.head&&"Promise"in window){var o=document.documentElement;if(sessionStorage.getItem("fontsLoaded"))o.classList.add("fonts-loaded");else{var e=document.createElement("script");e.src="/style-guide/js/vendor/fontfaceobserver/fontfaceobserver.standalone.js",e.onload=function(){var e=new FontFaceObserver("Charter");Promise.all([e.load()]).then(function(){o.classList.add("fonts-loaded"),sessionStorage.setItem("fontsLoaded",1)})},document.head.appendChild(e)}}}(); //# sourceMappingURL=wikimedia-design-style-guide.min.js.map.json \ No newline at end of file diff --git a/js/wikimedia-design-style-guide.min.js.map.json b/js/wikimedia-design-style-guide.min.js.map.json index 10838450..286f994a 100644 --- a/js/wikimedia-design-style-guide.min.js.map.json +++ b/js/wikimedia-design-style-guide.min.js.map.json @@ -1 +1 @@ -{"version":3,"sources":["wikimedia-design-style-guide.concat.js"],"names":["document","head","window","html","documentElement","sessionStorage","getItem","classList","add","script","createElement","src","onload","serif","FontFaceObserver","Promise","all","load","then","setItem","appendChild"],"mappings":"CACE,WAED,GAAKA,SAASC,MAAQ,YAAaC,OAAS,CAC3C,IAAIC,EAAOH,SAASI,gBAEpB,GAAKC,eAAeC,QAAS,eAC5BH,EAAKI,UAAUC,IAAK,oBACd,CACN,IAAIC,EAAST,SAASU,cAAe,UACrCD,EAAOE,IAAM,8DAEbF,EAAOG,OAAS,WACf,IAAIC,EAAQ,IAAIC,iBAAkB,WAElCC,QAAQC,IAAK,CACZH,EAAMI,SACHC,KAAM,WACTf,EAAKI,UAAUC,IAAK,gBACpBH,eAAec,QAAS,cAAe,MAGzCnB,SAASC,KAAKmB,YAAaX,KArB9B","file":"wikimedia-design-style-guide.min.js"} \ No newline at end of file +{"version":3,"sources":["wikimedia-design-style-guide.concat.js"],"names":["document","head","window","html","documentElement","sessionStorage","getItem","classList","add","script","createElement","src","onload","serif","FontFaceObserver","Promise","all","load","then","setItem","appendChild"],"mappings":"CACE,WAED,GAAKA,SAASC,MAAQ,YAAaC,OAAS,CAC3C,IAAIC,EAAOH,SAASI,gBAEpB,GAAKC,eAAeC,QAAS,eAC5BH,EAAKI,UAAUC,IAAK,oBACd,CACN,IAAIC,EAAST,SAASU,cAAe,UAErCD,EAAOE,IAAM,yEAEbF,EAAOG,OAAS,WACf,IAAIC,EAAQ,IAAIC,iBAAkB,WAElCC,QAAQC,IAAK,CACZH,EAAMI,SACHC,KAAM,WACTf,EAAKI,UAAUC,IAAK,gBACpBH,eAAec,QAAS,cAAe,MAGzCnB,SAASC,KAAKmB,YAAaX,KAtB9B","file":"wikimedia-design-style-guide.min.js"} \ No newline at end of file