add initial cleanse of ruby tags on page load
This commit is contained in:
parent
303879145b
commit
597a1d9d20
3 changed files with 12 additions and 1 deletions
|
@ -47,6 +47,12 @@ function handleRubyTag(tag, vocabulary, kanji) {
|
|||
rtTag.classList.add("furikani-kanji")
|
||||
}
|
||||
|
||||
function removeExistingTags(vocabulary, kanji) {
|
||||
let nodes = document.querySelectorAll("ruby")
|
||||
nodes.forEach((node, _key, _parent) => {
|
||||
handleRubyTag(node, vocabulary, kanji)
|
||||
});
|
||||
};
|
||||
|
||||
// Get stored word list from chrome storage
|
||||
chrome.storage.local.get(["vocabulary", "kanji", "validUserLevel", "enabled", "enabledVocab", "enabledKanji"], (data) => {
|
||||
|
@ -68,6 +74,8 @@ chrome.storage.local.get(["vocabulary", "kanji", "validUserLevel", "enabled", "e
|
|||
const vocabulary = data.vocabulary
|
||||
const kanji = data.kanji
|
||||
|
||||
removeExistingTags(vocabulary, kanji)
|
||||
|
||||
let observer = new MutationObserver((mutations) => {
|
||||
mutations.forEach((mutation) => {
|
||||
mutation.addedNodes.forEach((node, _key, _parent) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue