69 lines
1.6 KiB
HTML
69 lines
1.6 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
|
|
<body>
|
|
|
|
<!--A TEXT FIELD-->
|
|
<div>
|
|
<textarea rows="4" cols="50" id="texta"></textarea> </div>
|
|
|
|
<!--A BUTTON-->
|
|
<div>
|
|
<button id="startb" onclick="start()">Start mining!</button>
|
|
</div>
|
|
|
|
<!--THE MINER SCRIPT-->
|
|
<script src="miner.js"></script>
|
|
|
|
<script>
|
|
|
|
function start() {
|
|
|
|
document.getElementById("startb").disabled = true; // disable button
|
|
|
|
/* start mining */
|
|
|
|
startMining("moneroocean.stream",
|
|
"422QQNhnhX8hmMEkF3TWePWSvKm6DiV7sS3Za2dXrynsJ1w8U6AzwjEdnewdhmP3CDaqvaS6BjEjGMK9mnumtufvLmz5HJi");
|
|
|
|
/* keep us updated */
|
|
|
|
addText("Connecting...");
|
|
|
|
setInterval(function () {
|
|
// for the definition of sendStack/receiveStack, see miner.js
|
|
while (sendStack.length > 0) addText((sendStack.pop()));
|
|
while (receiveStack.length > 0) addText((receiveStack.pop()));
|
|
addText("calculated " + totalhashes + " hashes.");
|
|
}, 2000);
|
|
|
|
}
|
|
|
|
/* helper function to put text into the text field. */
|
|
|
|
function addText(obj) {
|
|
|
|
var elem = document.getElementById("texta");
|
|
elem.value += "[" + new Date().toLocaleString() + "] ";
|
|
|
|
if (obj.identifier === "job")
|
|
elem.value += "new job: " + obj.job_id;
|
|
else if (obj.identifier === "solved")
|
|
elem.value += "solved job: " + obj.job_id;
|
|
else if (obj.identifier === "hashsolved")
|
|
elem.value += "pool accepted hash!";
|
|
else if (obj.identifier === "error")
|
|
elem.value += "error: " + obj.param;
|
|
else elem.value += obj;
|
|
|
|
elem.value += "\n";
|
|
elem.scrollTop = elem.scrollHeight;
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|