1
0
This commit is contained in:
2026-04-20 16:06:22 +08:00
parent 9938e484bd
commit 2356843b77
3 changed files with 39 additions and 27 deletions

View File

@@ -1,11 +1,17 @@
(function () {
"use strict";
var loaderScript = document.currentScript;
function supportsModuleScripts() {
var script = document.createElement("script");
return "noModule" in script;
}
function supportsImportMaps() {
return !!(window.HTMLScriptElement && HTMLScriptElement.supports && HTMLScriptElement.supports("importmap"));
}
function supportsWebGL() {
try {
var canvas = document.createElement("canvas");
@@ -23,7 +29,7 @@
return;
}
if (!supportsModuleScripts() || !supportsWebGL() || typeof Promise === "undefined" || typeof fetch === "undefined") {
if (!supportsModuleScripts() || !supportsImportMaps() || !supportsWebGL() || typeof Promise === "undefined" || typeof fetch === "undefined") {
return;
}
@@ -31,7 +37,7 @@
script = document.createElement("script");
script.type = "module";
script.src = "assets/js/map3d.js";
script.src = loaderScript ? new URL("map3d.js", loaderScript.src).toString() : "assets/js/map3d.js";
script.onerror = function () {
map.removeAttribute("data-map-module-loaded");
};