Last active
May 12, 2018 14:48
-
-
Save krejdster/c0813d2d6e515e5eaecf3cb598c84db4 to your computer and use it in GitHub Desktop.
[Bitbay - transactions PCC]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sumArray = []; | |
var transactionsInterval = setInterval(function() { | |
// Get all buy (bid) transactions | |
$('.bid').closest('.historyItem-wrapper').find('strong#transaction-value').each(function(idx, record) { | |
var price = $(record).text().replace(/pln/ig, '').replace(/ /ig, '').trim(); | |
price = parseFloat(price); | |
sumArray.push(price); | |
}); | |
var nextPageButton = $('.waves-effect.pagination-next-page-button'); | |
// Check if there is "next page" available or is it an end of all transactions | |
if(nextPageButton.hasClass('disabled') == true) { | |
var sumAll = sumArray.reduce((a, b) => a + b, 0); | |
var onePercentOfThat = sumAll / 100; | |
console.log(onePercentOfThat); | |
alert(onePercentOfThat); | |
clearInterval(transactionsInterval); | |
} else { | |
nextPageButton.trigger('click'); | |
} | |
}, 4000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment