grue (OP)
Legendary
Offline
Activity: 2058
Merit: 1434
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
January 27, 2018, 04:55:40 PM Last edit: March 14, 2018, 03:31:13 AM by grue Merited by Welsh (50), ABCbits (26), dbshck (20), suchmoon (19), Cyrus (10), Vod (10), mprep (10), xandry (10), Mr. Big (10), minifrij (10), theymos_away (10), malevolent (7), OmegaStarScream (5), BitMaxz (5), Lutpin (5), akamit (5), vlom (4), Cobalt9317 (3), JayJuanGee (2), qwk (2), Daniel91 (2), SFR10 (2), hugeblack (2), btc-facebook (2), 0t3p0t (2), Mitchell (1), d5000 (1), owlcatz (1), mhanbostanci (1), Quickseller (1), Hhampuz (1), fronti (1), Xal0lex (1), mole0815 (1), Husna QA (1), o_e_l_e_o (1), InvoKing (1), marlboroza (1), EcuaMobi (1), Raja_MBZ (1), ibminer (1), cabalism13 (1), jhenfelipe (1), kaicrypzen (1), jtipt (1), paul00 (1), dogtana (1), revenant2017 (1), xdrpx (1), sncc (1), omer-jamal (1), Meraki (1) |
|
This is a very simple userscript that allows you to add merit without leaving the page. Click on the "+Merit" link to open/close the popup. ![](https://ip.bitcointalk.org/?u=https%3A%2F%2Fi.imgur.com%2FEfAEkBQ.png&t=665&c=mQOKwu2RKoXzew) Download: Merit.user.jsInstallation: Changelog: 1.0: release 1.1: fix csrf token not working when quick reply is disabled. (thanks minifrij)1.2: rehost file on github
|
|
|
|
minifrij
Legendary
Offline
Activity: 2352
Merit: 1267
In Memory of Zepher
|
Great script grue, thanks! Just a little thing though, when I tried installing and using the script it would tell me 'Failed to give merit' whenever I tried to reward it. I found that this was a session error due to how you get 'sc'. I've made a small fix here (on lines 12-14), which works for me currently: //get csrf token var sc = $('input[name="sc"][type="hidden"]').val(); sc = (!sc ? ($('a[onclick]')[1].href).split('sesc=')[1] : sc);
|
|
|
|
Lutpin
Copper Member
Legendary
Offline
Activity: 1890
Merit: 1874
Goodbye, Z.
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
January 27, 2018, 06:47:38 PM |
|
Great script grue, thanks! Just a little thing though, when I tried installing and using the script it would tell me 'Failed to give merit' whenever I tried to reward it. I found that this was a session error due to how you get 'sc'. I've made a small fix here (on lines 12-14), which works for me currently: //get csrf token var sc = $('input[name="sc"][type="hidden"]').val(); sc = (!sc ? ($('a[onclick]')[1].href).split('sesc=')[1] : sc);
Getting the same error, great you already spotted and fixed it ![Smiley](https://bitcointalk.org/Smileys/default/smiley.gif) Also, very well done grue, the extra page to open when giving merit was one of the most criticized aspect of this change. Thanks!
|
| | | | ███████ ██████████ ██████████ ██████████ ██████████ ██████████ ██████████ ██████████ ██████████ ██████████ ██████████ ██████████ ███████ | | | |
▄████████████████████████████████████████████████████████████▄ ██ ▄▄▄▄▄▄ ██ ██ ██████ ▄██████████▄ ████████████████████▀ ██ ████████ ▄████▀ ▀████▄ ████▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ██ ████ ████ ████▀ ▀██▀ ████ ██ ████ ████ ▄███▀ ████ ██ ████ ████ ███▀ ████▄▄▄▄▄▄▄▄▄▄ ██ ████ ████ ███ ██████████████ ██ ████ ████ ███▄ ████▀▀▀▀▀▀▀▀▀▀ ██ ████████████████████ ▀████ ████ ██ ██████████████████████ ▀████▄ ▄██▄ ████ ██ ████ ████ ▀████▄ ▄████▀ ████▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ██ ████ ████ ▀██████████▀ ████████████████████▄ ██ ▀▀▀▀▀▀ ██ ▀█████████████████████████████████████████████████████████████████████▀ | | |
|
|
|
grue (OP)
Legendary
Offline
Activity: 2058
Merit: 1434
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
January 27, 2018, 07:19:09 PM |
|
Great script grue, thanks! Just a little thing though, when I tried installing and using the script it would tell me 'Failed to give merit' whenever I tried to reward it. I found that this was a session error due to how you get 'sc'. I've made a small fix here (on lines 12-14), which works for me currently: //get csrf token var sc = $('input[name="sc"][type="hidden"]').val(); sc = (!sc ? ($('a[onclick]')[1].href).split('sesc=')[1] : sc);
thanks. turns out that if you don't have quick reply enabled, the input with the token isn't there. i updated the script to use the token from the logout link (which should always be there).
|
|
|
|
|
EcuaMobi
Legendary
Offline
Activity: 1876
Merit: 1475
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
February 01, 2018, 08:24:31 PM Last edit: February 23, 2018, 05:51:17 PM by EcuaMobi |
|
Thanks for this! I just found it and it's really useful. So here's a little bump for others to find it. Also, could you add a small link to own Merit stats ( https://bitcointalk.org/index.php?action=merit) ? Sometimes I used to click "+Merit" just to go there. Edit: I just realized I posted the wrong link. I meant own Metir stats. Something like https://bitcointalk.org/index.php?action=merit;msg=29410086 (with the corresponding msg)
|
|
|
|
sncc
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
February 07, 2018, 03:30:12 PM |
|
Thank you, this is very nice UI. Adding stats link would be interesting but imho it would be more useful if one could check his/her own (not others') sMerit balance when trying to send Merit. Could you implement it like this image? ![](https://ip.bitcointalk.org/?u=https%3A%2F%2Fi.imgur.com%2FN9Piytz.png&t=665&c=54c6Cp9jfD5VQA)
|
|
|
|
adrianto1995
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
February 08, 2018, 05:17:47 AM |
|
oh man you da real MVP it really helpful a lot, especially for low speed internet connection users like me... ![Smiley](https://bitcointalk.org/Smileys/default/smiley.gif) i will try it when i got my sMerit back...
|
|
|
|
Vod
Legendary
Offline
Activity: 3808
Merit: 3115
Licking my boob since 1970
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
February 08, 2018, 05:20:13 AM Merited by bill gator (1) |
|
Nice userscript!! I won't be using it, as I like the info presented in a new window when I click the merit button. ![Smiley](https://bitcointalk.org/Smileys/default/smiley.gif)
|
|
|
|
akamit
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
February 12, 2018, 08:08:47 PM |
|
Great job Grue! A useful script for lazy guys. I hope lazy guys will not hesitate anymore to merit someone's post now and then or will be able to show another excuse. A responsible bump for the lazy mates, those who have waited long for this. ![Wink](https://bitcointalk.org/Smileys/default/wink.gif)
|
|
|
|
BenOnceAgain
Member
![*](https://bitcointalk.org/Themes/custom1/images/star.gif)
Offline
Activity: 208
Merit: 84
🌐 www.btric.org 🌐
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
February 12, 2018, 08:33:12 PM |
|
This is a very simple userscript that allows you to add merit without leaving the page. Click on the "+Merit" link to open/close the popup.
Hi grue, thank you very much for the great script! Best regards, Ben
|
|
|
|
fabianji
Member
![*](https://bitcointalk.org/Themes/custom1/images/star.gif)
Offline
Activity: 70
Merit: 12
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
February 13, 2018, 05:23:36 AM |
|
This is a very simple userscript that allows you to add merit without leaving the page. Click on the "+Merit" link to open/close the popup.
Amazing - thank you!
|
|
|
|
ungvantuyen
Newbie
Offline
Activity: 49
Merit: 0
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
February 13, 2018, 05:40:47 AM |
|
Thanks Chris for the great works. How about drop-down list of meriters correspond to number of merits they sent. It will help to clear appearance of topics and threads that have abundant meriters. I don't remember the source of the idea, but I read about the idea somewhere in the ground.
|
|
|
|
EcuaMobi
Legendary
Offline
Activity: 1876
Merit: 1475
|
I have combined my own suggestion as well as sncc's and modified grue's script to implement them. This is the result: ![Loading image...](https://ip.bitcointalk.org/?u=https%3A%2F%2Fi.imgur.com%2FL5xiXfT.png&t=665&c=sXgjVuIgPkx2aA) The available sMerit points are shown. 'Available' is a link which opens the default https://bitcointalk.org/index.php?action=merit;msg=30923337 (with the corresponding msg) in a new window to keep the original functionality. Here's the modified source. grue, feel free to update your original code if you like the change: // ==UserScript== // @name bitcointalk merit // @namespace grue // @include https://bitcointalk.org/index.php?topic=* // @require https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.3.1.min.js // @version 1.1-em0.1 // @downloadURL https://grue.blob.core.windows.net/scripts/Merit.user.js?sv=2014-02-14&si=1&sr=c&sig=k%2BqstGBI3oQ8TrHfPWjS5HgjrazuDPmKJ6rYNs7rvRk%3D&.user.js // @grant none // ==/UserScript==
(() => { var sMerit; //get csrf token from the logout link let sc = $('td.maintab_back a[href*="index.php?action=logout;sesc="').attr("href"); sc = /;sesc=(.*)/.exec(sc)[1]; //Added by EcuaMobi: Get remaining sMerit $.post( "https://bitcointalk.org/index.php?action=merit;msg=29048068" ).then((data) => { sMerit = /You have <b>([0-9]+)<\/b> sendable/.exec(data)[1]; }).catch(() => sMerit = null);
//selector for the "+Merit" link $('td.td_headerandpost div[id^=ignmsgbttns] a[href*="index.php?action=merit;msg="]') .each((i, e) => { const msgId = /msg=([0-9]+)/.exec(e.href)[1]; const $popup = $(['<div id="grue-merit-popup' + msgId +'" class="grue-merit-popup" style="position: absolute; right: 40px; background-color: #ddd; font-size: 13px; padding: 8px;border-width: 1px;border-color: black;border-style: solid;">', ' <form>', ' <div>', ' Merit points: <input size="6" name="merits" value="0" type="text"/>', ' </div>', // Modified by EcuaMobi ' <div style="margin-top: 6px; "><span id="em-smerit-count' + msgId +'" style="font-size:11px;" /> <input value="Send" type="submit"></div>', ' </form>', '</div>' ].join("\n")); $popup.find("form").submit( (e) => { e.preventDefault(); $popup.find('input[type="submit"]') .prop("disabled", true) .val("Sending..."); const merits = e.target.elements["merits"].value; $.post( "https://bitcointalk.org/index.php?action=merit", {merits, msgID: msgId, sc} ).then((data) => { //Error pages usually have this (rough heuristic) if(data.includes("<title>An Error Has Occurred!</title")) { throw "error"; } //double check and see whether the post we merited was added to the list. Its msgId should be visible in the page source. if(data.includes("#msg" + msgId)) { alert("Merit added."); $("#grue-merit-popup" + msgId).toggle(false); // Added by EcuaMobi if(sMerit!=null) { sMerit -= merits } return; } alert("Server response indeterminate."); }) .catch(() => alert("Failed to add merit.")) .always(() => { $popup.find('input[type="submit"]') .prop("disabled", false) .val("Send"); }); }); $popup.insertAfter(e); $(e).click((e) => { e.preventDefault(); $("#grue-merit-popup" + msgId).toggle(); // Added by EcuaMobi if(sMerit!=null) { $("#em-smerit-count" + msgId).html('<a href="https://bitcointalk.org/index.php?action=merit;msg='+msgId+'" target="_blank">Available:</a> <b>'+sMerit+'</b> ') }; }); }); $(".grue-merit-popup").toggle(false); })(); I've clearly marked the modified code with either "Added by EcuaMobi" or "Modified by EcuaMobi". I also changed the version A small limitation is that it queries the available sMerit points once (when the thread is loaded). It does subtract them when points are sent. However, if sMerit points are received the change won't be reflected unless the page is reloaded. That would require re-querying every time which I considered an overkill. To install this version, you can just modify grue's script or install this from scratch: https://openuserjs.org/scripts/EcuaMobi/bitcointalk_merit(grue, I assumed this code is open-source. If that's not the case, let me know to unpublish this)
|
|
|
|
Meraki
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
February 23, 2018, 08:06:01 PM |
|
Thankyou for this it worked smoothly, really useful for me bc i hate the fact that new tab is opening for clicking the merit!
|
|
|
|
UsernameBitcoin
Sr. Member
![*](https://bitcointalk.org/Themes/custom1/images/star.gif) ![*](https://bitcointalk.org/Themes/custom1/images/star.gif) ![*](https://bitcointalk.org/Themes/custom1/images/star.gif)
Offline
Activity: 530
Merit: 250
CryptoTalk.Org - Get Paid for every Post!
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
February 24, 2018, 12:36:08 AM |
|
Great addition! This was required especially in the light of the changes to the merit system. I just found about the merit system today and was looking for a way to give merits easily.
Is it possible to integrate this into the forum itself? Using some simple machines plugin maybe?
|
|
|
|
Alex_Sr
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
February 28, 2018, 07:52:52 AM |
|
This is a very simple userscript that allows you to add merit without leaving the page. Click on the "+Merit" link to open/close the popup. ![](https://ip.bitcointalk.org/?u=https%3A%2F%2Fi.imgur.com%2FEfAEkBQ.png&t=665&c=mQOKwu2RKoXzew) Download: Merit.user.jsInstallation: Changelog: 1.0: release 1.1: fix csrf token not working when quick reply is disabled. (thanks minifrij) Thank you, this is very nice script. When will more merit - I will definitely use it!![](https://ip.bitcointalk.org/?u=https%3A%2F%2Fd.radikal.ru%2Fd37%2F1802%2F1e%2Fa7a444787636.jpg&t=665&c=mlZoFUQQfNJwlQ)
|
░░░░░░░▄▄▄▄▄▄ ░░░░▄██████████▄ ░░░██████████████ ░░██████░▐▌░██████ ░█████░░░░░░░▀█████ ██████▄▄░░▄▄░░██████ ████████░░▀▀░▄██████ ████████░░▄▄▄░░█████ ██████▀▀░░▀▀▀░░█████ ░█████░░░░░░░░█████ ░░██████░▐▌░██████ ░░░██████████████ ░░░░▀██████████▀ ░░░░░░░▀▀▀▀▀▀ ░░░▀▀▀████████▀▀▀
| | | | | | | | | | | | | | | | |
|
|
|
holder99
Member
![*](https://bitcointalk.org/Themes/custom1/images/star.gif)
Offline
Activity: 140
Merit: 12
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
February 28, 2018, 10:18:35 AM |
|
Awesome, the landlord is really a technology expert, this must support, will not be so troublesome later.
|
|
|
|
bobq
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
March 25, 2018, 08:41:25 AM |
|
I have combined my own suggestion as well as sncc's and modified grue's script to implement them. This is the result: ![Loading image...](https://ip.bitcointalk.org/?u=https%3A%2F%2Fi.imgur.com%2FL5xiXfT.png&t=665&c=sXgjVuIgPkx2aA) Thanks for this upgrade, it was absolutely necessary. Not knowing how many sMerits you still have when you are about to give one was not an option, given their overall scarcity (most people have just a few sMerits).
|
|
|
|
Quickseller
Copper Member
Legendary
Offline
Activity: 2968
Merit: 2370
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
June 20, 2019, 05:25:23 AM |
|
As an FYI, if you are a merit source, this will not account for your source merit, and will only display your accumulated sMerit. This is a script I will be using. I like not having to deal with a popup every time I give merit.
|
|
|
|
|