");
$(".remove-result-btn").click(function() {
chainsPerDay.splice($(this).attr("data-result-id"),1);
instances.splice($(this).attr("data-result-id"),1);
showResults($("#difficulty").val(), xpmToBtc, btcToUsd);
});
$(".result-instances").change(function() {
instances[$(this).attr("data-result-id")] = parseInt($(this).val());
showResults($("#difficulty").val(), xpmToBtc, btcToUsd);
});
}
}
var xpmToBtc;
var btcToUsd;
var chainsPerDay = new Array();
var instances = new Array();
$.when(
$.getJSON("//anty.info/primecoin/price/btc", function(price) {
xpmToBtc = parseFloat(price);
}),
$.getJSON("//anty.info/bitcoin/price/usd", function(price) {
btcToUsd = parseFloat(price);
}),
$.getJSON("//anty.info/primecoin/difficulty/now", function(difficulty) {
$("#difficulty").val(parseFloat(difficulty));
})
).then(function() {
$("#calculator").submit(function(event) {
chainsPerDay.push(parseFloat($("#chainsperday").val()));
instances.push(1);
showResults($("#difficulty").val(), xpmToBtc, btcToUsd);
event.preventDefault();
ga('send', 'pageview');
});
$("#difficulty").change(function() {
showResults($("#difficulty").val(), xpmToBtc, btcToUsd);
ga('send', 'event', 'input', 'change', 'difficulty');
});
$("#refresh-difficulty").click(function() {
$.getJSON("//anty.info/primecoin/difficulty/now", function(difficulty) {
$("#difficulty").val(parseFloat(difficulty));
showResults($("#difficulty").val(), xpmToBtc, btcToUsd);
});
ga('send', 'event', 'button', 'click', 'Refresh difficulty');
});
});
$("#chainsperday-helper").popover({title: "How to get \"chains per day\"", content: "