-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
176 lines (176 loc) · 6.13 KB
/
index.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<!DOCTYPE html>
<html lang="pt">
<head>
<meta
name="description"
content="Gerador de QR code NuBank. Adicone QR no seu cartão NuBank"
/>
<meta
name="keywords"
content="qrcode,nubank,nuconta,qr-code,gerador,adesivos,cartão"
/>
<meta name="robots" content="index, follow" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="author" content="Jadson G. Matos" />
<title>QR Card</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script>
var qrCard;
if ("serviceWorker" in navigator) {
navigator.serviceWorker.register("sw.js");
}
window.onload = () => {
qrCard = new QRCard();
qrCard.ctx = document.querySelector("[data-card]").getContext("2d");
qrCard.logo = document.querySelector("[data-logo='w']");
qrCard.render();
};
class QRCard {
constructor() {
this.ctx;
this.cpf;
this.name;
this.logo;
}
async render() {
this.cpf = document.querySelector("[data-cpf]").value;
this.name = document.querySelector("[data-name]").value;
this.ctx.globalCompositeOperation = "source-over";
this.ctx.fillStyle = "#8a05be";
this.ctx.fillRect(0, 0, 1063, 709);
let image = new Image();
image.src =
"https://chart.googleapis.com/chart?chs=177x177&cht=qr&choe=UTF-8&chld=H&chl=nuapp://cpf/" +
this.cpf;
image.crossOrigin = "anonymous";
image.onload = async () => {
this.ctx.globalCompositeOperation = "screen";
this.ctx.drawImage(image, 645, 64, 354, 354);
// Logo
this.ctx.drawImage(this.logo, 64, 459, 124, 90);
// Cor
this.ctx.globalCompositeOperation = "color";
this.ctx.fillStyle = "#8a05be";
this.ctx.fillRect(0, 0, 1063, 709);
// Nome
this.ctx.globalCompositeOperation = "source-over";
this.ctx.fillStyle = "#fff";
this.ctx.font = "64px Graphik-Regular";
this.ctx.fillText(this.name, 64, 645);
};
}
async download() {
let link = document.createElement("a");
link.download = this.name + "-QrCard.png";
link.href = document
.querySelector("[data-card]")
.toDataURL("image/png", 0.1);
link.click();
}
}
</script>
<style>
:root {
--roxo: #8a05be;
}
@font-face {
font-family: Graphik-Regular;
src: url("https://cdn.nubank.com.br/fonts/Graphik/variants/Graphik-Regular.woff2");
}
html,
body {
margin: 0;
font-family: Graphik-Regular, "Gotham SSm A", "Gotham SSm B",
"Helvetica Neue", Helvetica, Arial, sans-serif !important;
}
.c-t {
position: relative;
text-align: center;
left: 17.5vw;
width: 65vw;
border-radius: 2em;
}
.my-2 {
margin-top: 2em;
margin-bottom: 2em;
}
button {
background-color: var(--roxo);
border: 0;
height: 3em;
color: #fff;
cursor: pointer;
}
input {
padding-left: 2vw;
padding-top: 1vh;
padding-bottom: 1vh;
}
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
input:focus,
select:focus,
textarea:focus,
button:focus {
outline: none;
}
canvas {
position: relative;
left: 25vw;
width: 50vw;
border-radius: 1em;
filter: drop-shadow(1vw 1vh 2vmax #555);
margin-bottom: 2em;
}
</style>
</head>
<body>
<br />
<h1 class="c-t" style="color: var(--roxo)">Gerador de QR code NuBank</h1>
<h4 class="c-t">Adicone QR no seu cartão NuBank</h4>
<input
type="number"
data-cpf
class="my-2 c-t"
onkeyup="qrCard.render()"
placeholder="Seu CPF"
autofocus
/>
<input
type="text"
class="my-2 c-t"
data-name
onkeyup="qrCard.render()"
value="Seu Nome"
/>
<canvas class="img" data-card width="1063" height="709"></canvas>
<br />
<button
type="button"
onclick="qrCard.download()"
class="c-t b"
aria-expanded="false"
>
Download
</button>
<br />
<img
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHwAAABaCAQAAADQ4voeAAADhUlEQVR42u3c23GjMACFYUqgBJdAB6sOQgehg9ABdAAdQAdxB9CB3QF0AB38O7tEke0B60IeRKyjp8QeiU8XwDOIiMiqvFHQcUFmoKPig4ToWMX8qzEVE9uZaHgn9oP1c/DsFq3hCz9oPwGvsEvnP97kSzkqIyXibkInCErOzI94v9e9ydqeWDJrxlHQPvArf9e8+XjPRiMYkzGiMvg67vqvXFiSWVSbo0Z+IvODagtfMltWHHNG5cMPrA08YUnvUHmGSuMH1xwunOCq22Zkcj/AznB3ul9r3R7uTp84+YG2hDuXFJnOD/QWXFDQ0P0vl+/R6lZKQ8GbQTO1wXRPqeg2SoWwnGXFk7rSNXjBgH0a7SQeWTJsfN6gS2VxNdGluYcnCm2dicJoyUC6OtomSQ1H2yS5pp+s0jy9M+9Zcl757IxJzkbwGpP0a+yZGvFVcpZcEaulZkSlMzrFxVudsrGSS4sTrKqrfDofVqZaSWx5Vs+Yje7QZsVbP1iXK4tlJ0YKfv/DM3VqNOFqsBJb2bW+wFtkEudGT9/jOWjPtr0f8BMy+a5GhfZaLfyC56raXY2qJtutWeEXvFfjtKtRNZWnrW/4BR9YEu9uNEYmPgKcH2xURrwa/Pqq8D7AAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAAzzAreCXV4XzavAYGbHzGFRd4xHg6rnnfO8xqOdp/YLHmueeu93H0Mku9AsutLtM8l3HkCNz8gueaTfzTJycj0EgUxP5AS9Z0hps7BgQTseQorYjxL7AU4l6UneLSmV5DDHV424m3YO3lRO80nSi2wWrR2Xgk4I/K+XCkg/5H/k2k/vlJKvTpdSQ926jOhuct2NanKPYEp5jkkRD3rtxLjO8SSmZcc14q1CrR9tPe7e7aU5go+Ed+YnWAT8+XgjlSNX0G6W2fL2FeFpXarAjtDSaWyXtahuyU65ff7eUawIvtjR/lV63d839yuI3/ITaYp+8EjwiA0V/JXhEfkt/Jfj9NSbbAT8dDR5RovJp/bYomeh48PuN2RMfDmeJ6zHhEQkjKoPhuwETJpbkR4VHxNSW7wZ8v/3heVz4MoI9PPA/KXgjueuiP/JtJmq8jw3/V4TC66LYvwGu3g1okpmM6PfAlwmdafgzNTHRb4OrdZ9R0zMi09NT2v6w+Qv7Yq5qCeLwbwAAAABJRU5ErkJggg=="
data-logo="w"
hidden
/>
<br />
<div style="text-align: center">
<a href="https://github.com/Slender1808">Created by Jadson G. Matos</a>
</div>
<br />
<script
data-ad-client="ca-pub-7540935582112706"
async
src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"
></script>
</body>
</html>