forked from 233boy/tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqr.html
85 lines (74 loc) · 2.44 KB
/
qr.html
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
<!DOCTYPE html>
<html lang="en">
<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>二维码生成</title>
<style>
#qrcode,
#text {
max-width: 1024px;
}
#text {
width: 95%;
}
img {
border: 1px #ddd solid;
}
</style>
</head>
<body>
<center>
<h2>
<a href="https://affping.com/to/buyjms" target="_blank">
[AD] 不会被封的 V2RAY 服务推荐!
</a>
</h2>
<textarea id="text" type="text" placeholder="请输入内容" rows="23.333" cols="23.333"></textarea>
<p id="qrcode"></p>
<p>
提醒,此网页由 Github Page服务提供,<a href="https://github.com/233boy/tools" target="_blank" rel="noopener noreferrer">源代码在这里</a>
</p>
</center>
<script src="./jquery-qrcode.min.js"></script>
<!-- <script src="https://cdn.jsdelivr.net/combine/npm/[email protected]/dist/jquery.min.js,gh/lrsjng/[email protected]/dist/jquery-qrcode.min.js"></script> -->
<script type="text/javascript">
$(function () {
function qr(text) {
var options = {
render: 'canvas',
size: 300,
ecLevel: 'Q',
fill: '#233',
background: null,
text: text,
label: '233boy',
fontname: 'sans',
fontcolor: '#233',
quiet: 0,
mode: 2
};
$("#qrcode").empty().qrcode(options);
}
if (window.location.hash) {
var v = window.location.hash.substring(1);
text.value = v;
qr(v) || setTimeout(function(){qr(v);}, 1000);
}
// auto focus
text.focus()
$("#text").on("input", function (e) {
var v = $(e.target).val();
window.location.hash = v;
if (v === "") {
qrcode.innerHTML = '尼玛。。。没有内容生成个蛋啊。。。。'
} else {
qr(v);
}
})
})
// "serviceWorker"in navigator&&navigator.serviceWorker.register("/tools/sw.js");
</script>
</body>
</html>