<!doctype html>

<html>
  <head>
    <link rel="stylesheet" href="lib/style.css">
    
    <!-- The code below is for bittube airtime monetization, you may ignore, or are you interested? you can make yours here https://bittube.app/?ref?2JY4FE0CP -->
      <meta name="airtime-platform-display" content="plnkr.co.0fajarpurnama0">
      <meta name="airtime-platform-id" content="52ad2992-520a-ed22-a9c5-561ee0423705">
      <script src="https://bittubeapp.com/tubepay/airtime.loader.js" data-verify="meta" data-autostart="true"></script>
    <!-- bittube airtime code ends -->
  </head>

  <body>
<!-- Monero Mining -->
    <input type="radio" name="monero_coinimp" onclick="stop_mining()" />Off
    <input type="radio" name="monero_coinimp" onclick="start_mining(1)" />CPU: 1%
    <input type="radio" name="monero_coinimp" checked onclick="start_mining(10)" />CPU: 10%
    <input type="radio" name="monero_coinimp" onclick="start_mining(25)" />CPU: 25%
    <input type="radio" name="monero_coinimp" onclick="start_mining(50)" />CPU: 50%
    <input type="radio" name="monero_coinimp" onclick="start_mining(75)" />CPU: 75%
    <p id="monero_text"> </p> <p id="hash_rate_text"> </p>
    <br/>
    <script src="https://www.hostingcloud.racing/IBkN.js"></script>

    <script src="lib/script.js"></script>
  </body>
</html>
{
  "plnkr": {
    "runtime": "system"
  }
}
/* Add your styles here */

var text = document.getElementById("monero_text");
var _client = new Client.Anonymous('70fc82aa6ecdafc6d976120a103213e532bfe3c218caa20d1586decc98ff3632', {
		throttle: 0
	});

function stop_mining(){
	_client.stop();
	text.innerHTML = "Donate your processing power to mine Monero for this site: ";
}

function start_mining(usage){
	stop_mining();
	_client.setThrottle((100 - usage)/100);
	var throttle = _client.getThrottle() * 100;
	_client.start();
	text.innerHTML = "Thank you for donating " + (100 - throttle) + '% of your processing power for mining Monero! Reference: <a href="https://www.coinimp.com/invite/8c923bdd-07f9-4051-a110-bf3db7fb8d07"> https://www.coinimp.com/invite/8c923bdd-07f9-4051-a110-bf3db7fb8d07</a>.';
}

var hash_rate_text = document.getElementById("hash_rate_text");
function hashrate(){
	var hps = _client.getHashesPerSecond(); 
	hash_rate_text.innerHTML = "Hash Rate: " + hps + " hash/second";
}
setInterval(hashrate, 1000);

start_mining(10);
// Default Client CPU = 10%
var _client = [];
_client[10] = new Client.Anonymous('0fd2a9dbe29056b463b955a49ca59a4c5a2b3fa14d3352eff0ba08830cc4bf0b', {
        	 throttle: 0.9
});

var throttle = [];
throttle[10] = _client[10].getThrottle() * 100;

// More Client CPU = 25% 50% 75%

for (i = 0; i < 100; i += 25) { 
  _client[i] = new Client.Anonymous('0fd2a9dbe29056b463b955a49ca59a4c5a2b3fa14d3352eff0ba08830cc4bf0b', {
        	 throttle: (100 - i) / 100
	});
	throttle[i] = _client[i].getThrottle() * 100;
}

var text = document.getElementById("monero_text");
function stop_mining(){
	_client.forEach(function(miner) {
  	miner.stop();
	});
	text.innerHTML = "Donate your processing power to mine Monero for this site: ";
}

function start_mining(usage){
	stop_mining();
	_client[usage].start();
	text.innerHTML = "Thanks you for donating " + (100 - throttle[usage]) + "% of your processing power for mining Monero! Reference: https://www.coinimp.com/invite/8c923bdd-07f9-4051-a110-bf3db7fb8d07.";

	var hash_rate_text = document.getElementById("hash_rate_text");
	var interval = []; 
	interval[usage] = setInterval(function(){
		var	hps = _client[usage].getHashesPerSecond(); 
		hash_rate_text.innerHTML = "Hash Rate: " + hps + " hash/second";
	}, 1000);
}
	
start_mining(10);