-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptions.js
More file actions
23 lines (20 loc) · 715 Bytes
/
options.js
File metadata and controls
23 lines (20 loc) · 715 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
(async()=>{
const vtEl=document.getElementById("vt");
const openaiEl=document.getElementById("openai");
const init=await chrome.storage.local.get(["vtApiKey", "openaiApiKey"]);
if(init.vtApiKey) vtEl.value=init.vtApiKey;
if(init.openaiApiKey) openaiEl.value=init.openaiApiKey;
document.getElementById("save").onclick=async()=>{
await chrome.storage.local.set({
vtApiKey: vtEl.value.trim(),
openaiApiKey: openaiEl.value.trim()
});
alert("Saved successfully!");
};
document.getElementById("clear").onclick=async()=>{
await chrome.storage.local.remove(["vtApiKey", "openaiApiKey"]);
vtEl.value="";
openaiEl.value="";
alert("All API keys cleared");
};
})();