Repository navigation
Expand file tree
/
Copy pathscript.js
More file actions
82 lines (71 loc) · 1.54 KB
/
Copy pathscript.js
File metadata and controls
82 lines (71 loc) · 1.54 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
async function ded(){
const key = document.querySelector('#key');
const points_div = document.querySelector('#points');
let points;
let Points4572;
const codes = {
'97' : 'a',
'98' : 'b',
'99' : 'c',
'100' : 'd',
'101' : 'e',
'102' : 'f',
'103' : 'g',
'104' : 'h',
'105' : 'i',
'106' : 'j',
'107' : 'k',
'108' : 'l',
'109' : 'm',
'110' : 'n',
'111' : 'o',
'112' : 'p',
'113' : 'q',
'114' : 'r',
'115' : 's',
'116' : 't',
'117' : 'u',
'118' : 'v',
'119' : 'w',
'120' : 'x',
'121' : 'y',
'122' : 'z',
}
let keycode;
let au;
window.onload = ()=>{
Points4572=0;
points = 0;
Rand_keycode()
}
function Rand_keycode()
{
keycode = Math.floor(Math.random()*26)+97;
key.innerHTML = codes[keycode];
if(au==true) console.log('✅ Puntky: ' + points);
if(au==false) console.log('🚫 Puntky: ' + points);
console.log('Litera: ' + codes[keycode])
}
window.onkeypress = function(e) {
if(points==Points4572){
if (e.keyCode == keycode) {
Points4572++;
au=true;
points++;
points_div.innerHTML = points;
Rand_keycode();
}else{
au=false;
points = 0;
Points4572=0;
points_div.innerHTML = points;
Rand_keycode()
}
}
else {
console.log('🚫 Coś ci nie pykło z tą konsolą')
points=0;
}
}
};
ded();