forked from ShareX/sharex.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathncodeweb.html
398 lines (355 loc) · 12.7 KB
/
ncodeweb.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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
<!DOCTYPE html>
<html lang="pt_BR">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=2">
<title>Gerador de Código de Barras EAN-13</title>
<style>
body {
font-family: Arial, sans-serif;
}
.skeleton-wrapper {
width: 300px;
margin: 20px auto;
text-align: center;
}
.skeleton-circle {
animation: loading 3s infinite;
background: linear-gradient(90deg, #000000 25%, #a8a8a8 50%, #000000 75%);
background-size: 250% 80%;
border-radius: 10%;
display: inline-block;
width: 100px;
height: 100px;
margin: 0px auto;
}
.skeleton-nome {
margin-top: 41px;
margin-left: auto;
margin-right: auto;
background: linear-gradient(90deg, #030000 25%, #a8a8a8 50%, #030303 75%);
background-size: 250% 80%;
height: 20px;
width: 100%;
border-radius: 20px;
animation: loading 3s infinite;
}
.skeleton-text {
margin-top: 22px;
margin-left: auto;
margin-right: auto;
background: linear-gradient(90deg, #080808 25%, #a8a8a8 50%, #000000 75%);
background-size: 250% 80%;
height: 16px;
width: 42%;
border-radius: 100px;
animation: loading 3s infinite;
}
.nilsonlinux {
margin-top: 20px;
margin-left: auto;
margin-right: auto;
background-color: #000000;
color: #03fd24;
font-weight: bold;
border: 1px solid #067c02;
height: 16px;
width: 42%;
border-radius: 20px;
}
@keyframes skeleton-loading {
0% {
opacity: 0.7;
}
50% {
opacity: 0.2;
}
100% {
opacity: 0.7;
}
}
.profile {
text-align: center;
margin: 20px auto;
}
.profile img {
width: 100px;
height: 100px;
border-radius: 10%;
margin-bottom: 20px;
}
.info {
text-align: center;
color: #ffffff;
}
body {
font-family: Arial, sans-serif;
text-align: center;
background-color: #3d3c3c;
}
.container {
max-width: 300px;
margin: 0 auto;
padding: 30px;
background-color: hwb(0 33% 67% / 0.986);
border-radius: 10px;
box-shadow: 0 0 10px rgb(37, 37, 37);
}
h1 {
margin-bottom: 20px;
}
input[type="text"] {
width: 60%;
padding: 8px;
margin-bottom: 10px;
border-radius: 50px;
border: 1px solid #ff7e05;
}
button {
background-color: #757574;
color: #fcfcfc;
border: none;
border-radius: 50px;
padding: 5px 10px;
cursor: pointer;
}
button:hover {
background-color: #2c2c2c;
transition: background-color 0.3s; /* Transição de cor suave */
}
#barcode {
margin-top: 20px;
}
.skeleton {
animation: loading 1s infinite;
background: linear-gradient(90deg, #1efd00 25%, #000000 50%, #ff0303 75%, #bbff00 75%);
background-size: 250% 80%;
border-radius: 5px;
display: inline-block;
width: 64%;
height: 81px;
}
@keyframes loading {
0% {
background-position: 200% 0;
}
100% {
background-position: -200% 0;
}
}
.center-button {
display: flex;
justify-content: center;
margin-top: 20px; /* Espaço de margem superior para afastar o botão do código de barras */
}
button2 {
background-color: #1379d8;
color: #fafafa;
border: none;
border-radius: 7px;
padding: 8px 8px;
cursor: pointer;
transition: background-color 0.3s; /* Transição de cor suave */
}
button2:hover {
background-color: #150983;
}
@media (max-width: 768px) {
h1 {
font-size: 10px;
}
}
/* Estilos para os botões de redes sociais em formato de círculo */
.social-buttons {
margin: 10px;
}
.social-buttons a {
display: inline-block;
margin-right: 10px;
text-decoration: none;
text-align: center;
position: relative;
}
.social-buttons a i {
background-color: #5a5a5c; /* Cor de fundo do botão */
color: #fff; /* Cor do ícone */
font-size: 24px; /* Tamanho do ícone */
border-radius: 50%; /* Formato de círculo */
width: 40px; /* Largura do botão */
height: 40px; /* Altura do botão */
line-height: 40px; /* Centralizar o ícone verticalmente */
transition: background-color 0.3s; /* Transição de cor suave */
}
.social-buttons a:hover i {
background-color: #292a2b; /* Cor de fundo do botão no hover */
}
.social-buttons a .tooltip {
visibility: hidden;
text-align: center;
border-radius: 5px;
padding: 5px;
position: absolute;
z-index: 1;
bottom: 40px;
left: 40%;
transform: translateX(-50%);
opacity: 0;
transition: opacity 0.3s;
}
.social-buttons a:hover .tooltip {
visibility: visible;
opacity: 1;
}
.social-buttons a.skeleton-icon::before {
content: "";
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: linear-gradient(90deg, #363434 25%, #ffffff 50%, #272626 75%);
background-size: 250% 80%;
animation: loading 2s infinite;
border-radius: 50%;
display: inline-block;
width: 40px;
height: 40px;
}
.social-buttons a .tooltip {
visibility: hidden;
background-color: #333;
color: #fff;
text-align: center;
border-radius: 5px;
padding: 5px;
position: absolute;
z-index: 1;
bottom: -35px;
left: 50%;
transform: translateX(-50%);
opacity: 0;
transition: opacity 0.3s;
}
.social-buttons a:hover .tooltip {
visibility: visible;
opacity: 1;
}
</style>
</head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<body>
<div class="container">
<div class="skeleton-wrapper">
<div class="skeleton-circle"></div>
<div class="skeleton-nome"></div>
<div class="skeleton-text"></div>
</div>
<div class="profile" style="display: none;">
<img src="https://raw.githubusercontent.com/nilsonlinux/nilsonlinux.github.io/master/img/ncode.png" alt="Ncode">
<div class="info">
<h4 class="name"></h2>
<p class="nilsonlinux dev"></p>
</div>
</div>
<input type="text" id="username" placeholder="Nome de Usuário">
<input type="text" id="gmcore" placeholder="Usuário Gmcore (6 dígitos)">
<button onclick="generateBarcode()">Gerar Código de Barras</button>
<div id="barcode" class="skeleton1"></div>
<div class="center-button">
<button2 id="printButton" style="display: none;" onclick="printBarcode()">Imprimir</button2>
</div>
</div>
<!-- Botões de redes sociais com ícones e dicas (tooltips) -->
<div class="social-buttons">
<a href="https://nilsonlinux.github.io/donate" target="_blank" class="skeleton-icon"><i class="fab fa-github"></i>
<div class="tooltip">Github</div>
</a>
<a href="https://t.me/Nilsonlinux" target="_blank" class="skeleton-icon"><i class="fab fa-telegram"></i>
<div class="tooltip">Telegram</div>
</a>
<a href="http://10.172.68.76/donate.html" target="_blank" class="skeleton-icon"><i class="fa fa-usd"></i>
<div class="tooltip">Contribuir</div>
</a>
</div>
<script>
// Simulando o carregamento de informações
setTimeout(function() {
const skeletonIcons = document.querySelectorAll('.skeleton-icon');
skeletonIcons.forEach(function(icon) {
icon.classList.remove('skeleton-icon');
});
}, 1000); // 2 segundos
setTimeout(function() {
const skeletonWrapper = document.querySelector('.skeleton-wrapper');
const profileDiv = document.querySelector('.profile');
skeletonWrapper.style.display = 'none';
profileDiv.style.display = 'block';
// Preenchendo as informações
const name = 'Gerador de Código de Barras EAN-13';
const dev = '</>Nilsonlinux';
document.querySelector('.name').textContent = name;
document.querySelector('.dev').textContent = dev;
}, 2000); // Tempo simulado para a animação do skeleton-screen
function generateBarcode() {
const username = document.getElementById("username").value;
const gmcore = document.getElementById("gmcore").value;
// Verifique se o código é válido (6 dígitos)
if (gmcore.length !== 6 || !/^\d+$/.test(gmcore)) {
alert("Por favor, forneça um código Gmcore (6 dígitos). Caso o usuário possuir 4 ou 5 dígitos, complete com Zeros (0) no inicio do código. Exemplo: 001234, 012345");
return;
}
// Atualize o esqueleto de carregamento
const barcodeElement = document.getElementById("barcode");
barcodeElement.classList.add("skeleton");
// Faça a solicitação à API para gerar o código de barras
fetch(`https://bwipjs-api.metafloor.com/?bcid=ean13&scaleX=2&scaleY=1&text=000000${gmcore}&parsefnc&alttext=${username} ${gmcore}`)
.then(response => {
if (!response.ok) {
throw new Error(`Erro na solicitação à API: ${response.statusText}`);
}
return response.blob();
})
.then(blob => {
// Crie uma URL para a imagem
const imageUrl = URL.createObjectURL(blob);
// Exiba a imagem do código de barras
barcodeElement.innerHTML = `<img src="${imageUrl}" alt="Código de Barras EAN-13">`;
barcodeElement.classList.remove("skeleton"); // Remova o efeito de carregamento
// Mostre o botão de impressão
const printButton = document.getElementById("printButton");
printButton.style.display = "block";
})
.catch(error => {
alert(`Erro ao gerar o código de barras: ${error.message}`);
barcodeElement.classList.remove("skeleton"); // Remova o efeito de carregamento em caso de erro
barcodeElement.innerHTML = ""; // Remova qualquer imagem anterior
});
}
function printBarcode() {
const barcodeImage = document.querySelector("#barcode img");
if (barcodeImage) {
const win = window.open('Ncode', '_blank');
win.document.open();
win.document.write(`<html>
<head><title>Ncode - Gerador de código de barras - EAN13</title></head>
<center><img src="${barcodeImage.src}" alt="Código de Barras EAN-13" style="width: 100px; height: 50px;"></center>
<center><text>- - - - - - - - - - - - - - - -</text></center>
<center><img src="${barcodeImage.src}" alt="Código de Barras EAN-13" style="width: 100px; height: 50px;"></center>
<center><text>- - - - - - - - - - - - - - - -</text></center>
<center><img src="${barcodeImage.src}" alt="Código de Barras EAN-13" style="width: 100px; height: 50px;"></center>
<center><text>- - - - - - - - - - - - - - - -</text></center>
<center><img src="${barcodeImage.src}" alt="Código de Barras EAN-13" style="width: 100px; height: 50px;"></center>
<center><text>- - - - - - - - - - - - - - - -</text></center>
<center><p style="font-size: 13px;">Desenvolvido por: Nilsonlinux</p></center>
</body></html>`);
win.document.close();
win.print();
win.close();
} else {
alert("O código de barras ainda não foi gerado.");
}
}
</script>
</body>
</html>