-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.js
24 lines (21 loc) · 870 Bytes
/
options.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
// options.js
document.addEventListener('DOMContentLoaded', function() {
/**
* Display the extension options form and input field
*/
var settingsForm = document.getElementById('settingsForm');
var baseUrlInput = document.getElementById('baseUrl');
var baseUrlValue = localStorage.getItem('baseUrl');
baseUrlInput.value = baseUrlValue || ''; // Set to empty string if null
// Save settings on form submit
settingsForm.addEventListener('submit', function(event) {
event.preventDefault();
// Read baseUrl value from input field
var newBaseUrlValue = baseUrlInput.value;
// Save new baseUrl to local storage
localStorage.setItem('baseUrl', newBaseUrlValue);
// Close the popup window
window.close();
alert('Settings saved successfully!' + newBaseUrlValue);
});
});