Skip to content

Commit

Permalink
feat: add filters for language and deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
andylolz committed May 15, 2024
1 parent 0de4125 commit 7eea584
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 15 deletions.
4 changes: 2 additions & 2 deletions output/_layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ page.title }}{% if page.url != '/' %} | {{ site.title }}{% endif %}</title>
<link href="//cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="//cdn.datatables.net/v/bs5/jq-3.7.0/dt-2.0.7/fh-4.0.1/datatables.min.css">
<link rel="stylesheet" href="//cdn.datatables.net/v/bs5/jq-3.7.0/dt-2.0.7/fh-4.0.1/sp-2.3.1/sl-2.0.1/datatables.min.css">
<style type="text/css">
td {
word-break: break-word;
Expand All @@ -24,7 +24,7 @@
<script src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/luxon/2.3.1/luxon.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<script src="//cdn.datatables.net/v/bs5/jq-3.7.0/dt-2.0.7/fh-4.0.1/datatables.min.js"></script>
<script src="//cdn.datatables.net/v/bs5/jq-3.7.0/dt-2.0.7/fh-4.0.1/sp-2.3.1/sl-2.0.1/datatables.min.js"></script>

<div class="container py-3">
<header class="d-flex flex-wrap justify-content-end py-3 mb-4 border-bottom">
Expand Down
62 changes: 49 additions & 13 deletions output/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Proposed [Twitter community notes](https://twitter.com/i/communitynotes/download
<th>Tweet</th>
<th>Note</th>
<th>Reasons</th>
<th>Tweet language</th>
<th>Deleted</th>
<th>Username</th>
<th>Tweet content</th>
</tr>
Expand All @@ -25,22 +27,17 @@ Proposed [Twitter community notes](https://twitter.com/i/communitynotes/download
<script>
let table = new DataTable('table', {
layout: {
topStart: 'search',
top2Start: 'search',
top: 'searchPanes',
topStart: 'info',
topEnd: 'paging',
bottomStart: 'info',
bottom2Start: 'pageLength'
},
fixedHeader: true,
ajax: {
url: '{{ '/data/notes.json' | relative_url }}',
dataSrc: function ( data ) {
return data.filter(function(item) {
if (item.deleted === 1) {
return false;
}
return (item.lang === undefined || ['en', 'zxx'].includes(item.lang));
});
}
dataSrc: ''
},
columns: [
{
Expand All @@ -66,7 +63,10 @@ Proposed [Twitter community notes](https://twitter.com/i/communitynotes/download
}
return content;
},
searchable: false
searchable: false,
searchPanes: {
show: false
}
},
{
data: 'tweet_id', width: '550px', render: function (data, type, row, meta) {
Expand All @@ -78,16 +78,38 @@ Proposed [Twitter community notes](https://twitter.com/i/communitynotes/download
}
},
{
data: 'summary',
data: 'summary'
},
{
data: 'reasons',
searchPanes: {
show: false
}
},
{
data: 'lang',
visible: false,
defaultContent: '',
searchPanes: {
emptyMessage: 'Unknown (deleted tweet)'
}
},
{
data: 'reasons'
data: 'deleted',
visible: false,
defaultContent: 0,
searchPanes: {
show: true
}
},
{
data: 'user',
searchable: true,
visible: false,
defaultContent: ''
defaultContent: '',
searchPanes: {
show: false
}
},
{
data: 'tweet',
Expand All @@ -98,6 +120,20 @@ Proposed [Twitter community notes](https://twitter.com/i/communitynotes/download
],
drawCallback: function (settings) {
twttr.widgets.load();
},
searchPanes: {
orderable: false,
preSelect: [
{
column: 5,
rows: ['en', 'zxx']
},
{
column: 6,
rows: [0]
},
],
initCollapsed: true
}
});

Expand Down

0 comments on commit 7eea584

Please sign in to comment.