28 lines
771 B
JavaScript
28 lines
771 B
JavaScript
function persistOptions() {
|
|
var globals = {}; //global addon options
|
|
|
|
globals = {
|
|
width: document.querySelector('#indicator-width').value,
|
|
orientation: document.querySelector('#indicator-orientation').value,
|
|
ignore: document.querySelector('#ignore').value
|
|
};
|
|
|
|
return browser.storage.local.set({
|
|
globals: globals
|
|
});
|
|
}
|
|
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
loadOptions().then((options) => {
|
|
document.querySelector('#indicator-width').value = options.globals.width;
|
|
document.querySelector('#indicator-orientation').value = options.globals.orientation;
|
|
});
|
|
});
|
|
|
|
var list = document.querySelectorAll('select,input,textarea');
|
|
for (var i = 0; i < list.length; i++) {
|
|
list[i].addEventListener('change', (ev) => {
|
|
persistOptions();
|
|
});
|
|
}
|