Bitcoin Forum
February 21, 2020, 01:23:17 PM *
News: Latest Bitcoin Core release: 0.19.0.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Sort by merit in the anniversary art contest?  (Read 267 times)
iasenko
Hero Member
*****
Online Online

Activity: 840
Merit: 1652


https://bpip.org. The place for the forum stats :)


View Profile WWW
October 22, 2019, 04:56:07 AM
Last edit: October 22, 2019, 05:06:27 AM by iasenko
 #1

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

Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1582291397
Hero Member
*
Offline Offline

Posts: 1582291397

View Profile Personal Message (Offline)

Ignore
1582291397
Reply with quote  #2

1582291397
Report to moderator
1582291397
Hero Member
*
Offline Offline

Posts: 1582291397

View Profile Personal Message (Offline)

Ignore
1582291397
Reply with quote  #2

1582291397
Report to moderator
1582291397
Hero Member
*
Offline Offline

Posts: 1582291397

View Profile Personal Message (Offline)

Ignore
1582291397
Reply with quote  #2

1582291397
Report to moderator
hatshepsut93
Legendary
*
Online Online

Activity: 1428
Merit: 1119


( ͡° ͜ʖ ͡°)


View Profile
October 22, 2019, 08:07:31 AM
Merited by Welsh (4), hugeblack (3), Halab (2), stompix (1), Xal0lex (1), o_e_l_e_o (1), iasenko (1), DdmrDdmr (1)
 #2

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) {}
    })
}


LoyceV
Legendary
*
Offline Offline

Activity: 1764
Merit: 5802


Thick-Skinned Gang Leader


View Profile WWW
October 22, 2019, 09:02:46 AM
Last edit: October 22, 2019, 07:05:52 PM by LoyceV
Merited by malevolent (2), stompix (1), Kalemder (1), iasenko (1)
 #3

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.

AverageGlabella
Hero Member
*****
Offline Offline

Activity: 487
Merit: 643



View Profile
October 22, 2019, 09:27:32 AM
Merited by suchmoon (4), Welsh (2), malevolent (1), LoyceV (1), DdmrDdmr (1)
 #4

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. 
LoyceV
Legendary
*
Offline Offline

Activity: 1764
Merit: 5802


Thick-Skinned Gang Leader


View Profile WWW
October 22, 2019, 06:59:34 PM
Merited by lucky80 (1)
 #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.

Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!