Bugfix (no replies!)

This commit is contained in:
Andreas Grasser 2022-11-19 21:39:18 +01:00
parent 04a48d5ba7
commit 33fbcc1dae

View file

@ -17,7 +17,6 @@ function circle_main() {
let mastodon_handle = document.getElementById("txt_mastodon_handle").value; let mastodon_handle = document.getElementById("txt_mastodon_handle").value;
userInfo = formatedUserHandle(mastodon_handle); userInfo = formatedUserHandle(mastodon_handle);
getStatuses(); getStatuses();
//setTimeout(showConnections,3000);
} }
// Format the Mastodon Handle to an array: [username, userID, instance.tld] // Format the Mastodon Handle to an array: [username, userID, instance.tld]
@ -44,7 +43,7 @@ function getIdFromName(name, server) {
// Get a JSON String with all the posted statuses from the account and call processStatuses() // Get a JSON String with all the posted statuses from the account and call processStatuses()
async function getStatuses() { async function getStatuses() {
// Build the URL // Build the URL
let url = "https://"+userInfo[2]+"/api/v1/accounts/"+userInfo[1]+"/statuses"; let url = "https://"+userInfo[2]+"/api/v1/accounts/"+userInfo[1]+"/statuses?exclude_replies=true";
// Do the async http request and call processStatuses() // Do the async http request and call processStatuses()
httpRequest(url, processStatuses); httpRequest(url, processStatuses);
} }
@ -53,10 +52,11 @@ async function getStatuses() {
function processStatuses(statuses) { function processStatuses(statuses) {
jsonStat = JSON.parse(statuses); jsonStat = JSON.parse(statuses);
let request_limit = 30; let request_limit = 50;
for (var i=0; i<jsonStat.length; i++) { for (var i=0; i<jsonStat.length; i++) {
if (!jsonStat[i]["reblog"]) { if (!jsonStat[i]["reblog"]) {
console.log(jsonStat[i]["content"]);
evaluateStatus(jsonStat[i]["id"], (jsonStat[i]["favourites_count"]>0), (jsonStat[i]["reblogs_count"]>0)); evaluateStatus(jsonStat[i]["id"], (jsonStat[i]["favourites_count"]>0), (jsonStat[i]["reblogs_count"]>0));
request_limit--; request_limit--;
if (request_limit<0) break; if (request_limit<0) break;