Created
March 19, 2015 16:34
-
-
Save HelloZeroNet/f2ac7e34d12336069896 to your computer and use it in GitHub Desktop.
Bitcoin donate bar
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
<html> | |
<body> | |
<style> | |
.bitcoinbar { | |
width: 150px; margin-top: 5px; display: inline-block; height: 20px; border-radius: 5px; position: relative; | |
font-family: Consolas, Monospace; background-color: #eee; color: black; vertical-align: bottom; text-decoration: none | |
} | |
.bitcoinbar .progress { | |
text-align: center; display: block; position: relative; | |
font-size: 11px; vertical-align: middle; line-height: 22px; | |
} | |
.bitcoinbar:before { background-color: red; width: 50%; height: 20px; display: block; content: ""; border-radius: 5px; position: absolute; } | |
</style> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> | |
<ul> | |
<li><a href="bitcoin:1QDhxQ6PraUZa21ET5fYUCPgdrwBomnFgX" class="bitcoinbar" data-address="1QDhxQ6PraUZa21ET5fYUCPgdrwBomnFgX" data-goal="1.0"><div class='progress'>10%</div></a> Donate towoard ZeroNet second 2015 quarter development.</li> | |
<li><a href="bitcoin:1EU1tbG9oC1A8jz2ouVwGZyQ5asrNsE4Vr" class="bitcoinbar" data-address="1EU1tbG9oC1A8jz2ouVwGZyQ5asrNsE4Vr" data-goal="2.0">22%</a> Donate towoard DHT support.</li> | |
</ul> | |
<script> | |
function applyBitcoinbarData(elem, data) { | |
console.log(elem, data) | |
} | |
function updateBitcoinbars() { | |
var addresses = [] | |
$(".bitcoinbar").each(function() { | |
addresses.push("addresses="+$(this).data("address")) | |
}) | |
$.get("https://mainnet.helloblock.io/v1/addresses?"+addresses.join("&"), function(res) { | |
console.log(res.data.addresses) | |
for (var i=0;i<res.data.addresses.length;i++) { | |
var address_data = res.data.addresses[i] | |
elem = $(".bitcoinbar[data-address="+address_data.address+"]") | |
applyBitcoinbarData(elem, address_data) | |
} | |
}) | |
} | |
updateBitcoinbars() | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment