-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.js
19 lines (16 loc) · 817 Bytes
/
setup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
document.getElementById("setupForm").addEventListener("submit", function (event) {
event.preventDefault();
// Hide the form
this.style.display = "none";
// Show success message
const contentElement = document.getElementById("content");
const successMessage = document.createElement("p");
successMessage.innerHTML = `Your API key has been saved. It is safe to close the browser tab.<br /><br />
Now you can summarize the articles by clicking on the extension icon or by pressing <strong>Ctrl+Shift+Y</strong> (on Windows) or <strong>Cmd+Shift+Y</strong> (on Mac).`;
contentElement.appendChild(successMessage);
// Save the API key
const apiKey = document.getElementById("apiKey").value;
chrome.storage.local.set({ apiKey: apiKey }, function () {
console.log("API key saved");
});
});