Spaces:
Running
Running
fix: restore exact final loader
Browse files
loader.js
CHANGED
|
@@ -1,50 +1 @@
|
|
| 1 |
-
(function () {
|
| 2 |
-
"use strict";
|
| 3 |
-
|
| 4 |
-
var reduced = false;
|
| 5 |
-
try {
|
| 6 |
-
reduced = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
| 7 |
-
} catch (e) {}
|
| 8 |
-
|
| 9 |
-
var mobile = false;
|
| 10 |
-
try {
|
| 11 |
-
mobile = window.matchMedia("(max-width: 850px)").matches;
|
| 12 |
-
} catch (e2) {}
|
| 13 |
-
|
| 14 |
-
var conn = navigator.connection || navigator.mozConnection || navigator.webkitConnection;
|
| 15 |
-
var saveData = !!(conn && (conn.saveData || /2g|slow-2g/i.test(conn.effectiveType || "")));
|
| 16 |
-
|
| 17 |
-
var want3D = !reduced && !saveData && !mobile;
|
| 18 |
-
var wantGsap = !reduced && !saveData;
|
| 19 |
-
|
| 20 |
-
function loadScript(src) {
|
| 21 |
-
return new Promise(function (resolve, reject) {
|
| 22 |
-
var s = document.createElement("script");
|
| 23 |
-
s.src = src;
|
| 24 |
-
s.async = true;
|
| 25 |
-
try { s.fetchPriority = "low"; } catch (e) {}
|
| 26 |
-
s.onload = function () { resolve(src); };
|
| 27 |
-
s.onerror = function () { reject(new Error("fail " + src)); };
|
| 28 |
-
document.head.appendChild(s);
|
| 29 |
-
});
|
| 30 |
-
}
|
| 31 |
-
|
| 32 |
-
var queue = [];
|
| 33 |
-
|
| 34 |
-
if (wantGsap) {
|
| 35 |
-
queue.push(
|
| 36 |
-
loadScript("https://cdn.jsdelivr.net/npm/gsap@3.12.5/dist/gsap.min.js").then(function () {
|
| 37 |
-
return loadScript("https://cdn.jsdelivr.net/npm/gsap@3.12.5/dist/ScrollTrigger.min.js");
|
| 38 |
-
})
|
| 39 |
-
);
|
| 40 |
-
}
|
| 41 |
-
|
| 42 |
-
if (want3D) {
|
| 43 |
-
queue.push(
|
| 44 |
-
loadScript("https://cdn.jsdelivr.net/npm/three@0.160.0/build/three.min.js").then(function () {
|
| 45 |
-
return loadScript("scene3d.js");
|
| 46 |
-
})
|
| 47 |
-
);
|
| 48 |
-
} else {
|
| 49 |
-
var canvas = document.querySelector("[data-journey-canvas]");
|
| 50 |
-
if6�f2���6�f2�7G��R�F�7���&���R#��6�f2�6WDGG&�'WFR�&FF�vV&v��F�6&�VB"�&��FW"�6��VB"���ТР�v��F�r��Ut$�T����DU"���v�C4C�v�C4B��v�Dw6�v�Dw6��&VG��&�֗6R��VWVR���gV�7F�������&WGW&��6F6��gV�7F������&WGW&��V�òғ��Ғ��Ӱ��v��F�r��Ut$�T����DU"�&VG��F�V�gV�7F�������v��F�r�F�7F6�WfV�B��Wr7W7F��WfV�B�&�Wv&�VæFW2"����ғ��҂����
|
|
|
|
| 1 |
+
(function () {\n \"use strict\";\n\n var reduced = false;\n try {\n reduced = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n } catch (e) {}\n\n var mobile = false;\n try {\n mobile = window.matchMedia(\"(max-width: 850px)\").matches;\n } catch (e2) {}\n\n var conn = navigator.connection || navigator.mozConnection || navigator.webkitConnection;\n var saveData = !!(conn && (conn.saveData || /2g|slow-2g/i.test(conn.effectiveType || \"\")));\n\n var want3D = !reduced && !saveData && !mobile;\n var wantGsap = !reduced && !saveData;\n\n function loadScript(src) {\n return new Promise(function (resolve, reject) {\n var s = document.createElement(\"script\");\n s.src = src;\n s.async = true;\n try { s.fetchPriority = \"low\"; } catch (e) {}\n s.onload = function () {\ resolve(src); };\n s.onerror = function () {\ reject(new Error(\"fail \" + src)); };\n document.head.appendChild(s);\n });\n }\n\n var queue = [];\n\n if (wantGsap) {\n queue.push(\n loadScript(\"https://cdn.jsdelivr.net/npm/gsap@3.12.5/dist/gsap.min.js\").then(function () {\n return loadScript(\"https://cdn.jsdelivr.net/npm/gsap@3.12.5/dist/ScrollTrigger.min.js\");\n })\n );\n }\n\n if (want3D) {\n queue.push(\n loadScript(\"https://cdn.jsdelivr.net/npm/three@0.160.0/build/three.min.js\").then(function () {\n return loadScript(\"scene3d.js\");\n })\n );\n } else {\n var canvas = document.querySelector(\"[data-journey-canvas]\");\n if (canvas) {\n canvas.style.display = \"none\";\n canvas.setAttribute(\"data-webgl-disabled\", \"loader-skipped\");\n }\n }\n\n window.NEWBIEL_LOADER = {\n want3D: want3D,\n wantGsap: wantGsap,\n ready: Promise.all(queue.map(function (p) {\n return p.catch(function () {\ return null; });\n }))\n };\n\n window.NEWBIEL_LOADER.ready.then(function () {\n window.dispatchEvent(new CustomEvent(\"newbiel:deps\"));\n });\n}());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|