Update Redditlikekerfuffle.HTML

This commit is contained in:
Dangrainage 2023-11-26 22:09:28 +01:00 committed by GitHub
parent bf6c479d06
commit 29e128f1ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,19 +3,18 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bitt</title> <title>Anonymous Twitter</title>
<h1>Use this as you would Twitter, oh, sorry X</h1>
</head> </head>
<body> <body>
<div> <div>
<h2>Post a Bitt</h2> <h2>Post a Tweet</h2>
<textarea id="tweetInput" rows="4" cols="50"></textarea> <textarea id="tweetInput" rows="4" cols="50"></textarea>
<br> <br>
<button onclick="postTweet()">Post</button> <button onclick="postTweet()">Post</button>
</div> </div>
<div> <div>
<h2>Bitters</h2> <h2>Tweets</h2>
<ul id="tweetList"></ul> <ul id="tweetList"></ul>
</div> </div>
@ -31,7 +30,10 @@
function fetchTweets() { function fetchTweets() {
fetch(githubApiUrl) fetch(githubApiUrl)
.then(response => response.json()) .then(response => response.json())
.then(files => { .then(responseData => {
// Check if responseData is an array
const files = Array.isArray(responseData) ? responseData : [];
const tweetFiles = files const tweetFiles = files
.filter(file => file.name.endsWith('.json')) .filter(file => file.name.endsWith('.json'))
.sort((a, b) => b.name.localeCompare(a.name)); // Sort by filename in descending order .sort((a, b) => b.name.localeCompare(a.name)); // Sort by filename in descending order