-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptions.js
More file actions
29 lines (27 loc) · 1.01 KB
/
options.js
File metadata and controls
29 lines (27 loc) · 1.01 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
document.addEventListener('DOMContentLoaded', function() {
const saveButton = document.getElementById('save');
const jwtTokenInput = document.getElementById('jwtToken');
const statusDiv = document.getElementById('status');
// Load the saved token and display it in the input field
chrome.storage.sync.get('jwtToken', function(data) {
if (data.jwtToken) {
jwtTokenInput.value = data.jwtToken;
}
});
saveButton.addEventListener('click', function() {
const jwtToken = jwtTokenInput.value;
if (jwtToken) {
chrome.storage.sync.set({'jwtToken': jwtToken}, function() {
statusDiv.textContent = 'Token saved successfully!';
setTimeout(() => {
statusDiv.textContent = '';
}, 3000);
});
} else {
statusDiv.textContent = 'Please enter a token.';
setTimeout(() => {
statusDiv.textContent = '';
}, 3000);
}
});
});