perform startup initialization
This commit is contained in:
parent
335d611e57
commit
fc6122c99c
|
@ -1,3 +1,14 @@
|
|||
chrome.storage.local.get("token", (data) => {
|
||||
if(data.token !== undefined)
|
||||
return
|
||||
|
||||
chrome.storage.local.set({
|
||||
"enabled": true,
|
||||
"enabledVocab": true,
|
||||
"enabledKanji": true
|
||||
})
|
||||
})
|
||||
|
||||
// Query a WaniKani API endpoint with the given token
|
||||
const query = (token, url) =>
|
||||
new Promise(async (resolve, reject) => {
|
||||
|
|
22
src/popup.js
22
src/popup.js
|
@ -64,17 +64,17 @@ submitButton.addEventListener( "click", () => {
|
|||
|
||||
// Sync with wanikani
|
||||
chrome.runtime.sendMessage("", {type: "sync"}, response => {
|
||||
if(response.success)
|
||||
{
|
||||
statusField.innerHTML = String.fromCodePoint(0x2705)
|
||||
errorField.innerHTML = ""
|
||||
}
|
||||
else
|
||||
{
|
||||
statusField.innerHTML = String.fromCodePoint(0x2757)
|
||||
errorField.innerHTML = response.error
|
||||
}
|
||||
})
|
||||
if(response.success)
|
||||
{
|
||||
statusField.innerHTML = String.fromCodePoint(0x2705)
|
||||
errorField.innerHTML = ""
|
||||
}
|
||||
else
|
||||
{
|
||||
statusField.innerHTML = String.fromCodePoint(0x2757)
|
||||
errorField.innerHTML = response.error
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
// Set settings event listeners
|
||||
|
|
Loading…
Reference in a new issue