Merge pull request #6 from Lauchmelder23/v0.7

V0.7
This commit is contained in:
Lauchmelder 2022-04-01 14:10:19 +02:00 committed by GitHub
commit c8dd677f4a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 31 additions and 26 deletions

View file

@ -10,4 +10,8 @@
## v0.6.3
* Startup sync check is now more consistent
* Level number updates in realtime after sync
* Fixed bug where internal Kanji list would get reset on sync
* Fixed bug where internal Kanji list would get reset on sync
# v0.7
* FuriKani now supports Firefox!
* Fixed potential innerHTML risks

View file

@ -1,14 +1,14 @@
{
"name": "FuriKani",
"description": "Removes furigana on websites based on your WaniKani level",
"version": "0.6.3",
"version": "0.7",
"icons": {
"16": "res/icon16.png",
"48": "res/icon48.png",
"128": "res/icon128.png"
},
"manifest_version": 3,
"action": {
"manifest_version": 2,
"browser_action": {
"default_popup": "src/popup.html"
},
"content_scripts": [
@ -18,7 +18,7 @@
}
],
"background": {
"service_worker": "src/background.js"
"scripts": ["src/background.js"]
},
"permissions": ["storage"]
}

View file

@ -30,10 +30,10 @@ chrome.storage.local.get(["vocabulary", "kanji", "validUserLevel", "enabled", "e
if(data.enabled)
{
if(data.enabledVocab)
vocabStyleSheet.innerHTML = vocabStyle
vocabStyleSheet.innerText = vocabStyle
if(data.enabledKanji)
kanjiStyleSheet.innerHTML = kanjiStyle
kanjiStyleSheet.innerText = kanjiStyle
}
const vocabulary = data.vocabulary
@ -81,15 +81,15 @@ chrome.runtime.onMessage.addListener((msg, sender, sendResponse) => {
// If everything is disabled, disable all stylsheets
if(!data.enabled)
{
vocabStyleSheet.innerHTML = ""
kanjiStyleSheet.innerHTML = ""
vocabStyleSheet.innerText = ""
kanjiStyleSheet.innerText = ""
return
}
// Otherwise set the kanji and vocab stylesheets depending on their settings
vocabStyleSheet.innerHTML = data.enabledVocab ? vocabStyle : ""
kanjiStyleSheet.innerHTML = data.enabledKanji ? kanjiStyle : ""
vocabStyleSheet.innerText = data.enabledVocab ? vocabStyle : ""
kanjiStyleSheet.innerText = data.enabledKanji ? kanjiStyle : ""
sendResponse(true)
})

View file

@ -6,7 +6,7 @@
<body>
<header>
<h1>FuriKani</h1>
<h2>v0.6.3</h2>
<h2>v0.7</h2>
</header>
<div id="token-area">

View file

@ -12,31 +12,31 @@ chrome.storage.local.get(["level", "token", "enabled", "enabledVocab", "enabledK
// If no token is set, display exlamation mark and checkmark button
if(data.token === undefined)
{
statusField.innerHTML = String.fromCodePoint(0x2757)
submitButton.innerHTML = String.fromCodePoint(0x2705)
statusField.innerText = String.fromCodePoint(0x2757)
submitButton.innerText = String.fromCodePoint(0x2705)
submitButton.classList.add("no-token")
}
else // else display checkmark and reload button
{
statusField.innerHTML = String.fromCodePoint(0x2705)
submitButton.innerHTML = String.fromCodePoint(0x1F501)
statusField.innerText = String.fromCodePoint(0x2705)
submitButton.innerText = String.fromCodePoint(0x1F501)
}
// Display the users current WaniKani level
const levelSpan = document.getElementById("level")
levelSpan.innerHTML = data.level
levelSpan.innerText = data.level
// If the input field contains text that is not the current token, turn the
// button into a checkmark (else turn it into a repeat button)
inputField.addEventListener("input", () => {
if(inputField.value !== "" && inputField.value !== data.token)
{
submitButton.innerHTML = String.fromCodePoint(0x2705)
submitButton.innerText = String.fromCodePoint(0x2705)
submitButton.classList.add("new-token")
}
else
{
submitButton.innerHTML = String.fromCodePoint(0x1F501)
submitButton.innerText = String.fromCodePoint(0x1F501)
submitButton.classList.remove("new-token")
}
})
@ -60,25 +60,25 @@ submitButton.addEventListener( "click", () => {
if(submitButton.classList.contains("no-token"))
return
statusField.innerHTML = String.fromCodePoint(0x23F1)
statusField.innerText = String.fromCodePoint(0x23F1)
// Sync with wanikani
chrome.runtime.sendMessage("", {type: "sync"}, response => {
if(response.success)
{
statusField.innerHTML = String.fromCodePoint(0x2705)
errorField.innerHTML = ""
statusField.innerText = String.fromCodePoint(0x2705)
errorField.innerText = ""
// Update the users current WaniKani level
chrome.storage.local.get("level", (data) => {
const levelSpan = document.getElementById("level")
levelSpan.innerHTML = data.level
levelSpan.innerText = data.level
})
}
else
{
statusField.innerHTML = String.fromCodePoint(0x2757)
errorField.innerHTML = response.error
statusField.innerText = String.fromCodePoint(0x2757)
errorField.innerText = response.error
}
})
})

View file

@ -4,7 +4,8 @@
padding: 0px;
box-sizing: border-box;
border-radius: 0px;
color: #ECB365
color: #ECB365;
font-family: "Segoe UI", Tahoma, sans-serif;
}
body