diff --git a/map4.js b/map4.js index 876ff49..b0db6b5 100644 --- a/map4.js +++ b/map4.js @@ -40,24 +40,12 @@ ------------------------------------------------------- */ // ボタンが map4.html に存在する場合のみ処理(安全対策) +/* ------------------------------------------------------ + 招待リンクコピー機能(完全修正版) +------------------------------------------------------- */ const inviteBtn = document.getElementById("inviteBtn"); if (inviteBtn) { - - inviteBtn.addEventListener("click", async () => { - - if (!groupName) { - alert("グループ情報が取得できません。"); - return; - } - - // Supabase からパスワードを取得 - const { data, error } = await supa - .from("groups") - .select("password") - .eq("group_name", groupName) - .maybeSingle(); -if (inviteBtn) { inviteBtn.addEventListener("click", async () => { if (!currentGroup) { @@ -81,17 +69,8 @@ // join_group.html への招待リンク const inviteURL = - `https://www.yatex.org/gitbucket/KoekiGameDesign/2025-shino/pages/join_group.html` + - `?group=${encodeURIComponent(currentGroup)}&pass=${encodeURIComponent(pass)}`; - - try { - await navigator.clipboard.writeText(inviteURL); - alert("🎉 招待リンクをコピーしました!"); - } catch (e) { - alert("コピーに失敗しました…"); - } - }); -} + `https://www.yatex.org/gitbucket/KoekiGameDesign/2025-shino/pages/join_group.html` + + `?group=${encodeURIComponent(currentGroup)}&pass=${encodeURIComponent(pass)}`; try { await navigator.clipboard.writeText(inviteURL);