1var breakpoint_menu = 991; 2var breakpoint_mobile = 768; 3 4var stick_callouts = null; 5 6var Window = (function(){ 7 return{ 8 cookiecheck: function(){ 9 if ( !Cookies.get('ghkcookieaccept') ){ 10 $('.cookie-warning').fadeIn(); 11 } 12 $('.cookie-warning button').on('click',function(){ 13 var d = new Date(); 14 Cookies.set('ghkcookieaccept', d, { expires: 365 }); 15 $('.cookie-warning').hide(); 16 }) 17 18 }, 19 rowheight: function(){ 20 // match height of things in row, for when they are to to have matching underlines. 21 // do NOT use on elements with images > crop images to same height instead of calc 22 $('.match-height-js').each(function(){ 23 var items = $(this).find('.height-js'); 24 $(items).height('auto'); 25 var maxheight = 0; 26 $(items).each(function(){ 27 if ( $(this).height() > maxheight ) maxheight = $(this).height(); 28 }) 29 // console.log(maxheight) 30 $(items).height(maxheight) 31 }) 32 } 33 } 34}()); 35 36var Events = (function(){ 37 return{ 38 initLeafletFilter:function(){ 39 $('#leafletfilter').on('change',function(){ 40 var title = $(this).val(); 41 if (title==""){ 42 $('.block-pdfList').show(); 43 } 44 else { 45 $('.block-pdfList').hide(); 46 $('.block-pdfList').each(function(){ 47 if ( $(this).find('.pdflist').data('title')==title){ 48 $(this).show(); 49 } 50 }) 51 } 52 }) 53 }, 54 init: function(){ 55 56 $('#eventfilter_select, #specialty_select').on('change',function(){ 57 var eval = $('#eventfilter_select').val(); 58 var sval = $('#specialty_select').val(); 59 60 61 62 var showclass = ""; 63 if (eval!=""){ 64 showclass += ".date"+eval; 65 } 66 if (sval!=""){ 67 showclass += ".spec"+sval; 68 } 69 if ( sval=="" && eval=="" ){ 70 $('.eventfilter .item').show(); 71 } 72 else { 73 $('.eventfilter .item').hide(); 74 $('.eventfilter').find(showclass).slideDown(); 75 } 76 77 $(".eventfilter .panel").each(function(){ 78 if ( sval=="" && eval=="" ){ 79 var items = $(this).find('.item'); 80 } 81 else { 82 var items = $(this).find(showclass); 83 } 84 $(this).find('.item-count').text( items.length ); 85 }) 86 87 }); 88 89 90 } 91 } 92}()); 93 94 95var Nav = (function(){ 96 return { 97 init: function(){ 98 // mobile toggle header 99 $('.js-nav-toggle').on('click',function(){ 100 $(this).toggleClass('open'); 101 // $('.nav').slideToggle(); 102 $('body').toggleClass('mobile-nav-show'); 103 }) 104 105 $('a.has-dropdown').on('click',function(e){ 106 e.preventDefault(); 107 }) 108 $('.nav-item > a').on('click',function(e){ 109 if ( $(window).width() < breakpoint_menu ){ 110 var $navitem = $(this).parent(); 111 if ( $navitem.find('.nav-dropdown').length ){ 112 113 e.preventDefault(); 114 if ( $navitem.find('.nav-dropdown:visible').length ) { 115 $navitem.find('.nav-dropdown:visible').slideUp(); 116 } 117 else { 118 $('.nav-item .nav-dropdown').slideUp(); 119 $navitem.find('.nav-dropdown').slideDown(); 120 121 } 122 } 123 } 124 }) 125 $('a.closemobile').on('click',function(e){ 126 e.preventDefault(); 127 $('.nav-item .nav-dropdown').slideUp(); 128 }) 129 130 // mobile toggle footer 131 $('.js-footer-toggle').on('click',function(){ 132 if ( $(window).width()<breakpoint_mobile ){ 133 $(this).next().slideToggle(); 134 $(this).find('i').toggleClass('fa-angle-down').toggleClass('fa-angle-down') 135 } 136 }) 137 138 // main nav spacing and dropdown effect 139 $('.nav-item').css('width', 100/($('.nav-item').length)+'%' ); 140 // language change 141 $('select.language').on('change',function(){ 142 window.location = $(this).val()+window.location.search; 143 }) 144 145 $('.back-to-top a').on('click',function(e){ 146 e.preventDefault(); 147 $("html, body").animate({ scrollTop: 0 }, 300); 148 }) 149 }, 150 scroll: function(){ 151 var top = $(document).scrollTop(); 152 if ( stick_callouts != null && $(window).width()>breakpoint_mobile && top > stick_callouts ){ 153 if ( !$('#sidebar-callouts').hasClass('portal-nav')){ 154 $('#sidebar-callouts').addClass('stick'); 155 } 156 } 157 else { 158 $('#sidebar-callouts').removeClass('stick'); 159 160 $('#sidebar-callouts .dropdown-view-fixed').hide() 161 } 162 163 if ( top > 200 ){ 164 $('.back-to-top').show(); 165 } 166 else { 167 $('.back-to-top').hide(); 168 } 169 }, 170 initSidebar: function(){ 171 // set breakpoint for the sticky find doc/make appt/search treat button [desktop] 172 if ( $(document).height()>$(window).height() && $('#sidebar-callouts').length ){ 173 var $div = $('#sidebar-callouts'); 174 stick_callouts = $div.offset().top + $div.height(); 175 176 if ( $('.sidebar-callouts-container-js').length==0){ 177 $div.wrap('<div class="sidebar-callouts-container-js"></div>'); 178 } 179 $('.sidebar-callouts-container-js').height( $div.height() ); 180 } 181 182 // clone the waiting time box to mobile version 183 if ( $('.callout-waittime').length==1 ){ 184 $('.addthis_inline_share_toolbox').after($('.callout-waittime').clone()); 185 $('.addthis_inline_share_toolbox').next().removeClass('hidden-mobile sidebar').addClass('visible-mobile') 186 } 187 188 // clinic subnav 189 if ( $('.sidebar-nav-toggle').length && !$('.sidebar-nav-toggle').hasClass('initialized')){ 190 191 $('.sidebar-nav-toggle').addClass('initialized') 192 $('.sidebar-nav-toggle').on('click',function(e){ 193 e.preventDefault(); 194 $('.sidebar-nav').slideToggle(); 195 }) 196 $('.sidebar-nav-toggle-close').on('click',function(e){ 197 e.preventDefault(); 198 $('.sidebar-nav').slideUp(); 199 }) 200 201 // only for cancer services 202 $('.clinic-container.cancer-services .sidebar-nav').slideDown(); 203 } 204 205 }, 206 initHash: function(){ 207 // if we are going to an anchor, and its an accordion, open it 208 if(window.location.hash) { 209 if ( $(window.location.hash).length ){ 210 var $anchor = $(window.location.hash); 211 212 213 if ( $anchor.find('[data-toggle]').length ){ 214 $anchor.find('[data-toggle]').trigger('click') 215 setTimeout(function(){ 216 var offset = 10; 217 218 if ( $anchor.offset().top>stick_callouts && $(window).width()>=breakpoint_mobile ) { 219 offset = 50; 220 } 221 222 window.scrollTo(0, $anchor.offset().top-offset); 223 }, 300); 224 } 225 } 226 } 227 } 228 } 229}()); 230 231 232var Carousels = (function(){ 233 return { 234 init: function(){ 235 // banner with captions 236 $('#header-carousel .carousel').slick({ 237 prevArrow:$('#header-carousel .carousel-nav.left'), 238 nextArrow:$('#header-carousel .carousel-nav.right'), 239 fade:true, 240 autoplay: true, 241 autoplaySpeed: 5000, 242 dots: true, 243 adaptiveHeight: true, 244 customPaging: function(slick,index) { 245 return '<button type="button" data-role="none" role="button" tabindex="'+index+'"></button>'; 246 }, 247 appendDots: '.slider-pagination-wrapper' 248 }); 249 $('#header-carousel .carousel-text').slick({ 250 arrows:false, 251 fade:true 252 }); 253 $('#header-carousel .carousel').on('beforeChange',function(slick, slide, current, next){ 254 if ( next!= $('#header-carousel .carousel-text').slick('slickCurrentSlide') ) 255 $('#header-carousel .carousel-text').slick('slickGoTo',next); 256 }) 257 $('#header-carousel .carousel-text').on('beforeChange',function(slick, slide, current, next){ 258 if ( next!= $('#header-carousel .carousel').slick('slickCurrentSlide') ) 259 $('#header-carousel .carousel').slick('slickGoTo',next); 260 }) 261 262 // generic img carousel - show edges of left/right items if space allows 263 if ($('.contentblock .carousel').length > 0) { 264 265 var autoplay = false;
266 var autoplaySpeed = 0; 267 var responsiveSettings = []; 268 if ($('.contentblock .carousel').closest('.cancer-services')) { 269 autoplay = true; 270 autoplaySpeed = 5000; 271 // responsiveSettings = [ 272 // { 273 // breakpoint: 480, 274 // settings: { 275 // slidesToShow: 2, 276 // slidesToScroll: 2, 277 // centerMode: false, 278 // variableWidth: false 279 // } 280 // } 281 // ]; 282 } 283 284 $('.contentblock .carousel').slick({ 285 autoplay: autoplay, 286 autoplaySpeed: autoplaySpeed, 287 responsive: responsiveSettings, 288 centerMode:true, 289 variableWidth: true 290 }) 291 } 292 293 $('.carousel-small').each(function(){ 294 let $c = $(this); 295 $c.find('.carousel').slick({ 296 infinite: false 297 }) 298 }); 299 300 // carousel w nav at bottom right - 3 columns with 2 rows each, reduce in mobile 301 $(".doctorCarousel").each(function(){ 302 var $c = $(this); 303 var adaptiveHeight = true; 304 305 if ($c.hasClass('disableAdaptiveHeight')) { 306 adaptiveHeight = false; 307 } 308 309 $c.slick({ 310 dots:true, 311 appendArrows:$c.parent().find('.doctorCarousel-nav'), 312 appendDots:$c.parent().find('.doctorCarousel-nav'), 313 adaptiveHeight: adaptiveHeight, 314 // slidesToShow: 2, 315 // slidesToScroll: 2, 316 responsive: [ 317 { 318 breakpoint: 767, 319 settings: { 320 slidesToShow: 1, 321 slidesToScroll: 1, 322 } 323 } 324 ] 325 }); 326 327 setTimeout(function() { 328 329 $c.find('.slick-track .slide').each(function() { 330 var minHeight = 0; 331 332 $(this).find('.doctor-item > div').each(function() { 333 334 if ($(this).height() > minHeight) { 335 minHeight = $(this).height(); 336 } 337 }); 338 339 $(this).find('.doctor-item > div > .row > .col-xs-8.col-sm-8').height(minHeight); 340 $(this).find('.doctor-item').addClass('loaded') 341 }); 342 }, 1000); 343 344 345 // Toggle privileges 346 $c.find('.privilege-toggle').on('click',function(e){ 347 e.preventDefault(); 348 $(this).next().slideToggle(200,function(){ 349 var idx = $c.find('.slick-active').data('slick-index'); 350 $c.slick('setPosition',idx); //trigger resize in case accordion caused overflow 351 }); 352 $(this).find('span').toggleClass('hidden'); 353 }) 354 }) 355 356 if ( $(".doctorCarousel").length==0){ 357 // if not carousel 358 // Toggle privileges 359 $('body').on('click','.privilege-toggle',function(e){ 360 e.preventDefault(); 361 $(this).next().slideToggle(200); 362 $(this).find('span').toggleClass('hidden'); 363 }) 364 } 365 366 367 368 // sidebar carousel - like doctorcarousel with 1 item only 369 $(".sideCarousel").slick({ 370 dots:true, 371 appendArrows:$('.doctorCarousel-nav'), 372 appendDots:$('.doctorCarousel-nav') 373 }) 374 375 // home min carousel 376 let limit = 3; 377 if ( $('.features-simple .carousel .item').length<limit){ 378 limit = $('.features-simple .carousel .item').length; 379 } 380 $('.features-simple .carousel').slick({ 381 slidesToShow: limit, 382 slidesToScroll: 1, 383 arrows: true, 384 autoplay: true, 385 autoplaySpeed: 5000, 386 responsive: [ 387 { 388 breakpoint: 767, 389 settings: { 390 slidesToShow: 1, 391 392 } 393 } 394 ] 395 }) 396 397 // home clinics carousel 398 $('.features-clinics .carousel').slick({ 399 dots:true, 400 slidesToShow: 4, 401 slidesToScroll: 4, 402 arrows: false, 403 autoplay: true, 404 autoplaySpeed: 5000, 405 responsive: [ 406 { 407 408 breakpoint: 767, 409 settings: { 410 arrows: true, 411 dots: true, 412 slidesToShow: 1, 413 slidesToScroll: 1, 414 } 415 } 416 ] 417 }) 418 419 // sub clinic carousel 420 if ($('.clinic-carousel').length) { 421 $('.clinic-carousel').slick({ 422 arrows:false, 423 dots:true, 424 // adaptiveHeight:true, 425 autoplay: true, 426 autoplaySpeed: 5000}) 427 } 428 // ... 429 // $('.features-4 .carousel').slick({ 430 // arrows:false, 431 // autoplay: true, 432 // autoplaySpeed: 6000, 433 // fade: true 434 // }) 435 436 if ( $('.testimonials').length) { 437 $('.testimonials.side').each(function(){ 438 var $c = $(this); 439 $c.slick({ 440 adaptiveHeight: true, 441 }) 442 }) 443 $('.testimonials').lightGallery({ 444 selector: '.thumb' 445 }); 446 } 447 448 449 }, 450 resize: function(){ 451 if ( $(window).width() < breakpoint_menu ){ 452 // move navbar to mobile position 453 if ($('#navbar-desktop .nav').length) 454 $('.row.nav').appendTo( $('#navbar-mobile') ); 455 456 } 457 else { 458 // move navbar to original position 459 if ( $('#navbar-mobile .nav').length ) 460 $('.row.nav').appendTo( $('#navbar-desktop') ); 461 462 } 463 464 465 $('#sidebar-callouts').removeClass('stick'); 466 467 if ( $(window).width() < breakpoint_mobile ){ 468 // home small carousels 469 if ( $('.features-overlay.slick-initialized').length == 0) { 470 $('.features-text').slick(); 471 $('.features-overlay').not('.disableMobileCarousel').slick(); 472 } 473 474 //doctor search 475 if ( $('.doctor-search').length ){ 476 $('.doctor-search').after( $('.sidebar-search') ); 477 } 478 } 479 else { 480 // home small carousels 481 if ( $('.features-overlay.slick-initialized').length ){ 482 $('.features-overlay').slick('destroy'); 483 $('.features-text').slick('destroy'); 484 } 485 486 487 if ( $('.doctor-search').length ){ 488 $('.sidebar-search-after').after( $('.sidebar-search') ); 489 } 490 } 491 } 492 } 493}()); 494 495 496var Services = (function(){ 497 return{ 498 init: function(){ 499 500 if ( $('.waitingtime-ajax').length ){ 501 $.ajax({ 502 url: "/facilities-services/waitingTimeCache.html", 503 type: "GET", 504 success: function (response) { 505 $('.waitingtime-ajax').html(response); 506 } 507 }); 508 } 509 510 } 511 } 512 513}()) 514 515 516var Contact = (function(){ 517 return{ 518 initApptModal: function(){ 519 let apptModalIframeSrc = $('#bookingUrlIframeValue').val(); 520 521 $('#apptmodal').on('shown.bs.modal', function () { 522 $(this).find('iframe').attr('src', apptModalIframeSrc); 523 }) 524 $('#apptmodal').on('hidden.bs.modal', function () { 525 $('#apptmodal iframe').remove(); 526 $('#apptmodal .modal-body').append('<iframe style="height:600px;
526" src="'+apptModalIframeSrc+'"></iframe>') 527 }) 528 // if ( $('#apptmodal iframe').length) { 529 // var url = $('#apptmodal iframe').attr('src'); 530 // $('#apptmodal').on('hidden.bs.modal', function () { 531 // $('#apptmodal iframe').remove(); 532 // $('#apptmodal .modal-body').append('<iframe style="height:600px;" src="'+url+'"></iframe>') 533 // }) 534 // } 535 536 }, 537 poll: function(){ 538 // Poll form 539 $('.form-poll').each(function(){ 540 var $form = $(this); 541 $form.on('submit',function(e){ 542 e.preventDefault(); 543 $form.find('.msg').hide(); 544 $form.find('.loading').show(); 545 $.ajax({ 546 method:'POST', 547 url: $form.attr('action'), 548 data:$form.serialize(), 549 success: function(response){ 550 551 $form.find('.msg').hide(); 552 if (response.success){ 553 $form.find('.success').show(); 554 $form.find('.fields').slideUp(); 555 } 556 else { 557 $form.find('.error').show(); 558 } 559 560 } 561 }) 562 }) 563 }) 564 }, 565 init: function(){ 566 567 // prep file input styling and functions 568 $('input[type=file].init-fileinput').each(function(){ 569 var $input = $(this); 570 var text = $(this).data('title'); 571 if ( text == "" ) text = "Drop file or Browse"; 572 $input.wrap('<div class="input-custom"></div>'); 573 $input.after('<div class="filename"></div><button class="remove" style="display:none">x</button>');//filename disp and remover 574 $input.wrap('<label></label>'); 575 $input.after('<span class="text">'+text+'</span>');// the main button 576 $input.after('<span class="info"></span>');// size? 577 578 }) 579 $('.input-custom input[type=file]').on('change',function(e){ 580 var $parent = $(this).parent().parent(); 581 if ( $(this)[0].files.length ){ //they added a file 582 // lets frontend validate? 583 584 // valiate success 585 var val = $(this)[0].files[0]; 586 $parent.addClass('filled'); 587 $parent.find('.filename').text(val.name); 588 $parent.find('.info').text( (val.size/1000000).toFixed(2) + "MB" ); 589 $parent.find('.text').hide(); 590 $parent.find('.remove').show(); 591 } 592 else { //they removed file/left blank 593 $parent.removeClass('filled'); 594 $parent.find('.filename').text(''); 595 $parent.find('.info').text(''); 596 $parent.find('.text').show(); 597 $parent.find('.remove').hide(); 598 599 } 600 }) 601 602 $('.input-custom .remove').on('click',function(e){ 603 var $parent = $(this).parent(); 604 var input = $parent.find('input'); 605 606 console.log($(this).closest('.fileinput').hasClass('ahats')) 607 608 if ($(this).closest('.fileinput').hasClass('ahats')) { 609 $(input).val(""); 610 $parent.removeClass('filled'); 611 $parent.find('.filename').text(''); 612 $parent.find('.info').text(''); 613 $parent.find('.text').show(); 614 615 e.stopPropagation(); 616 e.preventDefault(); 617 } else { 618 if (input.length){ 619 $(input).val(""); 620 $parent.removeClass('filled'); 621 $parent.find('.filename').text(''); 622 $parent.find('.info').text(''); 623 $parent.find('.text').show(); 624 $parent.find('.remove').hide(); 625 e.stopPropagation(); 626 e.preventDefault(); 627 628 $parent.parent().hide(); 629 } 630 } 631 }) 632 633 $('.fileinput-multi input').on('change',function(){ 634 // reshuffle inputs in a multi input : put empty at the top and hide any empty 635 var $parentdiv = $(this).closest('.fileinput-multi'); 636 var inputs = $parentdiv.find('input[type=file]'); 637 638 var empty = null; 639 for (var i = inputs.length - 1; i >= 0; i--) { //hide any empty ones 640 var input = inputs[i]; 641 642 if ( input.files.length>0 ){ 643 $(input).parent().parent().show(); 644 } 645 else { 646 $(input).parent().parent().hide(); 647 if (empty==null){ 648 empty = $(input).parent().parent(); 649 } 650 } 651 } 652 // but show 1 empty div if any 653 if (empty!=null){ 654 $(empty).show(); 655 $parentdiv.prepend(empty); 656 } 657 }) 658 659 660 if ( $('.fileinput-multi input').length ){ 661 $('.fileinput-multi input').trigger('change'); 662 } 663 664 // one of those GP/specialist > specialist dropdown forms 665 $('.topic-select').on('change',function(){ 666 var email = $(this).find(':selected').data('email'); 667 if ( email ){ 668 $('.contact-form input[name=emailTo]').val(email); 669 } 670 }) 671 $('.topic-select').trigger('change'); 672 673 // FORM SUBMISSIONS 674 $('.contact-form').on('submit',function(e){ 675 676 e.preventDefault(); 677 678 var $form = $(this); 679 var formData = new FormData()
680 var valid = true; 681 682 683 var findData = $form.find('[name="topic"]').val(); 684 // if (findData && findData === "AHATS Application Form") { 685 formData.append('topic', findData); 686 // } 687 688 689 690 if ( grecaptcha.getResponse()==''){ 691 alert('Please complete Recaptcha.'); 692 return; 693 } 694 695 var filesizetotal = 0; 696 var filecount = 0; 697 $form.find('input[type=file]').each( function() { 698 var htmlInputFile = $(this)[0]; 699 700 if ($(this).hasClass('multiple')) { 701 for (let i = 0; i < htmlInputFile.files; i++) { 702 let uploadedFile = htmlInputFile[i]; 703 filesizetotal += uploadedFile.size; 704 formData.append("img"+filecount, uploadedFile, uploadedFile.name); 705 filecount++; 706 707 console.log(uploadedFile) 708 } 709 710 if ( filesizetotal > 10000000 ){ 711 alert('Exceeding 10MB.'); 712 valid = false; 713 } 714 } else { 715 if (htmlInputFile.files.length) { 716 717 filesizetotal += htmlInputFile.files[0].size; 718 if ( htmlInputFile.files[0].size < 10000000 ){ 719 formData.append("img"+filecount, htmlInputFile.files[0]); 720 filecount++; 721 } else { 722 alert(htmlInputFile.files[0].name+' is over 10MB.'); 723 valid = false; 724 } 725 } 726 } 727 }) 728 729 // Old upload without "multiple" 730 // $form.find('input[type=file]').each( function() { 731 // if ( $(this)[0].files.length) { 732 733 // filesizetotal +=$(this)[0].files[0].size; 734 // if ( $(this)[0].files[0].size < 10000000 ){ 735 // formData.append("img"+filecount, $(this)[0].files[0]); 736 // filecount++; 737 // } 738 // else { 739 // alert($(this)[0].files[0].name+' is over 10MB.'); 740 // valid = false; 741 // } 742 // } 743 // }) 744 745 if ( valid==true && filesizetotal > 10000000 ){ 746 alert('Total file sizes are over 10MB.'); 747 valid = false; 748 } 749 750 if (valid){ 751 752 formData.append('email',$('input[type=email]').val()); 753 $form.find('.message').hide(); 754 $form.find('.fields').slideUp(); 755 $form.find('.message.loading').show(); 756 757 if ($form.hasClass('contact-us-form')) { 758 759 if (window.location.href.includes('clinic') && window.location.href.includes('contact-us')) { 760 // Clinic Subsite -- Contact Us 761 window.gleneaglesDataLayer.clinicSubsiteContactUsSubmitButtonIsClicked( 762 $form.find('.topic-select :selected').attr('data-title'), 763 $form.find('input[name="fields[First Name]"]').val() + ' ' + $form.find('input[name="fields[Last Name]"]').val(), 764 $form.find('input[name="emailFrom"]').val(), 765 $form.find('input[name="fields[Phone]"]').val(), 766 localStorage.getItem('ghk-datalayer-userid'), 767 'https://gleneagles.com.hk/about-us', 768 $form.find('textarea[name="fields[Message]"]').val() 769 ); 770 } else if (window.location.href.includes('contact-us')) { 771 // Contact Us -- Contact Form Data Layer Submit 772 window.gleneaglesDataLayer.contactUsSubmitButtonIsClicked( 773 $form.find('.topic-select :selected').attr('data-title'), 774 $form.find('input[name="fields[First Name]"]').val() + ' ' + $form.find('input[name="fields[Last Name]"]').val(), 775 $form.find('input[name="emailFrom"]').val(), 776 $form.find('input[name="fields[Phone]"]').val(), 777 localStorage.getItem('ghk-datalayer-userid'), 778 null, 779 $form.find('textarea[name="fields[Message]"]').val() 780 ); 781 } else if (window.location.href.includes('clinic')) { 782 // Clinic Subsite -- Make an Appointment 783 window.gleneaglesDataLayer.clinicSubsiteBookAnAppointmentSubmitButtonIsClicked( 784 $form.find('.topic-select :selected').attr('data-title'), 785 $form.find('input[name="fields[First Name]"]').val() + ' ' + $form.find('input[name="fields[Last Name]"]').val(), 786 $form.find('input[name="emailFrom"]').val(), 787 $form.find('input[name="fields[Phone]"]').val(), 788 localStorage.getItem('ghk-datalayer-userid'), 789 'https://gleneagles.com.hk/about-us', 790 $form.find('textarea[name="fields[Message]"]').val() 791 ); 792 } 793 } 794 795 $.ajax({ 796 url: "/actions/gleneagles/contact/formAttachments", 797 type: "POST", 798 data: formData, 799 async: true, 800 cache: false, 801 contentType: false, 802 processData: false, 803 success: function (response) { 804 var success = false;
805 806 if ( response.length ){ 807 if ( filecount==0 && response[0]==0){ 808 success=true;// no files needed 809 } 810 if ( filecount>0 && response.length==filecount ){ 811 success = true; //all files were uploaded 812 } 813 } 814 815 816 if ( success ){ //files uploaded/no files needed 817 var data = $form.serialize(); 818 if (response[0]!=0){ 819 data = data+"&files="+response.join(","); 820 } 821 $.ajax({ 822 url: $form.attr('action'), 823 type: 'POST', 824 data: data, 825 success: function (data) { 826 if ( data[0] == "0" ){ //misc php validation error 827 $form.find('.message').hide(); 828 $form.find('.error').show(); 829 $form.find('.fields').slideDown(); 830 } 831 else if ( data[0] == "-1" ){ //event capacity 832 $form.find('.message').hide(); 833 $form.find('.error-capacity').show(); 834 } 835 else { 836 // more than 0 forms were saved 837 $form.find('.message').hide(); 838 $form.find('.success').show(); 839 840 if ($form.hasClass('contact-us-form')) { 841 if (window.location.href.includes('clinic') && window.location.href.includes('contact-us')) { 842 // Clinic Subsite -- Contact Us 843 window.gleneaglesDataLayer.clinicSubsiteContactUsThankyouPage( 844 $form.find('.topic-select :selected').attr('data-title'), 845 $form.find('input[name="fields[First Name]"]').val() + ' ' + $form.find('input[name="fields[Last Name]"]').val(), 846 $form.find('input[name="emailFrom"]').val(), 847 $form.find('input[name="fields[Phone]"]').val(), 848 localStorage.getItem('ghk-datalayer-userid'), 849 null, 850 $form.find('textarea[name="fields[Message]"]').val() 851 ); 852 } else if (window.location.href.includes('contact-us')) { 853 // Contact Us -- Contact Form Data Layer Submit 854 window.gleneaglesDataLayer.contactUsThankyouPageVisited( 855 $form.find('.topic-select :selected').attr('data-title'), 856 $form.find('input[name="fields[First Name]"]').val() + ' ' + $form.find('input[name="fields[Last Name]"]').val(), 857 $form.find('input[name="emailFrom"]').val(), 858 $form.find('input[name="fields[Phone]"]').val(), 859 localStorage.getItem('ghk-datalayer-userid'), 860 null, 861 $form.find('textarea[name="fields[Message]"]').val() 862 ); 863 } else if (window.location.href.includes('clinic')) { 864 // Clinic Subsite -- Make an Appointment 865 window.gleneaglesDataLayer.clinicSubsiteBookAnAppointmentThankyouPage( 866 $form.find('.topic-select :selected').attr('data-title'), 867 $form.find('input[name="fields[First Name]"]').val() + ' ' + $form.find('input[name="fields[Last Name]"]').val(), 868 $form.find('input[name="emailFrom"]').val(), 869 $form.find('input[name="fields[Phone]"]').val(), 870 localStorage.getItem('ghk-datalayer-userid'), 871 null, 872 $form.find('textarea[name="fields[Message]"]').val() 873 ); 874 } 875 } 876 } 877 878 } 879 }) 880 } 881 else { 882 // a file validation fail 883 $form.find('.message').hide(); 884 $form.find('.error-file').show(); 885 $form.find('.fields').slideDown(); 886 } 887 } 888 }); 889 890 891 } 892 893 }); 894 } 895 } 896}()); 897 898 899$(window).resize(function(){ 900 Carousels.resize(); 901 Window.rowheight(); 902 903 Nav.initSidebar(); 904}) 905 906$(window).scroll(function(){ 907 Nav.scroll(); 908}) 909 910$(document).ready(function(){ 911 912 if ( $('.ie-js').length ){ 913 $('body').addClass('ie'); 914 } 915 if ( $('.ie8-js').length ){ 916 $('body').addClass('ie8'); 917 } 918 Window.cookiecheck() 919 920 921 $('input, textarea').placeholder(); 922 923 $('.doctor-item-lg img, .doctor-item img').each(function(){ 924 $(this)[0].oncontextmenu = function() { 925 return false;
926 }; 927 }); 928 929 Nav.init(); 930 Carousels.init(); 931 Contact.initApptModal(); 932 Services.init(); 933 934 if ( $('.form-poll').length) { 935 Contact.poll() 936 } 937 938 if ( $('#leafletfilter').length ){ 939 Events.initLeafletFilter() 940 } 941 942 if ($('.contact-form').length){ 943 $('.contact-form').parsley(); 944 if ( $('.ie-js').length==0 || FormData!=undefined ){ 945 Contact.init(); 946 } 947 } 948 949 if ($('.event-page').length){ 950 Events.init(); 951 } 952 $(window).trigger('resize'); 953 $('.richtext table').addClass("table"); 954 955 // log out after 30min?? 956 var min = 30; 957 var ms = min * 60 * 1000; 958 if ( typeof globaluser !== 'undefined' && globaluser!="" ){ 959 var logouttimer = setTimeout(function(){ 960 $.ajax({ 961 url: "/logout", 962 type: "GET", 963 async: true, 964 cache: false, 965 contentType: false, 966 processData: false, 967 success: function (response) { 968 confirm("You have been logged out after 30min of inactivity."); 969 } 970 }); 971 972 },ms); 973 $('input, select, textarea').on('change',function(){ 974 clearTimeout(logouttimer); 975 }) 976 } 977 978 979 // extra fixed button menu, desktop only 980 $('#sidebar-callouts .callouts-drop > a').on('click',function(e){ 981 e.preventDefault(); 982 // if ( $(window).width()<768){ 983 // $(this).next().slideToggle(); 984 // } 985 }) 986 987 $(".callouts-drop").mouseenter(function() { 988 $(this).find('.dropdown-view-fixed').slideDown(); 989 }).mouseleave(function() { 990 $(this).find('.dropdown-view-fixed').slideUp(100); 991 }); 992 $(document).click(function(event) { 993 if(!$(event.target).closest('.btn-container').length) { 994 if($('.btn-container').is(":visible")) { 995 $('#sidebar-callouts .dropdown-view-fixed').slideUp(); 996 } 997 } 998 }); 999 1000 1001 $('.gallery-init').each(function(){ 1002 var id = $(this).attr('id'); 1003 $(this).lightGallery({ 1004 selector: '.gallery-item' 1005 }) 1006 }) 1007 $('.event-video iframe').each(function(){ 1008 var h = ($(this).width()/16)*9; 1009 $(this).height(h); 1010 }) 1011}) 1012 1013$(window).load(function(){ 1014 1015 Nav.initSidebar(); //some height things post-imgload 1016 Nav.initHash(); 1017 1018 if ( $('#homealert').length ){ 1019 // homepage important modal 1020 $('#homealert').modal('show'); 1021 } 1022 1023 // AHATS Announcement Modal 1024 if ($('#ahats-announcement-modal').length > 0) { 1025 let hideAhatsAnnouncementModal = localStorage.getItem('ahats-announcement-modal-expired-until'); 1026 if (!hideAhatsAnnouncementModal || (hideAhatsAnnouncementModal && new Date(hideAhatsAnnouncementModal) < new Date())) { 1027 $('#ahats-announcement-modal').modal('show'); 1028 } 1029 1030 $('#ahats-announcement-modal').on('hidden.bs.modal', function() { 1031 let oneWeekFromNow = new Date(); 1032 oneWeekFromNow.setDate(new Date().getDate() + 7); 1033 1034 localStorage.setItem('ahats-announcement-modal-expired-until', oneWeekFromNow); 1035 }); 1036 } 1037})
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.