# HG changeset patch # User HIROSE Yuuji # Date 1653746286 -32400 # Node ID 072362c47306f34c4cc012369b64f7a457c5f344 # Parent 8781f341d93ac9a7184264b35b7f8eecf529e0a2 Add author to hover text diff -r 8781f341d93a -r 072362c47306 s4-main.js --- a/s4-main.js Sat May 28 22:34:21 2022 +0900 +++ b/s4-main.js Sat May 28 22:58:06 2022 +0900 @@ -1034,14 +1034,17 @@ ta.parentNode.appendChild(btn); } function initReplyHover() { - function getTextId(id) { - console.log("Getting!::"+id); - let txt = document.getElementById(id).innerText; - return txt.split("\n").splice(0,hoverTextLines).join("\n"); + function getTextById(id) { + let repltd = document.getElementById(id), + txt = repltd.innerText, + authtd = repltd.parentNode.getElementsByTagName("td")[0], + authAs = authtd.getElementsByTagName("a"), + author = authAs[authAs.length-1].innerText, + digest = txt.split("\n").splice(0, hoverTextLines).join("\n"); + return "[[ "+author+" ]]\n"+digest; } for (let td of document.querySelectorAll("td.repl")) { let text = td.innerHTML; - console.log(text); if (text.startsWith("\>#")) { let newline = text.indexOf("\n"); let first = text.substring(0, newline), @@ -1050,7 +1053,7 @@ /#([0-9]+)/g, (match, start, whole) => { let id = RegExp.$1 - return '' + return '' + match + ''; } ) + rest;