forked from cyanheads/claude-sidebar-modifier
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopup.js
39 lines (35 loc) · 1.35 KB
/
popup.js
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
39
document.addEventListener('DOMContentLoaded', function() {
const widthSlider = document.getElementById('sidebarWidth');
const widthValue = document.getElementById('widthValue');
const disabledCheckbox = document.getElementById('sidebarDisabled');
const saveButton = document.getElementById('saveSettings');
// Load current settings
chrome.runtime.sendMessage({action: "getSettings"}, function(response) {
if (response) {
widthSlider.value = response.sidebarWidth;
widthValue.textContent = response.sidebarWidth;
disabledCheckbox.checked = response.sidebarDisabled;
}
});
// Update width value display
widthSlider.addEventListener('input', function() {
widthValue.textContent = this.value;
});
// Save settings
saveButton.addEventListener('click', function() {
const settings = {
sidebarWidth: parseInt(widthSlider.value),
sidebarDisabled: disabledCheckbox.checked
};
chrome.runtime.sendMessage({
action: "saveSettings",
settings: settings
}, function(response) {
if (response && response.success) {
alert('Settings saved successfully!');
} else {
alert('Error saving settings. Please try again.');
}
});
});
});