diff --git a/wikiweaver-ext/popup/popup.html b/wikiweaver-ext/popup/popup.html index ad51a15..3b1ee71 100644 --- a/wikiweaver-ext/popup/popup.html +++ b/wikiweaver-ext/popup/popup.html @@ -23,6 +23,10 @@ join leave + + open lobby + open_in_new + open settings open_in_new diff --git a/wikiweaver-ext/popup/popup.js b/wikiweaver-ext/popup/popup.js index a0241dc..43ef769 100644 --- a/wikiweaver-ext/popup/popup.js +++ b/wikiweaver-ext/popup/popup.js @@ -82,6 +82,17 @@ async function HandleLeaveClicked(e) { await UnregisterContentScripts(); } +async function HandleOpenLobbyClicked(e) { + const options = await chrome.storage.local.get(); + + let code = (await chrome.storage.session.get()).connected ? options.code : ""; + + await chrome.tabs.create({ + active: true, + url: `${options.url}/#${code}`, + }) +} + document.addEventListener("click", async (e) => { switch (e.target.id) { case "join": @@ -92,12 +103,16 @@ document.addEventListener("click", async (e) => { await HandleLeaveClicked(e); break; + case "open-lobby": + await HandleOpenLobbyClicked(e); + break; + case "open-settings": await chrome.runtime.openOptionsPage(); break; default: - console.log("Unhandled click event: ", e); + // Quietly ignore break; } }); diff --git a/wikiweaver-ext/popup/style.css b/wikiweaver-ext/popup/style.css index 05d4193..5f83495 100644 --- a/wikiweaver-ext/popup/style.css +++ b/wikiweaver-ext/popup/style.css @@ -58,7 +58,7 @@ body { background: var(--red); } -#open-settings { +#open-lobby { margin-top: 0.5rem; }