-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
109 lines (98 loc) · 4.55 KB
/
index.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
function WifiQR() {
var ssid = document.getElementById("SSID").value;
var pwd = document.getElementById("Password").value;
var enc = document.getElementById("enc").value;
var hidden = document.getElementById("hidden").checked;
var valid = document.forms["WifiForm"]["SSID"].value;
if (valid == null || valid == "") {
document.getElementById("ssid-error").innerHTML = '<p style="color:red; font-size:15px;">Please enter a SSID</p>';
document.getElementById("qrwifi").innerHTML = "<style>display:none;</style>";
} else {
document.getElementById("qrwifi").innerHTML = "<style>display:none;</style>";
var qrcode = new QRCode(document.getElementById("qrwifi"), {
text: "WIFI:S:" + ssid + ";T:" + enc + ";P:" + pwd + ";H:" + hidden + ";",
width: 128,
height: 128,
colorDark: "#000000",
colorLight: "#ffffff",
correctLevel: QRCode.CorrectLevel.H
});
document.getElementById("ssid-error").innerHTML = "<style>display:none;</style>";
}
}
function VcardQR() {
var name = document.getElementById("name").value;
var title = document.getElementById("title").value;
var company = document.getElementById("company").value;
var phone = document.getElementById("phone").value;
var url = document.getElementById("url").value;
var address = document.getElementById("address").value;
var email = document.getElementById("email").value;
document.getElementById("vcqr").innerHTML = "<style>display:none;</style>";
var qrcode = new QRCode(document.getElementById("vcqr"), {
text: "BEGIN:VCARD\r\nVERSION:3.0\r\nN:" + name + "\r\nTITLE:" + title + "\r\nORG:" + company + "\r\nTEL:" + phone + "\r\nURL:" + url + "\r\nEMAIL:" + email + "\r\nADR:" + address + "\r\nEND:VCARD",
width: 128,
height: 128,
colorDark: "#000000",
colorLight: "#ffffff",
correctLevel: QRCode.CorrectLevel.H
});
}
function smsQR() {
var phnumber = document.getElementById("phnumber").value;
var sms = document.getElementById("sms").value;
var valid = document.forms["SMSForm"]["phnumber"].value;
if (valid == null || valid == "") {
document.getElementById("sms-error").innerHTML = '<p style="color:red; font-size:15px;">Please enter a Phone no.</p>';
document.getElementById("smsrs").innerHTML = "<style>display:none;</style>";
} else {
document.getElementById("smsrs").innerHTML = "<style>display:none;</style>";
var qrcode = new QRCode(document.getElementById("smsrs"), {
text: "smsto:" + phnumber + ":" + sms,
width: 128,
height: 128,
colorDark: "#000000",
colorLight: "#ffffff",
correctLevel: QRCode.CorrectLevel.H
});
document.getElementById("sms-error").innerHTML = "<style>display:none;</style>";
}
}
function QRurl() {
var valid = document.forms["myForm"]["inputText"].value;
if (valid == null || valid == "") {
document.getElementById("error").innerHTML = '<p style="color:red; font-size:15px;">Please enter a text or url</p>';
document.getElementById("urlqr").innerHTML = "<style>display:none;</style>";
} else {
document.getElementById("urlqr").innerHTML = "<style>display:none;</style>";
const text1 = document.getElementById("inputText").value;
var qrcode = new QRCode(document.getElementById("urlqr"), {
text: text1,
width: 128,
height: 128,
colorDark: "#000000",
colorLight: "#ffffff",
correctLevel: QRCode.CorrectLevel.H
});
document.getElementById("error").innerHTML = "<style>display:none;</style>";
}
}
function QRtext() {
var valid = document.forms["texForm"]["inputText2"].value;
if (valid == null || valid == "") {
document.getElementById("error2").innerHTML = '<p style="color:red; font-size:15px;">Please enter a text </p>';
document.getElementById("teqr").innerHTML = "<style>display:none;</style>";
} else {
document.getElementById("teqr").innerHTML = "<style>display:none;</style>";
const text2 = document.getElementById("inputText2").value;
var qrcode = new QRCode(document.getElementById("teqr"), {
text: text2,
width: 128,
height: 128,
colorDark: "#000000",
colorLight: "#ffffff",
correctLevel: QRCode.CorrectLevel.H
});
document.getElementById("error2").innerHTML = "<style>display:none;</style>";
}
}