From 941c4a3a9f8373b5ab445ee46086f29d1a9e24f1 Mon Sep 17 00:00:00 2001 From: ZiRo Date: Tue, 17 May 2016 08:55:21 +0200 Subject: [PATCH] indicate mining process --- contrib/js/cuckoo_miner.js | 6 ++++++ contrib/static/nntpchan.js | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/contrib/js/cuckoo_miner.js b/contrib/js/cuckoo_miner.js index fee545d..ed7244f 100644 --- a/contrib/js/cuckoo_miner.js +++ b/contrib/js/cuckoo_miner.js @@ -1,8 +1,14 @@ onready(function(){ document.getElementById("start_miner").onclick = function() { + var btn = document.getElementById("start_miner"); + var label = btn.value; + btn.value = "..." + btn.disabled = true; var worker = new Worker("./static/mineworker.js"); worker.onmessage = function(e) { miner_cb(e.data); + btn.value=label; + btn.disabled = false; worker.terminate(); } worker.postMessage(55.0); // Start the worker. diff --git a/contrib/static/nntpchan.js b/contrib/static/nntpchan.js index d1acaf7..017995f 100644 --- a/contrib/static/nntpchan.js +++ b/contrib/static/nntpchan.js @@ -620,7 +620,8 @@ parent.appendChild(post);} /* local file: ./contrib/js/banner.js */ var banner_count=3;function nntpchan_inject_banners(elem,prefix){var n=Math.floor(Math.random()*banner_count);var banner=prefix+"static/banner_"+n+".jpg";var e=document.createElement("img");e.src=banner;e.id="nntpchan_banner";elem.appendChild(e);} /* local file: ./contrib/js/cuckoo_miner.js */ -onready(function(){document.getElementById("start_miner").onclick=function(){var worker=new Worker("./static/mineworker.js");worker.onmessage=function(e){miner_cb(e.data);worker.terminate();} +onready(function(){document.getElementById("start_miner").onclick=function(){var btn=document.getElementById("start_miner");var label=btn.value;btn.value="..." +btn.disabled=true;var worker=new Worker("./static/mineworker.js");worker.onmessage=function(e){miner_cb(e.data);btn.value=label;btn.disabled=false;worker.terminate();} worker.postMessage(55.0);};});function miner_cb(s){document.getElementById("miner_result").value=s;} /* local file: ./contrib/js/expand-image.js */ function filenameIsImage(fname){return/\.(gif|jpeg|jpg|png|webp)/.test(fname.toLowerCase());}