You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1.1 KiB
JavaScript

// Saves options to chrome.storage
function save_options() {
var stammTVBaseUrl = document.getElementById('stammtv-base-url').value;;
var stammTVWSSUrl = document.getElementById('stammtv-wss-url').value;;
chrome.storage.local.set({
baseURL: stammTVBaseUrl,
wssURL: stammTVWSSUrl
}, function () {
// Update status to let user know options were saved.
var status = document.getElementById('status');
status.textContent = 'Saved.';
status.style.color = '00FF00';
setTimeout(function () {
status.textContent = '';
}, 1500);
});
}
// Restores select box and checkbox state using the preferences
// stored in chrome.storage.
function restore_options() {
chrome.storage.local.get({
baseURL: 'Please fill in.',
wssURL: 'Please fill in.'
}, function (items) {
document.getElementById('stammtv-base-url').value = items.baseURL;
document.getElementById('stammtv-wss-url').value = items.wssURL;
});
}
document.addEventListener('DOMContentLoaded', restore_options);
document.getElementById('save').addEventListener('click', save_options);