console.log('%cTESTING COMPLETE', 'color:orange;font-weight:bold')
}
- document.getElementById('validate').addEventListener('click', e => {
- console.log(e)
+ function startValidation (event) {
const work = document.getElementById('work')
const hash = document.getElementById('hash')
- const validated = document.getElementById('validated')
- validated.innerText = ''
+ const validation = document.getElementById('validation')
+ validation.innerText = ''
NanoPow.validate(work.value, hash.value)
.then(result => {
- validated.innerText = result
+ validation.innerText = result
? 'Valid'
: 'INVALID'
})
.catch(err => {
console.error(err)
- validated.innerText = err.message
+ validation.innerText = err.message
})
- })
+ }
+ document.getElementById('btnStartValidation').addEventListener('click', startValidation)
- document.getElementById('go').addEventListener('click', e => {
+ function startTest (event) {
const size = document.getElementById('size')
const effort = document.getElementById('effort')
const isOutputShown = document.getElementById('isOutputShown')
const isGlForced = document.getElementById('isGlForced')
const isDebug = document.getElementById('isDebug')
run(+size.value, +effort.value, isOutputShown.checked, isGlForced.checked, isDebug.checked)
- })
+ }
+ document.getElementById('btnStartTest').addEventListener('click', startTest)
</script>
<style>body{background:black;color:white;}a{color:darkcyan;}input[type=number]{width:5em;}span{margin:0.5em;}</style>
</head>
<input id="work" type="text" />
<label for="hash">Hash</label>
<input id="hash" type="text" />
- <button id="validate">Validate</button>
- <span id="validated"></span>
+ <button id="btnStartValidation">Validate</button>
+ <span id="validation"></span>
<hr />
<label for="size">Test Size</label>
- <input id="size" type="number" value="64" />
+ <input id="size" type="number" value="64" autofocus />
<label for="effort">Effort (1-16)</label>
<input id="effort" type="number" value="8" min="1" max="16" />
<span>
<label for="isDebug">Debug?</label>
<input id="isDebug" type="checkbox" />
</span>
- <button id="go">Go</button>
+ <button id="btnStartTest">Go</button>
<h3 id="status">WAITING</h3>
<hr />
<pre id="summary"></pre>