libredirect/pages/options/options.js

26 lines
935 B
JavaScript
Raw Normal View History

2019-10-07 13:59:31 +02:00
'use strict';
let disableNitter = document.querySelector('#disableNitter');
let disableInvidious = document.querySelector('#disableInvidious');
let nitterInstance = document.querySelector('#nitterInstance');
let invidiousInstance = document.querySelector('#invidiousInstance');
chrome.storage.sync.get(
['disableNitter', 'disableInvidious', 'nitterInstance', 'invidiousInstance'],
2020-01-14 10:48:37 +01:00
result => {
2019-10-07 13:59:31 +02:00
disableNitter.checked = !result.disableNitter;
disableInvidious.checked = !result.disableInvidious;
nitterInstance.value = result.nitterInstance || '';
invidiousInstance.value = result.invidiousInstance || '';
}
);
document.querySelector('#save').addEventListener('click', () => {
chrome.storage.sync.set({
disableNitter: !disableNitter.checked,
disableInvidious: !disableInvidious.checked,
nitterInstance: nitterInstance.value,
invidiousInstance: invidiousInstance.value
});
window.close();
});