Repository navigation
Expand file tree
/
Copy pathoptions.js
More file actions
38 lines (33 loc) · 1.63 KB
/
Copy pathoptions.js
File metadata and controls
38 lines (33 loc) · 1.63 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
30
31
32
33
34
35
36
37
38
document.addEventListener('DOMContentLoaded', () => {
const urlParams = new URLSearchParams(window.location.search);
const reason = urlParams.get('reason');
const messageDiv = document.getElementById('install-update-message');
if (reason === 'install' && messageDiv) {
messageDiv.textContent = "Welcome! Thanks for installing Serval Price Extension. Configure your preferences below.";
messageDiv.style.display = 'block';
} else if (reason === 'update' && messageDiv) {
messageDiv.textContent = "Serval Price Extension has been updated! Check out the new small button option below.";
messageDiv.style.display = 'block';
}
// Load saved settings
chrome.storage.local.get(['theme', 'enableLittleButton'], (result) => {
if (result.theme) {
document.getElementById('theme').value = result.theme;
}
if (result.enableLittleButton !== undefined) {
document.getElementById('little-button').checked = result.enableLittleButton;
}
});
// Save theme selection
document.getElementById('theme').addEventListener('change', (event) => {
chrome.storage.local.set({ theme: event.target.value }, () => {
console.log(`Theme set to ${event.target.value}`);
});
});
// Save little button checkbox state
document.getElementById('little-button').addEventListener('change', (event) => {
chrome.storage.local.set({ enableLittleButton: event.target.checked }, () => {
console.log(`Enable Little Button set to ${event.target.checked}`);
});
});
});