-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
177 lines (136 loc) · 5.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
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
<html>
<head>
<title>Fast Chat - Send a WhatsApp Message without saving the number</title>
<meta name="description" content="Send a WhatsApp Message without saving the number">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<style id="" media="all">@font-face {
font-family: 'Poppins';
font-style: normal;
font-weight: 400;
font-display: swap;
src: url(../../../fonts.gstatic.com/s/poppins/v20/pxiEyp8kv8JHgFVrJJfedw.ttf) format('truetype');
}
@font-face {
font-family: 'Poppins';
font-style: normal;
font-weight: 800;
font-display: swap;
src: url(../../../fonts.gstatic.com/s/poppins/v20/pxiByp8kv8JHgFVrLDD4Z1xlEA.ttf) format('truetype');
}
</style>
<link href="css/main.css" rel="stylesheet" />
<meta name="robots" content="index, nofollow">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN" crossorigin="anonymous"></script>
<link href='https://fonts.googleapis.com/css?family=Varela Round' rel='stylesheet'>
<link rel="stylesheet" href="css/intlTelInput.css">
</head>
<body>
<div class="s004">
<form style="width: 100%;margin:auto; text-align:center;">
<fieldset style="width: 100%;">
<img src="img/wa.webp" style="width: 125px; "/><br><br>
<h1 style=" font-size: 43px; color: #fff; font-family: Varela Round;">JUST SEND, NOT SAVE</h1><br>
<h2 style="color:#fff;">Send a WhatsApp message without saving the number</h2><br>
<div class="inner-form">
<div class="input-field">
<input style="height: 50px; width: 100%; font-size: 24px;" type="tel" id="phone">
<br><br>
<span id="valid-msg" class="hide" style="color: #1eef1e; font-size:30px;">✓ Valid</span>
<span id="error-msg" class="hide" style="color: yellow; font-size:30px;"></span>
<script src="js/intlTelInput.js"></script>
<script>
var input = document.querySelector("#phone");
errorMsg = document.querySelector("#error-msg"),
validMsg = document.querySelector("#valid-msg");
// here, the index maps to the error code returned from getValidationError - see readme
var errorMap = ["Invalid number", "Invalid country code", "Too short", "Too long", "Invalid number"];
// initialise plugin
var iti = window.intlTelInput(input, {
utilsScript: "https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.19/js/utils.js",
autoPlaceholder: "aggressive",
preferredCountries: ["br", "us"],
separateDialCode: true
});
var reset = function() {
input.classList.remove("error");
errorMsg.innerHTML = "";
errorMsg.classList.add("hide");
validMsg.classList.add("hide");
};
//isNaN checa se não é um número
function thereIsLetter(str) {
var thereIsLetter = false;
for (let i = 0; i < str.length; i++) {
if (isNaN(str[i])) {
thereIsLetter = true;
}
}
return thereIsLetter;
}
// on blur: validate
input.addEventListener('keyup', function() {
reset();
if (input.value.trim()) {
if (iti.isValidNumber() && thereIsLetter(input.value) == false) {
validMsg.classList.remove("hide");
$('.send').prop('disabled', false)
} else {
$('.send').prop('disabled', true)
input.classList.add("error");
var errorCode = iti.getValidationError();
if(errorCode == -99){
errorMsg.innerHTML = 'Invalid Number';
}
else{
errorMsg.innerHTML = errorMap[errorCode];
}
errorMsg.classList.remove("hide");
}
}
});
// on keyup / change flag: reset
input.addEventListener('change', reset);
//input.addEventListener('keyup', reset);
</script>
</div>
</div>
<div class="suggestion-wrap">
<button disabled="" style="width: 150px; font-size: 20px;" type="button" class="btn btn-success send">Send Now!</button>
</div>
</fieldset>
</form>
</div>
<script src="https://code.jquery.com/jquery-3.6.3.min.js"></script>
<script>
$('.send').click(function(e){
e.preventDefault(); // previne a ação padrão do botão
//Get Dial Code
var iti = window.intlTelInputGlobals.getInstance(input);
var countryData = iti.getSelectedCountryData();
var dialCode = countryData["dialCode"];
//Get Phone
var phoneNumber = $('#phone').val(); // número de telefone
//DialCode + Phone
var dialCodeAndPhone = dialCode + phoneNumber;
var message = "Olá!"; // mensagem pré-definida
// Função para detectar se é um dispositivo móvel
function isMobile() {
return /Android|iPhone|iPad|iPod|webOS|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
}
var url = "";
if (isMobile()) {
// Caso seja um dispositivo móvel
url = "https://api.whatsapp.com/send?phone=" + dialCodeAndPhone + "&text=" + encodeURIComponent(message);
} else {
// Caso seja um desktop, usar o link para WhatsApp Web
url = "https://web.whatsapp.com/send?phone=" + dialCodeAndPhone + "&text=" + encodeURIComponent(message);
}
//alert(url);
window.open(url, '_blank');
})
</script>
</body>
</html>