Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:digas99/wanikani-kanji-highlighter
Browse files Browse the repository at this point in the history
  • Loading branch information
digas99 committed Mar 10, 2022
2 parents 3c29be5 + cdd77d0 commit be622c8
Show file tree
Hide file tree
Showing 8 changed files with 1,614 additions and 1,484 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# [Changelog v0.6.5](https://github.com/digas99/wanikani-kanji-highlighter/releases/tag/v0.6.5)
Released on 10/03/2022

## Popup
- Reduced loading times
- Removed subject info when hovering on subjects in profile, while at Wanikani

## Bug Fix
- Fixed issue where highlighted kanji would show on extension popups opened in other tabs (not only on the popup opened on their tab)

# [Changelog v0.6.4](https://github.com/digas99/wanikani-kanji-highlighter/releases/tag/v0.6.4)
Released on 06/03/2022

Expand Down
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ It works with any website, and provides detailed information about any kanji tha

## Table of contents:

1. [Latest Features](#changelog-v064)
1. [Latest Features](#changelog-v065)
2. [Usage Guide](#usage-guide)
- 2.1. [WaniKani API Token](#wanikani-api-token)
- 2.2. [Kanji Details](#kanji-details)
Expand All @@ -30,6 +30,17 @@ It works with any website, and provides detailed information about any kanji tha
- 2.7. [Settings](#settings)
3. [Pictures](#pictures)

## Changelog v0.6.5

Released on 10/03/2022

### Popup
- Reduced loading times
- Removed subject info when hovering on subjects in profile, while at Wanikani

### Bug Fix
- Fixed issue where highlighted kanji would show on extension popups opened in other tabs (not only on the popup opened on their tab)

## Changelog v0.6.4

Released on 06/03/2022
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "WaniKani Kanji Highlighter",
"description": "Unofficial kanji highlighter, matching kanji learned with WaniKani.",
"version": "0.6.4",
"version": "0.6.5",
"manifest_version": 2,
"icons": {
"16": "logo/logo_bb_16x16.png",
Expand Down
16 changes: 2 additions & 14 deletions scripts/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,11 +341,8 @@ const flipArrow = (arrow, sourceDir, destDir, paddingValue) => {
const assignUponSubjects = list => {
const type = list[Object.keys(list)[0]]["subject_type"];
if (list && type) {
const keys = Array(60).fill(0).map((_, i) => "wkhighlight_"+type+"_level"+(i+1));
keys.push("wkhighlight_assignments");
chrome.storage.local.get(keys, result => {
chrome.storage.local.get("wkhighlight_assignments", result => {
const allAssignments = result["wkhighlight_assignments"]["all"];
const levels = {};
const progress = Object.fromEntries(Object.keys(srsStages).map(stage => [stage, 0]));
const levelsInProgress = [];
if (allAssignments) {
Expand All @@ -357,8 +354,6 @@ const assignUponSubjects = list => {
const subjectId = data["subject_id"];
if (subjectId && list[subjectId]) {
const subject = list[subjectId];
if (!levels["wkhighlight_"+type+"_level"+subject["level"]])
levels["wkhighlight_"+type+"_level"+subject["level"]] = result["wkhighlight_"+type+"_level"+subject["level"]];

const timestamps = {
data_updated_at: assignment["data_updated_at"],
Expand All @@ -375,13 +370,6 @@ const assignUponSubjects = list => {
subject["hidden"] = data["hidden"];
progress[data["srs_stage"]]++;

if (levels["wkhighlight_"+type+"_level"+subject["level"]] && levels["wkhighlight_"+type+"_level"+subject["level"]][subjectId]) {
const currentSubjectLevelStats = levels["wkhighlight_"+type+"_level"+subject["level"]][subjectId];
currentSubjectLevelStats["passed_at"] = data["passed_at"];
currentSubjectLevelStats["srs_stage"] = data["srs_stage"];
currentSubjectLevelStats["hidden"] = data["hidden"];
}

lib.update(type, {id:subjectId}, row => {
row.srs_stage = data["srs_stage"];
row.hidden = data["hidden"];
Expand Down Expand Up @@ -411,7 +399,7 @@ const assignUponSubjects = list => {
break;
}
if (storageId)
chrome.storage.local.set({...{[storageId]:list, ["wkhighlight_"+type+"_progress"]: progress, ["wkhighlight_"+type+"_levelsInProgress"]: levelsInProgress}, ...levels});
chrome.storage.local.set({...{[storageId]:list, ["wkhighlight_"+type+"_progress"]: progress, ["wkhighlight_"+type+"_levelsInProgress"]: levelsInProgress}});
}
});
}
Expand Down
2 changes: 0 additions & 2 deletions scripts/highlighter/highlight-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@

totalHighlighted = learned.size() + notLearned.size();
contentHighlighted = {learned:learned.highlightedSet(), notLearned:notLearned.highlightedSet()};

chrome.runtime.sendMessage({badge:totalHighlighted, nmrKanjiHighlighted:totalHighlighted, kanjiHighlighted:contentHighlighted});
chrome.storage.local.set({"wkhighlight_nmrHighLightedKanji":totalHighlighted, "wkhighlight_allHighLightedKanji":contentHighlighted});
}, delay);
Expand Down Expand Up @@ -95,7 +94,6 @@
sendResponse({uptime:true});
return true;
}

});

const addStylesToFrame = (iframe, highlightVar, className) => {
Expand Down
2 changes: 1 addition & 1 deletion scripts/kana.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const convertToKana = text => {
kanaValue = kana[/[a-z]/.test(word.charAt(0)) ? 'll' : 'LL']+kana[word.slice(1)];
finalValue += kanaValue ? kanaValue : word;
}
return finalValue;
return finalValue == undefined ? '' : finalValue;
}

const isAllKana = text => {
Expand Down
Loading

0 comments on commit be622c8

Please sign in to comment.