Name |
Description |
Current Winner |
Current Best Ticket |
Total Amount |
Next Draw |
Ticket Cost |
Buy Ticket |
Instructions:
- Pick the lottery you like
- Purchase your ticket
- Best of luck!!
')
$('.alert-area').hide();
$('.alert-area').fadeIn('slow');
} else {
$('.alert-area').show();
$('.alert-area').fadeIn('slow');
$(".alert-area").html(' Transaction has been processed successfully. Good luck!
')
$('.alert-area').hide();
$('.alert-area').fadeIn('slow');
}
}
$('#buyTicket').on('show.bs.modal', function(e) {
var totalAmount = $(e.relatedTarget).data('total-amount');
var atId = $(e.relatedTarget).data('at-id');
$(e.currentTarget).find('input[name="total-amount"]').val(totalAmount);
$(e.currentTarget).find('input[name="at-id"]').val(atId);
});
$(document).ready(function() {
$.ajax({
url: 'http://' + window.location.hostname.toLowerCase() + ':' + window.location.port + '/burst',
type: 'POST',
dataType: "json",
data: "requestType=getATIds",
success: function(data, textStatus, jqXHR) {
drawTable(data);
}
});
});
function getInfo1(atId){
jsonRequest = {
requestType: "getAT",
at: atId.toString()
}
$.ajax({
url: 'http://' + window.location.hostname.toLowerCase() + ':' + window.location.port + '/burst',
type: 'POST',
dataType: "json",
data: jsonRequest,
success: function(response, textStatus, jqXHR) {
if ( response.description.toLowerCase().indexOf('lucky') > -1 || response.name.toLowerCase().indexOf('lucky') > -1 || response.description.toLowerCase().indexOf('lottery') > -1 || response.name.toLowerCase().indexOf('lottery') > -1)
{
drawRow(atId);
}
}
});
}
function getInfo(atId) {
if ($("#" + atId).is(":hidden")) {
$("#" + atId).show();
window.setInterval(function() {
getInfo(atId)
}, 10000);
}
jsonRequest = {
requestType: "getAT",
at: atId.toString()
}
$.ajax({
url: 'http://' + window.location.hostname.toLowerCase() + ':' + window.location.port + '/burst',
type: 'POST',
dataType: "json",
data: jsonRequest,
success: function(response, textStatus, jqXHR) {
if ( response.description.toLowerCase().indexOf('lucky') > -1 || response.name.toLowerCase().indexOf('lucky') > -1 || response.description.toLowerCase().indexOf('lottery') > -1 || response.name.toLowerCase().indexOf('lottery') > -1)
{
addToTable(response, atId)
}
}
});
}
function addToTable(data, atId) {
drawDtlRow(data, atId)
}
function longToRS(resp, wh, data, atId) {
jsonRequest = {
requestType: "rsConvert",
account: resp.hex2long
}
$.ajax({
url: 'http://' + window.location.hostname.toLowerCase() + ':' + window.location.port + '/burst',
type: 'POST',
dataType: "json",
data: jsonRequest,
success: function(response, textStatus, jqXHR) {
parseResults(response, 0, data, atId)
}
});
}
function drawDtlRow(data, atId) {
jsonRequest = {
requestType: "getATLong",
hexString: data.machineData.substring(9 * 16, 9 * 16 + 16)
}
$.ajax({
url: 'http://' + window.location.hostname.toLowerCase() + ':' + window.location.port + '/burst',
type: 'POST',
dataType: "json",
data: jsonRequest,
success: function(response, textStatus, jqXHR) {
longToRS(response, 0, data, atId)
}
});
jsonRequest = {
requestType: "getATLong",
hexString: data.machineData.substring(8 * 16, 8 * 16 + 16)
}
$.ajax({
url: 'http://' + window.location.hostname.toLowerCase() + ':' + window.location.port + '/burst',
type: 'POST',
dataType: "json",
data: jsonRequest,
success: function(response, textStatus, jqXHR) {
parseResults(response, 1, data, atId)
}
});
jsonRequest = {
requestType: "getATLong",
hexString: data.machineData.substring(3 * 16, 3 * 16 + 16)
}
$.ajax({
url: 'http://' + window.location.hostname.toLowerCase() + ':' + window.location.port + '/burst',
type: 'POST',
dataType: "json",
data: jsonRequest,
success: function(response, textStatus, jqXHR) {
parseResults(response, 2, data, atId)
}
});
jsonRequest = {
requestType: "rsConvert",
account: atId
}
$.ajax({
url: 'http://' + window.location.hostname.toLowerCase() + ':' + window.location.port + '/burst',
type: 'POST',
dataType: "json",
data: jsonRequest,
success: function(response, textStatus, jqXHR) {
parseResults(response, 3, data, atId)
}
});
jsonRequest = {
requestType: "getATLong",
hexString: data.machineData.substring(1 * 8, 1 * 8 + 8)
}
$.ajax({
url: 'http://' + window.location.hostname.toLowerCase() + ':' + window.location.port + '/burst',
type: 'POST',
dataType: "json",
data: jsonRequest,
success: function(response, textStatus, jqXHR) {
parseResults(response, 4, data, atId)
}
});
jsonRequest = {
requestType: "getATLong",
hexString: data.machineData.substring(1 * 16, 1 * 16 + 16)
}
$.ajax({
url: 'http://' + window.location.hostname.toLowerCase() + ':' + window.location.port + '/burst',
type: 'POST',
dataType: "json",
data: jsonRequest,
success: function(response, textStatus, jqXHR) {
getMinFee(response, 5, data, atId)
}
});
}
function hex2Long(resp, wh, data, atId) {
jsonRequest = {
requestType: "getATLong",
hexString: resp.attachment.creationBytes.substring(6 * 4, 6 * 4 + 16)
}
$.ajax({
url: 'http://' + window.location.hostname.toLowerCase() + ':' + window.location.port + '/burst',
type: 'POST',
dataType: "json",
data: jsonRequest,
success: function(response, textStatus, jqXHR) {
parseResults(response, 5, data, atId)
}
});
}
function getMinFee(resp, wh, data, atId) {
jsonRequest = {
requestType: "getTransaction",
transaction: atId
}
$.ajax({
url: 'http://' + window.location.hostname.toLowerCase() + ':' + window.location.port + '/burst',
type: 'POST',
dataType: "json",
data: jsonRequest,
success: function(response, textStatus, jqXHR) {
hex2Long(response, 5, resp, atId)
}
});
}
function parseResults(response, wh, data, atId) {
$("#" + atId + " td.name").html(data.name)
//$("#" + atId + " td.creator").html(data.creatorRS)
$("#" + atId + " td.description").html(data.description)
if (wh == 0) {
if ($("#" + atId + " td.winner").html() != response.accountRS) {
$("#" + atId + " td.winner").effect("highlight", {}, 3500)
$("#" + atId + " td.winner").html(response.accountRS)
} else {
$("#" + atId + " td.winner").html(response.accountRS)
}
if ($("#" + atId + " td.winner").html() == $("#monitor-account").val()) {
$("#" + atId).css('background-color', '#CCFF99');
} else {
$("#" + atId).css('background-color', 'none');
}
} else if (wh == 1)
if ($("#" + atId + " td.ticket").html() != response.hex2long) {
$("#" + atId + " td.ticket").effect("highlight", {}, 3500)
$("#" + atId + " td.ticket").html(response.hex2long)
} else
$("#" + atId + " td.ticket").html(response.hex2long)
else if (wh == 2) {
if ($("#" + atId + " td.quantityNQT").html() != response.hex2long / 100000000) {
$("#" + atId + " td.quantityNQT").effect("highlight", {}, 3500)
$("#" + atId + " td.quantityNQT").html(response.hex2long / 100000000)
} else
$("#" + atId + " td.quantityNQT").html(response.hex2long / 100000000)
} else if (wh == 4) {
if ($("#" + atId + " td.draw-in").html() != "after block: " + response.hex2long) {
$("#" + atId + " td.draw-in").effect("highlight", {}, 3500)
$("#" + atId + " td.draw-in").html("after block: " + response.hex2long)
} else
$("#" + atId + " td.draw-in").html("after block: " + response.hex2long)
} else if (wh == 5) {
var nqt = Number(data.hex2long);
var fee = Number(response.hex2long);
var total = nqt + fee;
if ($("#" + atId + " td.ticket-size").html() != total / 100000000) {
$("#" + atId + " td.ticket-size").effect("highlight", {}, 3500)
$("#" + atId + " td.ticket-size").html(total / 100000000)
} else
$("#" + atId + " td.ticket-size").html(total / 100000000)
}
var nqt = Number(data.hex2long);
var fee = Number(response.hex2long);
var total = nqt + fee;
$("#" + atId + " td.buy-ticket").html("Buy Ticket")
}
function drawTable(data) {
for (var i = 0; i " + rowData + ""));
var row = $("")
$("#at").append(row);
row.append(" | ")
row.append(" | ")
row.append(" | ");
row.append(" |
");
row.append(" | ");
row.append(" | ");
row.append(" | ");
row.append(" | ");
$("#" + rowData).hide();
}