Bitcoin Forum
December 08, 2019, 05:22:57 AM *
News: Latest Bitcoin Core release: 0.19.0.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: 1 2 [All]
  Print  
Author Topic: Enhanced merit UI [1.1]  (Read 2190 times)
grue
Legendary
*
Offline Offline

Activity: 2058
Merit: 1208



View Profile
January 27, 2018, 04:55:40 PM
Last edit: March 14, 2018, 03:31:13 AM by grue
Merited by dbshck (20), suchmoon (19), Vod (10), mprep (10), Cyrus (10), minifrij (10), xandry (10), Mr. Big (10), theymos_away (10), malevolent (7), OmegaStarScream (5), BitMaxz (5), Lutpin (5), akamit (5), vlom (4), Cobalt9317 (3), qwk (2), Daniel91 (2), btc-facebook (2), SFR10 (2), 0t3p0t (2), hugeblack (2), fronti (1), Mitchell (1), d5000 (1), owlcatz (1), Quickseller (1), EcuaMobi (1), Welsh (1), mhanbostanci (1), InvoKing (1), Raja_MBZ (1), marlboroza (1), ibminer (1), jhenfelipe (1), Hhampuz (1), kaicrypzen (1), jtipt (1), Xal0lex (1), paul00 (1), o_e_l_e_o (1), revenant2017 (1), xdrpx (1), dogtana (1), sncc (1), omer-jamal (1), Meraki (1)
 #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.



Download: Merit.user.js

Installation:

Changelog:
1.0: release
1.1: fix csrf token not working when quick reply is disabled. (thanks minifrij)
1.2: rehost file on github

It is pitch black. You are likely to be eaten by a grue.

Adblock for annoying signature ads | Enhanced Merit UI
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1575782577
Hero Member
*
Offline Offline

Posts: 1575782577

View Profile Personal Message (Offline)

Ignore
1575782577
Reply with quote  #2

1575782577
Report to moderator
Funky_Yoda
Newbie
*
Offline Offline

Activity: 27
Merit: 8


View Profile
January 27, 2018, 05:01:01 PM
 #2

Thanks for this information Smiley
Looks good. Will be using this. (one day Tongue ).
minifrij
Legendary
*
Offline Offline

Activity: 2100
Merit: 1174


In Memory of Zepher


View Profile WWW
January 27, 2018, 05:52:17 PM
Merited by grue (2), mprep (1), Mitchell (1), Welsh (1), btc-facebook (1), Lutpin (1)
 #3

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:
Code:
 //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 Offline

Activity: 1512
Merit: 1819


Goodbye, Z.


View Profile WWW
January 27, 2018, 06:47:38 PM
 #4

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:
Code:
 //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
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
Legendary
*
Offline Offline

Activity: 2058
Merit: 1208



View Profile
January 27, 2018, 07:19:09 PM
Merited by OgNasty (1)
 #5

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:
Code:
  //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).

It is pitch black. You are likely to be eaten by a grue.

Adblock for annoying signature ads | Enhanced Merit UI
bluefirecorp_
Full Member
***
Offline Offline

Activity: 434
Merit: 126


View Profile
January 28, 2018, 12:55:13 AM
 #6

Much better than my suggestion here; https://bitcointalk.org/index.php?topic=2818350.msg28914391#msg28914391

Good job. Didn't know you worked for Microsoft (that windows.net link >_>)
EcuaMobi
Legendary
*
Offline Offline

Activity: 1820
Merit: 1427


https://Ecua.Mobi


View Profile WWW
February 01, 2018, 08:24:31 PM
Last edit: February 23, 2018, 05:51:17 PM by EcuaMobi
 #7

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
Hero Member
*****
Offline Offline

Activity: 537
Merit: 510


View Profile
February 07, 2018, 03:30:12 PM
Merited by jtipt (1)
 #8

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?
adrianto1995
Full Member
***
Offline Offline

Activity: 714
Merit: 160



View Profile
February 08, 2018, 05:17:47 AM
 #9

oh man you da real MVP

it really helpful a lot, especially for low speed internet connection users like me...  Smiley
i will try it when i got my sMerit back...
Vod
Legendary
*
Offline Offline

Activity: 2954
Merit: 2340


Licking my boob since 1970


View Profile WWW
February 08, 2018, 05:20:13 AM
Merited by bill gator (1)
 #10

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

I'm into creating universes, smiting people, writing holy books and listening to Prayer Messages (PMs).
Nastyfans is a proven ponzi! BitcoinTalk Public Information Project (BPIP)  - BPIP Reports FAMO
"Masturbation makes you feel good but doesn't do anything for the person you're thinking of.  Just like prayer."
akamit
Hero Member
*****
Offline Offline

Activity: 1120
Merit: 591

Use ESCROW SERVICE for your own good!


View Profile
February 12, 2018, 08:08:47 PM
 #11

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

BenOnceAgain
Member
**
Offline Offline

Activity: 210
Merit: 83

🌐 www.btric.org 🌐


View Profile WWW
February 12, 2018, 08:33:12 PM
 #12

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

Dream it. Plan it. Build it.
Need help with your project? [MY WEBSITE] | [MY COMPANY] | [BLOG] | [TWITTER] | [LINKEDIN] | [EMAIL]
Want to help support the blockchain charity I'm building? [LEARN ABOUT BTRIC] | [DONATE] | [TWITTER] | [EMAIL]
fabianji
Member
**
Offline Offline

Activity: 70
Merit: 12


View Profile
February 13, 2018, 05:23:36 AM
 #13

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 Offline

Activity: 49
Merit: 0


View Profile
February 13, 2018, 05:40:47 AM
 #14

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 Offline

Activity: 1820
Merit: 1427


https://Ecua.Mobi


View Profile WWW
February 23, 2018, 06:58:58 PM
Merited by xandry (4), dbshck (3), Vod (2), akamit (2), hugeblack (2), Quickseller (1)
 #15

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...

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:
Code:
// ==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> &nbsp;&nbsp;&nbsp;') };
    });
  });
   $(".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
Full Member
***
Offline Offline

Activity: 448
Merit: 110



View Profile
February 23, 2018, 08:06:01 PM
 #16

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
****
Offline Offline

Activity: 534
Merit: 250

CryptoTalk.Org - Get Paid for every Post!


View Profile
February 24, 2018, 12:36:08 AM
 #17

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?

 
                                . ██████████.
                              .████████████████.
                           .██████████████████████.
                        -█████████████████████████████
                     .██████████████████████████████████.
                  -█████████████████████████████████████████
               -███████████████████████████████████████████████
           .-█████████████████████████████████████████████████████.
        .████████████████████████████████████████████████████████████
       .██████████████████████████████████████████████████████████████.
       .██████████████████████████████████████████████████████████████.
       ..████████████████████████████████████████████████████████████..
       .   .██████████████████████████████████████████████████████.
       .      .████████████████████████████████████████████████.

       .       .██████████████████████████████████████████████
       .    ██████████████████████████████████████████████████████
       .█████████████████████████████████████████████████████████████.
        .███████████████████████████████████████████████████████████
           .█████████████████████████████████████████████████████
              .████████████████████████████████████████████████
                   ████████████████████████████████████████
                      ██████████████████████████████████
                          ██████████████████████████
                             ████████████████████
                               ████████████████
                                   █████████
.CryptoTalk.org.|.MAKE POSTS AND EARN BTC!.🏆
Alex_Sr
Hero Member
*****
Offline Offline

Activity: 700
Merit: 918


HOLD BITCOIN! Fiat - SCAM!


View Profile WWW
February 28, 2018, 07:52:52 AM
 #18

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.



Download: Merit.user.js

Installation:

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!



░░░░░░░▄▄▄▄▄▄
░░░░▄██████████▄
░░░██████████████
░░██████▐▌██████
█████░░░░░░░▀█████
██████▄▄░░▄▄░░██████
████████░░▀▀▄██████
████████░░▄▄▄░░█████
██████▀▀░░▀▀▀░░█████
█████░░░░░░░░█████
░░██████▐▌██████
░░░██████████████
░░░░▀██████████▀
░░░░░░░▀▀▀▀▀▀
░░░
||
|
holder99
Member
**
Offline Offline

Activity: 140
Merit: 12


View Profile
February 28, 2018, 10:18:35 AM
 #19

Awesome, the landlord is really a technology expert, this must support, will not be so troublesome later.
bobq
Sr. Member
****
Offline Offline

Activity: 1008
Merit: 304



View Profile
March 25, 2018, 08:41:25 AM
 #20

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...


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 Offline

Activity: 1988
Merit: 1770



View Profile WWW
June 20, 2019, 05:25:23 AM
 #21

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...

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.
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.

Find the fire hydrant in my Avatar for a prize.
omer-jamal
Full Member
***
Offline Offline

Activity: 476
Merit: 243


View Profile
June 20, 2019, 04:55:41 PM
Last edit: June 23, 2019, 07:35:26 AM by omer-jamal
 #22

Awesome tool, I got an idea about script tool extension from this tool ..
Is it possible Make the box hide when click out?

do not send merit to this user He does not know where to spend it
babo
Legendary
*
Offline Offline

Activity: 1988
Merit: 1300



View Profile WWW
June 24, 2019, 09:11:30 AM
 #23

very nice script, very usefull Smiley

thank you for this ehancement Wink

better than website Tongue lol

smartmixer.io▀  ▀  ▀  ▀  ▀
▄  ▄  ▄  ▄  ▄

▀  ▀  ▀  ▀  ▀
▄  ▄  ▄  ▄  ▄

▀  ▀  ▀  ▀  ▀
▄  ▄  ▄  ▄  ▄

▀  ▀  ▀  ▀  ▀
▄  ▄  ▄  ▄  ▄

▀  ▀  ▀  ▀  ▀
.Make your Cryptos untraceable!.
(( ███████ ((    TELEGRAM    )) ███████ ))
▄▄███████▄▄
▄███████▀███████▄
▄███▀▀▀ ▄▄▄ ▀▀▀███▄
▄███ ▄▀▀▀   ▀▀▀▄ ███▄
████ █  ▄   ▄█ █ ████
████▌▐▌ ▀█▄█▀ ▐▌▐████
▀████ ▀▄  ▀  ▄▀ ████▀
▀████▄ ▀▄▄▄▀ ▄████▀
▀█████▄▄ ▄▄█████▀
▀▀███████▀▀
.
NO LOGS
▄▄███████▄▄
▄██████▀▀▀██████▄
▄█████▀ ▄▄▄ ▀█████▄
▄██████ ▀   █ ██████▄
███████   █▀  ███████
████████▄ ▄ ▄████████
▀████▀         ▀████▀
▀███   ▄   ▄   ███▀
▀███████████████▀
▀▀███████▀▀
.
NO SIGN-UP
▄▄███████▄▄
▄███████████████▄
▄███████▀   ▀█████▄
▄████▀  ▀      █████▄
████     ▄▀▄  ▀ ▀████
███    ▄▀▄ ▄▀▄    ███
▀███▄▄  ▀█ █▀   ▄███▀
▀████████ ████████▀
▀███████████████▀
▀▀███████▀▀
.

70% COMSN
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
MIX NOW!
.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀  ▀  ▀  ▀  ▀
▄  ▄  ▄  ▄  ▄

▀  ▀  ▀  ▀  ▀
▄  ▄  ▄  ▄  ▄

▀  ▀  ▀  ▀  ▀
▄  ▄  ▄  ▄  ▄

▀  ▀  ▀  ▀  ▀
▄  ▄  ▄  ▄  ▄

▀  ▀  ▀  ▀  ▀
jademaxsuy
Member
**
Offline Offline

Activity: 546
Merit: 26

★777Coin.com★ Fun BTC Casino!


View Profile WWW
June 25, 2019, 03:59:36 PM
 #24

What a very nice Input of you OP. As this could be helpful especially to the merit source on giving merits on quality posts. Well, this should be integrated by the bitcointalk forum itself. You can PM theymos for this OP having a new feature an easy, fast and reliable way on giving merits. Congratulations OP for this.

babo
Legendary
*
Offline Offline

Activity: 1988
Merit: 1300



View Profile WWW
June 26, 2019, 08:00:29 AM
 #25

What a very nice Input of you OP. As this could be helpful especially to the merit source on giving merits on quality posts. Well, this should be integrated by the bitcointalk forum itself. You can PM theymos for this OP having a new feature an easy, fast and reliable way on giving merits. Congratulations OP for this.

the greasemoney/tampermonkey scripts born because some enhancment isnt possible to develop Smiley (for many reason)
i not think theymos 'update' UX of merit form

smartmixer.io▀  ▀  ▀  ▀  ▀
▄  ▄  ▄  ▄  ▄

▀  ▀  ▀  ▀  ▀
▄  ▄  ▄  ▄  ▄

▀  ▀  ▀  ▀  ▀
▄  ▄  ▄  ▄  ▄

▀  ▀  ▀  ▀  ▀
▄  ▄  ▄  ▄  ▄

▀  ▀  ▀  ▀  ▀
.Make your Cryptos untraceable!.
(( ███████ ((    TELEGRAM    )) ███████ ))
▄▄███████▄▄
▄███████▀███████▄
▄███▀▀▀ ▄▄▄ ▀▀▀███▄
▄███ ▄▀▀▀   ▀▀▀▄ ███▄
████ █  ▄   ▄█ █ ████
████▌▐▌ ▀█▄█▀ ▐▌▐████
▀████ ▀▄  ▀  ▄▀ ████▀
▀████▄ ▀▄▄▄▀ ▄████▀
▀█████▄▄ ▄▄█████▀
▀▀███████▀▀
.
NO LOGS
▄▄███████▄▄
▄██████▀▀▀██████▄
▄█████▀ ▄▄▄ ▀█████▄
▄██████ ▀   █ ██████▄
███████   █▀  ███████
████████▄ ▄ ▄████████
▀████▀         ▀████▀
▀███   ▄   ▄   ███▀
▀███████████████▀
▀▀███████▀▀
.
NO SIGN-UP
▄▄███████▄▄
▄███████████████▄
▄███████▀   ▀█████▄
▄████▀  ▀      █████▄
████     ▄▀▄  ▀ ▀████
███    ▄▀▄ ▄▀▄    ███
▀███▄▄  ▀█ █▀   ▄███▀
▀████████ ████████▀
▀███████████████▀
▀▀███████▀▀
.

70% COMSN
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
MIX NOW!
.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀  ▀  ▀  ▀  ▀
▄  ▄  ▄  ▄  ▄

▀  ▀  ▀  ▀  ▀
▄  ▄  ▄  ▄  ▄

▀  ▀  ▀  ▀  ▀
▄  ▄  ▄  ▄  ▄

▀  ▀  ▀  ▀  ▀
▄  ▄  ▄  ▄  ▄

▀  ▀  ▀  ▀  ▀
hugeblack
Hero Member
*****
Online Online

Activity: 896
Merit: 935


For ReNt


View Profile
July 27, 2019, 01:25:54 PM
Last edit: July 27, 2019, 02:41:41 PM by hugeblack
 #26

Sorry for Bumping this. & thanks for creating it.
I've made some edits to update the page after sending sMerits.
Is it possible to display full sMerit amount on the same screen?
sMerit and source Merits. Something like this



Edit: Not only @EcuaMobi update but total amount (Merit source + sMerit)

dogtana
Member
**
Offline Offline

Activity: 546
Merit: 48


View Profile
July 27, 2019, 01:48:31 PM
Merited by cabalism13 (1)
 #27

I gave you my pre-last smerit for this.
ETFbitcoin
Legendary
*
Offline Offline

Activity: 1848
Merit: 2122

Use SegWit and enjoy lower fees.


View Profile WWW
July 27, 2019, 06:57:51 PM
Last edit: July 27, 2019, 07:34:58 PM by ETFbitcoin
Merited by dbshck (6), xandry (5), hugeblack (4), malevolent (2), EcuaMobi (2), babo (1), Coin-1 (1), cabalism13 (1), tranthidung (1)
 #28

Sorry for Bumping this. & thanks for creating it.
I've made some edits to update the page after sending sMerits.
Is it possible to display full sMerit amount on the same screen?
sMerit and source Merits. Something like this



Edit: Not only @EcuaMobi update but total amount (Merit source + sMerit)

It's piece of cake, i've made slight modification for your need :

Code:
// ==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.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;
  var source_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];
    source_sMerit = /The next ([0-9]+) merit you spend will come from your source/.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="1" 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 && source_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> &nbsp;&nbsp;&nbsp;')
    } else if (sMerit!=null && source_sMerit!=null) {
      $("#em-smerit-count" + msgId).html('<a href="https://bitcointalk.org/index.php?action=merit;msg='+msgId+'" target="_blank">Available (yours | source):</a> <b>'+sMerit+' | '+source_sMerit+'</b> &nbsp;&nbsp;&nbsp;')
    };
    });
  });
   $(".grue-merit-popup").toggle(false);
})();

It's based on version 1.1 & i separate personal and source merit amount. I did it in a minute, so i hope there aren't any logic error.

Edit : screenshot if you're merit source. If you're not, it's exactly same with version 1.1


hugeblack
Hero Member
*****
Online Online

Activity: 896
Merit: 935


For ReNt


View Profile
July 28, 2019, 06:19:35 AM
 #29

-snip-
It worked, thanks for your effort.
The update looks better than what I suggested.
I did not notice @EcuaMobi update because I do not read all comments so I wish more than one user could make some changes to update the topic. (Create a topic with multiple update powers)
@grue ----> Last Active:   August 01, 2018, 05:00:20 AM
*I made some adjustments to hide my Merits.

cabalism13
Hero Member
*****
Offline Offline

Activity: 672
Merit: 728


★Student Since 2000★


View Profile
July 29, 2019, 05:33:45 AM
 #30

-snip-
It worked, thanks for your effort.
The update looks better than what I suggested.
I did not notice @EcuaMobi update because I do not read all comments so I wish more than one user could make some changes to update the topic. (Create a topic with multiple update powers)
@grue ----> Last Active:   August 01, 2018, 05:00:20 AM
*I made some adjustments to hide my Merits.

I guess will try it though...
I somewhat accidentally gave dogtana a Merit... What a mistake...

By the way @hugeblack does it really work with our Source Merits? Have you tried using it (spend it)




▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄    ▄▄▄▄                  ▄▄▄   ▄▄▄▄▄        ▄▄▄▄▄   ▄▄▄▄▄▄▄▄▄▄▄▄    ▄▄▄▄▄▄▄▄▄▄▄▄▄▄   ▄▄▄▄▄▄▄▄▄▄▄▄▄▄   ▄▄▄▄▄▄▄▄▄▄▄
 ▀████████████████▄  ████                 █████   ▀████▄    ▄████▀  ▄██████████████   ████████████▀  ▄█████████████▀  ▄█████████████▄
              ▀████  ████               ▄███▀███▄   ▀████▄▄████▀               ████   ████                ████                   ▀████
   ▄▄▄▄▄▄▄▄▄▄▄█████  ████              ████   ████    ▀██████▀      ██████████████▄   ████████████▀       ████       ▄▄▄▄▄▄▄▄▄▄▄▄████▀
   ██████████████▀   ████            ▄███▀     ▀███▄    ████        ████        ████  ████                ████       ██████████████▀
   ████              ████████████▀  ████   ██████████   ████        ████████████████  █████████████▀      ████       ████      ▀████▄
   ▀▀▀▀              ▀▀▀▀▀▀▀▀▀▀▀   ▀▀▀▀   ▀▀▀▀▀▀▀▀▀▀▀▀  ▀▀▀▀        ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀   ▀▀▀▀▀▀▀▀▀▀▀▀        ▀▀▀▀       ▀▀▀▀        ▀▀▀▀▀

#1 CRYPTO CASINO & SPORTSBOOK
  WELCOME
BONUS
.INSTANT & FAST.
.TRANSACTION.....
.PROVABLY FAIR.
......& SECURE......
.24/7 CUSTOMER.
............SUPPORT.
BTC      |      ETH      |      LTC      |      XRP      |      XMR      |      BNB      |     more
babo
Legendary
*
Offline Offline

Activity: 1988
Merit: 1300



View Profile WWW
July 29, 2019, 10:47:10 AM
 #31

Awesome! i love this userscript, and now i love more

very good and usefull



thank you so much for your update

smartmixer.io▀  ▀  ▀  ▀  ▀
▄  ▄  ▄  ▄  ▄

▀  ▀  ▀  ▀  ▀
▄  ▄  ▄  ▄  ▄

▀  ▀  ▀  ▀  ▀
▄  ▄  ▄  ▄  ▄

▀  ▀  ▀  ▀  ▀
▄  ▄  ▄  ▄  ▄

▀  ▀  ▀  ▀  ▀
.Make your Cryptos untraceable!.
(( ███████ ((    TELEGRAM    )) ███████ ))
▄▄███████▄▄
▄███████▀███████▄
▄███▀▀▀ ▄▄▄ ▀▀▀███▄
▄███ ▄▀▀▀   ▀▀▀▄ ███▄
████ █  ▄   ▄█ █ ████
████▌▐▌ ▀█▄█▀ ▐▌▐████
▀████ ▀▄  ▀  ▄▀ ████▀
▀████▄ ▀▄▄▄▀ ▄████▀
▀█████▄▄ ▄▄█████▀
▀▀███████▀▀
.
NO LOGS
▄▄███████▄▄
▄██████▀▀▀██████▄
▄█████▀ ▄▄▄ ▀█████▄
▄██████ ▀   █ ██████▄
███████   █▀  ███████
████████▄ ▄ ▄████████
▀████▀         ▀████▀
▀███   ▄   ▄   ███▀
▀███████████████▀
▀▀███████▀▀
.
NO SIGN-UP
▄▄███████▄▄
▄███████████████▄
▄███████▀   ▀█████▄
▄████▀  ▀      █████▄
████     ▄▀▄  ▀ ▀████
███    ▄▀▄ ▄▀▄    ███
▀███▄▄  ▀█ █▀   ▄███▀
▀████████ ████████▀
▀███████████████▀
▀▀███████▀▀
.

70% COMSN
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
MIX NOW!
.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀  ▀  ▀  ▀  ▀
▄  ▄  ▄  ▄  ▄

▀  ▀  ▀  ▀  ▀
▄  ▄  ▄  ▄  ▄

▀  ▀  ▀  ▀  ▀
▄  ▄  ▄  ▄  ▄

▀  ▀  ▀  ▀  ▀
▄  ▄  ▄  ▄  ▄

▀  ▀  ▀  ▀  ▀
ETFbitcoin
Legendary
*
Offline Offline

Activity: 1848
Merit: 2122

Use SegWit and enjoy lower fees.


View Profile WWW
August 08, 2019, 08:47:04 AM
Merited by xandry (3), hugeblack (3)
 #32

Recently i got my source sMerit filled & i found 2 minor bug :
1. I forgot to remove @downloadURL which causes the script update itself to grue's code which don't show personal/source sMerit amount
2. Amount of personal sMerit is deducted rather than source sMerit when source sMerit is available

So i decide to fix it

Code:
// ==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.2
// @grant none
// ==/UserScript==

(() => {
  var sMerit, source_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];
    source_sMerit = /The next ([0-9]+) merit you spend will come from your source/.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="1" 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(source_sMerit!=null && source_sMerit-merits>=0){
            source_sMerit -= merits
          }else if(source_sMerit!=null && source_sMerit>0){
            sMerit -= merits-source_sMerit
            source_sMerit = 0
          }else 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 && source_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> &nbsp;&nbsp;&nbsp;')
    } else if (sMerit!=null && source_sMerit!=null) {
      $("#em-smerit-count" + msgId).html('<a href="https://bitcointalk.org/index.php?action=merit;msg='+msgId+'" target="_blank">Available (yours | source):</a> <b>'+sMerit+' | '+source_sMerit+'</b> &nbsp;&nbsp;&nbsp;')
    };
    });
  });
   $(".grue-merit-popup").toggle(false);
})();

hugeblack
Hero Member
*****
Online Online

Activity: 896
Merit: 935


For ReNt


View Profile
August 10, 2019, 09:50:52 AM
 #33

Recently i got my source sMerit filled & i found 2 minor bug :
1. I forgot to remove @downloadURL which causes the script update itself to grue's code which don't show personal/source sMerit amount
2. Amount of personal sMerit is deducted rather than source sMerit when source sMerit is available
I did not notice these bugs, the script works normally. There were some errors in updating the source values ​​but after refreshing the page everything works normally.
Generally, if you have some time, this update will be important for lazy people like me*:

 - Sending Merits quickly, instead of typing the number and then clicking Send, the numbers (1,2,5,10) are clickable.


ETFbitcoin
Legendary
*
Offline Offline

Activity: 1848
Merit: 2122

Use SegWit and enjoy lower fees.


View Profile WWW
August 10, 2019, 11:07:57 AM
Merited by hugeblack (1)
 #34

I did not notice these bugs, the script works normally. There were some errors in updating the source values ​​but after refreshing the page everything works normally.

That's because the script get sMerit amount when you load the page & didn't check if you send sMerit on different page afterwards.
The original script (before i modify it) works that way, so i don't change it.

Generally, if you have some time, this update will be important for lazy people like me*:

 - Sending Merits quickly, instead of typing the number and then clicking Send, the numbers (1,2,5,10) are clickable.


I'm also lazy people as well, so i'll do it when i have free time and not being lazy.

ETFbitcoin
Legendary
*
Offline Offline

Activity: 1848
Merit: 2122

Use SegWit and enjoy lower fees.


View Profile WWW
August 24, 2019, 07:10:59 AM
Last edit: August 25, 2019, 06:13:17 AM by ETFbitcoin
Merited by hugeblack (5), xandry (4), DarkStar_ (4), morvillz7z (3), Xal0lex (2), babo (1), mrvuit (1)
 #35

Enhanced merit UI [1.3]

I had free time, so i decide to make few changes.



Changelog :

  • Update jQuery to 3.4.1
  • New feature : one-click sMerit send
  • New feature : check sMerit amount when click "+Merit" (experemental, disabled by default)
  • Change input type to "number" to allow scroll
  • Change code structure
  • Show text "Getting sMerit amount..." when still checking sMerit amount, re-open pop-up to show sMerit amount

Unofficial full changelog (for history/tracking purpose) :

Code:
# RELEASE NOTES

## Version 1.3

* Update jQuery to 3.4.1
* New feature : one-click sMerit send
* New feature : check sMerit amount when click "+Merit" (experemental, disabled by default)
* Change input type to "number" to allow scroll
* Change code structure
* Show text "Getting sMerit amount..." when still checking sMerit amount, re-open pop-up to show sMerit amount

## Version 1.1.2

* Remove @downloadURL to prevent the script update itself to grue's code which don't show personal/source sMerit amount
* Fix Amount of personal sMerit is deducted rather than source sMerit when source sMerit is available

## Version 1.1.1

* Show both personal and source sMerit for merit source
* Change UI for merit source

## Version 1.1-em0.1

* The available sMerit points are shown

## Version 1.1

* Fix csrf token not working when quick reply is disabled

## Version 1.0

* Initial Release

Notes :

  • There's delay when open/close popup if you enable feature check sMerit amount when click "+Merit"
  • If you want to change amount of one-click sMerit value, change value inside oneClick_amount. Example :
Code:
oneClick_amount = [1, 2, 3, 4, 5, 10, 20, 50]
  • Only tested on Mozilla Firefox with Tampermonkey

Code:
// ==UserScript==
// @name        bitcointalk merit
// @version     1.3
// @author      grue, minifrij, EcuaMobi, ETFbitcoin
// @source      https://github.com/grue0/bitcointalk-scripts/
// @source      https://bitcointalk.org/index.php?topic=2833350.0;0
// @description A very simple userscript that allows you to add merit without leaving the page
// @include     https://bitcointalk.org/index.php?topic=*
// @require     https://code.jquery.com/jquery-3.4.1.min.js
// @grant none
// ==/UserScript==

(() => {
  var sMerit, source_sMerit, check_onClick = false, oneClick_amount = [1, 2, 5, 10, 50]

  function check_sMerit(msgId){
    // Added by EcuaMobi
    $.post(
      "https://bitcointalk.org/index.php?action=merit;msg=29048068"
    ).then((data) => {
      sMerit = /You have <b>([0-9]+)<\/b> sendable/.exec(data)[1]
      source_sMerit = /The next ([0-9]+) merit you spend will come from your source/.exec(data)[1]
      show_popup(msgId)
    }).catch(() => sMerit = null)
  }

  function show_popup(msgId){
    if(sMerit!=null && source_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> &nbsp;&nbsp;&nbsp;')
    } else if (sMerit!=null && source_sMerit!=null) {
      $("#em-smerit-count" + msgId).html('<a href="https://bitcointalk.org/index.php?action=merit;msg='+msgId+'" target="_blank">Available (yours | source):</a> <b>'+sMerit+' | '+source_sMerit+'</b> &nbsp;&nbsp;&nbsp;')
    }else{
      $("#em-smerit-count" + msgId).html('<a href="https://bitcointalk.org/index.php?action=merit;msg='+msgId+'" target="_blank">Getting sMerit amount...</b> &nbsp;&nbsp;&nbsp;')
    }
    $("#grue-merit-popup" + msgId).toggle()
  }

  // 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];

  // Get remaining sMerit
  check_sMerit()

  // 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]

    let oneClick_html = `
      <div style="display:inline-block;">
        One-click send :
      </div>
    `
    oneClick_amount.forEach((amount) => {
      oneClick_html += `
        <form style="display:inline-block;">
          <input name="merits" value="` + amount + `" type="hidden"/>
          <input style="padding:0" class="oneClick" value="` + amount + `" type="submit">
        </form>
      `
    })

    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;">',
      oneClick_html,
      '  <hr>',
      '  <form>',
      '    <div>',
      '      Merit points: <input style="height:1em" size="6" name="merits" value="1" type="number" min="1" max="50"/>',
      '    </div>',
      '    <div style="margin-top: 6px; "><span id="em-smerit-count' + msgId +'" style="font-size:11px;" /> <input class="sendButton" value="Send" type="submit"></div>',
      '  </form>',
      '</div>'
    ].join("\n"))
    $popup.find("form").submit( (e) => {
      e.preventDefault()
      $popup.find('.sendButton')
        .prop("disabled", true)
        .val("Sending...")
      $popup.find('.oneClick')
        .prop("disabled", true)
      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)
          if(!check_onClick){
            if(source_sMerit!=null && source_sMerit-merits>=0){
              source_sMerit -= merits
            }else if(source_sMerit!=null && source_sMerit>0){
              sMerit -= merits-source_sMerit
              source_sMerit = 0
            }else if(sMerit!=null){
              sMerit -= merits
            }
          }
          return
        }
        alert("Server response indeterminate.")
      })
      .catch(() => alert("Failed to add merit."))
      .always(() => {
        $popup.find('.sendButton')
          .prop("disabled", false)
          .val("Send")
        $popup.find('.oneClick')
          .prop("disabled", true)
      })
    })
    $popup.insertAfter(e)

    $(e).click((e) => {
      e.preventDefault()
      if(check_onClick){
        check_sMerit(msgId)
      }else{
        show_popup(msgId)
      }
    })
  })
  $(".grue-merit-popup").toggle(false)
})()

hugeblack
Hero Member
*****
Online Online

Activity: 896
Merit: 935


For ReNt


View Profile
August 24, 2019, 10:27:25 AM
 #36

I've tried it on Brave's browser and it looks good, I've sent the Merits using it.
The interface does not look as excellent as it appears, but there are no problems yet.
I will change the numbers to 4 and 6. Thanks for adding this.
And thanks for allowing scroll.
Finally thanks for your effort, you make life easier.


ETFbitcoin
Legendary
*
Offline Offline

Activity: 1848
Merit: 2122

Use SegWit and enjoy lower fees.


View Profile WWW
August 24, 2019, 02:44:33 PM
 #37

I've tried it on Brave's browser and it looks good, I've sent the Merits using it.
The interface does not look as excellent as it appears, but there are no problems yet.
I will change the numbers to 4 and 6. Thanks for adding this.
And thanks for allowing scroll.
Finally thanks for your effort, you make life easier.


You're welcome, but i didn't expect it'd be so different on chromium-based browser.

Pages: 1 2 [All]
  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!