toggle font button

This commit is contained in:
2022-05-04 21:54:05 +02:00
parent c5bbdd194c
commit e52ea0c3e6
5 changed files with 84 additions and 6 deletions

28
main.js
View File

@@ -5,13 +5,17 @@
let words = {}
let currentFont = "r";
function init() {
createWordList();
injectWords();
document.querySelector("#popup-container").addEventListener("click", () => {
document.querySelector("#popup-container").style.opacity = 0;
document.querySelector("#popup-container").style.pointerEvents = "none";
})
// createWordList();
// injectWords();
// document.querySelector("#popup-container").addEventListener("click", () => {
// document.querySelector("#popup-container").style.opacity = 0;
// document.querySelector("#popup-container").style.pointerEvents = "none";
// })
// above are commented out until wordlist is added~
document.querySelector("#font-button").addEventListener("click", () => {fontButton();});
}
function showPopup(word) {
@@ -68,6 +72,18 @@ function injectWords() {
});
}
function fontButton() {
if (currentFont == "r") {
document.querySelector("#style-heonian").disabled = false;
document.querySelector("#style-roman").disabled = true;
currentFont = "h";
} else {
document.querySelector("#style-heonian").disabled = true;
document.querySelector("#style-roman").disabled = false;
currentFont = "r";
}
}
window.onload = () => {
init();
}