const VISUAL_ITEMS = [1, 2, 3];
const CHAIN_ACCOUNTS = ["bscDUCO", "celoDUCO", "wDUCO", "maticDUCO"];
const STAKING_PERC = 1.0;
const BACKDROPS = [
"calders",
"Big_koelie",
"NostalgiaXPS",
"Xoiron",
"revox",
"if",
"jpx13",
"BjornNL",
"NicoFR75",
"CUTSDBZ",
"Albedo",
"Baphomet",
"Jonny11",
"Bujonek",
"Kwiatens",
"renderman",
"CaptSwirly",
"iNimbleSloth",
"Mike_Morgan",
"Ecthelias",
"Kizeren Killeshan",
"lunarismemo",
"ismellcows"
];
let last_screen = "screen-user-desktop";
let username, password, verified;
let transaction_limit = 10;
let transactions = [];
let miners = [];
let wrap_api = [];
let enabledItems = JSON.parse(localStorage.getItem("enabledItems")) || VISUAL_ITEMS;
let miners_state_changed = true;
let api_url = "server.duinocoin.com";
let timedelta = 3;
let login_backdrop = BACKDROPS[Math.floor(Math.random() * BACKDROPS.length)];
if (on_mobile()) {
last_screen = "screen-user-mobile";
timedelta = 1;
$("#backdrop-mobile").css("background-image",
"url('/assets/community_screens/" + login_backdrop + ".jpg')")
$("#image_author").text(login_backdrop)
} else {
$("#backdrop-desktop").css("background-image",
"url('/assets/community_screens/" + login_backdrop + ".jpg')")
$("#image_author_desktop").text(login_backdrop)
}
const balanceChartOptions = {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
display: false, // Hide the legend
},
tooltip: {
enabled: false, // Hide the tooltip
},
filler: {
propagate: false, // Do not fill between datasets
}
},
scales: {
x: {
display: false, // Hide the X-axis
},
y: {
display: false, // Show the Y-axis
title: {
display: false, // Hide the Y-axis title
},
},
},
elements: {
line: {
tension: 0.5, // Adjust curve tension (0 to 1, 0 for straight lines)
},
point: {
radius: 0, // Hide the data points
},
}
};
// Desktop - shorter versions
let adblockNotifications = [{
title: "Oh, you're using an adblocker? Color us surprised! π Not.",
description: "This website and other servers do not run on magic dust. Since you're so inclined on using an adblocker, maybe at least purchase our official merch or donate to help?",
},
{
title: "Attention, adblock aficionado! Yes, you!",
description: "Help our crew sail smoothly by checking out our official merch or making a small donation. Whitelisting us is like shining a lighthouse on our financial challenges which aren't small.",
},
{
title: "A wild adblocker appears!",
description: "Explore our official merch collection or give a modest donation to support our digital menagerie.",
},
{
title: "To block or not to block, that is the adblocker's question.",
description: "Join our quest for an ad-free and sustainable internet by perusing official merch or making a humble donation. Whitelisting us casts a benevolent enchantment on our humble land.",
},
{
title: "Adblocker strikes again! βοΈπ‘οΈ",
description: "Battle server maintenance costs with your support - check out our official merch or donate.",
},
{
title: "Adblocker vs. Fairy Godmothers: The revenue battle!",
description: "Script a happier ending with a humble donation or exploring our official merch.",
},
{
title: "Adblockers, assemble! π«πββοΈ",
description: "Become an adblocker hero - support us by purchasing our official merch or making a small donation.",
},
{
title: "Adblockageddon! ππ",
description: "Fuel our interstellar journey - check out our official merch or donate as an adblocker astronaut. Whitelisting us opens a cosmic gateway to ad-supported content!",
},
{
title: "Adblocker Artistry! π¨π«",
description: "Craft a masterpiece of support - explore our official merch collection or contribute a serene donation. Whitelisting us brings artistic vibrancy to the internet!",
},
{
title: "Adblockers: The Quiet Rebellion π€«π«",
description: "Join the silent rebellion with our official merch or a tranquil donation. Whitelisting us begins a quest for digital tranquility!",
},
{
title: "Ad-free, Adored, Ad-supported! π₯°π«",
description: "Share the love - check out our official merch or shower us with a heartfelt donation. Whitelisting us brings love to an ad-free and ad-supported internet!",
}
]
// Mobile longer versions since we have unlimited space
if (on_mobile()) {
adblockNotifications = [{
title: "Oh, you're using an adblocker? Color us surprised! π Not.",
description: "Surprise, surprise! Another adblocker user in the house. While we understand the desire for an ad-free experience, our bills won't pay themselves. If you'd like to be a hero and help keep our servers running, consider supporting us by purchasing our official merch or sparing a small donation. We promise, no guilt trips here! Just a friendly reminder that your whitelisting powers can bring joy and content to both our team and the pixels. Let's make the internet a better place, one non-blocked ad at a time! ππ«π",
},
{
title: "Attention, adblock aficionado! Yes, you!",
description: "Ahoy, ad-blocking mate! We see you navigating the seas of the internet with that adblocker flag high. While we respect your preference for an ad-free voyage, our crew needs sustenance to continue sailing smoothly. If you find it in your heart (and wallet) to support our ship, check out our official merch - treasure awaits! Alternatively, if you wish to drop some gold coins in our donation chest, it will undoubtedly fuel our journey. By the way, no pressure on the whole whitelist thing, but think of it as shining a lighthouse to guide us through the stormy waves of financial challenges. π΄ββ οΈπ«π°",
},
{
title: "A wild adblocker appears!",
description: "Look who's tamed the virtual wilds with an adblocker! While you're enjoying an ad-free safari, our digital menagerie needs sustenance to thrive. If you're feeling adventurous, support our cause by exploring our official merch collection - a treasure trove of delights! Alternatively, if you prefer a stealthy approach, a modest donation can do wonders for our conservation efforts. Don't worry; we won't send a herd of sad emojis your way, but a few happy ones might be nice. Oh, and before you venture deeper into the web, consider adding a touch of magic by whitelisting us. You'll become a mythical creature in the realm of ad-supported content! π¦π«π",
},
{
title: "To block or not to block, that is the adblocker's question.",
description: "Hark, the eternal question: to block or not to block? While the adblocker provides sanctuary from the ad storm, our humble kingdom needs some support to stand tall. Thou art invited to peruse our official merch emporium, where treasures await discerning eyes. Should thou be in a philanthropic mood, a humble donation will gladden our virtual hearts. We shan't pester thee about the whitelist, but 'tis akin to casting a benevolent enchantment upon our humble land. Let us join forces to create an internet realm both ad-free and sustainable, where all may thrive in harmony. π°π«π«",
},
{
title: "Adblocker strikes again! βοΈπ‘οΈ",
description: "Hail, valiant adblocker user! Thy sword of ad-blocking prowess is undeniable, but even warriors need allies. As we battle the forces of server maintenance costs, thou canst lend thy hand in various ways. Behold our official merch emporium - the spoils of victory shall be thine! Shouldst thou seek a noble quest, venture forth with a small donation, and thy name shall be whispered in the halls of digital legend. And lo! Whitelisting us is like bestowing the blessing of the internet gods, ensuring the harmony of content and sustenance. Together, we shall forge a prosperous realm where everyone wins! βοΈπ«ποΈ",
},
{
title: "Adblocker vs. Fairy Godmothers: The revenue battle!",
description: "Alas, our tale unfolds as adblockers thwart the flow of revenue, and fairy godmothers seem scarce these days. Fear not, for thou hast the power to script a happier ending! Support our endeavors by perusing our official merch - a realm of enchantment awaits thee! Shouldst thou wish to perform a good deed, a humble donation shall pave the way to our financial salvation. And lo, whitelisting us is akin to unleashing a cascade of digital pixie dust, bringing prosperity to both our kingdom and thine ad-free browsing. Let's weave a tale of symbiotic harmony in the ever-changing land of the web! π§π«β¨",
},
{
title: "Adblockers, assemble! π«πββοΈ",
description: "Calling all adblocker heroes! While you're protecting your screen from ads, spare a thought for our digital fortress. Supporting us is as easy as wielding a mouse - check out our official merch and embrace your inner e-commerce warrior. Don't worry; we're not pulling any heartstrings here. But, just a tiny nudge: a donation could upgrade our servers from a village hut to a grand castle. And if you decide to whitelist us, it's like offering an olive branch to the ever-hungry ad gods. So, let's unite and create a harmonious internet realm! π°π‘οΈπ°",
},
{
title: "Adblockageddon! ππ",
description: "Adblockers have descended upon the internet like a cosmic storm, leaving us in need of celestial support. If you're an adblocker astronaut floating through the galaxy, consider fueling our mission with a quick visit to our official merch store. And should you stumble upon a stardust pouch, a small donation will aid our interstellar journey. No forceful persuasion here, but whitelisting us is like opening a cosmic gateway to the universe of ad-supported content. Together, we'll soar among the stars of sustainable internet. πππ«",
},
{
title: "Adblocker Artistry! π¨π«",
description: "Ah, the elegance of adblockers - a brushstroke of web browsing mastery. But while you craft your ad-free masterpiece, spare a thought for our virtual gallery. Peruse our official merch collection, where art meets utility in a harmonious blend. An art connoisseur's spirit, you might decide to grant a small donation to fuel our creative endeavors. And if you choose to grace us with your virtual signature by whitelisting, it's like an art collaboration that brings our content to life. Together, we'll curate an internet landscape that's both ad-free and artistically vibrant! π¨π«π",
},
{
title: "Adblockers: The Quiet Rebellion π€«π«",
description: "In the realm of silent adblockers, a rebellion brews against noisy ads. But while you fight the good fight for peace and tranquility, consider supporting our tranquil sanctuary too. Delve into our official merch garden, where serenity and practicality intertwine. As you embrace the art of virtual zen, a serene donation could water our server gardens. And if you choose to whisper a few whitelisting mantras, the serene harmony of ads and content shall be restored. Let's embark on a quest for digital tranquility together! πΏπ«π§ββοΈ",
},
{
title: "Ad-free, Adored, Ad-supported! π₯°π«",
description: "Adored adblocker users, we cherish your preference for an ad-free experience. And as you fill your virtual heart with love, consider sharing some with us too. Explore our official merch kingdom, where love and practicality intertwine. Shower us with a heartfelt donation, and we'll feel the virtual hugs. And if you choose to share the love by whitelisting us, it's like a virtual love fest between ads and content. Together, we'll create an internet where love reigns, ad-free and ad-supported! π₯°π«π",
}
];
}
const receive_template = `
Your ${coin.toUpperCase()} address:
${data.address} Thank you even for the smallest donation!
This address will expire in 1 hour
`;
}
$(".fundraiser_address").html(finalhtml)
if (prev_btn) $(prev_btn).attr("disabled", false);
$(btn).removeClass("is-loading");
$(btn).attr("disabled", true);
prev_btn = btn;
});
}
function refresh_fundraiser_progress() {
fetch(`https://server2.duinocoin.com/fundraiser_progress`)
.then(response => response.json())
.then(data => {
if (data.target) {
$(".fundraiser_current").html(`${data.current}$`);
$(".fundraiser_goal").html(`${data.target}$`);
$(".fundraiser_percentage").html(`${data.perc.toFixed(2)}%`);
$(".fundraiserprogress").attr('value', data.perc);
$(".fundraiserprogress").text(data.perc.toFixed(2) + "%");
}
setTimeout(function() { refresh_fundraiser_progress() }, 5*60*1000);
});
}
function open_txsend() {
if (adBlockEnabled) adblock_alert();
$("html").css("overflow-y", "hidden");
if (on_mobile()) $("#txsend").show("slide", { direction: "down" }, '50');
else {
$("#txsend").fadeIn('fast');
$(document).click(function(event) {
if (event.target.id == ("txsend") && $('#txsend').is(":visible")) {
close_txsend();
}
});
}
}
function close_txsend() {
if (on_mobile()) {
$("#txsend").hide("slide", { direction: "down" }, '50', function() {
$("html").css("overflow-y", "scroll");
});
} else {
$("#txsend").fadeOut('fast', function() {
$("html").css("overflow-y", "scroll");
});
}
}
function open_txwrap() {
if (adBlockEnabled) adblock_alert();
$("html").css("overflow-y", "hidden");
if (on_mobile()) $("#txwrap").show("slide", { direction: "down" }, '50');
else {
$("#txwrap").fadeIn('fast');
$(document).click(function(event) {
if (event.target.id == ("txwrap") && $('#txwrap').is(":visible")) {
close_txwrap();
}
});
}
}
function close_txwrap() {
if (on_mobile()) {
$("#txwrap").hide("slide", { direction: "down" }, '50', function() {
$("html").css("overflow-y", "scroll");
});
} else {
$("#txwrap").fadeOut('fast', function() {
$("html").css("overflow-y", "scroll");
});
}
}
function fill_stake_amount(percentage) {
stake_amount = $("#stake_amount")
stake_amount.val(round_to(3, (percentage / 100) * balance));
stake_reward = $("#stake_reward");
stake_reward.val(round_to(3, (stake_amount.val() *
(1 + (STAKING_PERC / 100)))));
}
$("#stake_amount").on("input", function() {
stake_amount = $("#stake_amount");
stake_reward = $("#stake_reward");
stake_reward.val(round_to(3, (stake_amount.val() *
(1 + (STAKING_PERC / 100)))));
})
function open_stakemenu() {
if (adBlockEnabled) adblock_alert();
$("html").css("overflow-y", "hidden");
if (on_mobile()) $("#stakemenu").show("slide", { direction: "right" }, '50');
else {
$("#stakemenu").fadeIn('fast');
$(document).click(function(event) {
if (event.target.id == ("stakemenu") && $('#stakemenu').is(":visible")) {
close_stakemenu();
}
});
}
}
function close_stakemenu() {
if (on_mobile()) {
$("#stakemenu").hide("slide", { direction: "right" }, '50', function() {
$("html").css("overflow-y", "scroll");
});
} else {
$("#stakemenu").fadeOut('fast', function() {
$("html").css("overflow-y", "scroll");
});
}
}
function stake() {
stake_amount = $("#stake_amount").val();
stake_confirm = $("#stake_confirm");
if (stake_amount < 20) {
$("#stake_amount").effect("shake", { distance: 5 });
return;
}
stake_confirm.addClass("is-loading");
grecaptcha.ready(function() {
grecaptcha.execute('6LdJ9XsgAAAAAMShiVvOtZ4cAbvvdkw7sHKQDV-6', { action: 'submit' }).then(function(token) {
fetch("https://server.duinocoin.com/stake/" + encodeURIComponent(username) +
"?password=" + encodeURIComponent(password) +
"&amount=" + encodeURIComponent(stake_amount) +
"&captcha=" + encodeURIComponent(token))
.then(response => response.json())
.then(data => {
stake_confirm.removeClass("is-loading");
if (data.success) {
$('#stake_amount').val('');
stake_confirm.html("")
user_data(username);
} else {
stake_confirm.removeClass("is-success");
stake_confirm.addClass("is-danger");
stake_confirm.text("Error")
alert_bulma(data.message);
}
setTimeout(function() {
stake_confirm.removeClass("is-danger");
stake_confirm.addClass("is-success");
stake_confirm.text("Stake")
}, 3000);
}).catch(error => {
stake_confirm.removeClass("is-loading");
stake_confirm.removeClass("is-success");
stake_confirm.addClass("is-danger");
stake_confirm.text("Error")
alert_bulma(error);
setTimeout(function() {
stake_confirm.removeClass("is-danger");
stake_confirm.addClass("is-success");
stake_confirm.text("Stake")
}, 3000);
})
});
});
}
function update_wrap_fees() {
wrap_network = document.getElementById("wrap_network").value;
$(".wrap_fee").text(wrap_api["fee"][wrap_network]);
$(".wrap_min").text(wrap_api["min"][wrap_network]);
}
function wrap() {
wrap_network = document.getElementById("wrap_network").value;
wrap_amount = document.getElementById("wrap_amount").value;
address = document.getElementById("wrap_address").value;
if (!address) {
$("#wrap_address").effect("shake", { distance: 5 });
return;
}
if (wrap_amount < wrap_api["min"][wrap_network] || wrap_amount > balance) {
$("#wrap_amount").effect("shake", { distance: 5 });
return;
}
document.getElementById("wrap_confirm").classList.add("is-loading");
if (wrap_network == "wDUCO") {
fetch("https://server.duinocoin.com/wduco_wrap/" + encodeURIComponent(username) +
"?password=" + encodeURIComponent(password) +
"&address=" + encodeURIComponent(address) +
"&amount=" + encodeURIComponent(wrap_amount))
.then(response => response.json())
.then(data => {
if (data.success) {
$("#wrap_confirm").removeClass("is-info");
$("#wrap_confirm").addClass("is-success");
$("#wrap_confirm").text("Sucessful wrap");
$('#wrap_amount').val('');
$('#wrap_address').val('');
} else {
$("#wrap_confirm").attr("disabled", true);
$("#wrap_confirm").removeClass("is-info");
$("#wrap_confirm").addClass("is-danger");
$("#wrap_confirm").text("Error");
alert_bulma(data.message);
}
document.getElementById("wrap_confirm").classList.remove("is-loading");
setTimeout(function() {
$("#wrap_confirm").attr("disabled", false);
$("#wrap_confirm").removeClass("is-danger");
$("#wrap_confirm").removeClass("is-success");
$("#wrap_confirm").addClass("is-info");
$("#wrap_confirm").text("Wrap");
}, 3000)
}).catch(function(error) {
document.getElementById("wrap_confirm").classList.remove("is-loading");
$("#wrap_confirm").attr("disabled", true);
$("#wrap_confirm").removeClass("is-info");
$("#wrap_confirm").addClass("is-danger");
$("#wrap_confirm").text("Error");
alert_bulma(error);
setTimeout(function() {
$("#wrap_confirm").attr("disabled", false);
$("#wrap_confirm").removeClass("is-danger");
$("#wrap_confirm").removeClass("is-success");
$("#wrap_confirm").addClass("is-info");
$("#wrap_confirm").text("Wrap");
}, 3000)
});
} else {
fetch("https://server.duinocoin.com/transaction/" +
"?username=" + encodeURIComponent(username) +
"&password=" + encodeURIComponent(password) +
"&recipient=" + encodeURIComponent(wrap_network) +
"&memo=" + encodeURIComponent(address) +
"&amount=" + encodeURIComponent(wrap_amount))
.then(response => response.json())
.then(data => {
if (data.success) {
$("#wrap_confirm").removeClass("is-info");
$("#wrap_confirm").addClass("is-success");
$("#wrap_confirm").text("Sucessful wrap");
$('#wrap_amount').val('');
$('#wrap_address').val('');
} else {
$("#wrap_confirm").attr("disabled", true);
$("#wrap_confirm").removeClass("is-info");
$("#wrap_confirm").addClass("is-danger");
$("#wrap_confirm").text("Error");
alert_bulma(data.message.split(",")[1]);
}
document.getElementById("wrap_confirm").classList.remove("is-loading");
setTimeout(function() {
$("#wrap_confirm").attr("disabled", false);
$("#wrap_confirm").removeClass("is-danger");
$("#wrap_confirm").removeClass("is-success");
$("#wrap_confirm").addClass("is-info");
$("#wrap_confirm").text("Wrap");
}, 3000)
}).catch(function(error) {
document.getElementById("wrap_confirm").classList.remove("is-loading");
$("#wrap_confirm").attr("disabled", true);
$("#wrap_confirm").removeClass("is-info");
$("#wrap_confirm").addClass("is-danger");
$("#wrap_confirm").text("Error");
alert_bulma(error);
setTimeout(function() {
$("#wrap_confirm").attr("disabled", false);
$("#wrap_confirm").removeClass("is-danger");
$("#wrap_confirm").removeClass("is-success");
$("#wrap_confirm").addClass("is-info");
$("#wrap_confirm").text("Wrap");
}, 3000)
});
}
}
function send() {
let recipient = $('#send_recipient').val().trim()
let amount = $('#send_amount').val().trim()
let memo = $('#send_memo').val().trim()
if (!recipient) {
$("#send_recipient").effect("shake", { distance: 5 });
return;
}
if (!amount) {
$("#send_amount").effect("shake", { distance: 5 });
return;
}
$("#send_confirm").addClass('is-loading');
$.getJSON('https://server.duinocoin.com/transaction/' +
'?username=' + encodeURIComponent(username) +
"&password=" + encodeURIComponent(password) +
"&recipient=" + encodeURIComponent(recipient) +
"&amount=" + encodeURIComponent(amount) +
"&memo=" + encodeURIComponent(memo),
function(data) {
$("#send_confirm").removeClass('is-loading');
if (data.success == true) {
$('#send_recipient').val('');
$('#send_amount').val('');
$('#send_memo').val('');
$("#send_confirm").removeClass("is-danger");
$("#send_confirm").addClass("is-success");
$("#send_confirm").text("Sucessful transfer");
} else {
$("#send_confirm").text("Error");
alert_bulma(data.message.split(",")[1])
}
setTimeout(function() {
$("#send_confirm").attr("disabled", false);
$("#send_confirm").removeClass("is-success");
$("#send_confirm").addClass("is-danger");
$("#send_confirm").text("Send");
}, 3000);
})
}
function refresh_event() {
fetch(`https://${api_url}/event`)
.then(response => response.json())
.then(data => {
if (data.result.topic != "None") {
q = Math.abs(new Date() / 1000 - data.result.starts);
d = Math.abs(data.result.ends - data.result.starts);
progress_val = (q / d) * 100
$(".event_box").fadeIn();
$(".event_title").html(data.result.topic);
$(".event_desc").html(data.result.description);
$(".eventprogress").attr('value', progress_val);
}
});
}
refresh_event()
function more_transactions() {
$(".more_tx").addClass("is-loading");
transaction_limit += 10;
user_data(username);
}
function timeSince(date) {
var seconds = Math.floor((new Date() - date) / 1000);
var interval = seconds / 31536000;
if (Math.floor(interval) == 1) {
return Math.floor(interval) + " year ago";
}
if (interval > 1) {
return Math.floor(interval) + " years ago";
}
interval = seconds / 2592000;
if (Math.floor(interval) == 1) {
return Math.floor(interval) + " month ago";
}
if (interval > 1) {
return Math.floor(interval) + " months ago";
}
interval = seconds / 86400;
if (Math.floor(interval) == 1) {
return Math.floor(interval) + " day ago";
}
if (interval > 1) {
return Math.floor(interval) + " days ago";
}
interval = seconds / 3600;
if (Math.floor(interval) == 1) {
return Math.floor(interval) + " hour ago";
}
if (interval > 1) {
return Math.floor(interval) + " hours ago";
}
interval = seconds / 60;
if (Math.floor(interval) == 1) {
return Math.floor(interval) + " minute ago";
}
if (interval > 1) {
return Math.floor(interval) + " minutes ago";
}
if (Math.floor(seconds) == 1) {
return Math.floor(seconds) + " second ago";
}
return Math.floor(seconds) + " seconds ago";
}
function fallbackCopyTextToClipboard(text) {
var textArea = document.createElement("textarea");
textArea.value = text;
textArea.style.top = "0";
textArea.style.left = "0";
textArea.style.position = "fixed";
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
try {
var successful = document.execCommand('copy');
var msg = successful ? 'successful' : 'unsuccessful';
console.log('Fallback: Copying text command was ' + msg);
} catch (err) {
console.error('Fallback: Oops, unable to copy', err);
}
document.body.removeChild(textArea);
}
function copy(text, element) {
if (!navigator.clipboard) {
fallbackCopyTextToClipboard(text);
return;
}
navigator.clipboard.writeText(text).then(function() {
console.log('Async: Copying to clipboard was successful!');
$(element).html("")
}, function(err) {
console.error('Async: Could not copy text: ', err);
$(element).html("")
});
setTimeout(function() {
$(element).html("")
}, 1000)
}
function calculator_warning() {
alert_bulma(`Estimated value straight from gathered benchmarks (2020-2021). It may not be very accurate at this time.`);
}
function estimated_price_warning() {
alert_bulma(`Estimated value based on the highest exchange rate. No guarantee that any of the exchange sites has enough liquidity in it's reserves to swap your coins at that rate.`);
}
function estimated_earnings_warning() {
alert_bulma(`Estimated value calculated from last balance changes. The estimation will not be 100% accurate and should only be used as a reference.`);
}
$(document).keyup(function(e) {
if (e.key === "Escape") {
close_alert();
close_help();
close_shop();
close_stakemenu();
close_txsend();
close_txwrap();
close_achievements();
close_txdetails();
close_minerdetails();
close_buymenu();
close_settings();
} else if (e.key === "Enter") {
setTimeout(function() {
$("#loginbutton_desktop").click();
}, 150);
}
});
function on_mobile() {
const ua = navigator.userAgent;
if ($(window).width() >= 1024) return false;
if (/Mobile|Android|iP(hone|od|ad)|IEMobile|BlackBerry|Kindle|Silk-Accelerated|(hpw|web)OS|Opera M(obi|ini)/.test(ua)) {
return true;
}
return false;
}
function pass_reset_open() {
$("#login-desktop").fadeOut('fast', function() {
$("#login-mobile").fadeOut('fast', function() {
$("#pass_reset").fadeIn('fast');
});
});
}
function register_open() {
$("body").append('');
$("#login-desktop").fadeOut('fast', function() {
$("#login-mobile").fadeOut('fast', function() {
$("#register").fadeIn('fast');
});
});
}
function register_quiz_start() {
$("#register_start").fadeOut('fast');
$("#register_fail").fadeOut('fast', function() {
$("#register_content_start").fadeOut('fast', function() {
$("#register_content_1").fadeIn('fast');
$("#register_buttons_1").fadeIn('fast');
});
});
}
function register_quiz_1(result) {
if (result > 1) {
$("#register_content_1").fadeOut('fast');
$("#register_buttons_1").fadeOut('fast', function() {
$("#register_content_2").fadeIn('fast');
$("#register_buttons_2").fadeIn('fast');
});
} else {
$("#register_content_1").fadeOut('fast');
$("#register_buttons_1").fadeOut('fast', function() {
$("#register_fail").fadeIn('fast');
});
}
}
function register_quiz_2(result) {
if (result > 1) {
$("#register_content_2").fadeOut('fast');
$("#register_buttons_2").fadeOut('fast', function() {
$("#register_content_3").fadeIn('fast');
$("#register_buttons_3").fadeIn('fast');
});
} else {
$("#register_content_2").fadeOut('fast');
$("#register_buttons_2").fadeOut('fast', function() {
$("#register_fail").fadeIn('fast');
});
}
}
function register_quiz_3(result) {
if (result == 2) {
$("#register_content_3").fadeOut('fast');
$("#register_buttons_3").fadeOut('fast', function() {
$("#register_content_4").fadeIn('fast');
$("#register_buttons_4").fadeIn('fast');
});
} else {
$("#register_content_3").fadeOut('fast');
$("#register_buttons_3").fadeOut('fast', function() {
$("#register_fail").fadeIn('fast');
});
}
}
function register_quiz_4(result) {
if (result == 2) {
$("#register_content_4").fadeOut('fast');
$("#register_buttons_4").fadeOut('fast', function() {
$("#register_content_5").fadeIn('fast');
$("#register_buttons_5").fadeIn('fast');
});
} else {
$("#register_content_4").fadeOut('fast');
$("#register_buttons_4").fadeOut('fast', function() {
$("#register_fail").fadeIn('fast');
});
}
}
function register_quiz_5(result) {
if (result == 1) {
$("#register_content_5").fadeOut('fast');
$("#register_buttons_5").fadeOut('fast', function() {
$("#register_content_6").fadeIn('fast');
$("#register_buttons_6").fadeIn('fast');
});
} else {
$("#register_content_5").fadeOut('fast');
$("#register_buttons_5").fadeOut('fast', function() {
$("#register_fail").fadeIn('fast');
});
}
}
function register_quiz_end() {
$("#register_content_6").fadeOut('fast');
$("#register_buttons_6").fadeOut('fast', function() {
$("#register_end_1").fadeIn('fast');
});
}
function register_end_1() {
if (checkInputs_1()) {
$("#register_end_1").fadeOut('fast', function() {
$("#register_end_2").fadeIn('fast');
});
}
}
function register_end_2() {
if (checkInputs_2()) {
$("#register_button").addClass("is-loading");
fetch('https://server.duinocoin.com/register/' +
'?username=' + encodeURIComponent(register_username.val().trim()) +
'&password=' + encodeURIComponent(register_password.val()) +
'&email=' + encodeURIComponent(register_email.val().trim()) +
'&key=' + encodeURIComponent(register_miner_key.val().trim()) +
'&captcha=' + encodeURIComponent(captcha))
.then(data => data.json()).then((data) => {
$("#register_button").removeClass("is-loading");
if (data.success == true) {
alert_bulma(`Your wallet has been sucessfully created!
` +
`You can now go to the login page and authenticate with your credentials.` +
`Soon you'll also receive an e-mail confirming the registration process.` +
` Have fun using Duino-Coin!` +
` `);
} else {
server_message = data.message
alert_bulma(server_message + ` Please try again`);
}
})
.catch((error) => {
$("#register_button").removeClass("is-loading");
alert_bulma(`Your web browser couldn't connect to the Duino-Coin servers.
We'd like to help, but there are many possible causes -
before asking the support, try disabling your browser extensions
or similar programs and try again.
Make sure nothing blocks server2.duinocoin.com`);
});
}
}
$(register_username).focusout(function() {
fetch(`https://${api_url}/users/` +
encodeURIComponent(register_username.val().trim())
).then(data => data.json()).then(
(data) => {
if (data.success) setErrorFor(register_username, 'Username is already taken');
else setSuccessFor(register_username);
});
});
check1 = $('#check1');
check2 = $('#check2');
register_email = $("#register_email")
captchainfo = $('#captchainfo');
checkInfo = $("#checkInfo");
register_miner_key = $('#register_miner_key');
let captcha;
function checkInputs_2() {
captcha = grecaptcha.getResponse();
const emailValue = register_email.val().trim();
const miner_keyValue = register_miner_key.val().trim();
const check1Value = check1.is(':checked');
const check2Value = check2.is(':checked');
let isFormValid = true;
if (miner_keyValue === '') {
isFormValid = false;
setErrorFor(register_miner_key, 'Mining key cannot be blank.');
} else {
setSuccessFor(register_miner_key);
}
if (emailValue === '') {
setErrorFor(register_email, 'Email cannot be blank.');
isFormValid = false;
} else if (!isEmail(emailValue)) {
setErrorFor(register_email, 'Not a valid email.');
isFormValid = false;
} else {
setSuccessFor(register_email);
}
if (captcha !== undefined && captcha !== "") {
captchainfo.text("");
} else {
isFormValid = false;
captchainfo.text("Please answer the captcha correctly!");
}
if (check1Value && check2Value) {
checkInfo.text("");
} else {
isFormValid = false;
checkInfo.text("Please read and agree to the rules to create an account!");
}
return isFormValid;
}
register_username = $("#register_username");
register_password = $("#register_password");
register_password_c = $("#register_password_c");
function checkInputs_1() {
const usernameValue = register_username.val().trim();
const passwordValue = register_password.val().trim();
const passwordConfirmValue = register_password_c.val().trim();
let isFormValid = true;
if (usernameValue === '') {
setErrorFor(register_username, 'Username cannot be blank');
isFormValid = false;
} else {
setSuccessFor(register_username);
}
if (passwordValue === '') {
setErrorFor(register_password, 'Password cannot be blank');
isFormValid = false;
} else {
setSuccessFor(register_password);
}
if (passwordConfirmValue === '') {
setErrorFor(register_password_c, 'Confirm password cannot be blank');
isFormValid = false;
} else if (passwordValue !== passwordConfirmValue) {
setErrorFor(register_password_c, 'The password and confirmation password do not match');
isFormValid = false;
} else {
setSuccessFor(register_password_c);
}
return isFormValid;
}
function setErrorFor(input, message) {
input.addClass('is-danger');
const field = input.parent();
const small = field.children('small')[0];
small.innerText = message;
}
function setSuccessFor(input) {
input.removeClass('is-danger');
const field = input.parent();
const small = field.children('small')[0];
small.innerText = '';
}
function isEmail(email) {
return /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(email);
}
function generatePassword() {
const user = $("#reset_username");
if (user.val()) {
$("#reset_button").addClass("is-loading");
fetch("https://server.duinocoin.com/recovery?username=" + user.val())
.then(data => data.json()).then(data => {
$("#reset_button").removeClass("is-loading");
if (data.success && data.result.includes("sent")) {
alert_bulma(`${data.result}`);
} else {
alert_bulma(`${data.message}`);
}
}).catch(err => {
$("#reset_button").removeClass("is-loading");
alert_bulma(`Your web browser couldn't connect to the Duino-Coin servers.
We'd like to help, but there are many possible causes -
before asking the support, try disabling your browser extensions
or similar programs and try again.
Make sure nothing blocks server2.duinocoin.com`);
});
} else {
setErrorFor(user, "Enter your username!")
}
}
url = new URL(window.location);
recovery_username = url.searchParams.get("username");
recovery_hash = url.searchParams.get("hash");
if (recovery_username && recovery_hash) {
fetch("https://server.duinocoin.com/recovering/" + recovery_username + "?hash=" + recovery_hash)
.then(data => data.json()).then(data => {
if (data.success && data.result.includes("new password")) {
alert_bulma(`${data.result}
Your new passphrase: ${data.password}
Please consider changing it soon.`);
} else {
alert_bulma(`${data.message}`);
}
})
.catch(err => {
alert_bulma(`Your web browser couldn't connect to the Duino-Coin servers.
We'd like to help, but there are many possible causes -
before asking the support, try disabling your browser extensions
or similar programs and try again.
Make sure nothing blocks server2.duinocoin.com`);
});
}
greetings = [
"Welcome back",
"Hello again",
"Nice to see you",
"Hi there",
"Greetings",
"Welcome aboard",
"Hey",
"Hello",
"Great to see you",
"Back in action",
"Howdy",
"Greetings",
"Happy mining",
"Welcome to the vault",
"May the Kolka be with you",
"Good luck and have fun",
"Have a nice day",
"Hey there",
"It's been a while",
"Glad to see you're back",
"Back and ready for more",
"Welcome aboard once more",
"You were missed"
]
$(".greeting").text(greetings[Math.floor(Math.random() * greetings.length)]);
$("#theme_desktop").on('change', function() {
selected_theme = $("#theme_desktop").val();
if (selected_theme == "Terminal") {
//$("#theme-halloween").attr('disabled', true);
$("#theme-retro").attr('disabled', true);
$("#theme-terminal").attr('disabled', false);
$("#theme-glossy").attr('disabled', true);
$("#theme-bliss").attr('disabled', true);
localStorage.setItem('theme', 'Terminal');
} else if (selected_theme == "Glossy") {
//$("#theme-halloween").attr('disabled', true);
$("#theme-retro").attr('disabled', true);
$("#theme-terminal").attr('disabled', true);
$("#theme-glossy").attr('disabled', false);
$("#theme-bliss").attr('disabled', true);
localStorage.setItem('theme', 'Glossy');
} else if (selected_theme == "Retro") {
//$("#theme-halloween").attr('disabled', true);
$("#theme-retro").attr('disabled', false);
$("#theme-terminal").attr('disabled', true);
$("#theme-glossy").attr('disabled', true);
$("#theme-bliss").attr('disabled', true);
localStorage.setItem('theme', 'Retro');
} else if (selected_theme == "Bliss") {
//$("#theme-halloween").attr('disabled', true);
$("#theme-retro").attr('disabled', true);
$("#theme-terminal").attr('disabled', true);
$("#theme-glossy").attr('disabled', true);
$("#theme-bliss").attr('disabled', false);
localStorage.setItem('theme', 'Bliss');
}
/* else if (selected_theme == "Halloween") {
//$("#theme-halloween").attr('disabled', false);
$("#theme-retro").attr('disabled', true);
$("#theme-terminal").attr('disabled', true);
$("#theme-glossy").attr('disabled', true);
localStorage.setItem('theme', 'Halloween');
} */
else {
// default adaptive - disable all
//$("#theme-halloween").attr('disabled', true);
$("#theme-retro").attr('disabled', true);
$("#theme-terminal").attr('disabled', true);
$("#theme-glossy").attr('disabled', true);
$("#theme-bliss").attr('disabled', true);
localStorage.setItem('theme', 'Adaptive');
}
});
$("#theme_mobile").on('change', function() {
selected_theme = $("#theme_mobile").val();
if (selected_theme == "Terminal") {
//$("#theme-halloween").attr('disabled', true);
$("#theme-retro").attr('disabled', true);
$("#theme-terminal").attr('disabled', false);
$("#theme-glossy").attr('disabled', true);
$("#theme-bliss").attr('disabled', true);
localStorage.setItem('theme', 'Terminal');
} else if (selected_theme == "Glossy") {
//$("#theme-halloween").attr('disabled', true);
$("#theme-retro").attr('disabled', true);
$("#theme-terminal").attr('disabled', true);
$("#theme-glossy").attr('disabled', false);
$("#theme-bliss").attr('disabled', true);
localStorage.setItem('theme', 'Glossy');
} else if (selected_theme == "Retro") {
//$("#theme-halloween").attr('disabled', true);
$("#theme-retro").attr('disabled', false);
$("#theme-terminal").attr('disabled', true);
$("#theme-glossy").attr('disabled', true);
$("#theme-bliss").attr('disabled', true);
localStorage.setItem('theme', 'Retro');
} else if (selected_theme == "Bliss") {
//$("#theme-halloween").attr('disabled', true);
$("#theme-retro").attr('disabled', false);
$("#theme-terminal").attr('disabled', true);
$("#theme-glossy").attr('disabled', true);
$("#theme-bliss").attr('disabled', false);
localStorage.setItem('theme', 'Bliss');
}
/* else if (selected_theme == "Halloween") {
$("#theme-halloween").attr('disabled', false);
$("#theme-retro").attr('disabled', true);
$("#theme-terminal").attr('disabled', true);
$("#theme-glossy").attr('disabled', true);
localStorage.setItem('theme', 'Halloween');
} */
else {
// default adaptive - disable all
//$("#theme-halloween").attr('disabled', true);
$("#theme-retro").attr('disabled', true);
$("#theme-terminal").attr('disabled', true);
$("#theme-glossy").attr('disabled', true);
$("#theme-bliss").attr('disabled', true);
localStorage.setItem('theme', 'Adaptive');
}
});
window.addEventListener('load', function() {
console.log(`%cHold on!`, "color: red; font-size: 3em");
console.log(`%cThis browser feature is intended for developers.\nIf someone instructed you to copy and paste something here to enable some feature or to "hack" someone's account, it usually means he's trying to get access to your account.`, "font-size: 1.5em;");
console.log(`%cDo not execute unknown code here. We will not be responsible for your loss.`, "color: orange; font-size: 1.5em;");
});
// ------ helper MD5 functions ------- //
const MD5 = function(d) { var r = M(V(Y(X(d), 8 * d.length))); return r.toLowerCase() };
function M(d) { for (var _, m = "0123456789ABCDEF", f = "", r = 0; r < d.length; r++) _ = d.charCodeAt(r), f += m.charAt(_ >>> 4 & 15) + m.charAt(15 & _); return f }
function X(d) { for (var _ = Array(d.length >> 2), m = 0; m < _.length; m++) _[m] = 0; for (m = 0; m < 8 * d.length; m += 8) _[m >> 5] |= (255 & d.charCodeAt(m / 8)) << m % 32; return _ }
function V(d) { for (var _ = "", m = 0; m < 32 * d.length; m += 8) _ += String.fromCharCode(d[m >> 5] >>> m % 32 & 255); return _ }
function Y(d, _) {
d[_ >> 5] |= 128 << _ % 32, d[14 + (_ + 64 >>> 9 << 4)] = _;
for (var m = 1732584193, f = -271733879, r = -1732584194, i = 271733878, n = 0; n < d.length; n += 16) {
var h = m,
t = f,
g = r,
e = i;
f = md5_ii(f = md5_ii(f = md5_ii(f = md5_ii(f = md5_hh(f = md5_hh(f = md5_hh(f = md5_hh(f = md5_gg(f = md5_gg(f = md5_gg(f = md5_gg(f = md5_ff(f = md5_ff(f = md5_ff(f = md5_ff(f, r = md5_ff(r, i = md5_ff(i, m = md5_ff(m, f, r, i, d[n + 0], 7, -680876936), f, r, d[n + 1], 12, -389564586), m, f, d[n + 2], 17, 606105819), i, m, d[n + 3], 22, -1044525330), r = md5_ff(r, i = md5_ff(i, m = md5_ff(m, f, r, i, d[n + 4], 7, -176418897), f, r, d[n + 5], 12, 1200080426), m, f, d[n + 6], 17, -1473231341), i, m, d[n + 7], 22, -45705983), r = md5_ff(r, i = md5_ff(i, m = md5_ff(m, f, r, i, d[n + 8], 7, 1770035416), f, r, d[n + 9], 12, -1958414417), m, f, d[n + 10], 17, -42063), i, m, d[n + 11], 22, -1990404162), r = md5_ff(r, i = md5_ff(i, m = md5_ff(m, f, r, i, d[n + 12], 7, 1804603682), f, r, d[n + 13], 12, -40341101), m, f, d[n + 14], 17, -1502002290), i, m, d[n + 15], 22, 1236535329), r = md5_gg(r, i = md5_gg(i, m = md5_gg(m, f, r, i, d[n + 1], 5, -165796510), f, r, d[n + 6], 9, -1069501632), m, f, d[n + 11], 14, 643717713), i, m, d[n + 0], 20, -373897302), r = md5_gg(r, i = md5_gg(i, m = md5_gg(m, f, r, i, d[n + 5], 5, -701558691), f, r, d[n + 10], 9, 38016083), m, f, d[n + 15], 14, -660478335), i, m, d[n + 4], 20, -405537848), r = md5_gg(r, i = md5_gg(i, m = md5_gg(m, f, r, i, d[n + 9], 5, 568446438), f, r, d[n + 14], 9, -1019803690), m, f, d[n + 3], 14, -187363961), i, m, d[n + 8], 20, 1163531501), r = md5_gg(r, i = md5_gg(i, m = md5_gg(m, f, r, i, d[n + 13], 5, -1444681467), f, r, d[n + 2], 9, -51403784), m, f, d[n + 7], 14, 1735328473), i, m, d[n + 12], 20, -1926607734), r = md5_hh(r, i = md5_hh(i, m = md5_hh(m, f, r, i, d[n + 5], 4, -378558), f, r, d[n + 8], 11, -2022574463), m, f, d[n + 11], 16, 1839030562), i, m, d[n + 14], 23, -35309556), r = md5_hh(r, i = md5_hh(i, m = md5_hh(m, f, r, i, d[n + 1], 4, -1530992060), f, r, d[n + 4], 11, 1272893353), m, f, d[n + 7], 16, -155497632), i, m, d[n + 10], 23, -1094730640), r = md5_hh(r, i = md5_hh(i, m = md5_hh(m, f, r, i, d[n + 13], 4, 681279174), f, r, d[n + 0], 11, -358537222), m, f, d[n + 3], 16, -722521979), i, m, d[n + 6], 23, 76029189), r = md5_hh(r, i = md5_hh(i, m = md5_hh(m, f, r, i, d[n + 9], 4, -640364487), f, r, d[n + 12], 11, -421815835), m, f, d[n + 15], 16, 530742520), i, m, d[n + 2], 23, -995338651), r = md5_ii(r, i = md5_ii(i, m = md5_ii(m, f, r, i, d[n + 0], 6, -198630844), f, r, d[n + 7], 10, 1126891415), m, f, d[n + 14], 15, -1416354905), i, m, d[n + 5], 21, -57434055), r = md5_ii(r, i = md5_ii(i, m = md5_ii(m, f, r, i, d[n + 12], 6, 1700485571), f, r, d[n + 3], 10, -1894986606), m, f, d[n + 10], 15, -1051523), i, m, d[n + 1], 21, -2054922799), r = md5_ii(r, i = md5_ii(i, m = md5_ii(m, f, r, i, d[n + 8], 6, 1873313359), f, r, d[n + 15], 10, -30611744), m, f, d[n + 6], 15, -1560198380), i, m, d[n + 13], 21, 1309151649), r = md5_ii(r, i = md5_ii(i, m = md5_ii(m, f, r, i, d[n + 4], 6, -145523070), f, r, d[n + 11], 10, -1120210379), m, f, d[n + 2], 15, 718787259), i, m, d[n + 9], 21, -343485551), m = safe_add(m, h), f = safe_add(f, t), r = safe_add(r, g), i = safe_add(i, e)
}
return Array(m, f, r, i)
}
function md5_cmn(d, _, m, f, r, i) { return safe_add(bit_rol(safe_add(safe_add(_, d), safe_add(f, i)), r), m) }
function md5_ff(d, _, m, f, r, i, n) { return md5_cmn(_ & m | ~_ & f, d, _, r, i, n) }
function md5_gg(d, _, m, f, r, i, n) { return md5_cmn(_ & f | m & ~f, d, _, r, i, n) }
function md5_hh(d, _, m, f, r, i, n) { return md5_cmn(_ ^ m ^ f, d, _, r, i, n) }
function md5_ii(d, _, m, f, r, i, n) { return md5_cmn(m ^ (_ | ~f), d, _, r, i, n) }
function safe_add(d, _) { var m = (65535 & d) + (65535 & _); return (d >> 16) + (_ >> 16) + (m >> 16) << 16 | 65535 & m }
function bit_rol(d, _) { return d << _ | d >>> 32 - _ }
// ------ 2021 estimated earnings from various devices ------ //
let multiplier = document.getElementById('multiplier');
let inputHashrate = document.getElementById('input-hashrate');
multiplier.addEventListener('input', updateValueDevices);
inputHashrate.addEventListener('input', updateValueDevices);
function floatmap(x, in_min, in_max, out_min, out_max) {
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min
}
let device = document.getElementById('device-type');
let input_devices = document.getElementById('input-devices');
device.addEventListener('input', updateValueDevices);
input_devices.addEventListener('input', updateValueDevices);
function updateValueDevices(e) {
/* https://github.com/revoxhere/duino-coin#some-of-the-officially-tested-devices-duco-s1 */
let result = 0;
let hashrate = inputHashrate.value * parseInt(multiplier.value); //* multiplier.value;
if (hashrate <= 0 || input_devices.value <= 0 || input_devices.value > 125 || hashrate > 50000) {
update_element("values", "Error");
return;
}
if (device.value === 'PC') {
$(".device_selector").fadeOut('fast', function() {
$(".hashrate_selector").fadeIn('fast');
});
//result = (0.000363636 * hashrate) + 1.54545 // 2021
result = (0.0013 * hashrate) + 2.2 // 2023?
// extreme diff tier, TODO (2021)
if (hashrate > 8000) result = floatmap(result, 14.2, 100, 12.2, 30);
} else {
$(".hashrate_selector").fadeOut('fast', function() {
$(".device_selector").fadeIn('fast');
});
if (device.value === 'AVR') basereward = 8
if (device.value === 'ESP8266') basereward = 4
if (device.value === 'ESP32') basereward = 6
// kolka efficiency drop
for (i = 0; i < input_devices.value; i++) {
result += basereward;
basereward *= 0.94;
}
}
update_element("values", round_to(2, result) + " α²/day");
}
if (localStorage.getItem("shop-open-duco-cube")) {
$(".info-dot").fadeOut();
}