From ac6d45aede72050876ca3e48bd778ee07dc0ba52 Mon Sep 17 00:00:00 2001 From: Whirling Date: Thu, 9 Oct 2025 21:40:54 -0600 Subject: [PATCH] support modules --- gentown/gentown.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gentown/gentown.js b/gentown/gentown.js index 4eeed0b..3c94543 100644 --- a/gentown/gentown.js +++ b/gentown/gentown.js @@ -3404,7 +3404,7 @@ function addMod(url) { if (!url) return "Mod not specified"; if (!userSettings.mods) userSettings.mods = []; if (userSettings.mods.includes(url)) return "Mod already enabled"; - if (!url.match(/\.js$/)) return "Not a .JS file" + if (!url.match(/\.m?js$/)) return "Not a .JS file" userSettings.mods.push(url); saveSettings(); let btn = document.getElementById("actionItem-enabledMods"); @@ -3453,6 +3453,9 @@ function manageMod(url) { function runMod(url) { url = modToURL(url); let script = document.createElement("script"); + if (url.endsWith("mjs")) { + script.type = "module" + } script.src = url; document.body.appendChild(script); } @@ -4589,4 +4592,4 @@ window.addEventListener("load", function(){ //onload checkHash(); -}) \ No newline at end of file +})