Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

MediaWiki:Common.js: Difference between revisions

MediaWiki interface page
No edit summary
No edit summary
Line 102: Line 102:


   const rows = Array.from(table.querySelectorAll("tr"));
   const rows = Array.from(table.querySelectorAll("tr"));
  // Must have header + at least 1 row
   if (rows.length <= 1) return;
   if (rows.length <= 1) return;


Line 117: Line 115:
   }
   }


   // Sort rows by Time column (column index 3)
   // Time column is now index 4
   dataRows.sort((a, b) => {
   dataRows.sort((a, b) => {
     const timeA = parseTime(a.cells[3].innerText);
     const timeA = parseTime(a.cells[4].innerText);
     const timeB = parseTime(b.cells[3].innerText);
     const timeB = parseTime(b.cells[4].innerText);
     return timeA - timeB;
     return timeA - timeB;
   });
   });


  // Re-append sorted rows
   dataRows.forEach(row => table.appendChild(row));
   dataRows.forEach(row => table.appendChild(row));


  // Apply ranking
   dataRows.forEach((row, index) => {
   dataRows.forEach((row, index) => {
     const rankCell = row.cells[0];
     const rankCell = row.cells[0];