s4

changeset 984:a094bd547d6b

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 diff
     1.1 --- a/s4-main.js	Sun Jun 26 13:51:03 2022 +0900
     1.2 +++ b/s4-main.js	Sun Jun 26 14:10:54 2022 +0900
     1.3 @@ -14,6 +14,11 @@
     1.4  	mypath = mypath.substring(0, mypath.lastIndexOf("?"));
     1.5  	//alert("mypath="+mypath);
     1.6      }
     1.7 +    function escapeChars(old) {
     1.8 +	return old.replaceAll('"', '&quot;')
     1.9 +	    .replaceAll("<", '&lt;')
    1.10 +	    .replaceAll(">", '&gt;');
    1.11 +    }
    1.12      function collectElementsByAttr(elm, attr, val) {
    1.13  	var e = document.getElementsByTagName(elm);
    1.14  	if (!e) return null;
    1.15 @@ -1042,7 +1047,7 @@
    1.16  		    authtd = repltd.parentNode.getElementsByTagName("td")[0],
    1.17  		    author = authtd.querySelector("a.author").innerText,
    1.18  		    digest = txt.split("\n").splice(0, hoverTextLines).join("\n");
    1.19 -		return "[[ "+author+" ]]\n"+digest;
    1.20 +		return escapeChars("[[ "+author+" ]]\n"+digest);
    1.21  	    } else
    1.22  		return "";
    1.23  	}