mirror of
https://github.com/tubearchivist/browser-extension.git
synced 2025-04-20 18:20:12 +00:00
consolidate storage requests
This commit is contained in:
parent
0fd4d74eae
commit
edd3a945c3
@ -93,15 +93,6 @@ apiKeyInput.addEventListener('change', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
browserType.storage.local.get(['popupFullUrl', 'popupApiKey']).then(results => {
|
|
||||||
if (results.popupFullUrl != null && fullUrlInput.value === '') {
|
|
||||||
fullUrlInput.value = results.popupFullUrl;
|
|
||||||
}
|
|
||||||
if (results.popupApiKey != null && apiKeyInput.value === '') {
|
|
||||||
apiKeyInput.value = results.popupApiKey;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function sendCookie() {
|
function sendCookie() {
|
||||||
console.log('popup send cookie');
|
console.log('popup send cookie');
|
||||||
clearError();
|
clearError();
|
||||||
@ -203,11 +194,18 @@ function setStatusIcon(connected) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// fill in form
|
// fill in form
|
||||||
document.addEventListener('DOMContentLoaded', async () => {
|
document.addEventListener('DOMContentLoaded', async () => {
|
||||||
function onGot(item) {
|
function onGot(item) {
|
||||||
if (!item.access) {
|
if (!item.access) {
|
||||||
console.log('no access details found');
|
console.log('no access details found');
|
||||||
|
if (item.popupFullUrl != null && fullUrlInput.value === '') {
|
||||||
|
fullUrlInput.value = item.popupFullUrl;
|
||||||
|
}
|
||||||
|
if (item.popupApiKey != null && apiKeyInput.value === '') {
|
||||||
|
apiKeyInput.value = item.popupApiKey;
|
||||||
|
}
|
||||||
setStatusIcon(false);
|
setStatusIcon(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -241,7 +239,7 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|||||||
document.getElementById('autostart').checked = true;
|
document.getElementById('autostart').checked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
browserType.storage.local.get('access', function (result) {
|
browserType.storage.local.get(['access', 'popupFullUrl', 'popupApiKey'], function (result) {
|
||||||
onGot(result);
|
onGot(result);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user