Skip to content

Commit

Permalink
Send bids right from the bot tracker site
Browse files Browse the repository at this point in the history
  • Loading branch information
MattyIce committed Jan 3, 2018
1 parent 70ac448 commit a353bfe
Show file tree
Hide file tree
Showing 5 changed files with 150 additions and 27 deletions.
73 changes: 68 additions & 5 deletions bottracker.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

<script src="https://cdn.steemjs.com/lib/latest/steem.min.js"></script>

<script src="scripts/bottracker.min.js?v=8"></script>
<script src="scripts/bottracker.min.js?v=9"></script>

<script type="text/javascript">
steem.api.setOptions({ url: 'https://api.steemit.com' });
Expand Down Expand Up @@ -103,7 +103,7 @@ <h1>Steem Upvote Bot Tracker</h1>
<p>Welcome to the Steem Upvote Bot Tracker, the #1 place for information on voting bots and other options to <strong style="color: green;">profitably</strong> promote your posts on Steem!</p>
<p>If you like what you see here, you can find more great info by following me on SteemIt at <a target="_blank" href="http://www.steemit.com/@yabapmatt">@yabapmatt</a>.
</p>
<p>I don't charge anything or make any money off of this tool so I would appreciate your support by voting for me for Steem witness! Go to <a href="https://steemit.com/~witnesses" target="_blank">https://steemit.com/~witnesses</a> and enter "yabapmatt" in the vote box at the bottom of the page.
<p>I don't charge anything or make any money off of this tool so I would appreciate your support by voting for @yabapmatt for Steem witness! To vote for me you can <a href="https://v2.steemconnect.com/sign/account-witness-vote?witness=yabapmatt&approve=1">Click Here</a> or go to <a href="https://steemit.com/~witnesses" target="_blank">https://steemit.com/~witnesses</a> and find @yabapmatt in the list and click the upvote icon!.
<p>
<a class="btn btn-primary btn-lg" href="#bid" role="button">Bid-Based Voting Bots</a>
<a class="btn btn-primary btn-lg" href="#paid" role="button">Promotion Services</a>
Expand Down Expand Up @@ -323,8 +323,8 @@ <h3 class="panel-title"><i class="fa fa-sliders mr5"></i> Settings</h3>
<div class="col-lg-8 col-md-6">
<div style="margin-top: 7px;">
<b>$0&nbsp;&nbsp;</b>
<input id="min_vote_slider" type="text" class="span2" value="" data-slider-min="0" data-slider-max="500" data-slider-step="1" data-slider-value="0"/>
<b>&nbsp;&nbsp;$500</b>
<input id="min_vote_slider" type="text" class="span2" value="" data-slider-min="0" data-slider-max="1000" data-slider-step="2" data-slider-value="0"/>
<b>&nbsp;&nbsp;$1,000</b>
</div>
</div>
</div>
Expand All @@ -335,7 +335,8 @@ <h3 class="panel-title"><i class="fa fa-sliders mr5"></i> Settings</h3>

<div class="bs-callout bs-callout-info fade in">
<h4>Vote for Witness!</h4>
<p>Help support me and the bot tracker by voting for me for Steem witness! Go to <a href="https://steemit.com/~witnesses" target="_blank">https://steemit.com/~witnesses</a> to vote. Thank you!</p>
<p>Help support me and the bot tracker by voting for @yabapmatt for Steem witness! To vote, click the button below or go to <a href="https://steemit.com/~witnesses" target="_blank">https://steemit.com/~witnesses</a> and find @yabapmatt in the list and click the upvote icon. Thank you!</p>
<button class="btn btn-success" onclick="window.open('https://v2.steemconnect.com/sign/account-witness-vote?witness=yabapmatt&approve=1');">Vote for @yabapmatt!</button>
</div>

<div class="bs-callout bs-callout-danger fade in">
Expand Down Expand Up @@ -373,6 +374,7 @@ <h4>
<th>Last Vote</th>
<th>Next Vote</th>
<th>Details</th>
<th>Send Bid</th>
</tr>
</thead>
<tbody>
Expand All @@ -386,6 +388,7 @@ <h4>
<td>Loading...</td>
<td>Loading...</td>
<td>Loading...</td>
<td>Loading...</td>
</tr>
</tbody>
</table>
Expand Down Expand Up @@ -722,7 +725,67 @@ <h4 class="modal-title" id="myModalLabel" style="text-align: center;">NOTICE - P
</div>
</div>
</div>

<div class="modal fade modal-style2 modal-center" id="bid_dialog" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel" style="text-align: center;">Send a bid to @<span id="bid_dialog_bot_name"></span>!</h4>
</div>
<div class="modal-body" style="text-align: center;">
<iframe id="bid_dialog_frame" frameborder="0" src="" style="border: none; width: 95%;" height="560"></iframe>
</div>
</div>
</div>
</div>
</div>

<div class="modal fade modal-style2 modal-center" id="bid_details_dialog" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel" style="text-align: center;">Send a bid to @<span id="bid_details_dialog_bot_name"></span>!</h4>
</div>
<div class="modal-body" style="margin: 20px 50px;">
<div class="form-horizontal">
<div class="form-group">
<label for="bid_details_account_name">Your Steem Account Name</label>
<div class="input-group">
<span class="input-group-addon">@</span>
<input type="text" class="form-control" id="bid_details_account_name" placeholder="Account Name">
</div>
</div>

<div class="form-group">
<label for="bid_details_bid_amount">Bid Amount</label>
<div class="input-group">
<input type="text" class="form-control" id="bid_details_bid_amount" placeholder="0.5" value="0.5" style="display: inline; width: 75px;">
<select id="bid_details_bid_currency" class="form-control" style="display: inline; width: 100px; margin-left: 5px;">
<option value="SBD">SBD</option>
<option value="STEEM">STEEM</option>
</select>
</div>
</div>

<div class="form-group">
<label for="bid_details_post_url">Your post URL</label>
<input type="url" class="form-control" id="bid_details_post_url" placeholder="Post URL">
</div>

<div class="alert alert-danger" id="bid_details_error"></div>

<div class="form-group" style="text-align: center;">
<button id="bid_details_btn_submit" class="btn btn-default">Check and Submit!</button>
</div>

</div>
</div>
</div>
</div>
</div>

<div id="footer" class="clearfix white-bg"><!-- Start #footer -->
<p class="pull-left">
Copyright &copy; 2017 <a href="http://www.steemit.com/@yabapmatt" class="color-blue strong" target="_blank">Yabapmatt</a>. All rights reserved.
Expand Down
3 changes: 3 additions & 0 deletions css/icons.css
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,9 @@ Icon packs
.fa-eye:before {
content: "\f06e";
}
.fa-up:before {
content: "\e133";
}
.fa-eye-slash:before {
content: "\f070";
}
Expand Down
97 changes: 77 additions & 20 deletions scripts/bottracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ $(function () {
}
});

steem.api.getAccounts(['hottopic', 'bumper', 'echowhale', 'tipu', 'randofish', 'lays', 'thehumanbot', 'steemvote', 'upvotewhale', 'withsmn', 'minnowpond', 'resteembot', 'originalworks', 'treeplanter', 'followforupvotes', 'steemthat', 'frontrunner', 'steemvoter', 'morwhale', 'moonbot', 'drotto', 'blockgators', 'superbot'], function (err, result) {
steem.api.getAccounts(['microbot', 'hottopic', 'bumper', 'echowhale', 'tipu', 'randofish', 'lays', 'thehumanbot', 'steemvote', 'upvotewhale', 'withsmn', 'minnowpond', 'resteembot', 'originalworks', 'treeplanter', 'followforupvotes', 'steemthat', 'frontrunner', 'steemvoter', 'morwhale', 'moonbot', 'drotto', 'blockgators', 'superbot'], function (err, result) {
try {
result.sort(function (a, b) { return getVoteValue(100, b) - getVoteValue(100, a); });

Expand Down Expand Up @@ -202,7 +202,7 @@ $(function () {
}
});

setTimeout(loadAccountInfo, 60 * 1000);
setTimeout(loadAccountInfo, 60 * 10 * 1000);
}

var first_load = true;
Expand Down Expand Up @@ -269,7 +269,7 @@ $(function () {
return;
}

steem.api.getAccountHistory(account.name, -1, (first_load) ? 500 : 10, function (err, result) {
steem.api.getAccountHistory(account.name, -1, (first_load) ? 500 : 20, function (err, result) {
if (err) return;

if (!bot.rounds)
Expand Down Expand Up @@ -378,26 +378,41 @@ $(function () {
return (memo.lastIndexOf('/') >= 0 && memo.lastIndexOf('@') >= 0);
}

function checkPost(bot, transId, memo) {
var permLink = memo.substr(memo.lastIndexOf('/') + 1);
var author = memo.substring(memo.lastIndexOf('@') + 1, memo.lastIndexOf('/'));
function checkPost(bot, memo, amount, currency, callback) {
if (currency == 'STEEM' && !bot.accepts_steem) {
callback('This bot does not accept STEEM bids!');
return;
}
else if (currency == 'STEEM' && parseFloat(amount) < bot.min_bid_steem) {
callback('Bid is below the minimum, please bid ' + bot.min_bid_steem + ' STEEM or more!');
return;
}
else if (currency == 'SBD' && parseFloat(amount) < bot.min_bid) {
callback('Bid is below the minimum, please bid ' + bot.min_bid + ' SBD or more!');
return;
}

steem.api.getContent(author, permLink, function (err, result) {
if (!err && result && result.id > 0) {
var created = new Date(result.created + 'Z');
var permLink = memo.substr(memo.lastIndexOf('/') + 1);
var author = memo.substring(memo.lastIndexOf('@') + 1, memo.lastIndexOf('/'));

var votes = result.active_votes.filter(function(vote) { return vote.voter == bot.name; });
var already_voted = false; //votes.length > 0 && (new Date() - new Date(votes[0].time + 'Z') > 20 * 60 * 1000);
steem.api.getContent(author, permLink, function (err, result) {
if (!err && result && result.id > 0) {
var created = new Date(result.created + 'Z');

if(already_voted || (new Date() - created) >= ((6 * 24 + 8) * 60 * 60 * 1000)) {
// This post is already voted on by this bot or the post is too old to be voted on
removePost(bot, transId);
}
} else {
// Invalid memo
removePost(bot, transId);
}
});
var votes = result.active_votes.filter(function (vote) { return vote.voter == bot.name; });
var already_voted = votes.length > 0 && (new Date() - new Date(votes[0].time + 'Z') > 20 * 60 * 1000);

if (already_voted) {
// This post is already voted on by this bot
callback("This bot has already voted on this post!");
} else if ((new Date() - created) >= (bot.max_post_age * 24 * 60 * 60 * 1000)) {
// This post is too old
callback("This post is past the max age accepted by this bot!");
} else
callback(null); // Post is ok!
} else
callback("There was an error loading this post, please check the URL.");
});
}

function removePost(bot, transId) {
Expand Down Expand Up @@ -551,6 +566,12 @@ $(function () {
td.append(link);
row.append(td);

td = $(document.createElement('td'));
var link = $('<a href="javascript:void(0);"><i class="fa fa-upload mr5"></i>Send Bid</a>');
link.click(function (e) { sendBid(bot); });
td.append(link);
row.append(td);

if ((bid_sbd > 0 || bid_steem > 0) && bot.next < 0.16 * HOURS && bot.last > 0.5 * HOURS) {
row.addClass('green-bg');

Expand Down Expand Up @@ -723,6 +744,41 @@ $(function () {
});
}

var _dialog = null;

function sendBid(bot) {
$('#bid_details_dialog_bot_name').text(bot.name);
$('#bid_details_error').hide();
$('#bid_details_btn_submit').click(submitBid);
$('#bid_details_post_url').val('');
_dialog = $('#bid_details_dialog').modal();
_dialog.off('hidden.bs.modal');
_dialog.bot = bot;
}

function submitBid() {
var to = $('#bid_details_dialog_bot_name').text();
var from = $('#bid_details_account_name').val();
var amount = $('#bid_details_bid_amount').val();
var currency = $('#bid_details_bid_currency').val();
var url = $('#bid_details_post_url').val();

checkPost(_dialog.bot, url, amount, currency, function (error) {
if (error) {
$('#bid_details_error').html('<b>Error:</b> ' + error);
$('#bid_details_error').show();
} else {
_dialog.on('hidden.bs.modal', function (e) {
$('#bid_dialog_bot_name').text(to);
$('#bid_dialog_frame').attr('src', 'https://v2.steemconnect.com/sign/transfer?from=' + from + '&to=' + to + '&amount=' + amount + ' ' + currency + '&memo=' + url);
_dialog = $('#bid_dialog').modal();
});

_dialog.modal('hide');
}
});
}

setTimeout(loadBotInfo, 5 * 1000);
setTimeout(loadAccountInfo, 5 * 1000);
setInterval(updateTimers, 1000);
Expand Down Expand Up @@ -800,3 +856,4 @@ $(function () {
// Show disclaimer message
setTimeout(function () { $('#disclaimer').modal(); }, 2000);
});

Loading

0 comments on commit a353bfe

Please sign in to comment.