From 4d67d66d8e4425a485a472d1aa9b60efd01c3bdd Mon Sep 17 00:00:00 2001 From: Lauchmelder Date: Fri, 1 Apr 2022 14:07:30 +0200 Subject: [PATCH] replaced innerHTML with innerText --- src/content.js | 12 ++++++------ src/popup.js | 26 +++++++++++++------------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/content.js b/src/content.js index e100d03..9fb24bd 100644 --- a/src/content.js +++ b/src/content.js @@ -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) }) diff --git a/src/popup.js b/src/popup.js index faf61a8..430027f 100644 --- a/src/popup.js +++ b/src/popup.js @@ -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 } }) })