1var styleMap = [ 2 { 3 "elementType": "geometry", 4 "stylers": [ 5 { 6 "color": "#f5f5f5" 7 } 8 ] 9 }, 10 { 11 "elementType": "labels", 12 "stylers": [ 13 { 14 "visibility": "off" 15 } 16 ] 17 }, 18 { 19 "elementType": "labels.icon", 20 "stylers": [ 21 { 22 "visibility": "off" 23 } 24 ] 25 }, 26 { 27 "elementType": "labels.text.fill", 28 "stylers": [ 29 { 30 "color": "#616161" 31 } 32 ] 33 }, 34 { 35 "elementType": "labels.text.stroke", 36 "stylers": [ 37 { 38 "color": "#f5f5f5" 39 } 40 ] 41 }, 42 { 43 "featureType": "administrative", 44 "elementType": "geometry", 45 "stylers": [ 46 { 47 "visibility": "off" 48 } 49 ] 50 }, 51 { 52 "featureType": "administrative.land_parcel", 53 "stylers": [ 54 { 55 "visibility": "off" 56 } 57 ] 58 }, 59 { 60 "featureType": "administrative.land_parcel", 61 "elementType": "labels.text.fill", 62 "stylers": [ 63 { 64 "color": "#bdbdbd" 65 } 66 ] 67 }, 68 { 69 "featureType": "administrative.neighborhood", 70 "stylers": [ 71 { 72 "visibility": "off" 73 } 74 ] 75 }, 76 { 77 "featureType": "poi", 78 "stylers": [ 79 { 80 "visibility": "off" 81 } 82 ] 83 }, 84 { 85 "featureType": "poi", 86 "elementType": "geometry", 87 "stylers": [ 88 { 89 "color": "#eeeeee" 90 } 91 ] 92 }, 93 { 94 "featureType": "poi", 95 "elementType": "labels.text.fill", 96 "stylers": [ 97 { 98 "color": "#757575" 99 } 100 ] 101 }, 102 { 103 "featureType": "poi.park", 104 "elementType": "geometry", 105 "stylers": [ 106 { 107 "color": "#e5e5e5" 108 } 109 ] 110 }, 111 { 112 "featureType": "poi.park", 113 "elementType": "labels.text.fill", 114 "stylers": [ 115 { 116 "color": "#9e9e9e" 117 } 118 ] 119 }, 120 { 121 "featureType": "road", 122 "stylers": [ 123 { 124 "visibility": "off" 125 } 126 ] 127 }, 128 { 129 "featureType": "road", 130 "elementType": "geometry", 131 "stylers": [ 132 { 133 "color": "#ffffff" 134 } 135 ] 136 }, 137 { 138 "featureType": "road", 139 "elementType": "labels.icon", 140 "stylers": [ 141 { 142 "visibility": "off" 143 } 144 ] 145 }, 146 { 147 "featureType": "road.arterial", 148 "elementType": "labels.text.fill", 149 "stylers": [ 150 { 151 "color": "#757575" 152 } 153 ] 154 }, 155 { 156 "featureType": "road.highway", 157 "elementType": "geometry", 158 "stylers": [ 159 { 160 "color": "#dadada" 161 } 162 ] 163 }, 164 { 165 "featureType": "road.highway", 166 "elementType": "labels.text.fill", 167 "stylers": [ 168 { 169 "color": "#616161" 170 } 171 ] 172 }, 173 { 174 "featureType": "road.local", 175 "elementType": "labels.text.fill", 176 "stylers": [ 177 { 178 "color": "#9e9e9e" 179 } 180 ] 181 }, 182 { 183 "featureType": "transit", 184 "stylers": [ 185 { 186 "visibility": "off" 187 } 188 ] 189 }, 190 { 191 "featureType": "transit.line", 192 "elementType": "geometry", 193 "stylers": [ 194 { 195 "color": "#e5e5e5" 196 } 197 ] 198 }, 199 { 200 "featureType": "transit.station", 201 "elementType": "geometry", 202 "stylers": [ 203 { 204 "color": "#eeeeee" 205 } 206 ] 207 }, 208 { 209 "featureType": "water", 210 "elementType": "geometry", 211 "stylers": [ 212 { 213 "color": "#c9c9c9" 214 } 215 ] 216 }, 217 { 218 "featureType": "water", 219 "elementType": "labels.text.fill", 220 "stylers": [ 221 { 222 "color": "#9e9e9e" 223 } 224 ] 225 } 226] 227function initMap() { 228 var keys = Object.keys(mapa) 229 var lat1 = mapa[keys[0]].lat 230 var lng1 = mapa[keys[0]].long 231 var styles = styleMap; 232 map = new google.maps.Map(document.getElementById('map-box'), { 233 zoom: 2, 234 styles: styles, 235 center: new google.maps.LatLng(0, 0), 236 }); 237 238 setMarkers(map); 239} 240var map, infowindow, ib; 241 markers = []; 242 markerActive = 0; 243 244function setMarkers(map) { 245 var locais = Object.keys(mapa) 246 var image = { 247 url: 'assets/img/pin.png', 248 size: new google.maps.Size(60, 82), 249 origin: new google.maps.Point(0, 0), 250 anchor: new google.maps.Point(0, 82) 251 }; 252 var shape = { 253 coords: [0,60,82,0], 254 type: 'Circle' 255 }; 256 257 258 var infowindow = new google.maps.InfoWindow({ 259 content: 'marker' 260 }); 261 262 var msg = []; 263 for (var i = 0; i < locais.length; i++) { 264 var key = locais[i] 265 var local = mapa[key]; 266 pinMsg ='<div id="content">'+ 267 '<div id="siteNotice">'+ 268 '</div>'+ 269 '<h3 id="firstHeading" class="firstHeading">
269'+local.name+'</h3>'+ 270 '<div id="bodyContent">'+ 271 '<p>'+local.endereco+'</p>' 272 '</div>'+ 273 '</div>'; 274 msg.push(pinMsg) 275 var marker = new google.maps.Marker({ 276 position: {lat: local.lat, lng: local.long}, 277 map: map, 278 icon: { 279 url: image.url, 280 size: image.size, 281 origin: image.origin, 282 anchor: image.anchor 283 }, 284 shape: shape, 285 title: local.name, 286 id:i, 287 msg: pinMsg, 288 zIndex: 2 289 }); 290 marker.addListener('click', function() { 291 var id = this.id 292 infowindow.setContent(msg[id]) 293 infowindow.open(map, this); 294 }); 295 markers.push(marker); 296 } 297} 298 299var linkMenu = false 300var scrollTo = function(element) { 301 linkMenu = true 302 $('html, body').animate({ 303 scrollTop: $(element).offset().top 304 }, 1000, function(){ 305 //window.location.hash = element 306 linkMenu = false 307 }); 308} 309 310function openFullscreen(myVideo) { 311 var elem = myVideo 312 myVideo.currentTime = 0; 313 if (elem.requestFullscreen) { 314 elem.requestFullscreen(); 315 } else if (elem.mozRequestFullScreen) { /* Firefox */ 316 elem.mozRequestFullScreen(); 317 } else if (elem.webkitRequestFullscreen) { /* Chrome, Safari & Opera */ 318 elem.webkitRequestFullscreen(); 319 } else if (elem.msRequestFullscreen) { /* IE/Edge */ 320 elem.msRequestFullscreen(); 321 } 322 myVideo.addEventListener('fullscreenchange', (event) => { 323 if (document.fullscreenElement) { 324 myVideo.muted = false; 325 } else { 326 myVideo.muted = true; 327 } 328 }); 329} 330 331$(document).on('click', clickOutside); 332function clickOutside(e) { 333 if($(window).width() > 990){ 334 if ($('header').hasClass('open') && $(e.target).is("header") ) { 335 var target = e.target; 336 337 338 $('html,body').removeClass('lock'); 339 $('header').removeClass('open'); 340 $('.menu').removeClass('active'); 341 342 343 } 344 } 345} 346 347// $(document).click((e) => { 348// if($("header").hasClass("open") && $(e.target).is("header")) { 349// $('html,body').removeClass('lock'); 350// $('header').removeClass('open'); 351// $('.menu').removeClass('active'); 352// } 353// }); 354 355 356 357$(document).ready(function () { 358 if($(window).width() > 990){ 359 $("nav.menu.up ul.nav-menu li.sub").hover(function(){ 360 361 var ulSubmenu = $(this).find("ul") 362 var submenu = ulSubmenu[0].scrollHeight; 363 var menuOpened = ulSubmenu.hasClass("navSubMenuOpened"); 364 if(!menuOpened){ 365 ulSubmenu.addClass("navSubMenuOpened"); 366 ulSubmenu.closest(".navSubMenuOpened").css("max-height", submenu); 367 368 } else { 369 ulSubmenu.removeClass("navSubMenuOpened"); 370 ulSubmenu.css("max-height", 0); 371 } 372 }); 373 374 } 375 376 377 $('footer ul li.sub a span').click(function(e){ 378 379 e.preventDefault(); 380 381 $("footer ul li.sub ul").css("max-height", 0); 382 383 384 var menuActive = $(this).parents(".sub").hasClass("navSubMenuActive"); 385 386 var ulSubmenu = $(this).parents(".sub").find("ul") 387 var submenu = ulSubmenu[0].scrollHeight; 388 if(!menuActive){ 389 $("footer ul li.sub").removeClass("navSubMenuActive"); 390 $(this).parents(".sub").toggleClass('navSubMenuActive'); 391 392 ulSubmenu.addClass("navSubMenuOpened"); 393 ulSubmenu.closest(".navSubMenuOpened").css("max-height", submenu); 394 ulSubmenu.closest(".navSubMenuOpened").css("display", "block"); 395 } else { 396 $("footer ul li.sub").removeClass("navSubMenuActive"); 397 $("footer ul li.sub").removeClass("navSubMenuOpened"); 398 $("footer ul li.sub ul").css("max-height", 0); 399 } 400 401 }); 402 403 404 405}); 406 407/* Init */ 408var base = function () { 409 "use strict"; 410 return { 411 //main function 412 init: function () { 413 414 // Start Wow 415 new WOW().init(); 416 417 $(window).scroll(function(){ 418 var top = $(window).scrollTop(); 419 if(top > 100){ 420 $('header').addClass('down'); 421 } else { 422 $('header').removeClass('down'); 423 } 424 }); 425 426 // Menu base 427 $('header button.menu, header a.menu').click(function(e){ 428 e.preventDefault(); 429 $(this).toggleClass('active'); 430 $('nav.menu').addClass('active'); 431 $('nav.landing').slideToggle(); 432 $("header").toggleClass("open"); 433 $("html,body").toggleClass("lock"); 434 }); 435 $('button.product-search').click(function(e){ 436 e.preventDefault(); 437 $('nav.search').addClass('active'); 438 $('body').prepend('<div class="modal-backdrop fade show"></div>'); 439 $("html,body").addClass("lock"); 440 }); 441 $('nav .button-close').click(function(e){ 442 e.preventDefault(); 443 $(this).closest('nav').removeClass('active'); 444 $('header button.menu').removeClass('active'); 445 $('.modal-backdrop').remove(); 446 $("header").removeClass("open"); 447 $("html,body").removeClass("lock"); 448 }); 449 450 451 452 $("nav.menu li.sub > a").click(function(e){ 453 454 if($('.opensub:visible').length > 0){ 455 if($(this).is('.opensub')){ 456 $(this).parent().toggleClass('active'); 457 } 458 } else { 459 $(this).parent().toggleClass('active'); 460 } 461 }); 462 463 $('nav.menu li#menuMicroSite > p').click(function () { 464 if($(window).width() < 992) { 465 $(this).parent().toggleClass('active'); 466 } 467 }); 468 469 $('.mSite footer li.sub > a').click(function(e){ 470 e.preventDefault(); 471 $(this).toggleClass('active'); 472 $(this).next().slideToggle(); 473 }); 474 475 $("#home .cta p").addClass("text-center wow fadeInUp"); 476 477 // Carousel
478 $(".galeria-carousel .owl-carousel").owlCarousel({ 479 loop: true, 480 margin: 0, 481 nav: true, 482 dots: false, 483 responsive: { 484 0: { 485 items: 1 486 } 487 } 488 }); 489 490 // Accordion 491 $('.accordion .head a').click(function(e){ 492 e.preventDefault(); 493 $(this).closest('.head').next().slideToggle(); 494 $(this).closest('.item').toggleClass('active'); 495 }); 496 497 // Video 498 $('.box-video .overlay').click(function(){ 499 $(this).fadeOut(); 500 var vid = $(this).closest('.box-video').find('video'); 501 vid.trigger('play'); 502 }); 503 $('.box-video video').click(function(){ 504 $(this).trigger('pause'); 505 var vid = $(this).closest('.box-video').find('.overlay').fadeIn(); 506 }); 507 508 // Home 509 var timeCarousel = 6; 510 // var time = 0; 511 // var moreSlides = ($("#home .video .owl-carousel")) 512 var item_count = parseInt($("#home .video .owl-carousel").find('.slide').length); 513 var owl = $("#home .video .owl-carousel").owlCarousel({ 514 loop: false, 515 rewind: true, 516 margin: 0, 517 autoplay: true, 518 //autoplayTimeout: (timeCarousel*1000) + 1000, 519 autoplayTimeout: 3700, 520 autoplayHoverPause: false, 521 nav: false, 522 dots: true, 523 responsive: { 524 0: { 525 items: 1 526 } 527 }, 528 onInitialize: function(event) { 529 530 if (event.item.count <= 1) { 531 this.settings.loop = false; 532 this.settings.nav = false; 533 this.settings.dots = false; 534 this.settings.rewind = false; 535 } 536 else { 537 this.settings.loop = false; 538 this.settings.rewind = true; 539 this.settings.nav = false; 540 this.settings.dots = true; 541 } 542 } 543 }); 544 545 // owl.on('changed.owl.carousel', function(e) { 546 // time = 0; 547 // $('#home .video .timer span').remove(); 548 // $('#home .video .timer').prepend("<span></span>"); 549 // owl.trigger('stop.owl.autoplay'); 550 // owl.trigger('play.owl.autoplay'); 551 // }); 552 553 // setInterval(function(){ 554 // time = time + 1; 555 // var total = timeCarousel; 556 // var calc = time*100/total; 557 // $('#home .video .timer span').css('width',calc+'%'); 558 // if(calc > 100){ 559 // time = 0; 560 // $('#home .video .timer span').remove(); 561 // $('#home .video .timer').prepend("<span></span>"); 562 // } 563 // },1000); 564 565 $('#home .video .video').click(function(){ 566 $('#modalVideo').modal('show'); 567 }); 568 569 $(".index .noticias .owl-carousel").owlCarousel({ 570 loop: true, 571 margin: 42, 572 nav: false, 573 touchDrag: false, 574 mouseDrag: false, 575 dots: true, 576 autoHeight: true, 577 responsive: { 578 0: { 579 items: 1, 580 touchDrag: true, 581 582 }, 583 768: { 584 items: 2 585 586 } 587 } 588 }); 589 590 $(".index .campaign .owl-carousel").owlCarousel({ 591 loop: false, 592 margin: 0, 593 rewind: true, 594 nav: false, 595 autoplay: true, 596 autoplayTimeout:6000, 597 autoplaySpeed: 2000,
598 lazyLoad:true, 599 singleItem:true, 600 autoHeight: true, 601 autoplayHoverPause:true, 602 dots: true, 603 responsive: { 604 0: { 605 items: 1 606 } 607 } 608 }); 609 610 $(".index .campaign .owl-carousel").on('initialized.owl.carousel', function(event) { 611 if($(window).width() < 767) { 612 $(".index .campaign .owl-carousel .owl-item").each(function(index,element){ 613 if($(element).children(".inner").hasClass("video")){ 614 $(element).children(".inner.video").find("video")[0].play(); 615 } 616 }); 617 } 618 }); 619 620 $(".noticias .owl-carousel .owl-stage .owl-item").each(function(e){ 621 //var newStr = $(this).find(".title").text().substring(0, 50) + "..."; 622 //$(this).find(".title").text(newStr); 623 }); 624 625 $("#produtos .banner .owl-carousel").on('initialized.owl.carousel', function(event) { 626 if($(window).width() < 767) { 627 $("#produtos .banner .owl-carousel .owl-item").each(function(index,element){ 628 if($(element).children(".item").hasClass("video")){ 629 $(element).children(".item.video").find("video")[0].play(); 630 } 631 }); 632 } 633 }); 634 635 636 $("#produtos .banner .owl-carousel").owlCarousel({ 637 loop: false, 638 margin: 0, 639 rewind: true, 640 nav: false, 641 autoplay: true, 642 autoplayTimeout:6000, 643 autoplaySpeed: 2000, 644 lazyLoad:true, 645 singleItem:true, 646 autoHeight: true, 647 autoplayHoverPause:true, 648 dots: true, 649 responsive: { 650 0: { 651 items: 1 652 } 653 } 654 }); 655 656 657 658 659 setTimeout(() => { 660 $("#produtos .banner .owl-carousel .owl-stage").css('height', $("#produtos .banner .owl-carousel .owl-item .item").height() ) 661 }, 400); 662 663 $("#produtos .banner .owl-carousel .owl-dot").on('click', () => { 664 setTimeout(() => { 665 $("#produtos .banner .owl-carousel .owl-stage").css('height', $("#produtos .banner .owl-carousel .owl-item .item").height() ) 666 }, 100); 667 }) 668 669 window.addEventListener("load", function() { 670 window.dispatchEvent(new Event('resize')); 671 }); 672 673 window.onresize = function() { 674 setTimeout(() => { 675 $("#produtos .banner .owl-carousel .owl-stage").css('height', $("#produtos .banner .owl-carousel .owl-item .item").height() ) 676 }, 10); 677 } 678 679 $("#produtos .carousel-landing .owl-carousel").owlCarousel({ 680 loop: true, 681 margin: 0, 682 nav: false, 683 dots: true, 684 autoplay: true, 685 autoplayTimeout: 4500, 686 smartSpeed: 900, 687 autoplayHoverPause: true, 688 responsive: { 689 0: { 690 items: 1 691 } 692 } 693 }); 694 695 var owl; 696 owl = $("#home .produtos .owl-carousel").owlCarousel({ 697 loop: false, 698 rewind: true, 699 margin: 0, 700 nav: false, 701 autoplay: false, 702 touchDrag: false, 703 mouseDrag: false, 704 autoplayTimeout: 5000, 705 dots: true, 706 responsive: { 707 0: { 708 items: 1, 709 touchDrag: true 710 } 711 } 712 }); 713 714 owl.on('changed.owl.carousel', function(e) { 715 var current = e.item.index; 716 var href = $(e.target).find(".owl-item").eq(current).find(".item").data("url"); 717 $("#home .produtos .box .btn").attr("href", href); 718 }); 719 720 721 var owl_prod_buy; 722 owl_prod_buy = $(".products-buy .owl-carousel").owlCarousel({ 723 loop: false, 724 rewind: true, 725 margin: 50, 726 nav: false, 727 autoplay: false, 728 touchDrag: false, 729 mouseDrag: true, 730 autoplayTimeout: 5000, 731 dots: true, 732 responsive: { 733 0: { 734 items: 1, 735 touchDrag: true, 736 }, 737 768: { 738 items: 3, 739 touchDrag: true 740 } 741 742 } 743 }); 744 745 746 var areasCarousel = $("#home .areas .owl-carousel").owlCarousel({ 747 animateOut: 'fadeOutRight', 748 animateIn: 'fadeInLeft', 749 loop: false, 750 margin: 5, 751 nav: false, 752 dots: false, 753 mouseDrag: false, 754 responsive: { 755 0: { 756 items: 1 757 } 758 } 759 }); 760 761 $('#home .areas a').hover(function(e){ 762 e.preventDefault(); 763 var target = $(this).attr('data-hover'); 764 $('#home .areas a').removeClass('active'); 765 $(this).addClass('active'); 766 //.log($(target).closest('.owl-item').index()); 767 areasCarousel.trigger('to.owl.carousel', $(target).closest('.owl-item').index()) 768 }, function(){ 769 770 }); 771 772 773 //product-page 774 $("#produtos .box-carousel .owl-carousel").owlCarousel({ 775 autoplay: false, 776 autoplayTimeout: 1000, 777 loop: true, 778 margin: 0, 779 nav: true, 780 dots: false, 781 autoHeight: true, 782 responsive: { 783 0: { 784 items: 1 785 } 786 } 787 }); 788 789 // Verifica se existe a modal de profissional de saúde e a exibe 790 if($('#modalProfissionalSaude').length > 0){ 791 $('#modalProfissionalSaude').modal('show'); 792 } 793 794 // Filtro fake 795 $('.filter form').on('submit', function(e){ 796 e.preventDefault(); 797 var dataForm = $(this).serialize(); 798 $.ajax({ 799 method: "get", 800 url: "produto-listagem.php", 801 data: dataForm 802 }).done(function( msg ) { 803 //console.log('filter '+dataForm); 804 // ESCONDE PRODUTOS DE MODO FAKE 805 if($('.item-produto:visible').length > 1){ 806 $('.item-produto').parent().hide(); 807 $('.item-produto:first').parent().fadeIn(); 808 $('.more').hide(); 809 } else { 810 $('.item-produto').parent().fadeIn(); 811 $('.more').show(); 812 } 813 }); 814 }); 815 816 // Carregar mais 817 // $('#produtos .more a').click(function(e){ 818 // e.preventDefault(); 819 // var dataForm = $('.filter form.active').serialize(); 820 // $.ajax({ 821 // method: "get", 822 // url: "produto-listagem.php", 823 // data: dataForm+"&offset=1" 824 // }).done(function( msg ) { 825 // console.log('carregar mais '+dataForm+"&offset=1"); 826 // }); 827 // }); 828 829 // Troca status do form 830 $('.filter .form-control').on('change',function(e){ 831 e.preventDefault(); 832 var val = $(this).val(); 833 if($(this).closest('form').is('.active')){ 834 if(val){ 835 $(this).addClass('active'); 836 } else { 837 $(this).removeClass('active'); 838 } 839 } else { 840 $('.filter .form-control').removeClass('active'); 841 $('.filter form').removeClass('active'); 842 $(this).closest('form').addClass('active'); 843 if(val){ 844 $(this).addClass('active'); 845 } else { 846 $(this).removeClass('active'); 847 } 848 } 849 850 $(this).closest('form').submit(); 851 852 }); 853 854 $('.filter .close-form').click(function(){ 855 $(this).prev('select').removeClass('active').val(''); 856 }); 857 858 } 859 }; 860}(); 861 862 863 864 865 866 867document.addEventListener('DOMContentLoaded', () => { 868 const div1 = document.querySelector('.update header .lower .logo-new'); 869 const div2 = document.querySelector('.update header > .lower > div:has(ul)'); 870 871 if (!div1 || !div2) return; 872 873 let elementsWidth = div1.clientWidth + div2.clientWidth + 50; 874 875 const updateHeaderClass = () => { 876 if (window.innerWidth < elementsWidth) { 877 document.querySelector(".update header").classList.add("mobile"); 878 } else { 879 document.querySelector(".update header").classList.remove("mobile"); 880 } 881 }; 882 883 updateHeaderClass(); 884 window.addEventListener('resize', updateHeaderClass); 885}); 886 887 888 889document.addEventListener("click", e => { 890 891 const header = document.querySelector(".update header"); 892 893 if (!header) return; 894 895 if (header.classList.contains("open")) { 896 897 if (e.target.matches(".update header .menu-toggle")) { 898 document.querySelector(".update header").classList.remove("open"); 899 document.querySelector("html, body").classList.remove("lock"); 900 } 901 if (e.target.matches(".update header .close-side")) { 902 document.querySelector(".update header").classList.remove("open"); 903 document.querySelector("html, body").classList.remove("lock"); 904 } 905 // else if (!e.target.matches(".update header .lower *")) { 906 // document.querySelector(".update header").classList.remove("open"); 907 // document.querySelector("html, body").classList.remove("lock"); 908 // } 909 } 910 else { 911 912 if (e.target.matches(".update header .menu-toggle")) { 913 e.target.classList.add("open"); 914 document.querySelector(".update header").classList.add("open"); 915 document.querySelector("html, body").classList.add("lock"); 916 } 917 } 918 919}) 920 921if (document.querySelector("header .side-menu ul > li .submenu")) { 922 923 let subMenus = document.querySelectorAll("header .side-menu ul > li .submenu"); 924 925 // submenus 926
927 subMenus.forEach((el) => { 928 let span = document.createElement("span"); 929 span.classList.add("submenu-arrow"); 930 931 h = getTotalHeight(el) + 20; 932 933 el.parentNode.appendChild(span); 934 935 span.addEventListener("click", function (e) { 936 if (!el.classList.contains("open")) { 937 subMenus.forEach((ele) => { 938 ele.classList.remove("open"); 939 ele.parentNode.classList.remove("active"); 940 //ele.style.maxHeight = 0; 941 ele.style.opacity = 0; 942 }) 943 944 el.classList.toggle("open"); 945 el.parentNode.classList.toggle("active"); 946 //el.style.maxHeight = `${h.toString()}px`; 947 el.style.opacity = 1; 948 } 949 else { 950 el.classList.toggle("open"); 951 el.parentNode.classList.toggle("active"); 952 //el.style.maxHeight = 0; 953 el.style.opacity = 0; 954 } 955 956 }) 957 }) 958 959 function getTotalHeight(element) { 960 if (!(element instanceof Element)) { 961 throw new Error("Argument is not a valid DOM element"); 962 } 963 964 let totalHeight = 0; 965 for (let child of element.children) { 966 const style = window.getComputedStyle(child); 967 const marginTop = parseFloat(style.marginTop); 968 const paddingBottom = parseFloat(style.paddingBottom); 969 totalHeight += child.offsetHeight + marginTop + paddingBottom; 970 } 971 972 return totalHeight; 973 } 974 975 976} 977 978 979document.addEventListener("click", e => { 980 981 if (e.target.matches("header .search-form button")) { 982 if (!e.target.closest(".search-form").classList.contains("search-open")) { 983 e.target.closest(".search-form").classList.add("search-open"); 984 const searchInput = e.target.closest(".search-form").querySelector("input[name='search-query']"); 985 if (searchInput) { 986 searchInput.focus(); 987 } 988 } 989 else { 990 if (e.target.parentNode.querySelector("input[name='search-query']").value != "") { 991 992 document.querySelector("body").classList.add("loading"); 993 document.querySelector("body").classList.add("lock"); 994 995 e.target.parentNode.submit(); 996 } 997 else { 998 e.target.closest(".search-form").classList.remove("search-open"); 999 } 1000 } 1001 e.preventDefault(); 1002 } 1003 1004 const searchBox = document.querySelector("header .search-form"); 1005 if (searchBox != null) { 1006 // if (!searchBox.contains(e.target) && searchBox.querySelector("input[name='q']").value === "") { 1007 // searchBox.classList.remove("search-open"); 1008 // } 1009 } 1010}); 1011 1012 1013document.addEventListener('DOMContentLoaded', function () { 1014 if (window.innerWidth >= 992) { 1015 const upperMenu = document.querySelector('body.update header > .upper > ul'); 1016 const submenuULs = document.querySelectorAll('body.update header > .upper .submenu > ul'); 1017 1018 if (upperMenu && submenuULs.length > 0) { 1019 const firstLI = upperMenu.firstElementChild; 1020 const lastLI = upperMenu.lastElementChild; 1021 1022 if (firstLI && lastLI) { 1023 const left = firstLI.getBoundingClientRect().left; 1024 const right = lastLI.getBoundingClientRect().right; 1025 const width = (right - left) - 15; 1026 1027 submenuULs.forEach(ul => { 1028 ul.style.width = width + 'px'; 1029 }); 1030 } 1031 } 1032 1033 const lowerMenu = document.querySelector('body.update header > .lower > div > ul'); 1034 const submenuLowerULs = document.querySelectorAll('body.update header > .lower .submenu > ul'); 1035 1036 if (lowerMenu && submenuLowerULs.length > 0) { 1037 const firstLI = lowerMenu.firstElementChild; 1038 const lastLI = lowerMenu.lastElementChild; 1039 1040 if (firstLI && lastLI) { 1041 const left = firstLI.getBoundingClientRect().left; 1042 const right = lastLI.getBoundingClientRect().right; 1043 const width = right - left; 1044 1045 submenuLowerULs.forEach(ul => { 1046 ul.style.width = width + 'px'; 1047 }); 1048 } 1049 } 1050 } 1051});
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.