Skip to content

Commit

Permalink
Deploying to gh-pages from @ 404ad23 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
andylolz committed May 11, 2024
0 parents commit 378497c
Show file tree
Hide file tree
Showing 8 changed files with 170 additions and 0 deletions.
8 changes: 8 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
defaults:
-
scope:
path: ""
values:
layout: "default"

baseurl: "/x-community-notes"
1 change: 1 addition & 0 deletions _data/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.gitkeep
1 change: 1 addition & 0 deletions _data/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"scraped_at": "2024-05-11T08:16:45.971714+00:00", "most_recent": "2024-05-09T00:31:52+00:00"}
48 changes: 48 additions & 0 deletions _layouts/default.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ page.title }}</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.5/datatables.min.css">
<style type="text/css">
td {
word-break: break-word;
}
time {
cursor: help;
text-decoration: underline;
text-decoration-style: dotted;
}
.dt-type-numeric {
text-align: left !important;
}
</style>
</head>
<body>
<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.5/datatables.min.js"></script>

<div class="container py-3">
<header class="d-flex flex-wrap justify-content-end py-3 mb-4 border-bottom">
<ul class="nav nav-pills">
<li class="nav-item">
<a class="nav-link{% if page.url == '/' %} active{% endif %}" href="{{ '/' | relative_url }}">Home</a>
</li>
<li class="nav-item">
<a class="nav-link{% if page.url == '/about/' %} active{% endif %}" href="{{ '/about/' | relative_url }}">About</a>
</li>
</ul>
</header>

<main>
<h1>{{ page.title }}</h1>

{{ content }}
</main>
</div>
</body>
</html>
21 changes: 21 additions & 0 deletions about/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
title: How it works
---

Community note data is fetched regularly [from Twitter](https://twitter.com/i/communitynotes/download-data).

This data is always a couple of days old (**most recent data is from <time class="dt" datetime="{{ site.data.meta.most_recent }}" title="{{ site.data.meta.most_recent | date_to_rfc822 }}">{{ site.data.meta.most_recent }}</time>, scraped <time class="dt" datetime="{{ site.data.meta.scraped_at }}" title="{{ site.data.meta.scraped_at | date_to_rfc822 }}">{{ site.data.meta.scraped_at }}</time>**).

Notes are excluded if they meet any of the following criteria:

* Created more than a week ago
* Classifying the post as ‘not misleading’ (i.e. in support of the post)
* Currently rated ‘unhelpful’

<script>
const dts = document.getElementsByClassName('dt');
for (var i = 0; i < dts.length; i++) {
var dt = dts[i];
dt.textContent = luxon.DateTime.fromISO(dt.textContent).toRelative();
}
</script>
1 change: 1 addition & 0 deletions data/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.gitkeep
1 change: 1 addition & 0 deletions data/notes.json

Large diffs are not rendered by default.

89 changes: 89 additions & 0 deletions index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
---
title: Twitter community notes
---

Proposed [Twitter community notes](https://twitter.com/i/communitynotes/download-data) from the last week, updated regularly. _[More…]({{ '/about/' | relative_url }})_

<div class="table-responsive">
<table class="table table-striped" data-order='[[ 0, "desc" ]]'>
<thead>
<tr>
<th>Note created</th>
<th>Note shown</th>
<th>Tweet</th>
<th>Note</th>
<th>Reasons</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>

<script>
let table = new DataTable('table', {
ajax: {
url: '{{ '/data/notes.json' | relative_url }}',
"dataSrc": function ( data ) {
return data.filter(function(item) {
return (item.lang === undefined || item.lang === "en");
});
}
},
columns: [
{
data: 'created_at', render: function (data, type, row, meta) {
if (type !== 'display') {
return data;
}
return '<a href="https://twitter.com/i/birdwatch/t/' + row['tweet_id'] + '" target="_blank">' + luxon.DateTime.fromISO(data).toFormat('d MMM yyyy') + '</a>';
}
},
{
data: 'shown', defaultContent: '', render: function (data, type, row, meta) {
if (data === undefined) {
return '';
}
if (type !== 'display') {
return data;
}
content = luxon.DateTime.fromISO(data).toFormat('d MMM yyyy')
if (row['removed']) {
content += ' (since removed)';
}
return content;
}
},
{
data: 'tweet_id', width: '550px', render: function (data, type, row, meta) {
if (type !== 'display') {
return data;
}
content = row['tweet'] ? row['tweet'] : '';
return '<blockquote class="twitter-tweet">' + content + '<a href="https://twitter.com/_/status/' + data + '"></a></blockquote>';
}
},
{
data: 'summary',
},
{
data: 'reasons'
},
{
data: 'user',
searchable: true,
visible: false,
defaultContent: ''
},
{
data: 'tweet',
searchable: true,
visible: false,
defaultContent: ''
}
],
drawCallback: function (settings) {
twttr.widgets.load();
}
});
</script>

0 comments on commit 378497c

Please sign in to comment.