-
Notifications
You must be signed in to change notification settings - Fork 131
/
Copy pathsettings.js
29 lines (26 loc) · 1.05 KB
/
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
.getElementById('settingsForm')
.addEventListener('submit', function (e) {
e.preventDefault();
const openAIApiKey = document.getElementById('openAIApiKey').value;
const cloudName = document.getElementById('cloudName').value;
const uploadPreset = document.getElementById('uploadPreset').value;
localStorage.setItem('openAIApiKey', openAIApiKey);
localStorage.setItem('cloudName', cloudName);
localStorage.setItem('uploadPreset', uploadPreset);
document.getElementById('saveSettings').innerHTML = 'Saved';
setTimeout(() => {
if (openAIApiKey && cloudName && uploadPreset) {
hideSettings();
}
}, 1000);
});
// Populate form with existing values
document.addEventListener('DOMContentLoaded', function () {
document.getElementById('openAIApiKey').value =
localStorage.getItem('openAIApiKey') || '';
document.getElementById('cloudName').value =
localStorage.getItem('cloudName') || '';
document.getElementById('uploadPreset').value =
localStorage.getItem('uploadPreset') || '';
});