-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpopup.js
39 lines (31 loc) · 1.16 KB
/
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
29
30
31
32
33
34
35
36
37
38
39
const tokenInput = document.getElementById("access-token");
const saveButton = document.getElementById("save-button");
const tokenName = "accessToken";
const visibilityButton = document.getElementById("togglePassword");
const changeVisibility = () => {
const type = tokenInput.type;
tokenInput.type = type === "password" ? "text" : "password";
};
visibilityButton.addEventListener("click", changeVisibility);
const saveToken = () => {
const accessToken = tokenInput.value;
chrome.storage.sync.set({ accessToken });
// reflesh
chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
chrome.tabs.reload(tabs[0].id);
});
};
saveButton.addEventListener("click", saveToken);
tokenInput.addEventListener("keydown", (e) => {
if (e.key === "Enter") {
saveToken();
}
});
chrome.storage.sync.get(["accessToken"], (result) => {
result.accessToken && (tokenInput.value = result.accessToken);
});
reportBugButton.addEventListener("click", () => {
const repoUrl = "https://github.com/alicangunduz/knock-knock-follow-me"; // Repo URL
const issueUrl = `${repoUrl}/issues/new`; // Yeni sorun oluşturma URL'si
chrome.tabs.create({ url: issueUrl });
});