-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.html
188 lines (156 loc) · 8.84 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
177
178
179
180
181
182
183
184
185
186
187
188
<!DOCTYPE html>
<!--
Author: Lucas Marques Dutra <dutra.astro@gmail.com> (c) 2018
Collaborator: Mario Augusto Paglia Junior <mario@h1code.com.br> (c) 2018
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>
-->
<html lang="pt-br">
<head>
<title>Lanche pelo WhatsApp</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link media="all" href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" />
<link rel="shortcut icon" href="http://www.icons101.com/icon_ico/id_13859/burger.ico" type="image/x-icon" />
<meta name="description" content="Peça lanche facilmente pelo WhatsApp com essa ferramenta" />
<meta name="keywords" content="lanche, whatsapp, whats, comida, hamburger" />
<meta name="robots" content="index, follow" />
<link rel="manifest" href="manifest.json">
<!-- Bootstrap -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<!-- FontAwesome -->
<link rel='stylesheet' href='https://use.fontawesome.com/releases/v5.3.1/css/all.css' integrity='sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU' crossorigin='anonymous'>
<!-- Personalização CSS -->
<style>
html, body {
font-family: "Open Sans", sans-serif;
text-align: center;
}
footer {
margin-top: 100px;
}
</style>
</head>
<body>
<div class="container">
<div class="row">
<div class="col">
<h1 class="mt-4">Peça seu lanche pelo Whatsapp</h1>
<div class="alert alert-warning" role="alert">
<h6><strong>Atenção:</strong> Para aplicação funcionar, você precisa estar logado no WhatsApp Web</h6>
</div>
<div class="d-flex justify-content-center">
<fieldset>
<legend>
<h2>Personalize seu pedido</h2>
</legend>
<label for="numero-lanchonete">Número da lanchonete:</label>
<input class="form-control" id="numero-lanchonete" title='Não precisa colocar o "55" nem "+55"' type="tel" class="tel" placeholder="DDD + número">
<br><br>
<label for="mensagem">Mensagem:</label><br>
<textarea class="msg form-control" id="mensagem" rows="4" cols="40" placeholder="Personalize sua mensagem: ex.: Olá, gostaria de fazer um pedido"></textarea>
<hr>
<label for="lanches">Escolha seu lanche:</label>
<select class="lanche form-control" id="lanches"></select>
<br><br>
<label for="retirar">Retirar itens do lanche:</label><br>
<select multiple="multiple" size="15" class="itens form-control" id="retirar"></select>
<br>
<hr>
<label for="mensagem-adicional">Mensagem posterior adicional:</label><br>
<textarea class="msg-complementar form-control" rows="4" cols="40" placeholder="ex.: Quanto tempo até a entrega?"></textarea>
</fieldset>
</div>
<h3 class="mt-4">Revise seu pedido:</h3>
<output></output>
<br><br>
<button class="pedir btn btn-success btn-lg" type="button"><i class="fas fa-utensils"></i> Pedir Lanche!</button>
<footer class="mb-4">
<a href="http://www.reliablecounter.com" target="_blank"><img src="https://www.reliablecounter.com/count.php?page=terremoth.github.io/lanchepelowhats&digit=style/plain/3/&reloads=1"></a> Visualizações
<hr />
Criado por Lucas M. Dutra - <a href="mailto:dutra.astro@gmail.com">Email</a> | <a href="https://github.com/terremoth">GitHub</a> | <a href="https://facebook.com/0day1337">Facebook</a>
<br>
Colaborador: Mário Augusto Paglia Júnior - <a href="https://h1code.com.br">Site</a> | <a href="https://github.com/agenciah1code">GitHub</a>
<br>
<small><a href="http://bit.ly/lanche-whats">Shortlink para esta página</a> - Pax Profundis</small>
</footer>
</div>
</div>
</div>
<!-- JS do Bootstrap -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
<!-- Validação de campos com Mask jQuery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.mask/1.14.15/jquery.mask.min.js"></script>
<!-- JavaScript Personalizado -->
<script>
/**
* Bloco de validações gerais (funcionamento da aplicação)
*/
var lanches = ['X-Burger', 'X-Salada', 'X-Egg', 'X-Frango', 'X-Calabresa', 'X-Bacon', 'X-Dog', 'X-Tudo', 'Cachorro quente normal', 'Cachorro quente prensado'];
var itens = ['pão', 'carne', 'queijo', 'presunto', 'frango', 'bacon', 'calabresa', 'salsicha', 'ovo', 'ovo de codorna', 'alface', 'tomate', 'cebola', 'pepino', 'cenoura', 'milho', 'ervilha', 'maionese', 'ketchup', 'cheddar', 'catupiry', 'queijo ralado'];
$(function () {
lanches.forEach(function (item) {
$('.lanche').append("<option value='" + item + "'>" + item + "</option>");
});
itens.forEach(function (item) {
$('.itens').append("<option value='" + item + "'>" + item + "</option>");
});
$('select[multiple] > option').mousedown(function (e) {
e.preventDefault();
var originalScrollTop = $(this).parent().scrollTop();
$(this).prop('selected', $(this).prop('selected') ? false : true);
var self = this;
$(this).parent().focus();
setTimeout(function () {
$(self).parent().scrollTop(originalScrollTop);
}, 0);
return false;
});
$('.lanche,.itens,textarea').change(montaPedido);
$('.lanche,.itens').click(montaPedido);
function montaPedido() {
var textComposer = $('.msg').val() + " um " + $('.lanche').val();
var retirar = $('.itens').val();
if (retirar) {
retirar.forEach(function (item) {
textComposer += " sem " + item + ";"
});
}
textComposer += " " + $('.msg-complementar').val();
$('output').html(textComposer);
}
montaPedido();
$('.pedir').click(function () {
var tel = $('#numero-lanchonete').val();
if (!tel) {
return alert("O número do telefone é obrigatório!");
}
var tel = tel.replace(/[^\d]/g, '');
var api = window.open("https://api.whatsapp.com/send?phone=55" + tel + "&text=" + $('output').html());
});
});
/**
* Bloco de validação de formulários
*/
var SPMaskBehavior = function (val) {
return val.replace(/\D/g, '').length === 11 ? '(00) 00000-0000' : '(00) 0000-00009';
},
spOptions = {
onKeyPress: function (val, e, field, options) {
field.mask(SPMaskBehavior.apply({}, arguments), options);
}
};
$('#numero-lanchonete').mask(SPMaskBehavior, spOptions);
</script>
</body>
</html>