Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Commit ·
9d8de21
1
Parent(s): 2a764c7
restore avg column sticky and shadow after column visibility changes
Browse files- frontend/leaderboard.html +18 -31
frontend/leaderboard.html
CHANGED
|
@@ -191,37 +191,11 @@
|
|
| 191 |
z-index: 29 !important;
|
| 192 |
}
|
| 193 |
|
| 194 |
-
#table-wrapper table.gridjs-table thead th:nth-child(3) {
|
| 195 |
-
position: sticky !important;
|
| 196 |
-
left: var(--sticky-avg-left, 620px) !important;
|
| 197 |
-
top: 0 !important;
|
| 198 |
-
z-index: 44 !important;
|
| 199 |
-
background: #f1f5f9 !important;
|
| 200 |
-
box-shadow: 1px 0 0 rgba(148, 163, 184, 0.25);
|
| 201 |
-
}
|
| 202 |
-
|
| 203 |
-
#table-wrapper table.gridjs-table tbody td:nth-child(3) {
|
| 204 |
-
position: sticky !important;
|
| 205 |
-
left: var(--sticky-avg-left, 620px) !important;
|
| 206 |
-
z-index: 28 !important;
|
| 207 |
-
box-shadow: 1px 0 0 rgba(148, 163, 184, 0.25);
|
| 208 |
-
font-weight: 700 !important;
|
| 209 |
-
}
|
| 210 |
-
|
| 211 |
-
#table-wrapper table.gridjs-table tbody td:nth-child(3) * {
|
| 212 |
-
font-weight: 700 !important;
|
| 213 |
-
}
|
| 214 |
-
|
| 215 |
.dark #table-wrapper table.gridjs-table thead th:nth-child(1),
|
| 216 |
-
.dark #table-wrapper table.gridjs-table thead th:nth-child(2)
|
| 217 |
-
.dark #table-wrapper table.gridjs-table thead th:nth-child(3) {
|
| 218 |
background: #0f172a !important;
|
| 219 |
}
|
| 220 |
|
| 221 |
-
.dark #table-wrapper table.gridjs-table tbody td:nth-child(3) {
|
| 222 |
-
box-shadow: 1px 0 0 rgba(71, 85, 105, 0.6);
|
| 223 |
-
}
|
| 224 |
-
|
| 225 |
#table-wrapper .gridjs-th.avg-col-header,
|
| 226 |
#table-wrapper .gridjs-td.avg-col-header {
|
| 227 |
position: sticky !important;
|
|
@@ -1775,15 +1749,27 @@ window.toggleExpandText = function (idBase, btn) {
|
|
| 1775 |
const wrapper = $('#table-wrapper');
|
| 1776 |
const outer = $('#table-outer');
|
| 1777 |
if (!wrapper || !outer) return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1778 |
const th = wrapper.querySelector('th.avg-col-header');
|
| 1779 |
if (!th) return;
|
| 1780 |
|
| 1781 |
-
let highlight =
|
| 1782 |
if (!highlight) {
|
| 1783 |
highlight = document.createElement('div');
|
| 1784 |
highlight.id = 'avg-col-highlight';
|
| 1785 |
outer.appendChild(highlight);
|
| 1786 |
}
|
|
|
|
| 1787 |
|
| 1788 |
const outerRect = outer.getBoundingClientRect();
|
| 1789 |
const thRect = th.getBoundingClientRect();
|
|
@@ -1814,14 +1800,15 @@ window.toggleExpandText = function (idBase, btn) {
|
|
| 1814 |
}
|
| 1815 |
|
| 1816 |
function scheduleStickyApply(retries = 8) {
|
|
|
|
| 1817 |
let attempts = 0;
|
| 1818 |
const run = () => {
|
| 1819 |
const ok = applyStickyModelNameColumn();
|
| 1820 |
if (ok) {
|
| 1821 |
updateAvgColHighlight();
|
| 1822 |
-
// Re-run after layout settles to fix
|
| 1823 |
-
setTimeout(() => requestAnimationFrame(
|
| 1824 |
-
setTimeout(() => requestAnimationFrame(
|
| 1825 |
return;
|
| 1826 |
}
|
| 1827 |
if (attempts >= retries) return;
|
|
|
|
| 191 |
z-index: 29 !important;
|
| 192 |
}
|
| 193 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 194 |
.dark #table-wrapper table.gridjs-table thead th:nth-child(1),
|
| 195 |
+
.dark #table-wrapper table.gridjs-table thead th:nth-child(2) {
|
|
|
|
| 196 |
background: #0f172a !important;
|
| 197 |
}
|
| 198 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
#table-wrapper .gridjs-th.avg-col-header,
|
| 200 |
#table-wrapper .gridjs-td.avg-col-header {
|
| 201 |
position: sticky !important;
|
|
|
|
| 1749 |
const wrapper = $('#table-wrapper');
|
| 1750 |
const outer = $('#table-outer');
|
| 1751 |
if (!wrapper || !outer) return;
|
| 1752 |
+
|
| 1753 |
+
// Hide only when user has explicitly hidden the Average column.
|
| 1754 |
+
const avgColHidden = tableColumns.some(c => c.id && c.id.includes('Average') && c.hidden);
|
| 1755 |
+
const existing = $('#avg-col-highlight');
|
| 1756 |
+
if (avgColHidden) {
|
| 1757 |
+
if (existing) existing.style.display = 'none';
|
| 1758 |
+
return;
|
| 1759 |
+
}
|
| 1760 |
+
|
| 1761 |
+
// If DOM not ready yet (avg-col-header not applied), skip silently —
|
| 1762 |
+
// the 100ms/400ms retries in scheduleStickyApply will catch it.
|
| 1763 |
const th = wrapper.querySelector('th.avg-col-header');
|
| 1764 |
if (!th) return;
|
| 1765 |
|
| 1766 |
+
let highlight = existing;
|
| 1767 |
if (!highlight) {
|
| 1768 |
highlight = document.createElement('div');
|
| 1769 |
highlight.id = 'avg-col-highlight';
|
| 1770 |
outer.appendChild(highlight);
|
| 1771 |
}
|
| 1772 |
+
highlight.style.display = '';
|
| 1773 |
|
| 1774 |
const outerRect = outer.getBoundingClientRect();
|
| 1775 |
const thRect = th.getBoundingClientRect();
|
|
|
|
| 1800 |
}
|
| 1801 |
|
| 1802 |
function scheduleStickyApply(retries = 8) {
|
| 1803 |
+
const applyAll = () => { applyStickyModelNameColumn(); updateAvgColHighlight(); };
|
| 1804 |
let attempts = 0;
|
| 1805 |
const run = () => {
|
| 1806 |
const ok = applyStickyModelNameColumn();
|
| 1807 |
if (ok) {
|
| 1808 |
updateAvgColHighlight();
|
| 1809 |
+
// Re-run after layout settles to fix position after render
|
| 1810 |
+
setTimeout(() => requestAnimationFrame(applyAll), 100);
|
| 1811 |
+
setTimeout(() => requestAnimationFrame(applyAll), 400);
|
| 1812 |
return;
|
| 1813 |
}
|
| 1814 |
if (attempts >= retries) return;
|