Add option to disable auto dismiss on the extension
This commit is contained in:
@ -246,6 +246,7 @@
|
||||
case 'success':
|
||||
// Auto hide if everything went well and the user
|
||||
// has not initiated any interaction.
|
||||
|
||||
hideToastTimeout = setTimeout(function () {
|
||||
console.log('hiding: ', currentToastEl, doNotHide)
|
||||
if (!doNotHide) {
|
||||
@ -253,6 +254,12 @@
|
||||
currentToastEl = undefined
|
||||
}
|
||||
}, 2500)
|
||||
getStorageItem('disableAutoDismiss').then((disable) => {
|
||||
console.log('got disableAutoDismiss', disable)
|
||||
if (disable) {
|
||||
cancelAutoDismiss()
|
||||
}
|
||||
})
|
||||
statusBox.innerHTML = systemIcons.success
|
||||
break
|
||||
case 'failure':
|
||||
|
||||
@ -34,6 +34,21 @@ function clearAPIKey() {
|
||||
})
|
||||
}
|
||||
|
||||
function autoDismissChanged(event) {
|
||||
const value = document.getElementById('disable-auto-dismiss').checked
|
||||
console.log(
|
||||
' value: ',
|
||||
value,
|
||||
document.getElementById('disable-auto-dismiss')
|
||||
)
|
||||
|
||||
setStorage({
|
||||
disableAutoDismiss: value ? 'true' : null,
|
||||
}).then(() => {
|
||||
console.log('disableAutoDismiss updated', value)
|
||||
})
|
||||
}
|
||||
|
||||
;(() => {
|
||||
document
|
||||
.getElementById('save-api-key-btn')
|
||||
@ -44,4 +59,15 @@ function clearAPIKey() {
|
||||
document
|
||||
.getElementById('clear-api-key-btn')
|
||||
.addEventListener('click', clearAPIKey)
|
||||
|
||||
getStorageItem('disableAutoDismiss').then((value) => {
|
||||
console.log('disableAutoDismiss updated', value)
|
||||
document.getElementById('disable-auto-dismiss').checked = value
|
||||
? true
|
||||
: false
|
||||
})
|
||||
|
||||
document
|
||||
.getElementById('disable-auto-dismiss')
|
||||
.addEventListener('change', autoDismissChanged)
|
||||
})()
|
||||
|
||||
@ -3,12 +3,7 @@
|
||||
<head>
|
||||
<title>API Key Storage</title>
|
||||
<script src="/scripts/common.js"></script>
|
||||
<style>
|
||||
div.wrapper: {
|
||||
max-width: 480px;
|
||||
padding: 20px;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
@ -35,6 +30,14 @@
|
||||
<button id="save-api-key-btn">Save API Key</button>
|
||||
<button id="load-api-key-btn">Load API Key</button>
|
||||
<button id="clear-api-key-btn">Clear API Key</button>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<h1>Settings</h1>
|
||||
|
||||
<input type="checkbox" id="disable-auto-dismiss" />
|
||||
<label for="auto-dismiss">Disable Auto Dismiss</label>
|
||||
|
||||
</div>
|
||||
<script src="/scripts/options.js"></script>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user