Spaces:
Running
Running
From title attribute to model_title and :hover
Browse files
app.py
CHANGED
@@ -397,6 +397,18 @@ tr.row_odd {
|
|
397 |
font-weight: bolder;
|
398 |
}
|
399 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
400 |
"""
|
401 |
|
402 |
custom_js = """
|
@@ -413,15 +425,15 @@ function addTitleForEachCellOfLeaderboardTable(){
|
|
413 |
// Get the value of the title attribute from the first link
|
414 |
const titleText = firstCellLink.getAttribute('title');
|
415 |
|
416 |
-
// Set the
|
417 |
-
row.querySelectorAll('td').forEach(
|
418 |
-
// If the cell already has a
|
419 |
-
if (cell.hasAttribute('
|
420 |
return; // Exit the current iteration for this row
|
421 |
}
|
422 |
|
423 |
-
// Set the
|
424 |
-
cell.setAttribute('
|
425 |
});
|
426 |
}
|
427 |
});
|
|
|
397 |
font-weight: bolder;
|
398 |
}
|
399 |
|
400 |
+
.leaderboard-table td[model_title]:hover::after, .leaderboard-table-model-details td[model_title]:hover::after {
|
401 |
+
content: attr(model_title);
|
402 |
+
position: absolute;
|
403 |
+
background-color: rgba(50, 50, 50, 0.9);
|
404 |
+
color: white;
|
405 |
+
padding: 5px;
|
406 |
+
border-radius: 5px;
|
407 |
+
white-space: nowrap;
|
408 |
+
z-index: 10;
|
409 |
+
pointer-events: none;
|
410 |
+
}
|
411 |
+
|
412 |
"""
|
413 |
|
414 |
custom_js = """
|
|
|
425 |
// Get the value of the title attribute from the first link
|
426 |
const titleText = firstCellLink.getAttribute('title');
|
427 |
|
428 |
+
// Set the model_title attribute for all cells in the row
|
429 |
+
row.querySelectorAll('td').forEach(cell => {
|
430 |
+
// If the cell already has a model_title attribute, break the loop
|
431 |
+
if (cell.hasAttribute('model_title')) {
|
432 |
return; // Exit the current iteration for this row
|
433 |
}
|
434 |
|
435 |
+
// Set the model_title attribute permanently
|
436 |
+
cell.setAttribute('model_title', titleText);
|
437 |
});
|
438 |
}
|
439 |
});
|