diff --git a/app/static/js/highlight.js b/app/static/js/highlight.js index d7d72c2..3070d43 100644 --- a/app/static/js/highlight.js +++ b/app/static/js/highlight.js @@ -34,10 +34,10 @@ function highLight() { } const list = allWords.split(" ");//将所有的生词放入一个list中,用于后续处理 //判断获取的单词不能为空 - if(word !== null && word !== "" && word !== " "){ + if(word != null && word != "" && word != " "){ let articleContent_fb2 = articleContent; - if(localStorage.getItem("nowWord").indexOf(word) !== -1){ - while(articleContent_fb2.toLowerCase().indexOf(word.toLowerCase()) !== -1){ + if(localStorage.getItem("nowWord").indexOf(word) != -1){ + while(articleContent_fb2.toLowerCase().indexOf(word.toLowerCase()) != -1){ // 找到副本中和list[i]匹配的第一个单词(第一种匹配情况),并赋值给list[i]。 const index = articleContent_fb2.toLowerCase().indexOf(word.toLowerCase()); word = articleContent_fb2.substring(index, index + word.length);