Post
Topic
Board Meta
Merits 26 from 9 users
Re: List of Bitcointalk.org Userscripts/ Add-ons
by
hatshepsut93
on 25/08/2019, 16:41:15 UTC
⭐ Merited by LoyceV (10) ,vapourminer (5) ,Xal0lex (2) ,bones261 (2) ,xandry (2) ,Welsh (2) ,ETFbitcoin (1) ,hd49728 (1) ,mrvuit (1)
I don't know if it was done before, couldn't find anything like that, so I made a tiny script that sums all mertis of a post and displays it before individual merits

Like this:


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

;[...document.querySelectorAll(".td_headerandpost")].forEach(post => {
    try {
        let sum = [...post.querySelectorAll(".smalltext i > a")]
            .map(e => {
                return parseInt(e.nextSibling.textContent.match(/\((.*)\)/)[1])
            })
            .reduce((acc, e) => acc + e, 0)
        if (sum > 0) {
            let sumElement = document.createElement("span")
            sumElement.textContent = `Total merit: ${sum} | `
            post.querySelector(".smalltext i").prepend(sumElement)
        }
    } catch (e) {
        console.error(e)
    }
})