Automatically upvote after X minutes (Steemit bookmarklet)

in #steemtools8 years ago

I've made a bookmarklet that automatically lays an upvote at the minute mark you decide. Simply activate it, enter at what minute it should vote and keep the tab open. It will tell you in the title bar how many minutes left until vote and also show when a post has been upvoted.

Installation

Head over to steemlets.com and drag the "Vote at X" button to your bookmarks bar.

Alternatively, create a new bookmark and add the following code as URL:

javascript:(function() { function setTitle(voteAt, minutesAgo, originalTitle) { var voteIn = voteAt - minutesAgo; var unit = (voteIn === 1 ? 'minute' : 'minutes'); var newTitle = '<Votes in ' + voteIn + ' ' + unit + '> | ' + originalTitle; if (document.title !== newTitle) { document.title = newTitle; } }; function run(voteAt, originalTitle, voted) { if (!voteAt) { return; } voteAt = parseInt(voteAt); if (document.title.indexOf(originalTitle) === -1) { return; } var timeParts = document.getElementsByTagName('time')[0].innerHTML.split(' '); if (timeParts[1].indexOf('minute') !== -1) { var minutesAgo = parseInt(timeParts[0]); if (minutesAgo >= voteAt) { if (!voted) { document.querySelector('.PostFull__footer [title="Upvote"]').click(); voted = true; }; document.title = '<Upvoted!> | ' + originalTitle; } else { setTitle(voteAt, minutesAgo, originalTitle); } } else { setTitle(voteAt, 0, originalTitle); } setTimeout(function() { run(voteAt, originalTitle, voted); }, 1000); }; if (!document.querySelector('.PostFull__footer [title="Upvote"]')) { alert('Are you on steemit.com? In that case the bookmarklet may have stopped working. Please contact @lantto for an updated version.'); } else { run( parseInt(prompt('Enter at which minute mark it should upvote (e.g. 10, 15, 30 etc):')), document.title, false ); } })();

If you don't see your bookmarks bar you can enable it with Ctrl+Shift+B/Cmd+Shift+B in Chrome.

Full uncompressed source code can be found here.

Why?

When voting on Steemit you get curation rewards for upvoting content early. However, there's a rule in place reducing your reward if you vote too soon. This uses a linear model where you get 0% reward if you vote immediately as its posted, 50% if you vote after 15 minutes and 100% if you vote after 30 minutes or later.

Here is a good article by @liberosist describing this in detail.

When to use this instead of Steemit CountDown?

For most cases you will probably want to monitor the post manually before voting. Steemit CountDown is great for this as you can check out the post now and then to see how it's going. If it's few people who have voted for something you think may become viral it's better to wait and minimize the penalty.

However, sometimes you find an article where you just want to vote after a certain time. In those cases it's nice to set the timer and have it vote automatically.

Disclaimer

I would suggest double-checking that the vote went through before closing the tab. If steemit.com changes its website structure the bookmarklet may stop working and you will need to update it. In that case take a look at my blog for updates or give me a shout and I'll hit you up with a new version.


steemlets.com | steemroll.io

If you like my tools please give me a follow! @lantto

Sort:  

Here's an update since they added the weight vote selector:

javascript:(function() { function setTitle(voteAt, minutesAgo, originalTitle) { var voteIn = voteAt - minutesAgo; var unit = (voteIn === 1 ? 'minute' : 'minutes'); var newTitle = '<Votes in ' + voteIn + ' ' + unit + '> | ' + originalTitle; if (document.title !== newTitle) { document.title = newTitle; } }; function run(voteAt, originalTitle, voted) { if (!voteAt) { return; } voteAt = parseInt(voteAt); if (document.title.indexOf(originalTitle) === -1) { return; } var timeParts = document.getElementsByTagName('time')[0].innerHTML.split(' '); if (timeParts[1].indexOf('minute') !== -1) { var minutesAgo = parseInt(timeParts[0]); if (minutesAgo >= voteAt) { if (!voted) { document.querySelector('.PostFull__footer [title="Upvote"]').click(); document.querySelector('.confirm_weight').click(); voted = true; }; document.title = '<Upvoted!> | ' + originalTitle; } else { setTitle(voteAt, minutesAgo, originalTitle); } } else { setTitle(voteAt, 0, originalTitle); } setTimeout(function() { run(voteAt, originalTitle, voted); }, 1000); }; if (!document.querySelector('.PostFull__footer [title="Upvote"]')) { alert('Are you on steemit.com? In that case the bookmarklet may have stopped working. Please contact @lantto for an updated version.'); } else { run( parseInt(prompt('Enter at which minute mark it should upvote (e.g. 10, 15, 30 etc):')), document.title, false ); } })();

I added this line:

 document.querySelector('.confirm_weight').click(); 

before

voted = true;

As others have already said, clever tool and very useful! But I have a question, if I were to want to just vote always at a certain minute mark, for example 30 min in this case without any prompts, how should I edit the code?

Thanks! Use this code instead:

javascript:(function() { function setTitle(voteAt, minutesAgo, originalTitle) { var voteIn = voteAt - minutesAgo; var unit = (voteIn === 1 ? 'minute' : 'minutes'); var newTitle = '<Votes in ' + voteIn + ' ' + unit + '> | ' + originalTitle; if (document.title !== newTitle) { document.title = newTitle; } }; function run(voteAt, originalTitle, voted) { if (!voteAt) { return; } voteAt = parseInt(voteAt); if (document.title.indexOf(originalTitle) === -1) { return; } var timeParts = document.getElementsByTagName('time')[0].innerHTML.split(' '); if (timeParts[1].indexOf('minute') !== -1) { var minutesAgo = parseInt(timeParts[0]); if (minutesAgo >= voteAt) { if (!voted) { document.querySelector('.PostFull__footer [title="Upvote"]').click(); voted = true; }; document.title = '<Upvoted!> | ' + originalTitle; } else { setTitle(voteAt, minutesAgo, originalTitle); } } else { setTitle(voteAt, 0, originalTitle); } setTimeout(function() { run(voteAt, originalTitle, voted); }, 1000); }; if (!document.querySelector('.PostFull__footer [title="Upvote"]')) { alert('Are you on steemit.com? In that case the bookmarklet may have stopped working. Please contact @lantto for an updated version.'); } else { run( 30, document.title, false ); } })();

The very last part run( 30, document.title, false ); decides. So just replace that with whatever you want.

I may actually make a separate bookmarklet which is simpler and just votes at the 30 mark as that's the most common use case (I believe). Great suggestion anyway!

Thanks for the information automatically vote, it was very useful for me

No problem. Glad you found it useful! :)

it was very nice, may be useful for everyone

You are a hero among common folk ;)
Thank you for helping add to my steemit tools!

Very cool! I made a modification to the Steemit Countdown to send me an alert, but I like this idea much better. I'll check it out.

Thank you! Did we come to any conclusion about the followers-ordered-by-latest thing btw?

it seems not, i would still love to have this at some stage. Lets see if the developers release this feature anytime soon

it gonna become extremely useful as more people follow more people and the feed gets cloggy :)

This is great! I'll be using it regularly. :)

Thanks a lot. :) Glad you like it!

Interesting. I'm new and had no idea there were different payouts depending on when you voted. I'm still learning.

Nice! Putting this in my steemit tools folder. Thank you for the resource. :)

Glad to hear that. No problem! :)