Bitcoin Forum

Other => Meta => Topic started by: hd49728 on August 26, 2019, 04:16:18 AM



Title: @theymos. Can you integrate these userscripts to forum?
Post by: hd49728 on August 26, 2019, 04:16:18 AM
Began from that thread: @small improvement request. In merited posts, show your name in red or bold or.. (https://bitcointalk.org/index.php?topic=5176834.0)
hatshepsut93  made two userscripts for forum users. They are all great, but there are not too many users have technical skills to use userscripts, they are not coders. I think if it does not result in issues for forum, and does not take too much time, it will be great if you spend a little precious time to add them for forum users. Non-coders will be happy if forum integrates those features.
- Displays of total received merits for posts/ threads.
- Displays of username (logged-in account), if they sent already sent merit(s), at 1st position in list of merit senders for posts/ threads.
TopicDatewritten bySectionMerit
___________________________________________________________________________________________________________________________
Sum and display total received merits of posts/ threads (https://bitcointalk.org/index.php?topic=5148488.msg52264117#msg52264117)25/8/2019hatshepsut93sums & displays all mertis of a post7+
Display username at 1st position in list of merit senders of posts/threads (https://bitcointalk.org/index.php?topic=5176834.msg52267547#msg52267547)26/8/2019hatshepsut93sums & displays all mertis of a post1+

Display username at 1st position in list of merit senders of posts/threads
Strange that no one has made it yet, here's a script for this:

Code:
// ==UserScript==
// @name     Bitcointalk Highlight My Name in Merit
// @version  1.0
// @grant    none
// @include        https://bitcointalk.org/index.php?topic=*
// @run-at         document-end
// ==/UserScript==
;[...document.querySelectorAll(".td_headerandpost")].forEach(post => {
    let myName = document.querySelector("#hellomember b").textContent
    let allMerits = [...post.querySelectorAll(".smalltext i > a")]
    let myMerit = allMerits.find(e => e.textContent === myName)
    if (myMerit) {
        myMerit.style["font-weight"] = 1000
        if (allMerits.indexOf(myMerit) !== 0) {
            let myScore = myMerit.nextSibling
            post.querySelector(".smalltext i").removeChild(myMerit)
            post.querySelector(".smalltext i").removeChild(myScore)
            allMerits[0].before(myScore)
            myScore.before(myMerit)
        }
    }
})


Screenshot:

https://i.imgur.com/jP5yJyd.png

Also check my related userscript that sums all merits of a post -> https://bitcointalk.org/index.php?topic=5148488.msg52264117#msg52264117

Sum and display total received merits of posts/ threads
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:
https://i.imgur.com/uKHHbTp.png

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



Title: Re: @theymos. Can you add these userscripts to forum?
Post by: LoyceMobile on August 26, 2019, 04:42:31 AM
The whole idea about userscripts is that Admin doesn't have to do anything.


Title: Re: @theymos. Can you add these userscripts to forum?
Post by: akhjob on August 26, 2019, 10:42:54 AM
~skip~
Non-coders will be happy if forum integrates those features.
~skip~

OP, you don't have to be a coder to use an userscript, even non-coders can use them too. All they need is greasemonkey (firefox) (https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/), or tampermonkey (chrome) (https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo)  installed and copy-paste the code to get the desired output.

The whole idea about userscripts is that Admin doesn't have to do anything.

@LoyceV, meriting/agreeing to the OP from trusted device but disagreeing from non-trusted device  ??? Strange that I agree with the non-trusted one.


Title: Re: @theymos. Can you add these userscripts to forum?
Post by: o_e_l_e_o on August 26, 2019, 11:33:12 AM
Meriting a post does not necessarily imply agreement.


Title: Re: @theymos. Can you integrate these userscripts to forum?
Post by: hatshepsut93 on August 26, 2019, 12:33:36 PM
I don't think any userscripts should be integrated with forum, if you mean copying their code and inserting it into pages. Userscripts aren't very efficient, all this DOM manipulation can get pretty slow to the point where users will start to notice it. And some users might view this forum with Javascript turned off. It's just some of the reasons why stuff like that should generally be handled on server.

Meanwhile, we users can just unite all scripts into one addon, and this process has already started [ur=https://bitcointalk.org/index.php?topic=5178297.0l]here[/url].


Title: Re: @theymos. Can you integrate these userscripts to forum?
Post by: hugeblack on August 26, 2019, 06:04:33 PM
I don't think everyone will agree that these improvements will be a real addition to the forum if implemented.
There are a lot of things that should be added to this forum, but what makes them on top of @theymos's  "What to Do" list is what matters.

I'm happy with some userscripts that make life easier. 8)


Title: Re: @theymos. Can you add these userscripts to forum?
Post by: Coyster on August 26, 2019, 06:17:30 PM
@LoyceV, meriting/agreeing to the OP from trusted device but disagreeing from non-trusted device  ??? Strange that I agree with the non-trusted one.
Meriting a post does not necessarily imply agreement.
Correct.
Effort and thought put into a post can make a user merit such post, even if the meriter feels the content of the OP is not 100% correct nor is he or she in absolute agreement, though agreement in most situations is the determinant factor.


Title: Re: @theymos. Can you integrate these userscripts to forum?
Post by: Initscri on August 26, 2019, 08:00:47 PM
The whole idea about userscripts is that Admin doesn't have to do anything.

+1, w/ the amount of mods available (and which are going to be avail to the forum), there's absolutely 0 point in Theymos implementing. If people want them, they should pick & choose themselves.

There is a post compiling a list of them, but I'll be looking into a way to make this a lot more easier.


Title: Re: @theymos. Can you integrate these userscripts to forum?
Post by: hd49728 on August 27, 2019, 01:53:15 AM
There is a post compiling a list of them, but I'll be looking into a way to make this a lot more easier.
Not sure, but maybe you implied about my list
List of Bitcointalk.org Userscripts/ Add-ons (https://bitcointalk.org/index.php?topic=5148488.0)
Fortunately, @mrvuit made this one, and continuously upgraded it. It will be more convenient if that extension expands to other browsers, like Firefox, Brave, because some people don't want to use Chrome.
Bitcointalk Extension - All In One - Available on Chrome store - Version 2.3 (https://bitcointalk.org/index.php?topic=5178297.0)


Title: Re: @theymos. Can you integrate these userscripts to forum?
Post by: bob123 on August 27, 2019, 08:37:03 AM
I don't think it is necessary for them to be integrated into the forum. Everyone can install them, if needed.


hatshepsut93  made two userscripts for forum users. They are all great, but there are not too many users have technical skills to use userscripts, they are not coders.


It takes roughly 1 minute (15 seconds if you have greasemonkey installed already) to activate such a script.

1. Download greasemonkey
2. Copy the script
3. Click on the greasemonkey button -> new user script
4. Paste the script
5. Profit

You don't need to be a coder or techsavy at all to install these scripts.


Title: Re: @theymos. Can you add these userscripts to forum?
Post by: LoyceV on August 27, 2019, 09:03:59 AM
@LoyceV, meriting/agreeing to the OP from trusted device but disagreeing from non-trusted device  ??? Strange that I agree with the non-trusted one.
You should think of (my) Merit as "this post is worth reading".

Meriting a post does not necessarily imply agreement.
I agree to that :D (but I didn't Merit it)

A bit longer answer than I made on Mobile:
Changes made by Admin risk compromising the stability or security of the forum itself. Anything a user does, can at worst destroy his own system. I remember the Seeking reporter badge images (https://bitcointalk.org/index.php?topic=4742257.0) that theymos wanted to add. That was more than a year ago, and this is theymos' last post on the subject:
when I went to implement this it ended up being quite a bit more of a can of worms than I originally thought
Anything that can be done user-side, should stay user-side :)