mirror of
https://github.com/aureliendavid/rsspreview.git
synced 2025-08-23 03:38:44 +00:00
* diplay media:thumbnail images or not (default: no) * add a max-width to all image on preview page (default: yes 900px)
43 lines
945 B
JavaScript
43 lines
945 B
JavaScript
|
|
function saveOptions(e) {
|
|
e.preventDefault();
|
|
|
|
browser.storage.sync.set({
|
|
doThumb: document.querySelector("#doThumb").checked,
|
|
doMaxWidth: document.querySelector("#doMaxWidth").checked,
|
|
valMaxWidth: document.querySelector("#valMaxWidth").value
|
|
});
|
|
}
|
|
|
|
|
|
function restoreOptions() {
|
|
|
|
|
|
function onResult(result) {
|
|
document.querySelector("#doThumb").checked = result.doThumb;
|
|
document.querySelector("#doMaxWidth").checked = result.doMaxWidth;
|
|
document.querySelector("#valMaxWidth").value = result.valMaxWidth;
|
|
}
|
|
|
|
function onError(error) {
|
|
console.log(`Error: ${error}`);
|
|
}
|
|
|
|
var getting = browser.storage.sync.get({
|
|
doThumb: false,
|
|
doMaxWidth: true,
|
|
valMaxWidth: "900px"
|
|
});
|
|
getting.then(onResult, onError);
|
|
|
|
}
|
|
|
|
|
|
|
|
document.addEventListener("DOMContentLoaded", restoreOptions);
|
|
|
|
document.querySelectorAll('.validate').forEach((elem) => {
|
|
elem.addEventListener('change', saveOptions);
|
|
});
|
|
|