You have BLATENTLY stolen our javascript.
bitgrenade :
$(document).ready(function() {
function toHMS(seconds)
{
seconds = seconds-1;
if(seconds > 0)
{
var h = Math.floor(seconds / 3600);
var m = Math.floor(seconds % 3600 / 60);
var s = Math.floor(seconds % 3600 % 60);
var result = (h < 10 ? "0" + h : h) + ":" + (m < 10 ? "0" + m : m) + ":" + (s < 10 ? "0" + s : s);
return result;
}
}
function updateTimers()
{
$(".timer").each(function() {
if(!isNaN($(this).html()))
{
seconds = $(this).html();
}
else
{
var hms = $(this).html();
var a = hms.split(":");
var seconds = (+a[0]) * 60 * 60 + (+a[1]) * 60 + (+a[2]);
}
if(seconds > 0)
{
$(this).html(toHMS(seconds));
}
else
{
$(this).html("N/A");
//pollGrenades();
}
});
}
$(".timer").each(function()
{
$(this).html(toHMS($(this).html()));
});
$(".grenade_button").live("click",function() {
var str = $(this).attr("id");
var id = str.match(/[0-9]+/g);
var address = $("#address").val();
var nick = $("#nick").val();
var url = $("#url").val();
$.ajax({
url: "./",
type: "POST",
async: false,
data: "action=buy.grenade&grenade_id="+id+"&address="+address+"&nick="+nick+"&url="+url,
success: function(data) {
if (data.error == 1) {
display_notify(data.title,data.msg,0);
} else {
$("#deposit_fields").html(data.msg);
pollGrenades();
}
}
});
});
var pollingGrenades = false;
function pollGrenades() {
if (! pollingGrenades) {
pollingGrenades = true;
$.ajax({
url: "./",
type: "POST",
async: false,
data: "action=get.grenades&coin_id="+1,
success: function(data) {
$("#grenade_wrapper").html(data.grenades);
}
});
pollingGrenades = false;
}
}
setInterval(updateTimers, 1000);
setInterval(pollGrenades, 30000);
updateTimers();
$("#coin_display").val(1);
$("#coin_display").change(function() {
$("form#coin_select_form").submit();
});
$("#faq_link").click(function() {
$("#faq").modal({
overlayClose:true,
opacity:65,
overlayCss: {backgroundColor:"#000"}
});
});
});
CoinBomb.comfunction toHMS(seconds)
{
seconds = seconds-1;
if(seconds > 0)
{
var h = Math.floor(seconds / 3600);
var m = Math.floor(seconds % 3600 / 60);
var s = Math.floor(seconds % 3600 % 60);
var result = (h < 10 ? "0" + h : h) + ":" + (m < 10 ? "0" + m : m) + ":" + (s < 10 ? "0" + s : s);
return result;
}
}
function updateTimers()
{
$('.timer').each(function() {
if(!isNaN($(this).html()))
{
seconds = $(this).html();
}
else
{
var hms = $(this).html();
var a = hms.split(':');
var seconds = (+a[0]) * 60 * 60 + (+a[1]) * 60 + (+a[2]);
}
if(seconds > 0)
{
$(this).html(toHMS(seconds));
}
else
{
pollBombs('BTC');
}
});
}
var pollRunning = false;
function pollBombs()
{
if(!pollRunning)
{
pollRunning = true;
$.ajax({
url: "poll.php",
type: "POST",
data: {currencyName : currencyName},
dataType: "html"
})
.done(function(msg)
{
var $msg = $(msg);
$msg.find('.timer').each(function()
{
$(this).html(toHMS($(this).html()));
});
$('#bombWrapper').html($msg);
resizeContainer();
}
)
.always(function()
{
window.pollRunning = false
}
);
}
}