A HSBI Tipping Bookmarklet

in #hive-192847yesterday

HSBI.jpg

As I was responding to comments on my previous post about HSBI, I got the idea for something I wanted peakd to add. I popped into Discord and asked @asgarth about it. He seemed receptive, but not entirely enthusiastic about it, so I set about doing it myself and I'll share the results so you guys can do it too.

What I asked for was an easy way to share HSBI, just a button either below the post or in the post menu. Now let's be clear, it's not hard to send HSBI as it. You just go to your wallet, send the amount of Hive corresponding to the number of HSBI shares you want to send, then put the person you are sending to in the memo comment. On peakd it is even easier, just go to the "Other tab" in your wallet, and click the sponsor button. Well... that actually breaks sometimes. But when it works, it is really super.

As I replied to comments, however, I was thinking that a single button might make this even quicker and less error prone. If a button on a post could already know the user name you want to send the HSBI to—presumably the person whose post you are reading—so all you would have to do is enter an amount. As someone who sends a lot of HSBI, this would really make my workflow faster.

But I do realize I may be an edge case and Asgarth has a lot of more important features on his plate. So I wondered if I could get close to this functionality by myself.

I decided a bookmarklet might be perfect for this. I also decided that @ecoinstant's Tip Jar would be the perfect tool to use to make this work.

I went through a number of versions of a bookmarklet but this is what I ended up with:

   javascript:(function(){var url=window.location.href,match=url.match(/@([^\/]+)/),name=match?match[1]:"";if(!name||name.toLowerCase()==="dbooster"){name=prompt("Enter the Hive username:");}if(name){var amount=prompt("Enter the amount:");if(amount){var newTab=window.open("");newTab.location.href="https://thecrazygm.com/hivetools/utility/tipjar/steembasicincome/"+encodeURIComponent(amount)+"/hive/"+encodeURIComponent(name);}}})();

First off, I wrote this for use on peakd. One could probably tweak it for the other Hive portals, but I always use peakd. Now this does a few things.

  1. If no post is open, it prompts you for a username and then an amount. It then opens a new tab in your browser with everything you need filled in to send some HSBI to whatever username you entered. All you have to do is then hit the "Send Transaction" button.
  2. If a post is open, it automatically grabs the post author username and then prompts you for an amount. Then it opens a new tab with all the info, same as above, ready for you to hit the "Send Transaction" button.
  3. If your own post is open, it prompts for both a username and amount. The assumption here is if your own post is open, you probably want to send the HSBI to a commenter, not yourself (which wouldn't work anyway). I can't think of an easy way to auto copy the commenter's name, so this one still relies on you either copy/pasting it or typing it in yourself.

Now for step 3 to work correctly, you will need to modify that line of code above. Just look through it: near the beginning you will see my username "dbooster" (without quotes). Simply replace my username with yours.

You probably know how to make a bookmarklet, but if not, the easiest way to do it is bookmark a random page and then edit it, replacing the URL with that line of code above.

This bookmarklet currently works perfectly in Brave. In Firefox it will mostly work, but it won't autograb the username. I'm not quite sure why this is and none of the fixes I've tried have worked. If you know a solution, please let me know.

I haven't tested in other browsers, as Keychain support is iffy elsewhere, so I always either use Brave or Firefox with Hive.

So there you go. It works well. Not quite as seamless as a built in button would be, but pretty close. If you send a lot of HSBI like I do, it may save you some time.

If you have any questions, please let me know, and if you want to edit it to add in the other Hive portals or outposts (like ecency, inleo, or any others) or other logic and improvements, please share the result with me.

Tagging @thekittygirl because I think she enjoys keeping track of Hive tools like this

Hi there! David is an American teacher and translator lost in Japan, trying to capture the beauty of this country one photo at a time and searching for the perfect haiku. He blogs here and at laspina.org. Write him on Mastodon.

【Support @dbooster with Hive SBI】

Sort:  

Amazing!!!!

I've honestly never heard of a bookmarklet before.

Wow, really? That amazes me a little. They've been around since the beginning of the web. It's an easy way to execute a bit of javascript to do simple manipulations of a webpage.

Yeah, I have never heard of them :) I was actually looking for a tool the other day, but I don't know if it exists. I might reach out to you in Discord to see if you have heard of something.

This is super-cool and a great use of CrazyGM's "tipjar" tool! Bravo! ✨

Nice innovation! I haven't heard of bookmarklet before, very cool.
!BBH
!PIZZA

PIZZA!
Hive.Pizza upvoted this post.

$PIZZA slices delivered:
@thebighigg(1/5) tipped @dbooster

You can now send $PIZZA tips in Discord via tip.cc!