add cuckoo miner to postform
This commit is contained in:
parent
1791fc475b
commit
261493af0b
13
contrib/js/cuckoo_miner.js
Normal file
13
contrib/js/cuckoo_miner.js
Normal file
@ -0,0 +1,13 @@
|
||||
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();
|
||||
}
|
||||
worker.postMessage(55.0); // Start the worker.
|
||||
};
|
||||
});
|
||||
function miner_cb(s) {
|
||||
document.getElementById("miner_result").value = s;
|
||||
}
|
27637
contrib/static/miner-js.js
Normal file
27637
contrib/static/miner-js.js
Normal file
File diff suppressed because one or more lines are too long
6
contrib/static/mineworker.js
Normal file
6
contrib/static/mineworker.js
Normal file
@ -0,0 +1,6 @@
|
||||
importScripts('./miner-js.js');
|
||||
|
||||
onmessage = function(e) {
|
||||
var s = cuckoo["mine_cuckoo"](e.data);
|
||||
postMessage(s);
|
||||
}
|
@ -619,6 +619,9 @@ function nntpchan_buildpost(parent,j){var post=document.createElement("div");if(
|
||||
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();}
|
||||
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());}
|
||||
function setupInlineImage(thumb,url){if(thumb.inlineIsSetUp)return;thumb.inlineIsSetUp=true;var img=thumb.querySelector("img.thumbnail");var expanded=false;var oldurl=img.src;thumb.onclick=function(){if(expanded){img.setAttribute("class","thumbnail");img.src=oldurl;expanded=false;}else{img.setAttribute("class","expanded-thumbnail");img.src=url;expanded=true;}
|
||||
|
@ -77,6 +77,14 @@
|
||||
<input type="text" name="captcha" autocomplete="off" id="captcha_solution" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
{{#i18n.Translations}}{{cuckoo_pow}}{{/i18n.Translations}}
|
||||
</th>
|
||||
<td>
|
||||
<input type="text" name="pow" autocomplete="off" id="miner_result" /><input id="start_miner" type="button" value="{{#i18n.Translations}}{{start_mining}}{{/i18n.Translations}}"/>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
@ -171,3 +171,6 @@ secretkey_name=Secret key
|
||||
key_install_title=A new keypair has been generated for you. Please keep it safe and don't share it with anyone, as this is used to login to the mod panel
|
||||
#'
|
||||
|
||||
cuckoo_pow=Proof of Work
|
||||
start_mining=Mine!
|
||||
|
||||
|
Reference in New Issue
Block a user