Skip to content

Commit

Permalink
Deploying to gh-pages from @ 639b66e 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
andylolz committed May 10, 2024
0 parents commit 084d4ef
Show file tree
Hide file tree
Showing 7 changed files with 161 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
47 changes: 47 additions & 0 deletions _layouts/default.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!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" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<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.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.

82 changes: 82 additions & 0 deletions index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
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;
}
return '<blockquote class="twitter-tweet">' + (row['tweet'] ? row['tweet'] : '') + '<a href="https://twitter.com/_/status/' + data + '"></a></blockquote>';
}
},
{
data: 'summary',
},
{
data: 'reasons'
},
{
data: 'tweet',
searchable: true,
visible: false,
defaultContent: ''
}
],
drawCallback: function (settings) {
twttr.widgets.load();
}
});
</script>

0 comments on commit 084d4ef

Please sign in to comment.