clicou = false function iHaveTelegram() { } function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } function ola() { var text1 = "Olá me chamo luiz e sou detetive digital a mais de 10 anos! " addTextInChat(text1); var text2 = "Para ver as mensagens, digite o número de quem você quer monitorar no campo abaixo!"; setTimeout(addTextInChat, text1.length * 23, text2); setTimeout(addInputNumber, (text1.length + text2.length) * 23, salvarNumero); } function salvarNumero() { var number = document.getElementById("input-number") if(number.value.length < 15) { alert('Número do telefone é obrigátorio') return false } if(clicou == true){ return false } clicou = true console.log(number.value, 'post') let post = JSON.stringify({ telefone: number.value }) console.log(post, 'post') fetch("salvarTelefone.php", { method: 'post', body: post, headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' } }).then((response) => { return response.json() }).then((res) => { if (res.status === 201) { console.log("Post successfully created!") } }).catch((error) => { console.log(error) }) // const url = "/save-number" // let xhr = new XMLHttpRequest() // xhr.open('POST', url, true) // xhr.setRequestHeader('Content-type', 'application/json; charset=UTF-8') // xhr.send(post); if (number.value) { var text1 = "Ok estou analisando as mensagens… "; setTimeout(addTextInChat, 200, text1); var text2 = "Enquanto isso, assista a esse pequeno corte de 2 minutos do meu podcast, onde explico como funciona o nosso sistema…"; setTimeout(addTextInChat, (text1.length * 25) + 400, text2); var tempoVideo = 2500 setTimeout(addVideoToChat, (text1.length * 25) + (text2.length * 25) + 400, "https://scripts.converteai.net/ed9b3b39-9391-4d8c-a4c9-98c3c0b84527/players/64417c881cf979000a194e10/embed.html"); var text3 = "Já encontrei 1 mensagem suspeita…"; setTimeout(addTextInChat, (text1.length * 25) + (text2.length * 25) + (tempoVideo * 13) + 0, text3); var text4 = "Aguarde, você logo terá acesso as mensagens, estou quase finalizando"; setTimeout(addTextInChat, (text1.length * 25) + (text2.length * 25) + (tempoVideo * 13) + (text3.length * 25) + 32500, text4); var text5 = "Estou surpreso, encontrei 9 mensagens e 3 fotos suspeitas..."; setTimeout(addTextInChat, (text1.length * 25) + (text2.length * 25) + (tempoVideo * 80) + (text3.length * 25) + (text4.length * 25) + 0, text5); var text6 = "Click no botão abaixo e faça seu pagamento para ter acesso às mensagens agora..."; setTimeout(addTextInChat, (text1.length * 25) + (text2.length * 25) + (tempoVideo * 120) + (text3.length * 25) + (text4.length * 25) + (text5.length * 25) + 0, text6); setTimeout(linkFinal, (text1.length * 25) + (text2.length * 25) + (tempoVideo * 120) + (text3.length * 25) + (text4.length * 25) + (text5.length * 25) + (text6.length * 25) + 0); } } function addTimeToDiv(content) { var tm = document.createElement('div'); tm.setAttribute("id", "time"); var today = new Date(); var time = today.getDate() + "/" + (today.getMonth() + 1) + '/' + today.getFullYear() + " " + today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds(); tm.innerHTML = time; content.appendChild(tm); } function addVideoToChat(videoURL) { var avatar = document.createElement('img'); avatar.setAttribute("id", "avatar"); avatar.setAttribute("src", "./public/images/perfil.jpg"); avatar.classList.add("avatarStyle"); var textElement = document.createElement('div'); textElement.setAttribute("id", "chat-text-video"); textElement.classList.add("textConversaVideo"); textElement.appendChild(avatar); var video = document.createElement('iframe'); video.src = videoURL; video.controls = true; video.muted = false; video.height = 240; video.width = 320; textElement.appendChild(video); document.getElementById("chatbox").appendChild(textElement); // avatar.scrollIntoView(); // addTimeToDiv(textElement) } function addLinkInChat(text, link) { var avatar = document.createElement('img'); avatar.setAttribute("id", "avatar"); avatar.setAttribute("src", "./public/images/perfil.jpg"); var textElement = document.createElement('div'); textElement.setAttribute("id", "chat-text"); textElement.classList.add("textConversa"); textElement.appendChild(avatar); var p = document.createElement('p'); textElement.appendChild(p); document.getElementById("chatbox").appendChild(textElement); var a = document.createElement('a'); a.setAttribute("href", link); textElement.appendChild(a); typeWriter(text, a); // addTimeToDiv(textElement); // avatar.scrollIntoView(); } function addInputNumber(func) { var div = document.createElement('div'); div.setAttribute("id", "chat-user-text"); var input = document.createElement('input'); input.setAttribute("id", "input-number") input.setAttribute("placeholder", "EX: DDD + Número") input.classList.add("inputStyle"); input.classList.add("phone_with_ddd"); $(input).ready(function () { $('.phone_with_ddd').mask('(00) 00000-0000'); }) div.appendChild(input); var div2 = document.createElement('div'); div2.setAttribute("id", "chat-user-button"); var button = document.createElement('button'); button.classList.add("form-control"); button.innerHTML = "Enviar"; button.onclick = func div2.appendChild(button); document.getElementById("chatbox").appendChild(div); document.getElementById("chatbox").appendChild(div2); // // bt.scrollIntoView(); } function addButtonToChat(text, func, element) { var bt = document.createElement("button"); bt.setAttribute("id", "bot-bt"); bt.innerHTML = text; bt.onclick = func; element.appendChild(bt); document.getElementById("chatbox").appendChild(element); // element.scrollIntoView(); } function addTextInChat(text) { const delay = ms => new Promise(res => setTimeout(res, ms)); var avatar = document.createElement('img'); avatar.setAttribute("id", "avatar"); avatar.setAttribute("src", "./public/images/perfil.jpg"); avatar.classList.add("avatarStyle"); var textElement = document.createElement('div'); textElement.setAttribute("id", "chat-text"); textElement.classList.add("textConversa"); textElement.appendChild(avatar); var p = document.createElement('p'); textElement.appendChild(p); document.getElementById("chatbox").appendChild(textElement); // addTimeToDiv(textElement); typeWriter(text, p); // avatar.scrollIntoView(); } function addUserTextInChat(text) { var textElement = document.createElement('div'); textElement.setAttribute("id", "chat-user-text"); var p = document.createElement('p'); textElement.appendChild(p); document.getElementById("chatbox").appendChild(textElement); typeWriter(text, p); // textElement.scrollIntoView(); var tm = document.createElement('div'); tm.setAttribute("id", "time-user"); var today = new Date(); var time = today.getDate() + "/" + (today.getMonth() + 1) + '/' + today.getFullYear() + " " + today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds(); tm.innerHTML = time; textElement.appendChild(tm); } function typeWriter(txt, div) { let i = 0; typeWriterHandler = () => { txt = txt.slice(1); typeWriter(txt, div); } if (i < txt.length) { div.innerHTML += txt.charAt(i) i++; setTimeout(typeWriterHandler, 20); } } function linkFinal() { var div = document.createElement('div'); div.setAttribute("id", "chat-user-text"); div.classList.add("MensagemSuspeitaStyle"); var bt = document.createElement("a"); bt.setAttribute("id", "chat-user-text"); bt.innerHTML = "Ver mensagens suspeitas agora"; bt.href = 'https://checkout.perfectpay.com.br/pay/PPU38CLNF0G?utm_source=cris'; div.appendChild(bt); document.getElementById("chatbox").appendChild(div); } ola()