From 8489c2cb83eabed1ce04b11dd582ba4986f008c8 Mon Sep 17 00:00:00 2001 From: MathMan05 Date: Fri, 22 May 2026 14:58:42 -0500 Subject: [PATCH] don't let that happen --- src/webpage/settings.ts | 139 ++++++++++++++++++++-------------------- 1 file changed, 70 insertions(+), 69 deletions(-) diff --git a/src/webpage/settings.ts b/src/webpage/settings.ts index 5d043bb..66aa0f5 100644 --- a/src/webpage/settings.ts +++ b/src/webpage/settings.ts @@ -1135,78 +1135,79 @@ class InstancePicker implements OptionsElement { const span = document.createElement("span"); span.textContent = this.instanceInfo.name; div.append(span); - div.onclick = () => { - const d = new Dialog(""); - const instnaces = getInstances() ?? []; - for (const i of instnaces) { - if (!i.display) continue; - const instance = document.createElement("div"); - instance.classList.add("flexttb", "instDiv"); - const div = document.createElement("div"); - instance.append(div); + if (!new URLSearchParams(window.location.search).get("instance")) + div.onclick = () => { + const d = new Dialog(""); + const instnaces = getInstances() ?? []; + for (const i of instnaces) { + if (!i.display) continue; + const instance = document.createElement("div"); + instance.classList.add("flexttb", "instDiv"); + const div = document.createElement("div"); + instance.append(div); - div.classList.add("flexltr"); - if (i.image) { - const img = document.createElement("img"); - img.src = i.image; - div.append(img); - } - const span = document.createElement("span"); - span.textContent = i.name; - div.append(span); - - if (i.description) { - const p = document.createElement("p"); - p.textContent = i.description; - instance.append(p); - } - instance.onclick = async () => { - d.hide(); - this.instanceInfo = { - name: i.name, - des: i.description, - img: i.image, - }; - this.genArea(); - const urls = await checkInstance(i.name, this.verify, this.button); - if (urls) { - this.onchange(urls); + div.classList.add("flexltr"); + if (i.image) { + const img = document.createElement("img"); + img.src = i.image; + div.append(img); } - }; - d.options.addHTMLArea(instance); - } - d.options.addButtonInput("", I18n.register.other(), () => { - const opt = d.options.addSubOptions(I18n.register.other()); - let id = 0; - opt.addTextInput(I18n.register.instURL(), () => {}).onchange = async (_) => { - const thisid = ++id; - await new Promise((res) => setTimeout(res, 1000)); - console.log(id, thisid); - if (thisid !== id) return; - try { - const i = await checkInstance(_, this.verify, this.button); - if (i) { - this.onchange(i); - const ping = (await (await fetch(i.api + "/ping")).json()).instance; - this.instanceInfo = { - name: ping.name, - des: ping.description ?? undefined, - img: ping.image ?? undefined, - }; - this.genArea(); - } else { - this.instanceInfo = { - name: _, - }; - this.genArea(); + const span = document.createElement("span"); + span.textContent = i.name; + div.append(span); + + if (i.description) { + const p = document.createElement("p"); + p.textContent = i.description; + instance.append(p); + } + instance.onclick = async () => { + d.hide(); + this.instanceInfo = { + name: i.name, + des: i.description, + img: i.image, + }; + this.genArea(); + const urls = await checkInstance(i.name, this.verify, this.button); + if (urls) { + this.onchange(urls); } - } catch { - // - } - }; - }); - d.show().parentElement!.style.zIndex = "203"; - }; + }; + d.options.addHTMLArea(instance); + } + d.options.addButtonInput("", I18n.register.other(), () => { + const opt = d.options.addSubOptions(I18n.register.other()); + let id = 0; + opt.addTextInput(I18n.register.instURL(), () => {}).onchange = async (_) => { + const thisid = ++id; + await new Promise((res) => setTimeout(res, 1000)); + console.log(id, thisid); + if (thisid !== id) return; + try { + const i = await checkInstance(_, this.verify, this.button); + if (i) { + this.onchange(i); + const ping = (await (await fetch(i.api + "/ping")).json()).instance; + this.instanceInfo = { + name: ping.name, + des: ping.description ?? undefined, + img: ping.image ?? undefined, + }; + this.genArea(); + } else { + this.instanceInfo = { + name: _, + }; + this.genArea(); + } + } catch { + // + } + }; + }); + d.show().parentElement!.style.zIndex = "203"; + }; } static picker?: InstancePicker; static genDataList() {