changeset 964:759070ee3d20 draft

Replace @all for ajaxpost
author HIROSE Yuuji <yuuji@gentei.org>
date Sun, 20 Feb 2022 08:47:31 +0900
parents 8afc139044f1
children b6d1384e1b2c
files s4-main.js
diffstat 1 files changed, 13 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/s4-main.js	Thu Feb 10 21:36:57 2022 +0900
+++ b/s4-main.js	Sun Feb 20 08:47:31 2022 +0900
@@ -176,7 +176,7 @@
 	    // Append absolutely new articles.
 	    ntr = n.parentNode;
 	    addEventsToNewTr(ntr)
-	    tbody.appendChild(ntr);
+	    tbody.appendChild(atMarkView(ntr));
 	    ntr.classList.add("dissolving");
 	    let localntr = ntr;
 	    setTimeout(() => {
@@ -782,6 +782,17 @@
 	if (!te || !te[0]) return;
 	te[0].addEventListener("keydown", helpMarkdown, false);
     }
+    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;
+	    }
+	}
+	return elem;
+    }
     function initBlogs() {
 	// Auto-complete #xxxx
 	let i, check = collectElementsByAttr("input", "name", "notifyto");
@@ -820,14 +831,7 @@
 	}
 	// Hack article_m links
 	registPjaxViewers(document.querySelectorAll("a[href]"));
-	// Enclose "@all" with span
-	for (i of document.querySelectorAll("td.repl")) {
-	    let ii = i.innerHTML;
-	    if (ii.startsWith("@all")) {
-		ii = ii.replace(/^@all/,'<div class="atall">@all</div>');
-		i.innerHTML = ii;
-	    }
-	}
+	atMarkView(document);
     }
     function initGrpAction() {
 	var rev = document.getElementById("reverse");

yatex.org