Skip to content

Commit

Permalink
feat: show note scores
Browse files Browse the repository at this point in the history
  • Loading branch information
andylolz committed Jun 10, 2024
1 parent 8387146 commit 13c6865
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions output/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ Proposed [Twitter (X) community notes](https://x.com/i/communitynotes/download-d
}
}

const showScore = function (score) {
if (score === undefined) {
score = 0;
}
return ' <small>[' + score + ']</small>';
}

let table = new DataTable('#notes-table', {
layout: {
top2Start: 'search',
Expand Down Expand Up @@ -99,9 +106,9 @@ Proposed [Twitter (X) community notes](https://x.com/i/communitynotes/download-d
{
data: 'notes',
render: function (data, type, row, meta) {
let output = data[0]['summary'];
let output = data[0]['summary'] + showScore(data[0]['score']);
for (let i = 1; i < data.length; i++) {
output = output + '<br><hr>' + data[i]['summary'];
output = output + '<br><hr>' + data[i]['summary'] + showScore(data[i]['score']);
}
return output;
}
Expand Down

0 comments on commit 13c6865

Please sign in to comment.