From f22b5c7c5b29729491d7aae8b3f9f570cb4afade Mon Sep 17 00:00:00 2001 From: Eddie Kohler Date: Fri, 8 Sep 2023 11:40:33 -0400 Subject: [PATCH] Use ul.comma for allprefs lists. --- scripts/script.js | 14 ++++---------- stylesheets/style.css | 11 +++++++++-- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/scripts/script.js b/scripts/script.js index ba235e2a3d..f69b5e2660 100644 --- a/scripts/script.js +++ b/scripts/script.js @@ -9934,7 +9934,7 @@ function render_allpref() { var pctr = this; demand_load.pc().then(function (pcs) { var allpref = pattrnear(pctr, "data-allpref") || "", - atomre = /(\d+)([PT])(\S+)/g, t = [], m, pref, frag, i, e, u; + atomre = /(\d+)([PT])(\S+)/g, t = [], m, pref, ul, i, e, u; while ((m = atomre.exec(allpref)) !== null) { pref = parseInt(m[3]); t.push([m[2] === "P" ? pref : 0, pref, t.length, pcs[m[1]], m[2]]); @@ -9951,7 +9951,7 @@ function render_allpref() { else return a[2] < b[2] ? -1 : 1; }); - frag = document.createDocumentFragment(); + ul = $e("ul", "comma"); for (i = 0; i !== t.length; ++i) { u = t[i]; pref = u[1]; @@ -9960,15 +9960,9 @@ function render_allpref() { } else { e = $e("span", "asspref1", u[4].concat("+", pref)); } - e = $e("span", "nb", usere(u[3]), " ", e); - if (i < t.length - 1) { - e.append(","); - frag.append(e, " "); - } else { - frag.append(e); - } + ul.append($e("li", null, usere(u[3]), " ", e)); } - pctr.replaceChildren(frag); + pctr.parentElement.replaceChild(ul, pctr); removeClass(pctr, "need-allpref"); }, function () { pctr.closest("div").replaceChildren(); diff --git a/stylesheets/style.css b/stylesheets/style.css index e6e4e04a72..2af2d75977 100644 --- a/stylesheets/style.css +++ b/stylesheets/style.css @@ -1190,14 +1190,21 @@ ul.semi { margin-top: 0; margin-bottom: 0; } -ul.semi > li { +ul.comma { + display: inline; +} +ul.semi > li, ul.comma > li { display: inline-block; } ul.semi > li::after { content: "; "; padding-right: 0.35em; } -ul.semi > li:last-child::after { +ul.comma > li::after { + content: ", "; + padding-right: 0.35em; +} +ul.semi > li:last-child::after, ul.comma > li:last-child::after { content: ""; padding-right: 0; }