-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpopup.js
More file actions
35 lines (33 loc) · 1.26 KB
/
Copy pathpopup.js
File metadata and controls
35 lines (33 loc) · 1.26 KB
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
28
29
30
31
32
33
34
35
document.addEventListener("DOMContentLoaded", () => {
const portInput = document.getElementById("port");
const passInput = document.getElementById("password");
const sceneInput = document.getElementById("scene");
const sourceInput = document.getElementById("source");
const saveBtn = document.getElementById("saveBtn");
const statusText = document.getElementById("status");
// Load saved settings
chrome.storage.local.get(
["obsPort", "obsPass", "obsScene", "obsSource"],
(data) => {
portInput.value = data.obsPort || "4455";
passInput.value = data.obsPass || "";
sceneInput.value = data.obsScene || "";
sourceInput.value = data.obsSource || "";
},
);
saveBtn.addEventListener("click", () => {
chrome.storage.local.set(
{
obsPort: portInput.value.trim(),
obsPass: passInput.value,
obsScene: sceneInput.value.trim(),
obsSource: sourceInput.value.trim(),
},
() => {
statusText.style.color = "#00ffcc";
statusText.innerText =
"Settings Saved! Background script is connecting...";
},
);
});
});