-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
89 lines (60 loc) · 2.26 KB
/
script.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
let header = document.getElementById('header')
let passwordLength
function getPassword(){
getPassword1()
getPassword2()
getPassword3()
getPassword4()
}
function getPassword1(){
chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
passwordLength = document.getElementById('slider').value
let password = ""
for (let i=0; i<passwordLength; i++){
password += chars[Math.floor(Math.random() * Math.floor(chars.length-1)) ]
document.getElementById("pass1").textContent = password
}
}
function getPassword2(){
chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
passwordLength = document.getElementById('slider').value
let password = ""
for (let i=0; i<passwordLength; i++){
password += chars[Math.floor(Math.random() * Math.floor(chars.length-1)) ]
document.getElementById("pass2").textContent = password
}
}
function getPassword3(){
chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
passwordLength = document.getElementById('slider').value
let password = ""
for (let i=0; i<passwordLength; i++){
password += chars[Math.floor(Math.random() * Math.floor(chars.length-1)) ]
document.getElementById("pass3").textContent = password
}
}
function getPassword4(){
chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
passwordLength = document.getElementById('slider').value
let password = ""
for (let i=0; i<passwordLength; i++){
password += chars[Math.floor(Math.random() * Math.floor(chars.length - 1)) ]
document.getElementById("pass4").textContent = password
}
}
// Setting Password Length
// document.getElementById('length').innerHTML = "Length: 1 "
let sliderEl = document.getElementById('slider').value
document.getElementById('length').textContent ="Dlugosc: " + sliderEl
document.getElementById('slider').oninput = function(){
let sliderEl = document.getElementById('slider').value
if(sliderEl > 0){
document.getElementById('length').innerHTML = "Dlugosc: " + sliderEl
} else {
document.getElementById('length').innerHTML = "Dlugosc: 1"
}
}
// change font size accordingly to password size
// function changeSize(){
// if
// }