persist inputs in popup

This commit is contained in:
Kevin Gibbons 2023-11-04 22:05:56 -07:00
parent aaa04a43b5
commit 0fd4d74eae
1 changed files with 24 additions and 0 deletions

View File

@ -78,6 +78,30 @@ document.getElementById('autostart').addEventListener('click', function () {
toggleAutostart();
});
let fullUrlInput = document.getElementById('full-url');
fullUrlInput.addEventListener('change', () => {
browserType.storage.local.set({
popupFullUrl: fullUrlInput.value,
});
});
let apiKeyInput = document.getElementById('api-key');
apiKeyInput.addEventListener('change', () => {
browserType.storage.local.set({
popupApiKey: apiKeyInput.value,
});
});
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() {
console.log('popup send cookie');
clearError();