diff --git a/JS/index.js b/JS/index.js index 94a2da2..167fb9c 100644 --- a/JS/index.js +++ b/JS/index.js @@ -213,6 +213,8 @@ async function PosterContainerUpdate(Direction) { // Begin by having the website we are using get pushed to the expanded view array and clean out the HTML. WebsiteAPIType.push("Mastodon"); i.getElementsByClassName("PostContent")[0].innerHTML = ""; + i.getElementsByClassName("Username")[0].innerHTML = ""; + // Public stuff if (MastodonLoadedFeed[CurrentThing + counter + 1] == undefined) { let TempFeed; if (Discover == true) { @@ -227,15 +229,17 @@ async function PosterContainerUpdate(Direction) { MastodonLoadedFeed = await MastodonLoadedFeed.concat(TempFeed); } // put the reblog into the regular post; Make changes as necessary. - if (MastodonLoadedFeed[CurrentThing + counter].reblog != null) { - i.getElementsByClassName("Username")[0].innerHTML = MastodonLoadedFeed[CurrentThing + counter].reblog.account.username + " ( R: " + MastodonLoadedFeed[CurrentThing + counter].account.username + " )"; + if (MastodonLoadedFeed[CurrentThing + counter].reblog != null && typeof MastodonLoadedFeed[CurrentThing + counter].reblog != "string") { // Fix a reblog issue. let ReblogFix = MastodonLoadedFeed[CurrentThing + counter].account.username; MastodonLoadedFeed[CurrentThing + counter] = MastodonLoadedFeed[CurrentThing + counter].reblog; MastodonLoadedFeed[CurrentThing + counter].reblog = ReblogFix; - } else { - i.getElementsByClassName("Username")[0].innerHTML = MastodonLoadedFeed[CurrentThing + counter].account.username + i.getElementsByClassName("Username")[0].innerHTML = " ( R: " + MastodonLoadedFeed[CurrentThing + counter].reblog + " )"; + } else if (MastodonLoadedFeed[CurrentThing + counter].reblog != null && typeof MastodonLoadedFeed[CurrentThing + counter].reblog == "string") { + // this function is if the changes are already made. + i.getElementsByClassName("Username")[0].innerHTML = " ( R: " + MastodonLoadedFeed[CurrentThing + counter].reblog + " )"; } + i.getElementsByClassName("Username")[0].innerHTML = MastodonLoadedFeed[CurrentThing + counter].account.username + i.getElementsByClassName("Username")[0].innerHTML // Check for images. if (MastodonLoadedFeed[CurrentThing + counter].media_attachments.length != 0) { if (MastodonLoadedFeed[CurrentThing + counter].media_attachments[0].type == "image") {