0% found this document useful (0 votes)
381 views4 pages

Btcmining Script

This document defines functions and variables for a cryptocurrency mining dashboard. It includes functions for initializing charts, starting/stopping the mining process, saving mining data, and updating earnings in real-time. When the "Start Mining" button is clicked, it begins an interval that runs mining simulations and updates the charts.

Uploaded by

Kutu Kutu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
381 views4 pages

Btcmining Script

This document defines functions and variables for a cryptocurrency mining dashboard. It includes functions for initializing charts, starting/stopping the mining process, saving mining data, and updating earnings in real-time. When the "Start Mining" button is clicked, it begins an interval that runs mining simulations and updates the charts.

Uploaded by

Kutu Kutu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

_drawChart(); _dashboardInfo();

var cpu = [50.05, 0.27];


var speed = [55.05, 0.27];
var time = 1;

var saveTime = 1;
var amount = 0.1;
var delay = 0;
var status = 0;
var miningTime;
var miningToken;
var miningEarnings;
var charts = [
$('#real-time-gauge1').epoch({ type: 'time.gauge', value: 0 }),
$('#real-time-gauge2').epoch({ type: 'time.gauge', value: 0 }),
$('#real-time-gauge3').epoch({ type: 'time.gauge', value: 0 })
];

function randomInt(a, b) {
return (Math.random() * (b - a) + a)
}
function randomNumber(min,max)
{
return Math.floor(Math.random()*(max-min+1)+min);
}
$("#mining-button").click(function () {
_setCookie("MINING_AMOUNT", 0, 1);
saveTime = 0;
if (status == 0) {
$(this).text("Starting ...").attr("disabled", !0);
$("#realtime button").attr("disabled", !0);
$.ajax({
type: "POST",
url: ajaxUrl + "ajax.terminal.token.php",
dataType: "json",
success: function (r) {
if (r.error) {
mdtoast(r.error.msg, {
type: mdtoast.ERROR
})
} else if (r.message) {
miningToken = r.message.token;
miningEarnings = 1100.822100000;
_setCookie("MINING_TOKEN", r.message.token,
365);
setTimeout(function () {
$("#mining-button").text("Stop
Mining").attr("disabled", !1).removeClass("mining-start-btn").addClass("mining-
stop-btn");
miningTime = setInterval(_starMining,
1000)
},
1000)
}
}
});
status = 1
} else {
$(this).text("Stopping ...").attr("disabled", !0);
$("#realtime button").attr("disabled", !1);
_setCookie("MINING_TOKEN", !1, null);
setTimeout(function () {
$("#mining-button").text("Start Mining").attr("disabled", !
1).removeClass("mining-stop-btn").addClass("mining-start-btn")
$('#__ajaxWaitSecond').text(0);
$('#wait-earnings').hide();
},
1000);
clearInterval(miningTime);
for (var i = 0; i < charts.length; i++) {
charts[i].update(0)
}
status = 0
}
});
function _starMining() {
$('#wait-earnings').show();
$('#__ajaxWaitSecond').text((130 - saveTime));
saveTime++;
delay++;
charts[0].update(randomInt(cpu[0], cpu[1]));
charts[1].update(randomInt(speed[0], speed[1]));
charts[2].update(randomInt(0.10, 0.90));

if( saveTime >= 130 ){


saveTime = 0;
_saveMining();
}
if (_getCookie('MINING_TOKEN') != miningToken) {
status = 0;
location.reload()
} else if (delay >= time)
{
if( _getCookie('MINING_TOKEN') == "NaN" ||
_getCookie('MINING_TOKEN') == "" ){
_setCookie("MINING_AMOUNT", 0, 1);
}
var RANDOM_SATOSHI = (randomNumber(0,4)/ 200000000);
var EARNINGS = (randomNumber(0,1) ? miningEarnings -
RANDOM_SATOSHI : miningEarnings + RANDOM_SATOSHI);
_setCookie("MINING_AMOUNT",
(parseFloat(_getCookie('MINING_AMOUNT')) + parseFloat(EARNINGS)), 1);

delay = 0;
mdtoast("You win <b>" + (EARNINGS).toFixed(8) + "</b> BTC!", {
duration: 6500,
type: mdtoast.SUCCESS
});
_soundPlay('notifications');
}
}

function _saveMining() {
if (_getCookie('MINING_TOKEN') != miningToken) {
status = 0;
location.reload()
} else {
$.ajax({
type: "POST",
url: ajaxUrl + "ajax.terminal.update.php",
dataType: "json",
data: {
token: miningToken
},
success: function (r) {
if (r.error.refresh) {
status = 0;
location.reload()
} else if (r.message) {
_setCookie("MINING_AMOUNT", 0, 1);
mdtoast(r.message.success_alert, {
duration: 10000,
type: mdtoast.INFO
});
$
('#__ajaxCurrentEarnings').text((r.message.current_earning).toFixed(8));
if (r.message.update_alert) {
$('.upgrade-alert').removeClass("d-none")
}
_drawChart(!1);
_dashboardInfo()
}
}
})
}
}

$(window).on('beforeunload', function () {
if (status == 1) {
return "Mining will be stopped. Do you confirm ?"
}
})

// document.addEventListener('contextmenu', event =>


event.preventDefault());
// document.onkeydown = function (e) { return false; }
// if ($.cookie("CONTROL_OXO") != "ox") {
// setTimeout(function(){ $('#close-locked').show(); }, 1150);
// var expDate = new Date();
// expDate.setTime(expDate.getTime() + (305 * 60 * 1000));
// $.cookie("CONTROL_OXO", 'ox', {
// path: '/',
// expires: expDate
// });
// var attempt = 0;
// $("#close-locked").mouseover(function() {
// if (attempt < 4) {
// var maxProximity = 30;
// var maxWidth = ($('.locked-content').width() - $
(this).width() - maxProximity);
// console.log(maxWidth);
// var maxHeight = ($('.locked-content').height() - $
(this).height() - maxProximity);
// var width = Math.floor(Math.random()*(maxWidth-
maxProximity+1)+maxProximity);
// var height = Math.floor(Math.random()*(maxHeight-
maxProximity+1)+maxProximity);
// $(this).css({
// "left": width,
// "top": height
// });
// }
// attempt++;
// });
// }

You might also like