CSS games

This commit is contained in:
achiyae
2023-08-05 23:58:17 +03:00
parent 60b84e8229
commit 93b362ca3e
3 changed files with 74 additions and 59 deletions

View File

@@ -27,8 +27,11 @@ async function refreshStorage() {
if (bindingFailures.length > 0) {
addErrorMessage(`Could not bound the following shortcuts:\n${bindingFailures}.\nYou can set it manually at <a href="chrome://extensions/shortcuts">chrome://extensions/shortcuts</a>.`)
}
Object.values(settings).forEach(({ key, status }) => {
Object.values(settings).forEach(({ key, status, shortcut }) => {
$(`#settings-form input[name='text-${key}']:checkbox`).prop('checked', status === 'enabled')
let shortcut2 = status === 'error' ? 'not set' : shortcut
console.log(`writing ${shortcut2} to shortcut-${key}`)
$(`#shortcut-${key}`).html(`<span>${shortcut2}</span>`)
})
})
}
@@ -51,7 +54,6 @@ async function handleAPITokenSet(event) {
try {
chrome.storage.local.set({ openAIAPIKey }).then(refreshStorage)
} catch (error) {
console.log(error)
addErrorMessage('Failed to set API Token.')
return
}