上传文件至 app/static/js

pull/128/head
谢尚海 2024-05-27 22:58:59 +08:00
parent d8e4fbbb2d
commit cfd85a5035
1 changed files with 3 additions and 3 deletions

View File

@ -43,12 +43,12 @@ function highLight() {
// 删除所有的mark标签,防止标签发生嵌套
articleContent = articleContent.replace(/<(mark)[^>]*>/gi, "");
articleContent = articleContent.replace(/<(\/mark)[^>]*>/gi, "");
// 将文章中所有出现该单词word的地方改为"<span class='highlighted'>" + word + "</span>"。
// 将文章中所有出现该单词word的地方改为"<mark>" + word + "<mark>"。
for (let word of totalSet) {
articleContent = articleContent.replace(new RegExp("\\b" + word + "\\b", "g"), "<span class='highlighted'>" + word + "</span>");
articleContent = articleContent.replace(new RegExp("\\b" + word + "\\b", "g"), "<mark>" + word + "</mark>");
}
document.getElementById("article").innerHTML = articleContent;
$('mark').css('padding', 0);
}
function cancelHighlighting() {