Anonymous ID: e05bf5 Aug. 5, 2018, 1:04 p.m. No.2467707   🗄️.is 🔗kun   >>7775 >>7892 >>7938 >>7994

I am shamelessly reposting my code to move the most answered posts in a full thread to the top. It makes it easier to read up on old threads. To use it, enter a number of required answers for each post, and push the button.

 

Put the code in Options -User JS.

 

It's the last time i will repost this.

 

let requiredAnswers = 3; //Change this value if neededlet numberOfPosts = $('.post').length;let thread = document.getElementsByClassName("thread")[0];let done = false;let warning = false;let buttonInput = document.createElement("div");if (active_page == 'thread') { buttonInput.id = "buttonInput"; buttonInput.innerHTML = "<br<input type='button' id='button' value='Get most answered posts' onclick='prependMostAnswered()'><input id='inputField' type='textfield' value='" + requiredAnswers + "'>"; thread.parentNode.insertBefore(buttonInput, thread);}function prependMostAnswered() { numberOfPosts = $('.post').length; if (done) { return; } if (numberOfPosts > 750) { if (document.getElementById("warning") != null) { document.getElementById("warning").innerHTML = ""; } var br = document.createElement("br"); thread.parentNode.insertBefore(br, thread); let numberOfAnswers = inputField.value; for (let i = 0; i < document.getElementsByClassName("post").length; i++) { let post = document.getElementsByClassName("post")[i]; let answers = post.childNodes[0].childNodes[10]; if (answers !== undefined && answers.childElementCount >= numberOfAnswers) { post.style.backgroundColor = '#FFFCEE'; thread.parentNode.insertBefore(post, thread); var br = document.createElement("br"); thread.parentNode.insertBefore(br, thread); } } document.getElementById("buttonInput").innerHTML = ""; done = true; } else { document.getElementById("button").value = "Wait for " + (750 - numberOfPosts) + " new posts."; if (!warning) { var text = document.createElement("div"); text.id = "warning"; text.innerHTML = "<br> Thread is not full, the code only works for finshed threads."; thread.parentNode.insertBefore(text, thread); warning = true; } } }

Anonymous ID: e05bf5 Aug. 5, 2018, 1:19 p.m. No.2467923   🗄️.is 🔗kun

>>2467832

It's great that you found it useful. I tried to copy all the posts, so that it would be possible to run it before the thread is full, but I guess there are too many links and it crashed all the time.