commit
fc43e55604
|
@ -5,4 +5,9 @@
|
||||||
* Fixed error appearing right after installing extension
|
* Fixed error appearing right after installing extension
|
||||||
|
|
||||||
## v0.6.2
|
## v0.6.2
|
||||||
* Added color transitions to buttons and links in the popup
|
* Added color transitions to buttons and links in the popup
|
||||||
|
|
||||||
|
## 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
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "FuriKani",
|
"name": "FuriKani",
|
||||||
"description": "Removes furigana on websites based on your WaniKani level",
|
"description": "Removes furigana on websites based on your WaniKani level",
|
||||||
"version": "0.6.2",
|
"version": "0.6.3",
|
||||||
"icons": {
|
"icons": {
|
||||||
"16": "res/icon16.png",
|
"16": "res/icon16.png",
|
||||||
"48": "res/icon48.png",
|
"48": "res/icon48.png",
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
<h1>FuriKani</h1>
|
<h1>FuriKani</h1>
|
||||||
<h2>v0.6.2</h2>
|
<h2>v0.6.3</h2>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div id="token-area">
|
<div id="token-area">
|
||||||
|
|
|
@ -92,7 +92,6 @@ const updateCache = async (token, oldLevel, newLevel) => {
|
||||||
|
|
||||||
// Extract Kanji as well
|
// Extract Kanji as well
|
||||||
var url = "https://api.wanikani.com/v2/subjects?types=kanji&levels=" + levelURLString
|
var url = "https://api.wanikani.com/v2/subjects?types=kanji&levels=" + levelURLString
|
||||||
var kanji = new Set()
|
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -131,9 +130,6 @@ const sync = () =>
|
||||||
// Get user level
|
// Get user level
|
||||||
level = user.data.level
|
level = user.data.level
|
||||||
|
|
||||||
// If the users level is somehow larger than their max allowed level, set the flag
|
|
||||||
|
|
||||||
|
|
||||||
// if users level is larger than max allowed level, abort
|
// if users level is larger than max allowed level, abort
|
||||||
if(level > user.data.subscription.max_level_granted)
|
if(level > user.data.subscription.max_level_granted)
|
||||||
{
|
{
|
||||||
|
@ -141,9 +137,9 @@ const sync = () =>
|
||||||
return reject("User account level exceeds account level limit")
|
return reject("User account level exceeds account level limit")
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the wanikani level differs from the local leve, update the cache
|
// If the wanikani level differs from the local level, update the cache
|
||||||
if(level !== data.level)
|
if(level !== data.level)
|
||||||
updateCache(data.token, data.level, level)
|
await updateCache(data.token, data.level, level)
|
||||||
|
|
||||||
chrome.storage.local.set({"validUserLevel": true})
|
chrome.storage.local.set({"validUserLevel": true})
|
||||||
resolve("Successfully synchronized data!")
|
resolve("Successfully synchronized data!")
|
||||||
|
@ -165,4 +161,6 @@ chrome.runtime.onMessage.addListener((data, sender, sendResponse) => {
|
||||||
})
|
})
|
||||||
|
|
||||||
// At browser start, sync with wanikani
|
// At browser start, sync with wanikani
|
||||||
sync().then(value => console.log(value)).catch(reason => {})
|
chrome.runtime.onStartup.addListener(() => {
|
||||||
|
sync().then(value => console.log(value)).catch(reason => {})
|
||||||
|
})
|
|
@ -68,6 +68,12 @@ submitButton.addEventListener( "click", () => {
|
||||||
{
|
{
|
||||||
statusField.innerHTML = String.fromCodePoint(0x2705)
|
statusField.innerHTML = String.fromCodePoint(0x2705)
|
||||||
errorField.innerHTML = ""
|
errorField.innerHTML = ""
|
||||||
|
|
||||||
|
// Update the users current WaniKani level
|
||||||
|
chrome.storage.local.get("level", (data) => {
|
||||||
|
const levelSpan = document.getElementById("level")
|
||||||
|
levelSpan.innerHTML = data.level
|
||||||
|
})
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue