You are viewing a single comment's thread from:

RE: Automatically upvote after X minutes (Steemit bookmarklet)

in #steemtools8 years ago

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?

Sort:  

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!

Coin Marketplace

STEEM 0.21
TRX 0.20
JST 0.035
BTC 90558.46
ETH 3133.31
USDT 1.00
SBD 3.06