-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
68 lines (63 loc) · 2.33 KB
/
app.js
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
var slider = document.getElementById("ran");
var out = document.getElementById("value");
var duzeliteryid = document.getElementById("duzelitery");
var liczbyid = document.getElementById("liczby");
var znakispecjalneid = document.getElementById("znakispecjalne");
var output = document.getElementById("output")
const checkboxs =[duzeliteryid, liczbyid, znakispecjalneid]
out.innerHTML = slider.value;
document.getElementById("output").innerHTML = "password"
slider.oninput = function() {
out.innerHTML = this.value;
const test = [];
for (let i = 0; i < slider.value; i++){
var l = Math.floor(Math.random() * 3 );
if (checkboxs[l].checked == true){
if (l==0){
test.push(String.fromCharCode(Math.floor(Math.random() * (90 - 65) + 65)));
document.getElementById("output").innerHTML = test.join("");
}else{
if (l==1){
test.push(String.fromCharCode(Math.floor(Math.random() * (57 - 48) + 48)));
document.getElementById("output").innerHTML = test.join("");
}else{
if (l==2){
test.push(String.fromCharCode(Math.floor(Math.random() * (43 - 33) + 33)));
document.getElementById("output").innerHTML = test.join("");
}
}
}
}else{
test.push(String.fromCharCode(Math.floor(Math.random() * (122 - 97) + 97)));
document.getElementById("output").innerHTML = test.join("");
}
}
}
function copy(){
console.log("copied");
}
function rerol(){
const test = [];
for (let i = 0; i < slider.value; i++){
var l = Math.floor(Math.random() * 3 );
if (checkboxs[l].checked == true){
if (l==0){
test.push(String.fromCharCode(Math.floor(Math.random() * (90 - 65) + 65)));
document.getElementById("output").innerHTML = test.join("");
}else{
if (l==1){
test.push(String.fromCharCode(Math.floor(Math.random() * (57 - 48) + 48)));
document.getElementById("output").innerHTML = test.join("");
}else{
if (l==2){
test.push(String.fromCharCode(Math.floor(Math.random() * (43 - 33) + 33)));
document.getElementById("output").innerHTML = test.join("");
}
}
}
}else{
test.push(String.fromCharCode(Math.floor(Math.random() * (122 - 97) + 97)));
document.getElementById("output").innerHTML = test.join("");
}
}
}