function timers() {
}
setInterval(function() {
if($(".bid-histories table tr:nth-child(1) td:nth-child(3)").html()==$(".bid-histories table tr:nth-child(2) td:nth-child(3)").html()){
$(".bid-histories table tr:nth-child(1)").remove();
}
}, 100);
jQuery(document).ready(function() {
$('.arrow1').addClass('blinkEffect');
setTimeout(function() {
$('.arrow2').addClass('blinkEffect');
}, 500);
var isDetailView = 0;
var options1 = {
chart: {
height: 360,
type: 'radialBar',
},
plotOptions: {
radialBar: {
startAngle: -180,
endAngle: 180,
hollow: {
margin: 0,
size: '70%',
background: '#fff',
image: undefined,
imageOffsetX: 0,
imageOffsetY: 0,
position: 'front',
dropShadow: {
enabled: true,
top: 3,
left: 0,
blur: 4,
opacity: 0.24
}
},
track: {
background: '#fff',
strokeWidth: '67%',
margin: 0, // margin is in pixels
dropShadow: {
enabled: true,
top: -3,
left: 0,
blur: 4,
opacity: 0.35
}
},
dataLabels: {
showOn: 'always',
name: {
offsetY: -10,
show: true,
color: '#888',
fontSize: '17px'
},
value: {
formatter: function(val) {
return parseInt(val);
},
color: '#111',
fontSize: '36px',
show: false,
}
}
}
},
fill: {
colors: ['#bf267f'],
type: 'gradient',
gradient: {
shade: 'black',
type: 'diagonal1',
shadeIntensity: 1,
gradientToColors: ['#000', '#000'],
inverseColors: false,
opacityFrom: 1,
opacityTo: 1,
stops: [0, 100]
}
},
series: [75],
stroke: {
lineCap: 'round'
},
labels: [""],
responsive: [{
breakpoint: 576,
options: {
chart: {
height: 200,
type: 'radialBar',
},
},
}],
responsive: [{
breakpoint: 470,
options: {
chart: {
height: 100,
type: 'radialBar',
},
},
}],
responsive: [{
breakpoint: 1200,
options: {
chart: {
height: 250,
type: 'radialBar',
},
},
}, {
breakpoint: 470,
options: {
chart: {
height: 150,
type: 'radialBar',
},
},
}, {
breakpoint: 576,
options: {
chart: {
height: 220,
type: 'radialBar',
},
},
}]
}
if ($('.priceChart').length > 0) {
isDetailView = 1;
options1['chart']['height'] = 350;
options1['plotOptions']['radialBar']['startAngle'] = -170;
options1['plotOptions']['radialBar']['endAngle'] = 190;
}
var options_p = {
chart: {
height: 350,
type: 'radialBar',
},
plotOptions: {
radialBar: {
startAngle: -135,
endAngle: 225,
hollow: {
margin: 0,
size: '70%',
background: '#fff',
image: undefined,
imageOffsetX: 0,
imageOffsetY: 0,
position: 'front',
dropShadow: {
enabled: true,
top: 3,
left: 0,
blur: 4,
opacity: 0.24
}
},
track: {
background: '#fff',
strokeWidth: '67%',
margin: 0, // margin is in pixels
dropShadow: {
enabled: true,
top: -3,
left: 0,
blur: 4,
opacity: 0.35
}
},
dataLabels: {
showOn: 'always',
name: {
offsetY: -10,
show: true,
color: '#888',
fontSize: '17px'
},
value: {
formatter: function(val) {
return parseInt(val);
},
color: '#111',
fontSize: '36px',
show: true,
}
}
}
},
fill: {
type: 'gradient',
gradient: {
shade: 'dark',
type: 'vertical',
shadeIntensity: 0.5,
gradientToColors: ['#000'],
inverseColors: false,
opacityFrom: 1,
opacityTo: 1,
stops: [0, 100]
}
},
series: [75],
stroke: {
lineCap: 'round'
},
}
function valBetween(v, min, max) {
return (Math.min(max, Math.max(min, v)));
}
function SetChart(auction_id, val, txt = "") {
var i = valBetween(Math.ceil((val / 100) * 20), 1, 20);
for (j = 1; j <= i; j++)
$('.' + auction_id + ' #gauge path:nth-child(' + j + ')').show();
for (j = i + 1; j <= 20; j++)
$('.' + auction_id + ' #gauge path:nth-child(' + j + ')').hide();
$('.' + auction_id + ' #gauge-label')
.css('color', $('.' + auction_id + ' #gauge path:nth-child(' + i + ')')[0].style.fill);
if (txt == "") {
var str = Math.floor(val / 10) + '"';
$('.' + auction_id + ' #gauge-label').text(str);
} else {
$('.' + auction_id + ' #gauge-label').text(txt);
}
}
function SetPriceChart(val, max) {
var i = valBetween(Math.ceil((val - (max - 1) / 1) * 28), 1, 28);
//console.log(val, max, i);
for (j = 1; j <= i; j++)
$('.priceChart #gauge path:nth-child(' + j + ')').show();
for (j = i + 1; j <= 28; j++)
$('.priceChart #gauge path:nth-child(' + j + ')').hide();
if( check_premium == 0)
$('#gauge').css('box-shadow', '0 0 32px rgba(21, 55, 172, 0.25), inset 0 -192px 192px -240px ' + $('#gauge path:nth-child(' + i + ')')[0].style.fill + ', inset 0 0 2px -1px ' + $('#gauge path:nth-child(' + i + ')')[0].style.fill);
}
var auctionObjects = new Array();
$('.auction-item').each(function() {
if ($(this).hasClass('is_closed'))
return;
var auctionId = $(this).attr('id');
auctionObjects[auctionId] = $('.' + auctionId);
auctionObjects[auctionId]['flash-elements'] = $('.' + auctionId + ' .countdown, .' + auctionId + ' .bid-price, .', +auctionId + ' .blink');
auctionObjects[auctionId]['bt'] = $('.' + auctionId + ' .bnr_timer_calculation');
auctionObjects[auctionId]['bid-price'] = $('.' + auctionId + ' .bid-price');
auctionObjects[auctionId]['bid-value'] = $('.' + auctionId + ' .bid-value');
auctionObjects[auctionId]['product-value'] = $('.' + auctionId + ' .product-value');
auctionObjects[auctionId]['p_value'] = $('.' + auctionId + ' .p_value');
auctionObjects[auctionId]['timerChart1'] = $('.' + auctionId + ' .timerChart');
auctionObjects[auctionId]['a-saving'] = $('.' + auctionId + ' .auctionSavings');
if (isDetailView) {
auctionObjects[auctionId]['timerChart'] = new ApexCharts(
document.querySelector('.' + auctionId + ' .timerChart'),
options1
);
auctionObjects[auctionId]['timerChart'].render();
}
auctionObjects[auctionId]['bid-bidder'] = $('.' + auctionId + ' .bid-bidder');
auctionObjects[auctionId]['timer'] = $('.' + auctionId + ' .countdown');
auctionObjects[auctionId]['blink'] = $('.' + auctionId + ' .blink');
auctionObjects[auctionId]['seat_status'] = $('.' + auctionId + ' .seat_status');
auctionObjects[auctionId]['time_inc'] = $('.' + auctionId + ' .time_inc');
auctionObjects[auctionId]['min_seat'] = $('.' + auctionId + ' .min_seat');
auctionObjects[auctionId]['seat_sold'] = $('.' + auctionId + ' .seat_sold');
auctionObjects[auctionId]['reverse_state'] = $('.' + auctionId + ' .reverse_state');
auctionObjects[auctionId]['closed_status'] = $('.' + auctionId + ' .closed_status');
auctionObjects[auctionId]['div_bidButton'] = $('.' + auctionId + ' .div_bidButton');
auctionObjects[auctionId]['bid-button'] = $('.' + auctionId + ' .bid-button');
auctionObjects[auctionId]['indicadores'] = $('.' + auctionId + ' .indicadores');
auctionObjects[auctionId]['time_left'] = $('.' + auctionId + ' .time_left');
auctionObjects[auctionId]['no_mostrar'] = $('.' + auctionId + ' .no_mostrar');
auctionObjects[auctionId]['bid-loading'] = $('.' + auctionId + ' .bid-loading');
auctionObjects[auctionId]['bid-message'] = $('.' + auctionId + ' .bid-message');
auctionObjects[auctionId]['a-saving'] = $('.' + auctionId + ' .auctionSavings');
auctionObjects[auctionId]['bid-histories'] = $('#bidHistoryTable' + auctionId);
auctionObjects[auctionId]['bid-histories-p'] = $('#bidHistoryTable' + auctionId + ' p');
auctionObjects[auctionId]['bid-histories-tbody'] = $('#bidHistoryTable' + auctionId + ' tbody');
auctionObjects[auctionId]['apexcharts-canvas'] = $('.' + auctionId + ' .apexcharts-canvas');
});
setInterval(function() {
$('.auction-item').each(function() {
if ($(this).hasClass('is_closed'))
return;
var auctionId = $(this).attr('id');
var closed = parseInt(auctionObjects[auctionId]['closed_status'].html());
var diff = parseInt(auctionObjects[auctionId]['bt'].html());
var diff_raw = parseInt(auctionObjects[auctionId]['bt'].html());
if(diff_raw<8){
$('#'+auctionId).removeClass('add-border');
}
var seat_status = parseInt(auctionObjects[auctionId]['seat_status'].html());
var time_inc = parseInt(auctionObjects[auctionId]['time_inc'].html());
var min_seat = parseInt(auctionObjects[auctionId]['min_seat'].html());
var seat_sold = parseInt(auctionObjects[auctionId]['seat_sold'].html());
var bidder = auctionObjects[auctionId]['bid-bidder'].html();
var bidPrice = auctionObjects[auctionId]['bid-price'].html();
if (diff < 0) diff = 1;
var day = parseInt(Math.floor(diff / 86400));
if (day < 1) {
day = 0;
} else {
day = day;
}
diff -= day * 86400;
var hour = parseInt(Math.floor(diff / 3600));
if (hour < 10) hour = '0' + hour;
diff -= hour * 3600;
var minute = parseInt(Math.floor(diff / 60));
if (minute < 10) minute = '0' + minute;
diff -= minute * 60;
var second = parseInt(diff);
if (second < 10) second = '0' + second;
var result = day + 'd ' + hour + ':' + minute + ':' + second;
if (day > 0) {
var result = day + 'd ' + hour + ':' + minute + ':' + second;
} else {
var result = hour + ':' + minute + ':' + second;
}
if (seat_status == 1 && seat_sold != min_seat) {
var result = seat_sold + '/' + min_seat + Seats;
}
//console.log(diff_raw, "====>", diff);
var isDisplaySeat = auctionObjects[auctionId]['time_left'].data('info');
if (isDisplaySeat) {
var t_minSeat = parseInt(auctionObjects[auctionId]['min_seat'].html());
var t_seatSold = parseInt(auctionObjects[auctionId]['seat_sold'].html());
var tmp = Math.floor(100 * t_seatSold / t_minSeat);
if (!isDetailView) {
auctionObjects[auctionId]['time_left'].css('opacity', '0');
auctionObjects[auctionId]['timer'].css('opacity', '0');
SetChart(auctionId, tmp, t_seatSold + "/" + t_minSeat);
} else {
auctionObjects[auctionId]['timerChart'].updateSeries([tmp]);
auctionObjects[auctionId]['timer'].html(t_seatSold + "/" + t_minSeat);
}
var html = auctionObjects[auctionId]['bid-bidder'].html();
var tmp1 = t_minSeat - t_seatSold;
var tmp2 = tmp1 + 1;
tmp1 = tmp1.toString();
tmp2 = tmp2.toString();
html = html.replace(tmp2, tmp1);
auctionObjects[auctionId]['bid-bidder'].html(html);
} else {
if (diff_raw > 0) {
//console.log(auctionId, '===>', result);
if (diff_raw > 180) {
auctionObjects[auctionId]['timer'].html(result);
if (!isDetailView) {
auctionObjects[auctionId]['timerChart1'].hide();
auctionObjects[auctionId]['time_left'].css('opacity', '1');
auctionObjects[auctionId]['timer'].css('opacity', '1');
} else if (isDetailView) {
auctionObjects[auctionId]['apexcharts-canvas'].css('display', 'none');
} else
auctionObjects[auctionId]['timerChart'].updateSeries([100]);
} else {
auctionObjects[auctionId]['timer'].html(diff_raw + '"');
if (!isDetailView) {
auctionObjects[auctionId]['timerChart1'].show();
auctionObjects[auctionId]['time_left'].css('opacity', '0');
auctionObjects[auctionId]['timer'].css('opacity', '0');
}
if (diff_raw > 10) {
if (!isDetailView)
SetChart(auctionId, 100, diff_raw + '"');
else
auctionObjects[auctionId]['timerChart'].updateSeries([100]);
} else {
if (!isDetailView){
if(check_premium == 0)
SetChart(auctionId, diff_raw * 10);
}else{
auctionObjects[auctionId]['timerChart'].updateSeries([diff_raw * 10]);
}
auctionObjects[auctionId]['bid-bidder'].stop();
auctionObjects[auctionId]['bid-price'].stop();
auctionObjects[auctionId]['bid-bidder'].attr('style', '');
auctionObjects[auctionId]['bid-price'].attr('style', '');
}
}
} else {
if (closed == 1) {
if (page_name == 'view') {
location.reload();
return false;
}
if (page_name == 'view_mistery') {
location.reload();
return false;
}
auctionObjects[auctionId]['timerChart1'].hide();
if (auctionObjects[auctionId].hasClass('detail_view')) {
var txt =
'
Sold For
' + bidPrice + '
' + auctionObjects[auctionId].data('p1') + 'Save over , ' + auctionObjects[auctionId].data('p2') + '
This auction its closed, the winner is ' + bidder + '
Sold The auction is finished, the user ' + bidder + ' won it for ' + bidPrice + ' Congratulations
Each bid reverts the timer back to 10s
Highest bidder wins!
';
auctionObjects[auctionId].find(".content_manage_hieght").html(txt);
auctionObjects[auctionId].closest(".box").addClass('view_close');
if (auctionObjects[auctionId].closest('#auction-details').find('.close_sticker').length)
auctionObjects[auctionId].closest('#auction-details').find('.center_img').addClass('is_closed').append('');
} else {
$('.' + auctionId + ' .auc_btm_content').css('opacity', '0');
$('.' + auctionId + ' .auc_btm_content').hide();
$('.' + auctionId + ' .closePanel').show();
auctionObjects[auctionId]['timer'].css('opacity', '1');
auctionObjects[auctionId]['timer'].html(Sold);
auctionObjects[auctionId]['div_bidButton'].hide();
var tmp1 = parseFloat(auctionObjects[auctionId]['product-value'].html());
var tmp2 = auctionObjects[auctionId]['bid-value'].html();
tmp2 = tmp2.replace(',', '.');
tmp2 = parseFloat(tmp2);
//console.log('tmp1_' + tmp1);
//console.log('tmp2_' + tmp2);
tmp1 = tmp1 - tmp2;
//console.log('tmp1_' + tmp1);
tmp2 = commaSeparateNumber(tmp1);
//console.log('tmp222_' + tmp2);
tmp2 = tmp2.toString();
tmp2 = tmp2.replace(',', '@');
tmp2 = tmp2.replace('.', ',');
tmp2 = tmp2.replace('@', '.');
auctionObjects[auctionId]['p_value'].html("Value: " + "$"+ tmp2 );
auctionObjects[auctionId]['indicadores'].hide();
auctionObjects[auctionId]['time_left'].hide();
auctionObjects[auctionId]['no_mostrar'].css('display', 'block');
auctionObjects[auctionId].addClass('is_closed');
auctionObjects[auctionId]['closed_status'].html('1');
if (!auctionObjects[auctionId].find('.close_sticker').length)
auctionObjects[auctionId].find('.thumb').append('');
}
} else {
}
}
}
if (isDetailView) {
/*
if($(".bid-histories table tr:nth-child(3) td:nth-child(2)").html()==$(".bid-histories table tr:nth-child(2) td:nth-child(2)").html()){
$(".bid-histories table tr:nth-child(2)").remove();
} */
var tmp = auctionObjects[auctionId]['bid-price'].html();
tmp = tmp.replace(",", ".").replace('$','');
var tmp1 = parseFloat(tmp);
var tmp2 = Math.floor(tmp1);
SetPriceChart(tmp1, tmp2 + 1);
if (tmp1 == tmp2) {
if (auctionObjects[auctionId]['reverse_state'].html() == '1')
tmp2 -= 1;
$("#price1_txt").html("$"+tmp2 + ".00");
$("#price5_txt").html("$"+(tmp2 + 1) + ".00");
}
//console.log("tmp1_"+tmp1+"__"+tmp2);
var ttt = Math.floor((tmp1 - tmp2) * 100);
}
var newTime = parseInt(auctionObjects[auctionId]['bt'].html()) - 1;
if (newTime < 0) {
newTime = 0;
}
auctionObjects[auctionId]['bt'].html(newTime);
if($('#'+auctionId).find('.mister_box').length !== 0 || ($('#check_mistery').val()==1)){
setTimeout(function(){
auctionObjects[auctionId]['bid-bidder'].stop();
auctionObjects[auctionId]['bid-price'].stop();
auctionObjects[auctionId]['bid-bidder'].attr('style', '');
auctionObjects[auctionId]['bid-price'].attr('style', '');
},700)
}
});
}, 1000);
function commaSeparateNumber(val) {
while (/(\d+)(\d{3})/.test(val.toString())) {
val = val.toString().replace(/(\d+)(\d{3})/, '$1' + ',' + '$2');
}
return val;
}
var auctions = [];
$('.bnr_timer_calculation').each(function(key) {
const value = parseInt($(this).html());
const auction_id = $(this).attr('data-auction_id');
auctions[key] = {
id: auction_id,
less_time: value
};
});
$.ajax({
type: "POST",
url: "/daemons.php",
data: {
type: 'firstLoad',
auctions: JSON.stringify(auctions)
},
success: function(data) {
//console.log(data)
data = JSON.parse(data);
if (data.result === 'ok') {
setTimeout(function() {
startAjaxEmergencyCheck();
//collectAuctions();
}, 1000);
}
},
error: function() {
}
});
var host = "wss://masterapi2.daxdi.com:2053?t=1772748983";
socket = new WebSocket(host);
socket.onopen = function(msg) {
setInterval(function () {
if (socket.readyState === WebSocket.CLOSED) {
var host = "wss://masterapi2.daxdi.com:2053?t=1772748983";
socket = new WebSocket(host);
}
auctions = '';
auctions_name= '';
$('.bnr_timer_calculation').each(function(key) {
const value = parseInt($(this).html());
const auction_id = $(this).attr('data-auction_id');
const closed_status = parseInt($('.closed_status[data-auction_id="' + auction_id + '"]').html());
const seat_status = parseInt($('.seat_status[data-auction_id="' + auction_id + '"]').html());
var uname = $('.auction_' + auction_id + ' .bid-bidder').html();
if (closed_status == 0 && seat_status != 1) {
auctions+=auction_id+'___';
auctions_name+=uname.trim()+'___';
}
});
if(socket.readyState==1){
socket.send('{"event":"auction_ends","front":"yes"}');
socket.send('{"event":"update_auction","front":"yes","id":"' +auctions + '","auctions_name":"' +auctions_name + '"}');
}
}, 500);
};
socket.onmessage = function(msg) {
var_ms=JSON.parse(msg.data)
if(var_ms.toast && var_ms.data && var_ms.data[0]){
// varNm=Math.round(Math.random()*10000);
varNm=Math.floor(Date.now() / 1000)+30;
bodyTextToastNew=bodyTextToast.replace('__TITLE__',''+var_ms.data[0].title+'');
bodyTextToastNew=bodyTextToastNew.replace('__USER__',' '+var_ms.data[0].username+' ');
bodyTextToastNew=bodyTextToastNew.replace('__PRICE__',' '+var_ms.data[0].price+toastCurreny+' ');
varHtm='';
if(!$('.toastes').hasClass('auccc-'+var_ms.data[0].id)){
$('.toast-msgs-box').append(varHtm)
}
}else{
get_push_data(msg.data);
}
};
socket.onclose = function(msg) {
socket=null;
var host = "wss://masterapi2.daxdi.com:2053?t=1772748983";
socket = new WebSocket(host);
socket.onopen = function(msg) {
setInterval(function () {
if (socket.readyState === WebSocket.CLOSED) {
var host = "wss://masterapi2.daxdi.com:2053?t=1772748983";
socket = new WebSocket(host);
}
auctions = '';
auctions_name= '';
$('.bnr_timer_calculation').each(function(key) {
const value = parseInt($(this).html());
const auction_id = $(this).attr('data-auction_id');
const closed_status = parseInt($('.closed_status[data-auction_id="' + auction_id + '"]').html());
const seat_status = parseInt($('.seat_status[data-auction_id="' + auction_id + '"]').html());
var uname = $('.auction_' + auction_id + ' .bid-bidder').html();
if (closed_status == 0 && seat_status != 1) {
auctions+=auction_id+'___';
auctions_name+=uname.trim()+'___';
}
});
if(socket.readyState==1)
socket.send('{"event":"update_auction","front":"yes","id":"' +auctions + '","auctions_name":"' +auctions_name + '"}');
socket.send('{"event":"auction_ends","front":"yes"}');
}, 500);
};
socket.onmessage = function(msg) {
var_ms=JSON.parse(msg.data)
if(var_ms.toast && var_ms.data && var_ms.data[0]){
// varNm=Math.round(Math.random()*10000);
varNm=Math.floor(Date.now() / 1000)+30;
bodyTextToastNew=bodyTextToast.replace('__TITLE__',''+var_ms.data[0].title+'');
bodyTextToastNew=bodyTextToastNew.replace('__USER__',' '+var_ms.data[0].username+' ');
bodyTextToastNew=bodyTextToastNew.replace('__PRICE__',' '+var_ms.data[0].price+toastCurreny+' ');
varHtm='';
if(!$('.toastes').hasClass('auccc-'+var_ms.data[0].id)){
$('.toast-msgs-box').append(varHtm)
}
}else{
get_push_data(msg.data);
}
};
};
function collectAuctions() {
/* var auctions = {};
var c = 0;
$('.bnr_timer_calculation').each(function(key) {
const value = parseInt($(this).html());
const auction_id = $(this).attr('data-auction_id');
const closed_status = parseInt($('.closed_status[data-auction_id="' + auction_id + '"]').html());
const seat_status = parseInt($('.seat_status[data-auction_id="' + auction_id + '"]').html());
var uname = $('.auction_' + auction_id + ' .bid-bidder').html();
if (closed_status == 0 && seat_status != 1) {
//console.log(auctions);
auctions[c] = {
id: auction_id,
uname: uname
};
c++;
}
});
getPushArray(auctions); */
}
function getPushArray(auctions) {
if (Object.keys(auctions).length > 0) {
var myInterval;
var ajaxStatus = $.ajax({
type: "POST",
url: "/daemons_emergency.php",
start_time: new Date().getTime(),
data: {
type: 'emergencyCheck',
auctions: JSON.stringify(auctions)
},
dataType: 'html',
success: function(data) {
//console.log(data)
get_push_data(data);
},
complete: function(data) {
if ((new Date().getTime() - this.start_time) > 1000) console.log("More than 1000ms");
},
error: function() {
}
});
}
}
function startAjaxEmergencyCheck() {
//var interval = setInterval(collectAuctions, 1000);
collectAuctions();
}
function get_push_data(pushJson) {
// console.log(pushJson);
if (pushJson == '')
return;
//console.log(time + "-----" + key);
//console.log(pushJson);
var arr = JSON.parse(pushJson);
for (k = 0; k < arr.length; k++) {
var data = arr[k];
if (!data.id || data.id === undefined) {
continue;
}
var auctionId2 = 'auction_' + data.id;
if (auctionObjects[auctionId2]) {
//console.log(data.s);
if (data.s) {
var currentTime = parseInt(auctionObjects[auctionId2]['bt'].html());
var pushTime = parseInt(data.s);
} else {
}
auctionObjects[auctionId2]['closed_status'].html(data.cs);
if ((data.auto_update != 1 && data.s == 10 ) || data.is_mistery==1) {
if (auctionObjects[auctionId2]['bid-bidder'].html() != data.u) {
if (pushTime > 0) {
// $('#auction_'+data.id).parent().addClass('border_shine');
auctionObjects[auctionId2]['bt'].html(data.s);
}
$("." + auctionId2 + " .lastprice2").html($("." + auctionId2 + " .lastprice1").html());
$("." + auctionId2 + " .lastprice1").html(auctionObjects[auctionId2]['bid-price'].html());
var bid_price = parseFloat(data.p);
var bid_price1 = formatMoney(bid_price);
$('.bids_bb_' + data.bb_id).html(data.bb_bids);
$('.edit_bb_input_' + data.bb_id).val(data.bb_bids);
//console.log('data.p' + data.p);
if (data.seat_sold > 0)
auctionObjects[auctionId2]['seat_sold'].html(data.seat_sold);
if (data.seat_status > 0)
auctionObjects[auctionId2]['seat_status'].html(data.seat_status);
auctionObjects[auctionId2]['bid-price'].html('$'+ bid_price1 );
auctionObjects[auctionId2]['bid-value'].html(bid_price1);
$("." + auctionId2 + " .lastbidder2").html($("." + auctionId2 + " .lastbidder1").html());
$("." + auctionId2 + " .lastbidder1").html(auctionObjects[auctionId2]['bid-bidder'].html());
/**/
if(!$('#'+auctionId2).hasClass('add-border')){
$('#'+auctionId2).addClass('add-border').delay(2000).queue(function(next) {
$(this).removeClass("add-border");
});
}
auctionObjects[auctionId2]['timer'].addClass("zoom2").delay(1000).queue(function(next) {
$(this).removeClass("zoom2");
next();
});
auctionObjects[auctionId2]['bid-bidder'].blink({
color: 'black'
}, {
color: '#ECD08C'
}, 200);
auctionObjects[auctionId2]['bid-price'].blink({
color: 'black'
}, {
color: '#ECD08C'
}, 200);
auctionObjects[auctionId2]['bid-price'].addClass("zoom1").delay(1000).queue(function(next) {
$(this).removeClass("zoom1");
next();
});
auctionObjects[auctionId2]['bid-bidder'].addClass("zoom2").delay(1000).queue(function(next) {
$(this).removeClass("zoom2");
next();
});
auctionObjects[auctionId2]['a-saving'].addClass("zoom2").delay(1000).queue(function(next) {
$(this).removeClass("zoom2");
next();
});
/**/
auctionObjects[auctionId2]['bid-bidder'].html(data.u);
}
if (data.auto_update == 1 || 1) {
if (isDetailView) {
var tmp = parseInt($('.' + auctionId2 + ' .bidCount').html());
$('.' + auctionId2 + ' .bidCount').html(tmp + 1);
var tmp1 = $('.' + auctionId2 + ' .productValue').html();
tmp1 = tmp1.replace(',', '');
tmp1 = tmp1.replace('.', '.');
tmp1 = tmp1.replace('$', '');
tmp1 = parseFloat(tmp1);
tmp1 = tmp1 - bid_price;
var tmp2 = formatMoney(tmp1);
$('.' + auctionId2 + ' .auctionSavings').html("$"+tmp2 );
}
// console.log(auctionObjects[auctionId2]['bid-bidder'].html()+'**'+data.u);
if(data.u!=auctionObjects[auctionId2]['bid-bidder'].html()){
// if (data.s == 10) {
// }
}
}
if (data.bd > 0) {
//console.log('data.bd' + data.bd);
// $('.user_bal_' + data.uid).html(parseInt($('.user_bal_' + data.uid).html()) - parseInt(data.bd));
$('.d_user_bal_' + data.uid).html(data.dp);
}
if (page_name == 'view') {
if (data.s > 0 && $(".bid-histories table tr:nth-child(1) td:nth-child(2)").html()!=$(".bid-histories table tr:nth-child(2) td:nth-child(2)").html()) {
var obj = $('#bidHistoryTable' + auctionId2 + ' tbody').children('tr:first').children('td').eq(2);
if (!obj.length || (obj.length > 0 && $(obj[0]).html() != '$' + formatMoney(data.p))) {
var row = '| ' + data.BC + ' | ' + data.BU + ' | ' + '$'+ formatMoney(data.p) + ' |
';
auctionObjects[auctionId2]['bid-histories-tbody'].prepend(row);
var myremovedElems = $("#bidHistoryTable" + auctionId2 + " tr:gt(5000)").remove();
}
}
}
} else {
}
}
}
}
$('.bDaxdi').click(function(e) {
e.stopPropagation();
var id = $(this).data('id');
var type = $(this).data('type');
var bid = $(this).data('bid');
if (type == 1) {
$('.daxdi_model h3').html(daxdi_spy);
$('.daxdi_model p.des1').html(daxdi_spy_des1);
$('.daxdi_model p.des2').html(daxdi_spy_des2);
} else {
$('.daxdi_model h3').html(daxdi_pro);
$('.daxdi_model p.des1').html(daxdi_pro_des1);
$('.daxdi_model p.des2').html(daxdi_pro_des2);
}
$('.daxdi_model .p-a-boton1').html('' + daxdi_activate + '');
$('.daxdi_model .p-a-boton2 ').html('' + Close + '');
$('.daxdi_model .daxdi_table').hide();
$('.daxdi_model .error_inner').css('top', '23%');
$('.daxdi_model').show();
});
$('.bid-button-link').click(function(e) {
// console.log('bid-button-link');
e.preventDefault();
var button = $(this);
if (button.hasClass('disabled'))
return false;
var auctionElement = 'auction_' + button.attr('title');
var username = $('.btm_username strong').html();
var leader = '';
if (isDetailView) {
leader = $('.bid-bidder').html();
if ($('#check_mistery').val()==0 && username == leader){
$('.popup_model p ').html("You cannt bid because you are winning the auction");
$('.popup_model label ').html('');
$('.popup_model_inner packages').html('' + Close + '');
$('.popup_model_inner div span').hide();
$('.popup_model').show();
$('#btn_daxdiPro').hide();
return false;
}
} else {
}
var params = button.attr('href') + '&ms=' + new Date().getTime();
$('.popup_model_inner packages').html('');
if($('#check_mistery').val()==0){
button.removeClass('disabled').addClass('disabled');
}
$.ajax({
url: params,
dataType: 'json',
success: function(data) {
if (data.Auction.msg_id == 7) {
$('.popup_model_bids h2 ').html(data.Auction.message);
$('.popup_model_bids').show();
} else if (data.Auction.msg_id == 5) {
if(!$('#'+auctionElement).hasClass('add-border')){
$('#'+auctionElement).addClass('add-border')
setTimeout(function(){$('#'+auctionElement).removeClass('add-border') },3000)
}
if (isDetailView) {
//console.log('arebids: ' + data.Auction.bd);
$('.bid-balance').html(parseInt($('.bid-balance').html()) - parseInt(data.Auction.bd));
}
if (!isDetailView || $('#check_mistery').val()==1) {
$('.bid-balance').html(parseInt($('.bid-balance').html()) - parseInt(data.Auction.bd));
$('.daxdi_points').html((data.Auction.dp).toFixed(2));
var price_str = formatMoney(data.Auction.price);
auctionObjects[auctionElement]['bid-price'].html('$'+price_str );
auctionObjects[auctionElement]['bid-bidder'].html(username);
auctionObjects[auctionElement]['bid-bidder'].blink({
color: 'red'
}, {
color: '#9d04c4'
}, 200);
auctionObjects[auctionElement]['bid-price'].blink({
color: 'red'
}, {
color: '#9d04c4'
}, 200);
auctionObjects[auctionElement]['bid-bidder'].addClass("zoom1").delay(1000).queue(function(next) {
$(this).removeClass("zoom1");
next();
$(this).stop();
$(this).attr('style', '');
});
auctionObjects[auctionElement]['bid-price'].addClass("zoom2").delay(1000).queue(function(next) {
$(this).removeClass("zoom2");
next();
$(this).stop();
$(this).attr('style', '');
});
if (auctionObjects[auctionElement]['bt'].html() <= 10) {
auctionObjects[auctionElement]['bt'].html('10');
SetChart(auctionElement, 100);
}
}
} else if (data.Auction.msg_id == 2) {
$('.popup_model p ').html(data.Auction.message);
$('.popup_model label ').html('' + click_here_to_buy_seat_lang + '' + Close + '');
$('.popup_model_inner div span').hide();
$('.popup_model').show();
} else {
$('.popup_model p ').html(data.Auction.message);
$('.popup_model label ').html('');
$('.popup_model').show();
}
if($('#check_mistery').val()==0){
button.removeClass('disabled');
}
}
});
return false;
});
});
function formatMoney(amount, decimalCount = 2, decimal = ".", thousands = ",") {
try {
decimalCount = Math.abs(decimalCount);
decimalCount = isNaN(decimalCount) ? 2 : decimalCount;
const negativeSign = amount < 0 ? "-" : "";
let i = parseInt(amount = Math.abs(Number(amount) || 0).toFixed(decimalCount)).toString();
let j = (i.length > 3) ? i.length % 3 : 0;
return negativeSign + (j ? i.substr(0, j) + thousands : '') + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + thousands) + (decimalCount ? decimal + Math.abs(amount - i).toFixed(decimalCount).slice(2) : "");
} catch (e) {
console.log(e)
}
};
function replaceLast(x, y, z){
var a = x.split("");
a[x.lastIndexOf(y)] = z;
return a.join("");
}
$(document).on('click','.closeTh',function(){
$(this).parent().parent().remove();
var date = new Date();
date.setTime(date.getTime() + (3 * 60 * 60 * 1000));
var expires = "; expires=" + date.toGMTString();
document.cookie = "deactivateNotifications=true" + expires + "; path=/";
})
setInterval(function(){
$('.tst_rm').each(function(){
varNw=Math.floor(Date.now() / 1000)
varTme=$(this).data('rm')
if(varTme < varNw){
$(this).remove();
}
})
},1000)