diff --git a/static/script.js b/static/script.js index 76c47cf..30289b2 100644 --- a/static/script.js +++ b/static/script.js @@ -35,7 +35,9 @@ const redditInit = { loadPage() async function loadPage() { + loadingImage.src = loadingImageSrc + loadingImage.style.display = "block" setLoadingText("Loading thread...") // Get thread from reddit and all comment IDs (inc. removed ones) from pushshift @@ -139,6 +141,15 @@ function extractMorechildrenIDs(comments) { async function getRemovedComments(allCommentIDs) { const idsDiff = allCommentIDs.filter(x => !commentIDs.includes(x)) + + commentIDs.forEach(id => { + if(commentLookup.has(id)) { + if(commentLookup.get(id).body === "[removed]") { + idsDiff.push(id) + } + } + }) + generateCommentInfo(idsDiff.length) console.log("All ids :", allCommentIDs) console.log("Comments ids (dup): ", commentIDs) @@ -200,7 +211,7 @@ async function getCommentsToGenerate(commentsToLookup) { if(commentsToFetch.length !== 0) { //await - console.log("fuck it") + console.error("fuck it, ill fix it later") } if(newCommentsToLookup.length !== 0) { @@ -272,31 +283,17 @@ function generateThread(data) { mainDiv.appendChild(threadDiv) } function createComment(comment) { - /*const comment_div = document.createElement("div") - comment_div.id = comment.id - comment_div.className = "comment comment-" + (comment.hasOwnProperty("removed") ? "removed" : (comment.depth % 2 == 0 ? "even" : "odd")); - comment_div.innerHTML = ` -
[likely removed by automoderator]
" : markdown.render(comment.body)}
diff --git a/templates/header.html b/templates/header.html
index 7be3867..d56abfe 100644
--- a/templates/header.html
+++ b/templates/header.html
@@ -11,8 +11,8 @@
Loading...Removeddit [beta]
+
+