fillword.js & highlight.js: fix JavaScript errors on the front page
parent
0c6616d52c
commit
e6c945bac7
|
@ -21,14 +21,19 @@ function fillInWord() {
|
||||||
localStorage.setItem('selectedWords', element.value);
|
localStorage.setItem('selectedWords', element.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (document.getElementById("text-content")) {
|
||||||
document.getElementById("text-content").addEventListener("click", fillInWord, false);
|
document.getElementById("text-content").addEventListener("click", fillInWord, false);
|
||||||
|
}
|
||||||
|
|
||||||
const sliderValue = document.getElementById("rangeValue");
|
const sliderValue = document.getElementById("rangeValue");
|
||||||
const inputSlider = document.getElementById("rangeComponent");
|
const inputSlider = document.getElementById("rangeComponent");
|
||||||
|
|
||||||
|
if (inputSlider) {
|
||||||
inputSlider.oninput = () => {
|
inputSlider.oninput = () => {
|
||||||
let value = inputSlider.value;
|
let value = inputSlider.value;
|
||||||
sliderValue.textContent = value + '×';
|
sliderValue.textContent = value + '×';
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
function onReadClick() {
|
function onReadClick() {
|
||||||
isRead = !isRead;
|
isRead = !isRead;
|
||||||
|
|
|
@ -9,12 +9,14 @@ function cancelBtnHandler() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function showBtnHandler() {
|
function showBtnHandler() {
|
||||||
|
if (document.getElementById("text-content")) {
|
||||||
document.getElementById("text-content").removeEventListener("click", fillInWord2, false);
|
document.getElementById("text-content").removeEventListener("click", fillInWord2, false);
|
||||||
document.getElementById("text-content").removeEventListener("touchstart", fillInWord2, false);
|
document.getElementById("text-content").removeEventListener("touchstart", fillInWord2, false);
|
||||||
document.getElementById("text-content").addEventListener("click", fillInWord, false);
|
document.getElementById("text-content").addEventListener("click", fillInWord, false);
|
||||||
document.getElementById("text-content").addEventListener("touchstart", fillInWord, false);
|
document.getElementById("text-content").addEventListener("touchstart", fillInWord, false);
|
||||||
highLight();
|
highLight();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
function replaceWords(str, word) {
|
function replaceWords(str, word) {
|
||||||
let count = 0;
|
let count = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue