|
|
@ -32,7 +32,7 @@ function validateAndSave() {
|
|
|
|
console.log('Failed to save settings - form validation was not successful.')
|
|
|
|
console.log('Failed to save settings - form validation was not successful.')
|
|
|
|
saveButton.classList.replace('btn-primary', 'btn-danger');
|
|
|
|
saveButton.classList.replace('btn-primary', 'btn-danger');
|
|
|
|
saveButton.classList.replace('btn-success', 'btn-danger');
|
|
|
|
saveButton.classList.replace('btn-success', 'btn-danger');
|
|
|
|
saveButton.textContent = getMessage('settingsSaveButtonCaptionFailure');
|
|
|
|
saveButton.textContent = chrome.i18n.getMessage('settingsSaveButtonCaptionFailure');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -46,7 +46,7 @@ function save() {
|
|
|
|
// Update form controls to let user know options were saved.
|
|
|
|
// Update form controls to let user know options were saved.
|
|
|
|
saveButton.classList.replace('btn-primary', 'btn-success');
|
|
|
|
saveButton.classList.replace('btn-primary', 'btn-success');
|
|
|
|
saveButton.classList.replace('btn-danger', 'btn-success');
|
|
|
|
saveButton.classList.replace('btn-danger', 'btn-success');
|
|
|
|
saveButton.textContent = getMessage('settingsSaveButtonCaptionSuccess');
|
|
|
|
saveButton.textContent = chrome.i18n.getMessage('settingsSaveButtonCaptionSuccess');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
console.error('Unsupported browser or no access to localStorage')
|
|
|
|
console.error('Unsupported browser or no access to localStorage')
|
|
|
@ -58,8 +58,8 @@ function save() {
|
|
|
|
function load(){
|
|
|
|
function load(){
|
|
|
|
if (chrome && chrome.storage && chrome.storage.local) {
|
|
|
|
if (chrome && chrome.storage && chrome.storage.local) {
|
|
|
|
chrome.storage.local.get({
|
|
|
|
chrome.storage.local.get({
|
|
|
|
baseURL: getMessage("settingsFormInputRequired"),
|
|
|
|
baseURL: chrome.i18n.getMessage("settingsFormInputRequired"),
|
|
|
|
wssURL: getMessage("settingsFormInputRequired")
|
|
|
|
wssURL: chrome.i18n.getMessage("settingsFormInputRequired")
|
|
|
|
}, function (items) {
|
|
|
|
}, function (items) {
|
|
|
|
stammTVBaseUrl.value = items.baseURL;
|
|
|
|
stammTVBaseUrl.value = items.baseURL;
|
|
|
|
stammTVWSSUrl.value = items.wssURL;
|
|
|
|
stammTVWSSUrl.value = items.wssURL;
|
|
|
@ -70,7 +70,6 @@ function load(){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function autofillWSSURL() {
|
|
|
|
function autofillWSSURL() {
|
|
|
|
console.log('here am i');
|
|
|
|
|
|
|
|
if (stammTVBaseUrl.value.startsWith('http')) {
|
|
|
|
if (stammTVBaseUrl.value.startsWith('http')) {
|
|
|
|
let predictedWSSURL = stammTVBaseUrl.value.replace('https', 'wss').replace('http', 'wss');
|
|
|
|
let predictedWSSURL = stammTVBaseUrl.value.replace('https', 'wss').replace('http', 'wss');
|
|
|
|
if (predictedWSSURL.endsWith('/')) {
|
|
|
|
if (predictedWSSURL.endsWith('/')) {
|
|
|
|