s4
changeset 1037:634fee6a6bd2
Add row number to title attribute after sort.
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Wed, 06 Mar 2024 09:55:20 +0900 |
parents | 9c392ddb4d8a |
children | b8b1b8356b94 |
files | s4-main.js |
diffstat | 1 files changed, 5 insertions(+), 2 deletions(-) [+] |
line diff
1.1 --- a/s4-main.js Wed Mar 06 09:49:08 2024 +0900 1.2 +++ b/s4-main.js Wed Mar 06 09:55:20 2024 +0900 1.3 @@ -1000,7 +1000,7 @@ 1.4 } 1.5 sbtn.addEventListener("click", (e)=>{ 1.6 let uidsort = (sbtn.textContent.indexOf(umode) >= 0); 1.7 - let rows = [], elm, 1.8 + let rows = [], elm, i=0, 1.9 tbl = document.querySelector("table.blog_replies"); 1.10 for (let tr of tbl.rows) { 1.11 elm = {}; 1.12 @@ -1011,7 +1011,10 @@ 1.13 rows.push(elm); 1.14 } 1.15 rows.sort(uidsort ? compareRowsByUid : compareRowsByAid); 1.16 - for (let r of rows) tbl.appendChild(r.tr); 1.17 + for (let r of rows) { 1.18 + tbl.appendChild(r.tr); 1.19 + r.tr.title = ++i; 1.20 + } 1.21 sbtn.textContent = uidsort ? amode : umode; 1.22 }); 1.23 }