Anonymous ID: 0c7d2f July 31, 2018, 12:15 p.m. No.2373990   🗄️.is 🔗kun   >>4011 >>4017

Attention fellow workfags.

 

I have made a Javascript snippet to place in Options -User JS to find all posts with more than a given number of replies. It works like this:

 

You enter a number of wanted replies, and the button moves all posts with a higher number of replies to the top of the thread. This makes it a little easier to read up on all the unread threads after work. Enjoy.

 

let thread = document.getElementsByClassName("thread")[0];var button = document.createElement("input");button.type = "button";button.value = "Get most answered posts";button.onclick = prependMostRead;var inputField = document.createElement("input");inputField.type = "textfield";inputField.value = 4;thread.parentNode.insertBefore(button, thread);thread.parentNode.insertBefore(inputField, thread);function prependMostRead() { 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); } } }