-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopup.js
27 lines (20 loc) · 904 Bytes
/
popup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
let redirYtHome = document.querySelector("#redir-yt-home");
let ytUrl = document.querySelector("#yt-redirect-url");
// load redirect url from local storage
const ytUrlStore = await chrome.storage.local.get(["yt_url"]);
const redirYtHomeStore = await chrome.storage.local.get(["redir_yt_home"]);
console.log(ytUrlStore, redirYtHomeStore)
import saveSettings from "./shared.js";
if (ytUrlStore.yt_url !== undefined)
ytUrl.value = ytUrlStore.yt_url;
if (redirYtHomeStore.redir_yt_home !== undefined)
redirYtHome.checked= redirYtHomeStore.redir_yt_home;
redirYtHome.addEventListener("change", (event) => {
chrome.storage.local.set({ redir_yt_home: redirYtHome.checked });
console.log("changed redirYtHome", redirYtHome.checked, event.target.checked)
saveSettings();
});
ytUrl.addEventListener("change", (event) => {
chrome.storage.local.set({ yt_url: ytUrl.value });
saveSettings();
});