-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptions.js
More file actions
26 lines (23 loc) · 838 Bytes
/
Copy pathoptions.js
File metadata and controls
26 lines (23 loc) · 838 Bytes
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
document.addEventListener('DOMContentLoaded', () => {
const kittyPathInput = document.getElementById('kittyPath');
const openerInput = document.getElementById('opener');
const saveBtn = document.getElementById('saveBtn');
const successMessage = document.getElementById('successMessage');
chrome.storage.sync.get(['kittyPath', 'opener'], result => {
const { kittyPath, opener } = result;
kittyPathInput.value = kittyPath;
openerInput.value = opener;
});
saveBtn.addEventListener('click', () => {
const settings = {
kittyPath: kittyPathInput.value.trim(),
opener: openerInput.value.trim(),
};
chrome.storage.sync.set(settings, () => {
successMessage.classList.add('show');
setTimeout(() => {
successMessage.classList.remove('show');
}, 2000);
});
});
});