After not getting very much direction on how to fix the unread posts functionality, we fixed our using an in-house script. It only runs on search pages, only shows unread topics, and once read, the topics go away. Oh yeah, and it organizes the threads by last response...Kind of like vBulletin 4.
I'm sure there are better or more efficient ways of doing it, but this only took us an hour or two from scratch, and it seems to work just fine, and hopefully it helps someone else out who is struggling with some of the quirks of vB5.
Code:
function getDate (thread) { var postdate = thread.getElementsByClassName("post-date")[0].innerHTML, dateRegex = /(\d\d)-(\d\d)-(\d\d\d\d), (\d\d):(\d\d)/, dateArray = postdate.match (dateRegex), threadDate = new Date (dateArray[3], dateArray[1], dateArray[2], dateArray[4], dateArray[5], 0); return threadDate; } var match = /search/.test(location.pathname); if (match) { var threads = document.getElementsByClassName("topic-item"); var threadsArray = Array.prototype.slice.call(threads); threadsArray.sort (function (a, b) { var aDate = getDate(a), bDate = getDate(b); return (aDate - bDate); }).reverse (); table = document.getElementsByClassName ("topic-list")[0]; threadsArray.forEach (function (thread) { if (thread.className.match (/read/)) { thread.style.display = "none"; } table.appendChild (thread); }); threadsArray = null; }
Comment