feat: Add live search functionality to leaderboard tables

This commit is contained in:
Paul Gauthier (aider) 2024-11-21 10:21:39 -08:00
parent 6f4ed00105
commit d7248b11e5

View file

@ -31,6 +31,10 @@ This measures the LLM's coding ability, and whether it can
write new code that integrates into existing code.
The model also has to successfully apply all its changes to the source file without human intervention.
<input type="text" id="editSearchInput" placeholder="Search..." style="width: 100%; max-width: 800px; margin: 10px auto; padding: 8px; display: block; border: 1px solid #ddd; border-radius: 4px;">
<input type="text" id="refacSearchInput" placeholder="Search..." style="width: 100%; max-width: 800px; margin: 10px auto; padding: 8px; display: block; border: 1px solid #ddd; border-radius: 4px;">
<table style="width: 100%; max-width: 800px; margin: auto; border-collapse: collapse; box-shadow: 0 2px 4px rgba(0,0,0,0.1); font-size: 14px;">
<thead style="background-color: #f2f2f2;">
<tr>
@ -132,6 +136,42 @@ The model also has to successfully apply all its changes to the source file with
});
updateChart();
// Add search functionality for edit table
document.getElementById('editSearchInput').addEventListener('keyup', function() {
var searchText = this.value.toLowerCase();
var tableBody = document.querySelector('table:first-of-type tbody');
var rows = tableBody.getElementsByTagName('tr');
for (var i = 0; i < rows.length; i++) {
var rowText = rows[i].textContent.toLowerCase();
if (rowText.includes(searchText)) {
rows[i].style.display = '';
} else {
rows[i].style.display = 'none';
}
}
updateChart();
});
});
</script>
<script>
document.addEventListener('DOMContentLoaded', function () {
// Add search functionality for refactoring table
document.getElementById('refacSearchInput').addEventListener('keyup', function() {
var searchText = this.value.toLowerCase();
var tableBody = document.querySelector('table:nth-of-type(2) tbody');
var rows = tableBody.getElementsByTagName('tr');
for (var i = 0; i < rows.length; i++) {
var rowText = rows[i].textContent.toLowerCase();
if (rowText.includes(searchText)) {
rows[i].style.display = '';
} else {
rows[i].style.display = 'none';
}
}
updateChart();
});
});
</script>
<style>