Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- window.addEventListener('load', function () {
- if(window.innerWidth > 767) {
- document.getElementsByClassName("logo-medium")[0].innerHTML += "<a style='font-size: 24px;'>Águia Tracking Service</a>"
- }else{
- document.getElementsByClassName("logo-medium")[0].innerHTML += "<a style='font-size: 18px;'>Águia TS</a>"
- }
- if(window.location.pathname == "/contato"){
- document.getElementById("fieldSubject").parentNode.innerHTML =
- `
- <label>Assunto</label>
- <select class="form-control" id="fieldSubject" style="border: 1px solid #dde1e5 !important;">
- <option value="orcamento">Orçamento</option>
- <option value="suporte">Suporte técnico</option>
- <option value="emprego">Oportunidade de Emprego</option>
- <option value="reclamacao">Reclamação</option>
- <option value="outros">Outros</option>
- </select>
- `;
- document.getElementsByClassName("button submit-button button-lg undefined button-dynamic-buttons kv-button-instant-edit button-secondary")[0].onclick = function(){
- var _nome = document.getElementById('fieldFirstName').value;
- var _email = document.getElementById('fieldEmail').value;
- var _assunto = document.getElementById('fieldSubject').value;
- var _telefone = document.getElementById('fieldPhone').value;
- var _message = document.getElementById('fieldMessage').value;
- if(_nome != "" && _email != "" && _email.indexOf("@") > 0 && _assunto != "" && _telefone != "" && _message != ""){
- var xmlhttp = new XMLHttpRequest();
- xmlhttp.open("POST", "https://us-central1-dagomail.cloudfunctions.net/enviarEmail");
- xmlhttp.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
- xmlhttp.onreadystatechange = function() {//Call a function when the state changes.
- if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
- document.getElementById("contact-form").innerHTML = `<div style="height: 200px; text-align: center;">
- <p style="font-size: 24px;">Mensagem enviada!</p>
- <p style="font-size: 18px; font-size: 18px; max-width: 500px; min-width: 300px; text-align: center; margin: auto; width: 50%; border: 3px solid #f7bc35; padding: 10px;">Sua mensagem foi enviada com sucesso. Esperamos responder em até 24 horas. Você também pode nos contatar através dos nossos e-mails e telefones. Os links estão logo abaixo.</p>
- </div>`
- }
- }
- xmlhttp.send(JSON.stringify(
- {
- "nome": _nome,
- "email": _email,
- "assunto": _assunto,
- "telefone": _telefone,
- "message": _message,
- }
- ));
- }
- }
- setTimeout(function(){
- if(document.getElementsByClassName("captcha-field-wrapper")[0]){
- document.getElementsByClassName("captcha-field-wrapper")[0].style.visibility = "hidden";
- document.getElementsByClassName("captcha-field-wrapper")[0].style.height = "0";
- }
- },10);
- document.getElementsByClassName("fieldSubscribe-container")[0].innerHTML = ""
- }
- });
Add Comment
Please, Sign In to add comment