-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.js
29 lines (26 loc) · 1003 Bytes
/
settings.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
document.addEventListener('DOMContentLoaded', () => {
// Load existing settings
chrome.storage.local.get(['serverUrl', 'modelName'], (result) => {
if (result.serverUrl) {
document.getElementById('server-url').value = result.serverUrl;
}
if (result.modelName) {
document.getElementById('model-name').value = result.modelName;
}
});
// Save settings handler
document.getElementById('save-settings').addEventListener('click', () => {
const serverUrl = document.getElementById('server-url').value;
const modelName = document.getElementById('model-name').value;
chrome.storage.local.set({
serverUrl: serverUrl,
modelName: modelName
}, () => {
window.location.href = 'popup.html';
});
});
// Back button handler
document.getElementById('back-button').addEventListener('click', () => {
window.location.href = 'popup.html';
});
});