Author

Topic: Sort by merit in the anniversary art contest? (Read 390 times)

legendary
Activity: 3290
Merit: 16489
Thick-Skinned Gang Leader and Golden Feather 2021
October 22, 2019, 01:59:34 PM
#5
Its probably best to filter by merit once the competition is closer to ending otherwise it would be unfair to anyone who is posting new art as their art would be towards the end of the pile.
I made a solution for that too, showing posts in random order: 10yearBitcointalk.tk/random.html.
The order of posts is changed at each (hourly) update.
legendary
Activity: 1232
Merit: 1080
Its probably best to filter by merit once the competition is closer to ending otherwise it would be unfair to anyone who is posting new art as their art would be towards the end of the pile. We still have close to a month for entries and I think the better ones will start getting posted closer towards that date because better art usually takes longer to make. 
legendary
Activity: 3290
Merit: 16489
Thick-Skinned Gang Leader and Golden Feather 2021
For users who don't want to install user scripts: see 10yearBitcointalk.tk, following iasenko's request, updated every hour.

Update: the site works, but you risk running into bitcointalk.org image proxy: Bandwidth limit exceeded problems.
legendary
Activity: 3024
Merit: 2148
Here you go, it adds a "sort by merit" button right before the "reply" button. Works well even on large threads, tried it with all posts from the anniversary art thread.

Code:
// ==UserScript==
// @name     Bitcointalk Sort By Merit
// @version  1.0
// @grant    none
// @include        https://bitcointalk.org/index.php?topic=*
// @run-at         document-end
// ==/UserScript==

const sortBtn = document.createElement("a")
sortBtn.href = "javascript:void(0)"
sortBtn.textContent = "sort by merit"

const threadButtons = document.querySelector("td.mirrortab_back")

threadButtons.prepend(document.createTextNode(" | "))
threadButtons.prepend(sortBtn)

sortBtn.addEventListener("click", sortByMerit)

function sortByMerit() {
    const table = document.querySelector("#bodyarea .bordercolor > tbody")
    const posts = [...table.rows]
        .map(post => {
            try {
                const merit = [...post.querySelectorAll(".td_headerandpost .smalltext i > a")]
                    .map(e => {
                        return parseInt(e.nextSibling.textContent.match(/\((.*)\)/)[1])
                    })
                    .reduce((acc, e) => acc + e, 0)

                return { merit, post }
            } catch (e) {
                console.error(e)
            }
        })
        .sort(({ merit: merit1 }, { merit: merit2 }) => merit2 - merit1)

    posts.forEach(({ post, merit }) => {
        try {
            table.append(post)
        } catch (e) {}
    })
}

legendary
Activity: 2240
Merit: 3150
₿uy / $ell ..oeleo ;(
I think this thread is perfect for implementation of "sort by merited posts" feature. It is a fast growing one and attract a lot of interest.
I tried using Top-merited recent replies but it's not responsible anymore. Sad
Jump to: