forked from anders94/blockchain-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblock.pug
60 lines (51 loc) · 1.98 KB
/
block.pug
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
extends layout
block content
.container
h1 #{__('Block')}
.well#block1chain1well
form.form-horizontal
.form-group
label.col-sm-2.control-label(for='block1chain1number') #{__('Block')}:
.col-sm-10
.input-group
span.input-group-addon #
input#block1chain1number.form-control(type='number', value='1' onchange='updateHash(1, 1);' onkeyup='updateHash(1, 1);')
.form-group
label.col-sm-2.control-label(for='block1chain1nonce') #{__('Nonce')}:
.col-sm-10
input#block1chain1nonce.form-control(type='text', value='72608', onkeyup='updateHash(1, 1);')
.form-group
label.col-sm-2.control-label(for='block1chain1data') #{__('Data')}:
.col-sm-10
textarea#block1chain1data.form-control(rows='10', onkeyup='updateHash(1, 1);')
#state.form-group
label.col-sm-2.control-label(for='block1chain1hash') #{__('Hash')}:
.col-sm-10
input#block1chain1hash.form-control(type='text', disabled)
.form-group
.col-sm-2
i.icon-spinner.icon-spin.icon-large
.col-sm-10
button#block1chain1mineButton.btn.btn-primary.ladda-button(data-style='expand-right')
span.ladda-label #{__('Mine')}
script.
$(function() {
mineButtonAnimation(1, 1);
updateHash(1, 1);
});
function getText(block, chain) {
return $('#block'+block+'chain'+chain+'number').val() +
$('#block'+block+'chain'+chain+'nonce').val() +
$('#block'+block+'chain'+chain+'data').val();
}
function mineButtonAnimation(block, chain) {
$('#block'+block+'chain'+chain+'mineButton').click(function(e) {
e.preventDefault();
var l = Ladda.create(this);
l.start();
setTimeout(function() {
mine(block, chain, false);
l.stop();
}, 250); // give UI time to update
});
}