-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
105 lines (90 loc) · 2.62 KB
/
index.html
File metadata and controls
105 lines (90 loc) · 2.62 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>PatternLockJS Demo</title>
<style>
*,
::before,
::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html,
body {
/* 禁用下拉刷新 */
overscroll-behavior-y: contain;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
}
#lock {
position: absolute;
top: calc(50% - 22.5vh);
left: calc(50% - 22.5vh);
width: 45vh;
height: 45vh;
border: 1px solid #000;
}
#password,
#value {
width: 100%;
text-align: center;
position: absolute;
left: 50%;
transform: translate(-50%);
font-size: 2rem;
font-weight: bold;
color: #424242;
}
#password {
top: 3rem;
}
#password::before {
content: 'Password: ';
font-size: 1.75rem;
}
#value {
bottom: 3rem;
}
#value::before {
content: 'Value: ';
font-size: 1.75rem;
}
</style>
</head>
<body>
<!-- 设置一个空元素,作为PatternLock图案锁的容器 -->
<div id="lock"></div>
<div id="password"></div>
<div id="value"></div>
<!-- 引入patternlock.js -->
<script src="./dist/patternlock.min.js"></script>
<script>
window.onload = () => {
let pwd = '159637';
const pwdElement = document.querySelector('#password');
const valueElement = document.querySelector('#value');
const lock = new PatternLock('#lock', {
complete: value => {
valueElement.innerText = value;
},
reset: () => {
console.log('reset');
},
verify: value => {
if (value == pwd) {
alert('密码正确!');
return true;
} else {
return false;
}
}
});
pwdElement.innerText = pwd;
valueElement.innerText = '?';
}
</script>
</body>
</html>