-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
59 lines (48 loc) · 1.47 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title> whatsdirect - Adicione e inicie o chat sem precisar salvar o número :) </title>
<link rel="icon" href="favicon.png">
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto">
<link rel="stylesheet" href="css/fontawesome.css">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<header>
<div class="container">
<h1 class="title"> <img src="favicon.png"> whats<span>direct</span> </h1>
</div>
</header>
<main>
<div class="container">
<div class="box">
<input type="text" id="number" placeholder="DDD + número">
<br>
<a href="#" target="blank" id="send" class="btn-send"> <i class="fa fa-send"></i></a>
</div>
<p class="box-text"> válido apenas números nacionais (Brasil) </p>
</div>
</main>
<script type="text/javascript">
const url = 'https://api.whatsapp.com/send?phone=55';
let button = document.getElementById('send');
let input = document.getElementById('number');
button.addEventListener('click', function(e) {
let value = input.value.replace(/[^0-9]/g,'');
if (value.length == 0) {
alert('Digite o número');
e.preventDefault();
return false;
}
if (value.length < 10) {
alert('Digite um número válido');
e.preventDefault();
return false;
}
button.setAttribute('href', url + value);
});
</script>
</body>
</html>