-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpopup.js
More file actions
21 lines (18 loc) · 748 Bytes
/
popup.js
File metadata and controls
21 lines (18 loc) · 748 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const openLibrary = document.querySelector("#open-library");
const continueGame = document.querySelector("#continue-game");
const openOptions = document.querySelector("#open-options");
const status = document.querySelector("#status");
openLibrary.addEventListener("click", () => {
chrome.tabs.create({ url: chrome.runtime.getURL("app.html") });
});
continueGame.addEventListener("click", async () => {
const data = await chrome.storage.local.get({ recent: [] });
if (!data.recent || !data.recent.length) {
status.textContent = "No recent game found.";
return;
}
chrome.tabs.create({ url: chrome.runtime.getURL("app.html?continue=1") });
});
openOptions.addEventListener("click", () => {
chrome.runtime.openOptionsPage();
});