-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopup.js
28 lines (25 loc) · 905 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
28
document.getElementById("save").addEventListener("click", async () => {
const token = document.getElementById("github-token").value;
const repo = document.getElementById("repo-name").value;
const branch = document.getElementById("branch-name").value || "main";
if (!token || !repo) {
showStatus("Please fill in all required fields", false);
return;
}
try {
await chrome.storage.sync.set({
githubToken: token,
repoName: repo,
branchName: branch,
debugMode: true, // Added debug mode for extra logging
});
showStatus("Settings saved successfully! Reload LeetCode page.", true);
} catch (error) {
showStatus("Error saving settings", false);
}
});
function showStatus(message, isSuccess) {
const status = document.getElementById("status");
status.textContent = message;
status.className = `status ${isSuccess ? "success" : "error"}`;
}