changeset 1001:bbd5a0c50d5b draft

Keep pjaxview in @all post
author HIROSE Yuuji <yuuji@gentei.org>
date Sun, 04 Dec 2022 10:36:33 +0859
parents ddf85e80f64e
children 47b3e770372d
files examples/common/default/default.css s4-main.js
diffstat 2 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/examples/common/default/default.css	Sun Dec 04 09:56:36 2022 +0859
+++ b/examples/common/default/default.css	Sun Dec 04 10:36:33 2022 +0859
@@ -160,6 +160,8 @@
     color: white; background: #66f; padding: 0 0.8ex;
     display: inline-block; border-radius: 0.8ex;
 }
+td.repl.atall:first-line {font-size: 125%;}
+
 .blog_replies td.repatt {min-width: 12em;}
 .blog_replies td.hideauthor {display: none;}
 table.blog_replies iframe {
--- a/s4-main.js	Sun Dec 04 09:56:36 2022 +0859
+++ b/s4-main.js	Sun Dec 04 10:36:33 2022 +0859
@@ -793,10 +793,12 @@
     function atMarkView(elem) {
 	// Enclose "@all" with span
 	for (i of elem.querySelectorAll("td.repl")) {
-	    let ii = i.innerHTML;
-	    if (ii.startsWith("@all")) {
-		ii = ii.replace(/^@all/,'<div class="atall">@all</div>');
-		i.innerHTML = ii;
+	    if (i.textContent.startsWith("@all")) {
+		i.firstChild.nodeValue = i.firstChild.nodeValue.substring(4);
+		i.insertAdjacentHTML(
+		    'afterbegin', '<div class="atall">@all</div>'
+		);
+		i.classList.add("atall");
 	    }
 	}
 	return elem;

yatex.org