Mercurial > hgrepos > hgweb.cgi > s4
changeset 984:a094bd547d6b draft
Escape chars in hover string
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Sun, 26 Jun 2022 14:10:54 +0900 |
parents | c69cf72ea116 |
children | 77eec995911b |
files | s4-main.js |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/s4-main.js Sun Jun 26 13:51:03 2022 +0900 +++ b/s4-main.js Sun Jun 26 14:10:54 2022 +0900 @@ -14,6 +14,11 @@ mypath = mypath.substring(0, mypath.lastIndexOf("?")); //alert("mypath="+mypath); } + function escapeChars(old) { + return old.replaceAll('"', '"') + .replaceAll("<", '<') + .replaceAll(">", '>'); + } function collectElementsByAttr(elm, attr, val) { var e = document.getElementsByTagName(elm); if (!e) return null; @@ -1042,7 +1047,7 @@ authtd = repltd.parentNode.getElementsByTagName("td")[0], author = authtd.querySelector("a.author").innerText, digest = txt.split("\n").splice(0, hoverTextLines).join("\n"); - return "[[ "+author+" ]]\n"+digest; + return escapeChars("[[ "+author+" ]]\n"+digest); } else return ""; }