mirror of
https://github.com/tubearchivist/browser-extension.git
synced 2025-07-02 23:31:12 +00:00
persist inputs in popup
This commit is contained in:
parent
aaa04a43b5
commit
0fd4d74eae
@ -78,6 +78,30 @@ document.getElementById('autostart').addEventListener('click', function () {
|
|||||||
toggleAutostart();
|
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() {
|
function sendCookie() {
|
||||||
console.log('popup send cookie');
|
console.log('popup send cookie');
|
||||||
clearError();
|
clearError();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user