s4

changeset 1001:bbd5a0c50d5b

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 diff
     1.1 --- a/examples/common/default/default.css	Sun Dec 04 09:56:36 2022 +0859
     1.2 +++ b/examples/common/default/default.css	Sun Dec 04 10:36:33 2022 +0859
     1.3 @@ -160,6 +160,8 @@
     1.4      color: white; background: #66f; padding: 0 0.8ex;
     1.5      display: inline-block; border-radius: 0.8ex;
     1.6  }
     1.7 +td.repl.atall:first-line {font-size: 125%;}
     1.8 +
     1.9  .blog_replies td.repatt {min-width: 12em;}
    1.10  .blog_replies td.hideauthor {display: none;}
    1.11  table.blog_replies iframe {
     2.1 --- a/s4-main.js	Sun Dec 04 09:56:36 2022 +0859
     2.2 +++ b/s4-main.js	Sun Dec 04 10:36:33 2022 +0859
     2.3 @@ -793,10 +793,12 @@
     2.4      function atMarkView(elem) {
     2.5  	// Enclose "@all" with span
     2.6  	for (i of elem.querySelectorAll("td.repl")) {
     2.7 -	    let ii = i.innerHTML;
     2.8 -	    if (ii.startsWith("@all")) {
     2.9 -		ii = ii.replace(/^@all/,'<div class="atall">@all</div>');
    2.10 -		i.innerHTML = ii;
    2.11 +	    if (i.textContent.startsWith("@all")) {
    2.12 +		i.firstChild.nodeValue = i.firstChild.nodeValue.substring(4);
    2.13 +		i.insertAdjacentHTML(
    2.14 +		    'afterbegin', '<div class="atall">@all</div>'
    2.15 +		);
    2.16 +		i.classList.add("atall");
    2.17  	    }
    2.18  	}
    2.19  	return elem;