1/* Template Name: Landrick - Saas & Software Landing Page Template 2 Author: Shreethemes 3 E-mail: [email protected] 4 Created: August 2019 5 Version: 4.5.0 6 Updated: March 2022 7 File Description: Main JS file of the template 8 9 10*/ 11 12 13/*********************************/ 14/* INDEX */ 15/*================================ 16 * 01. Loader * 17 * 02. Toggle Menus * 18 * 03. Active Menu * 19 * 04. Clickable Menu * 20 * 05. Back to top * 21 * 06. Feather icon * 22 * 07. DD Menu * 23 * 08. Active Sidebar Menu * 24 * 09. Contact Js * 25 ================================*/ 26 27 28window.addEventListener('load', fn , false ) 29 30// window.onload = function loader() { 31function fn() { 32 // Preloader 33 if(document.getElementById('preloader')){ 34 setTimeout(() => { 35 document.getElementById('preloader').style.visibility = 'hidden'; 36 document.getElementById('preloader').style.opacity = '0'; 37 }, 350); 38 } 39 // Menus 40 activateMenu(); 41} 42 43//Menu 44// Toggle menu 45function toggleMenu() { 46 document.getElementById('isToggle').classList.toggle('open'); 47 var isOpen = document.getElementById('navigation') 48 if (isOpen.style.display === "block") { 49 isOpen.style.display = "none"; 50 } else { 51 isOpen.style.display = "block"; 52 } 53}; 54 55//Menu Active 56function getClosest(elem, selector) { 57 58 // Element.matches() polyfill 59 if (!Element.prototype.matches) { 60 Element.prototype.matches = 61 Element.prototype.matchesSelector || 62 Element.prototype.mozMatchesSelector || 63 Element.prototype.msMatchesSelector || 64 Element.prototype.oMatchesSelector || 65 Element.prototype.webkitMatchesSelector || 66 function (s) { 67 var matches = (this.document || this.ownerDocument).querySelectorAll(s), 68 i = matches.length; 69 while (--i >= 0 && matches.item(i) !== this) { } 70 return i > -1; 71 }; 72 } 73 74 // Get the closest matching element 75 for (; elem && elem !== document; elem = elem.parentNode) { 76 if (elem.matches(selector)) return elem; 77 } 78 return null; 79 80}; 81 82function activateMenu() { 83 var menuItems = document.getElementsByClassName("sub-menu-item"); 84 if (menuItems) { 85 86 var matchingMenuItem = null; 87 for (var idx = 0; idx < menuItems.length; idx++) { 88 if (menuItems[idx].href === window.location.href) { 89 matchingMenuItem = menuItems[idx]; 90 } 91 } 92 93 if (matchingMenuItem) { 94 matchingMenuItem.classList.add('active'); 95 96 97 var immediateParent = getClosest(matchingMenuItem, 'li'); 98 99 if (immediateParent) { 100 immediateParent.classList.add('active'); 101 } 102 103 var parent = getClosest(immediateParent, '.child-menu-item'); 104 if(parent){ 105 parent.classList.add('active'); 106 } 107 108 var parent = getClosest(parent || immediateParent , '.parent-menu-item'); 109 110 if (parent) { 111 parent.classList.add('active'); 112 113 var parentMenuitem = parent.querySelector('.menu-item'); 114 if (parentMenuitem) { 115 parentMenuitem.classList.add('active'); 116 } 117 118 var parentOfParent = getClosest(parent, '.parent-parent-menu-item'); 119 if (parentOfParent) { 120 parentOfParent.classList.add('active'); 121 } 122 } else { 123 var parentOfParent = getClosest(matchingMenuItem, '.parent-parent-menu-item'); 124 if (parentOfParent) { 125 parentOfParent.classList.add('active'); 126 } 127 } 128 } 129 } 130} 131 132// Clickable Menu 133if(document.getElementById("navigation")){ 134 var elements = document.getElementById("navigation").getElementsByTagName("a"); 135 for(var i = 0, len = elements.length; i < len; i++) { 136 elements[i].onclick = function (elem) { 137 if(elem.target.getAttribute("href") === "javascript:void(0)") { 138 var submenu = elem.target.nextElementSibling.nextElementSibling; 139 submenu.classList.toggle('open'); 140 } 141 } 142 } 143} 144 145// Menu sticky 146function windowScroll() { 147 const navbar = document.getElementById("topnav"); 148 if(navbar!=null){ 149 if ( 150 document.body.scrollTop >= 50 || 151 document.documentElement.scrollTop >= 50 152 ) { 153 navbar.classList.add("nav-sticky"); 154 } else { 155 navbar.classList.remove("nav-sticky"); 156 } 157 } 158} 159 160window.addEventListener('scroll', (ev) => { 161 ev.preventDefault(); 162 windowScroll(); 163}) 164 165// back-to-top 166var mybutton = document.getElementById("back-to-top"); 167window.onscroll = function () { 168 scrollFunction(); 169}; 170 171function scrollFunction() { 172 if(mybutton!=null){ 173 if (document.body.scrollTop > 500 || document.documentElement.scrollTop > 500) { 174 mybutton.style.display = "block"; 175 } else { 176 mybutton.style.display = "none"; 177 } 178 } 179} 180
181function topFunction() { 182 document.body.scrollTop = 0; 183 document.documentElement.scrollTop = 0; 184} 185 186//ACtive Sidebar 187(function () { 188 var current = location.pathname.substring(location.pathname.lastIndexOf('/') + 1);; 189 if (current === "") return; 190 var menuItems = document.querySelectorAll('.sidebar-nav a'); 191 for (var i = 0, len = menuItems.length; i < len; i++) { 192 if (menuItems[i].getAttribute("href").indexOf(current) !== -1) { 193 menuItems[i].parentElement.className += " active"; 194 } 195 } 196})(); 197 198//Feather icon 199feather.replace(); 200 201// dd-menu 202var ddmenu = document.getElementsByClassName("dd-menu"); 203for(var i = 0, len = ddmenu.length; i < len; i++) { 204 ddmenu[i].onclick = function (elem) { 205 elem.stopPropagation(); 206 } 207} 208 209//Tooltip 210var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')) 211var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) { 212 return new bootstrap.Tooltip(tooltipTriggerEl) 213}); 214 215//Popovers 216var popoverTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="popover"]')) 217var popoverList = popoverTriggerList.map(function (popoverTriggerEl) { 218 return new bootstrap.Popover(popoverTriggerEl) 219}) 220 221//small menu 222try { 223 var spy = new Gumshoe('#navmenu-nav a'); 224}catch(err) { 225 226} 227 228 229//Contact js 230try 231 { 232 function validarFormaContacto() 233 { 234 var nombre = document.forms["forma-contacto"]["nombre"].value; 235 var telefono = document.forms["forma-contacto"]["telefono"].value; 236 var correo = document.forms["forma-contacto"]["correo"].value; 237 var mensaje = document.forms["forma-contacto"]["mensaje"].value; 238 var datoserror = ""; 239 240 eliminarMensaje(); 241 242 document.getElementById('btn-enviar').classList.remove("btn-success"); 243 document.getElementById('btn-enviar').classList.remove("btn-danger"); 244 document.getElementById('btn-enviar').classList.remove("btn-warning"); 245 document.getElementById('btn-enviar').classList.add("btn-primary"); 246 247 248 249 if (nombre == "" || nombre == null) 250 { 251 datoserror+=(datoserror ? ", " : "")+"nombre completo"; 252 document.getElementById('btn-enviar').classList.remove("btn-primary"); 253 document.getElementById('btn-enviar').classList.add("btn-danger"); 254 } 255 if (telefono == "" || telefono == null) 256 { 257 datoserror+=(datoserror ? ", " : "")+"teléfono"; 258 document.getElementById('btn-enviar').classList.remove("btn-primary"); 259 document.getElementById('btn-enviar').classList.add("btn-danger"); 260 } 261 if (correo == "" || correo == null) 262 { 263 datoserror+=(datoserror ? ", " : "")+"correo electrónico"; 264 document.getElementById('btn-enviar').classList.remove("btn-primary"); 265 document.getElementById('btn-enviar').classList.add("btn-danger"); 266 } 267 if (mensaje == "" || mensaje == null) 268 { 269 datoserror+=(datoserror ? ", " : "")+"mensaje"; 270 document.getElementById('btn-enviar').classList.remove("btn-primary"); 271 document.getElementById('btn-enviar').classList.add("btn-danger"); 272 } 273 274 if(datoserror) 275 { 276 crearMensaje("<p class=\"text-muted mb-0\">Debes introducir <span class=\"text-danger\">"+datoserror+"</span> para poder enviarlo.</p>"); 277 return false; 278 } 279 280 document.getElementById('icono-enviar').classList.add("d-none"); 281 document.getElementById('cargador-enviar').classList.remove("d-none"); 282 document.getElementById('btn-enviar').disabled = true; 283 284 /**/ 285 grecaptcha.ready(function() 286 { 287 grecaptcha.execute('6LeAenokAAAAAPYvofieJnizmWYaYtY0hGAOcjRf', {action:'validate_captcha'}).then(function(token) 288 { 289 var xhttp = new XMLHttpRequest(); 290 xhttp.onreadystatechange = function () 291 { 292 if (this.readyState == 4 && this.status == 200) 293 { 294 crearMensaje("<p class=\"text-muted mb-0\">¡Gracias por enviarnos un <span class=\"text-success\">mensaje</span>, nos pondremos en contacto pronto!</p>"); 295 document.getElementById('btn-enviar').classList.remove("btn-primary"); 296 document.getElementById('btn-enviar').classList.remove("btn-danger"); 297 document.getElementById('btn-enviar').classList.remove("btn-warning"); 298 document.getElementById('btn-enviar').classList.add("btn-success"); 299 document.getElementById('icono-enviar').classList.remove("uil-at"); 300 document.getElementById('icono-enviar').classList.add("uil-check"); 301 document.getElementById('icono-enviar').classList.remove("d-none"); 302 document.getElementById('texto-enviar').innerHTML = 'Gracias'; 303 document.getElementById('cargador-enviar').classList.add("d-none"); 304 document.forms["forma-contacto"].reset(); 305 } 306 }; 307 xhttp.open("POST", "/des/fun/fun-contacto.php", true); 308 xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 309 xhttp.send("nombre=" + nombre + "&telefono=" + telefono + "&correo=" + correo + "&mensaje=" + mensaje+ "&recaptcha=" + token); 310 }); 311 }); 312 /**/ 313 return false;
314 } 315 } 316 317catch (error) 318 { 319 320 } 321 322//Agenda de Presentación 323try 324 { 325 function validarFormaAgendarPresentacion() 326 { 327 var correo = document.forms["forma-agendar"]["correo"].value; 328 329 eliminarMensaje(); 330 331 document.getElementById('btn-enviar').classList.remove("btn-success"); 332 document.getElementById('btn-enviar').classList.remove("btn-danger"); 333 document.getElementById('btn-enviar').classList.remove("btn-warning"); 334 document.getElementById('btn-enviar').classList.add("btn-primary"); 335 336 if (correo == "" || correo == null) 337 { 338 crearMensaje("<p class=\"text-muted mb-0\">Debes introducir tu <span class=\"text-danger\">correo electrónico</span> para poder agendar la presentación.</p>"); 339 document.getElementById('btn-enviar').classList.remove("btn-primary"); 340 document.getElementById('btn-enviar').classList.add("btn-danger"); 341 return false; 342 } 343 344 document.getElementById('icono-enviar').classList.add("d-none"); 345 document.getElementById('cargador-enviar').classList.remove("d-none"); 346 document.getElementById('btn-enviar').disabled = true; 347 348 /**/ 349 grecaptcha.ready(function() 350 { 351 grecaptcha.execute('6LeAenokAAAAAPYvofieJnizmWYaYtY0hGAOcjRf', {action:'validate_captcha'}).then(function(token) 352 { 353 var xhttp = new XMLHttpRequest(); 354 xhttp.onreadystatechange = function () 355 { 356 if (this.readyState == 4 && this.status == 200) 357 { 358 crearMensaje("<p class=\"text-muted mb-0\">¡Gracias por <span class=\"text-success\">solicitar una presentación</span>, nos pondremos en contacto pronto!</p>"); 359 document.getElementById('btn-enviar').classList.remove("btn-primary"); 360 document.getElementById('btn-enviar').classList.remove("btn-danger"); 361 document.getElementById('btn-enviar').classList.add("btn-success"); 362 document.getElementById('icono-enviar').classList.remove("uil-arrow-right"); 363 document.getElementById('icono-enviar').classList.add("uil-check"); 364 document.getElementById('icono-enviar').classList.remove("d-none"); 365 document.getElementById('texto-enviar').innerHTML = 'Gracias'; 366 document.getElementById('cargador-enviar').classList.add("d-none"); 367 document.forms["forma-agendar"].reset(); 368 } 369 }; 370 xhttp.open("POST", "/des/fun/fun-agendar-presentacion.php", true); 371 xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 372 xhttp.send("correo=" + correo + "&recaptcha=" + token); 373 }); 374 }); 375 /**/ 376 return false; 377 } 378 } 379catch (error) 380 { 381 382 } 383 384//Acepta polÃtica de cookies 385try 386 { 387 function validarFormaCookies() 388 { 389 grecaptcha.ready(function() 390 { 391 grecaptcha.execute('6LeAenokAAAAAPYvofieJnizmWYaYtY0hGAOcjRf', {action:'validate_captcha'}).then(function(token) 392 { 393 var xhttp = new XMLHttpRequest(); 394 xhttp.onreadystatechange = function () 395 { 396 if (this.readyState == 4 && this.status == 200) 397 { 398 399 } 400 }; 401 xhttp.open("POST", "/des/fun/fun-cookies.php", true); 402 xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 403 xhttp.send("recaptcha=" + token); 404 }); 405 }); 406 /**/ 407 return false; 408 } 409 } 410catch (error) 411 { 412 413 } 414 415var tiempomensaje; 416 417/* Mensajes */ 418function crearMensaje(mensaje) 419 { 420 document.getElementById('error-pop').innerHTML = "<div class=\"card message-popup shadow rounded py-4 px-4 animate__animated animate__fadeInUp\" id=\"message-popup\" data-wow-delay=\".1s\"><h5>"+mensaje+"</h5><div class=\"message-popup-actions text-end\"><button>
420<i class=\"uil uil-times text-dark fs-4\"></i></button></div></div>"; 421 document.getElementById('error-pop').classList.remove("d-none"); 422 tiempomensaje = setTimeout(function(){eliminarMensaje();}, 5000); 423 on('.message-popup button', 'click', () => {eliminarMensaje()}); 424 } 425 426function eliminarMensaje() 427 { 428 clearTimeout(tiempomensaje); 429 document.getElementById('error-pop').innerHTML = ""; 430 document.getElementById('error-pop').classList.add("d-none"); 431 } 432 433//VCard js 434try 435 { 436 function descargarVCard() 437 { 438 439 var codigo = document.forms["forma-colaborador"]["codigo"].value; 440 441 document.getElementById('btn-enviar').classList.remove("btn-success"); 442 document.getElementById('btn-enviar').classList.remove("btn-danger"); 443 document.getElementById('btn-enviar').classList.remove("btn-warning"); 444 document.getElementById('btn-enviar').classList.add("btn-primary"); 445 446 if (codigo == "" || codigo == null) 447 { 448 datoserror+=(datoserror ? ", " : "")+"código"; 449 document.getElementById('btn-enviar').classList.remove("btn-primary"); 450 document.getElementById('btn-enviar').classList.add("btn-danger"); 451 } 452 453 454 //document.getElementById('icono-enviar').classList.add("d-none"); 455 //document.getElementById('cargador-enviar').classList.remove("d-none"); 456 457 document.getElementById('btn-enviar').disabled = true; 458 459 /**/ 460 document.forms["forma-colaborador"].submit(); 461 /**/ 462 return false; 463 } 464 } 465 466catch (error) 467 { 468 469 }
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.