Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions wikiweaver-ext/popup/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
<input id="username" class="box text" placeholder="username" maxlength="12"></input>
<button id="join" class="button box text">join</button>
<button id="leave" class="button box text">leave</button>
<button id="open-lobby" class="button box text">
open lobby
<span class="material-symbols-outlined">open_in_new</span>
</button>
<button id="open-settings" class="button box text">
open settings
<span class="material-symbols-outlined">open_in_new</span>
Expand Down
17 changes: 16 additions & 1 deletion wikiweaver-ext/popup/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand All @@ -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;
}
});
Expand Down
2 changes: 1 addition & 1 deletion wikiweaver-ext/popup/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ body {
background: var(--red);
}

#open-settings {
#open-lobby {
margin-top: 0.5rem;
}

Expand Down