s4

changeset 964:759070ee3d20

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 diff
     1.1 --- a/s4-main.js	Thu Feb 10 21:36:57 2022 +0900
     1.2 +++ b/s4-main.js	Sun Feb 20 08:47:31 2022 +0900
     1.3 @@ -176,7 +176,7 @@
     1.4  	    // Append absolutely new articles.
     1.5  	    ntr = n.parentNode;
     1.6  	    addEventsToNewTr(ntr)
     1.7 -	    tbody.appendChild(ntr);
     1.8 +	    tbody.appendChild(atMarkView(ntr));
     1.9  	    ntr.classList.add("dissolving");
    1.10  	    let localntr = ntr;
    1.11  	    setTimeout(() => {
    1.12 @@ -782,6 +782,17 @@
    1.13  	if (!te || !te[0]) return;
    1.14  	te[0].addEventListener("keydown", helpMarkdown, false);
    1.15      }
    1.16 +    function atMarkView(elem) {
    1.17 +	// Enclose "@all" with span
    1.18 +	for (i of elem.querySelectorAll("td.repl")) {
    1.19 +	    let ii = i.innerHTML;
    1.20 +	    if (ii.startsWith("@all")) {
    1.21 +		ii = ii.replace(/^@all/,'<div class="atall">@all</div>');
    1.22 +		i.innerHTML = ii;
    1.23 +	    }
    1.24 +	}
    1.25 +	return elem;
    1.26 +    }
    1.27      function initBlogs() {
    1.28  	// Auto-complete #xxxx
    1.29  	let i, check = collectElementsByAttr("input", "name", "notifyto");
    1.30 @@ -820,14 +831,7 @@
    1.31  	}
    1.32  	// Hack article_m links
    1.33  	registPjaxViewers(document.querySelectorAll("a[href]"));
    1.34 -	// Enclose "@all" with span
    1.35 -	for (i of document.querySelectorAll("td.repl")) {
    1.36 -	    let ii = i.innerHTML;
    1.37 -	    if (ii.startsWith("@all")) {
    1.38 -		ii = ii.replace(/^@all/,'<div class="atall">@all</div>');
    1.39 -		i.innerHTML = ii;
    1.40 -	    }
    1.41 -	}
    1.42 +	atMarkView(document);
    1.43      }
    1.44      function initGrpAction() {
    1.45  	var rev = document.getElementById("reverse");