1(function($) { 2 3var isMobile = { 4 Android: function() { 5 return navigator.userAgent.match(/Android/i); 6 }, 7 BlackBerry: function() { 8 return navigator.userAgent.match(/BlackBerry/i); 9 }, 10 iOS: function() { 11 return navigator.userAgent.match(/iPhone|iPad|iPod/i); 12 }, 13 Opera: function() { 14 return navigator.userAgent.match(/Opera Mini/i); 15 }, 16 Windows: function() { 17 return navigator.userAgent.match(/IEMobile/i); 18 }, 19 any: function() { 20 return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows()); 21 } 22}; 23 24if( !isMobile.any() ){ //Not mobile 25 26 $( ".bio-entry-wrap" ).click(function() { 27 28 thisparent = $(this).parent(); 29 30 if ( thisparent.hasClass( "closed" ) ) { 31 $('.open').addClass("closed"); 32 $('.open').removeClass("open"); 33 thisparent.addClass("open"); 34 thisparent.removeClass("closed"); 35 }else if ( thisparent.hasClass( "open" ) ) { 36 $('.open').addClass("closed"); 37 $('.open').removeClass("open"); 38 } 39 }); 40 41}else{ //Is mobile 42 43 $( ".bio-entry-wrap" ).click(function() { 44 45 thisparent = $(this).parent(); 46 47 if ( thisparent.hasClass( "closed" ) ) { 48 thisparent.addClass("open"); 49 thisparent.removeClass("closed"); 50 }else if ( thisparent.hasClass( "open" ) ) { 51 thisparent.removeClass("open"); 52 thisparent.addClass("closed"); 53 } 54 }); 55 56} 57 58// Now check URL parameters and trigger clicks 59function checkUrlAndTriggerClicks() { 60 // Get URL parameters 61 var urlParams = new URLSearchParams(window.location.search); 62 var bioId = urlParams.get('bio'); // example: ?bio=123 63 64 if (bioId) { 65 // Trigger click on specific bio entry 66 var $element = $('#' + bioId + ' .bio-entry-wrap'); 67 68 if ($element.length) { 69 // Trigger click 70 $element.click(); 71 72 // Scroll to element 73 $('html, body').animate({ 74 scrollTop: $element.offset().top -70 75 }, 500); // 500ms animation duration 76 } 77 } 78} 79 80// Run after bindings are complete 81checkUrlAndTriggerClicks(); 82 83//check scroll position outside scrolling 84if($(document).scrollTop() > 100) 85 { 86 $('#masthead').data('size','small'); 87 $('#masthead').toggleClass('small', 300); 88 89 } 90 else 91 { 92 $('#masthead').data('size','big'); 93 94 } 95 96//check scroll position outside scrolling 97if($(document).scrollTop() > 430) 98 { 99 $('.tertiary-menu').data('size','small'); 100 $('.tertiary-menu').toggleClass('small', 0); 101 102 } 103 else 104 { 105 $('.tertiary-menu').data('size','big'); 106 107 } 108 109//check scroll position while scrolling 110$(window).scroll(function(){ 111 112 if ($(this).scrollTop() > 100) { 113 114 //Check to see if the window is top if not then display button 115 //$('.scrollToTop').fadeIn(); 116 117 //skrink header on scroll ************ 118 if($('#masthead').data('size') == 'big') 119 { 120 $('#masthead').data('size','small'); 121 $('#masthead').toggleClass('small', 300); 122 } 123 124 var nav = $('#primary-hidden'); 125 if(nav.height() != 0){ 126 nav.stop().animate({ height: '0' }, 200); 127 $('.site-header').removeClass('open', 200); 128 } 129 130 } else { 131 //$('.scrollToTop').fadeOut(); 132 133 if($('#masthead').data('size') == 'small') 134 { 135 $('#masthead').data('size','big'); 136 $('#masthead').toggleClass('small', 300); 137 } 138 } 139 140 /*if ($(this).scrollTop() > 430) { 141 142 //Check to see if the window is top if not then display button 143 //$('.scrollToTop').fadeIn(); 144 145 //skrink header on scroll ************ 146 if($('.tertiary-menu').data('size') == 'big') 147 { 148 $('.tertiary-menu').data('size','small'); 149 $('.tertiary-menu').toggleClass('small', 0); 150 } 151 152 } else { 153 //$('.scrollToTop').fadeOut(); 154 155 if($('.tertiary-menu').data('size') == 'small') 156 { 157 $('.tertiary-menu').data('size','big'); 158 $('.tertiary-menu').toggleClass('small', 0); 159 } 160 }*/ 161 162 $('.countit').each(function () { 163 numCount($(this)); 164 }); 165 166}); 167 168$('.menu-foot > span').removeClass("fa-plus").removeClass("fas").addClass("fa-reply").addClass("fa-solid"); 169 170var plusListeners = false; 171 172if ($(window).width() < 900) { 173 174 $('#primary-menu > li').has('.sub-menu').children('span').show(); 175 $('#primary-menu li.topic').has('.sub-menu').children('span').show(); 176 177 if(plusListeners == false){ 178 179 $('#primary-menu > li > span, #primary-menu li.topic > span').click(function() { 180 $(this).siblings(".sub-menu").toggleClass( "show", 250, "swing" ); 181 if ( $(this).hasClass("fa-minus") ) { 182 $(this).removeClass("fa-minus").addClass("fa-plus"); 183 }else if ( $(this).hasClass("fa-plus") ) { 184 $(this).removeClass("fa-plus").addClass("fa-minus"); 185 } 186 }); 187 188 $('#primary-menu li.topic > a').click(function(e) { 189 190 e.stopPropagation(); 191 e.preventDefault(); 192 193 $(this).siblings(".sub-menu").toggleClass( "show", 250, "swing" ); 194 if ( $(this).siblings(".fas").hasClass("fa-minus") ) { 195 $(this).siblings(".fas").removeClass("fa-minus").addClass("fa-plus"); 196 }else if ( $(this).siblings(".fas").hasClass("fa-plus") ) { 197 $(this).siblings(".fas").removeClass("fa-plus").addClass("fa-minus"); 198 } 199 }); 200 201 plusListeners = true; 202 } 203 204}else{ 205 206} 207 208$( window ).resize(function() { 209 210 if ($(window).width() < 900) { 211 212 $('#primary-menu > li').has('.sub-menu').children('span').show(); 213 $('#primary-menu li.topic').has('.sub-menu').children('span').show(); 214 215 if(plusListeners == false){ 216 217 $('#primary-menu > li > span, #primary-menu li.topic > span').click(function() { 218 $(this).siblings(".sub-menu").toggleClass( "show", 250, "swing" ); 219 if ( $(this).hasClass("fa-minus") ) { 220 $(this).removeClass("fa-minus").addClass("fa-plus"); 221 }else if ( $(this).hasClass("fa-plus") ) { 222 $(this).removeClass("fa-plus").addClass("fa-minus"); 223 } 224 }); 225 226 $('#primary-menu li.topic > a').click(function(e) { 227 228 e.stopPropagation(); 229 e.preventDefault(); 230 231 $(this).siblings(".sub-menu").toggleClass( "show", 250, "swing" ); 232 if ( $(this).siblings(".fas").hasClass("fa-minus") ) { 233 $(this).siblings(".fas").removeClass("fa-minus").addClass("fa-plus"); 234 }else if ( $(this).siblings(".fas").hasClass("fa-plus") ) { 235 $(this).siblings(".fas").removeClass("fa-plus").addClass("fa-minus"); 236 } 237 }); 238 239 plusListeners = true; 240 } 241 242 }else{ 243 $('#primary-menu > li').has('.sub-menu').children('span').hide(); 244 $('#primary-menu li.topic').has('.sub-menu').children('span').hide(); 245 } 246 247}); 248 249function EscBind(onoff, element){ 250 if(onoff == "on"){ 251 $(element).keydown(function(keyPressed) { 252 if (keyPressed.keyCode == 27) { 253 $('.site-header').removeClass('search-header'); 254 } 255 }); 256 }else if(onoff == "off"){ 257 $(element).off('keydown'); 258 } 259} 260 261$('.search-secondary').click(function(){ 262 if($(this).hasClass('search-header')){ 263 EscBind('off', $('.site-header')); 264 }else{ 265 EscBind('on', $('.site-header')); 266 } 267 $('.site-header').toggleClass('search-header'); 268}); 269 270$('#header-search #close-button').click(function(){ 271 EscBind('off', $('.site-header')); 272 $('.site-header').removeClass('search-header'); 273}); 274 275$('#hp-return').click(function(){ 276 var nav = $('#primary-hidden'); 277 if(nav.height() === 0){ 278 autoHeightAnimate(nav, 200); 279 $('.site-header').addClass('open', 200); 280 } else { 281 nav.stop().animate({ height: '0' }, 200); 282 $('.site-header').removeClass('open', 200); 283 } 284}); 285 286function autoHeightAnimate(element, time){ 287 var curHeight = element.height(), // Get Default Height 288 autoHeight = element.css('height', '60px').height(); // Get Auto Height 289 element.height(curHeight); // Reset to Default Height 290 element.stop().animate({ height: autoHeight }, time); // Animate to Auto Height 291} 292 293 294function isVisible($el) { 295 var winTop = $(window).scrollTop(); 296 var winBottom = winTop + $(window).height(); 297 var elTop = $el.offset().top; 298 var elBottom = elTop + $el.height(); 299 return ((elBottom<= winBottom) && (elTop >= winTop)); 300} 301
302function numCount(numb){ 303 304if(isVisible(numb) && $(numb).data('count') != 'yes') { 305 306 $(numb).data('count','yes'); 307 var number = numb.text(); 308 var numtest = (number - Math.floor(number)) !== 0; 309 310 if(numtest){ 311 numb.prop('Counter',0).animate({ 312 Counter: numb.text() 313 }, { 314 duration: 4000, 315 easing: 'swing', 316 step: function (now) { 317 numb.text(Math.round(now).toLocaleString('en-US')); 318 }, 319 complete : function(){ 320 numb.text(Math.round(numb.text()).toLocaleString('en-US')); 321 } 322 }); 323 }else{ 324 numb.prop('Counter',0).animate({ 325 Counter: numb.text() 326 }, { 327 duration: 4000, 328 easing: 'swing', 329 step: function (now) { 330 numb.text(Math.ceil(now).toLocaleString('en-US')); 331 } 332 }); 333 } 334} 335 336} 337 338$('.countit').each(function () { 339 numCount($(this)); 340}); 341 342$('.mail-secondary a, #newsletter-footer a, .newsletter-signup-body a, .newslettersignup').on('click', function() { 343 $.fancybox.open( $('#newsletter-signup'), { 344 }); 345}); 346 347$('#menu-item-15645' ).html( 348 '<div class="select"><select id="language-select"><option value="en">English</option><option value="vi">Tiếng Viá»t</option><option value="es">Español</option><option value="zh-CN">䏿</option><option value="hi">हिनà¥à¤¦à¥</option></select><div class="select-arrow"></div></div>' 349).promise().done(function(){ 350 $('#menu-item-15645 .select select' ).change( function(){ 351 var langSel = $(this).val(); 352 var pathName = window.location.pathname; 353 console.log(pathName); 354 window.location.href = "https://destinationhomesv-org.translate.goog"+pathName+"?_x_tr_sl=en&_x_tr_tl="+langSel; 355 }); 356}); 357 358function googleTranslateElementInit() { 359 new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.FloatPosition.TOP_LEFT}, 'google_translate_element'); 360 } 361 362$('#tree-housing-but, #tree-housing-but2').on('click', function() { 363 $.fancybox.open( $('#tree-housing'), { 364 }); 365}); 366 367$('#tree-temp-but, #tree-temp-but2').on('click', function() { 368 $.fancybox.open( $('#tree-temp'), { 369 }); 370}); 371 372$('#tree-prev-but, #tree-prev-but2').on('click', function() { 373 $.fancybox.open( $('#tree-prev'), { 374 }); 375}); 376 377$('.wp-block-image.plan-progress').click(function(){ 378 $(this).next().find('a').trigger('click'); 379}); 380 381$('#help-close').click(function(){ 382 383 var parent = $('#need-help'); 384 var max = $('#max-help'); 385 var min = $('#min-help'); 386 387 /*max.slideUp("fast"); 388 min.slideDown("slow");*/ 389 390 parent.removeClass("open"); 391 parent.addClass("closed"); 392 setCookie("getHelp", "minHelp" , 30); 393 394}); 395 396$('#help-open, #min-help').click(function(){ 397 398 var parent = $('#need-help'); 399 var max = $('#max-help'); 400 var min = $('#min-help'); 401 402 /*max.slideDown();
403 min.slideUp();*/ 404 405 parent.addClass("open"); 406 parent.removeClass("closed"); 407 setCookie("getHelp", "maxHelp" , 30); 408 409}); 410 411/*OWL START*/ 412$(".image-owl-carousel").owlCarousel({ 413 loop:true, 414 nav:true, 415 items:1 416}); 417/*$(".video-owl-carousel").owlCarousel({ 418 loop:true, 419 nav:true, 420 items:1, 421 dots:false, 422 videoHeight:475, 423 videoWidth:800 424});*/ 425 426// Global variables 427let players = {}; 428let isAPIReady = false; 429let carouselInitialized = false; 430let detectionAttempts = 0; 431 432// Debug logging function 433function debugLog(message) { 434 console.log(message); 435 const debugEl = document.getElementById('debugInfo'); 436 if (debugEl) { 437 debugEl.innerHTML = `[${new Date().toLocaleTimeString()}] ${message}`; 438 } 439} 440 441// This function MUST be in global scope for YouTube API 442window.onYouTubeIframeAPIReady = function() { 443 debugLog('â YouTube API Ready!'); 444 isAPIReady = true; 445 446 // Initial detection 447 autoDetectAndInitializePlayers(); 448 449 // Initialize carousel if not already done 450 if (!carouselInitialized) { 451 initializeCarousel(); 452 } 453}; 454 455// Auto-detect YouTube videos in the carousel 456function autoDetectYouTubeVideos() { 457 const detectedVideos = []; 458 detectionAttempts++; 459 debugLog(`ð Detection attempt #${detectionAttempts}`); 460 461 // Primary Method: Find existing YouTube iframes (Method 1) 462 $('.owl-carousel iframe[src*="youtube.com"], .owl-carousel iframe[src*="youtu.be"]').each(function() { 463 const element = $(this); 464 const src = element.attr('src'); 465 let playerId = element.attr('id'); 466 467 // Generate ID if not present 468 if (!playerId) { 469 playerId = 'iframe-player-' + Math.random().toString(36).substr(2, 9); 470 element.attr('id', playerId); 471 } 472 473 // Skip if already processed 474 if (players[playerId]) { 475 return; 476 } 477 478 // Extract video ID from URL 479 let videoId = null; 480 const embedMatch = src.match(/\/embed\/([^?&]+)/); 481 const watchMatch = src.match(/[?&]v=([^&]+)/); 482 483 if (embedMatch) { 484 videoId = embedMatch[1]; 485 } else if (watchMatch) { 486 videoId = watchMatch[1]; 487 } 488 489 if (videoId) { 490 detectedVideos.push({ 491 id: playerId, 492 videoId: videoId, 493 type: 'direct-iframe', 494 element: this 495 }); 496 } 497 }); 498 499 debugLog(`ð¹ Found ${detectedVideos.length} new iframe video(s)`); 500 return detectedVideos; 501} 502 503function autoDetectAndInitializePlayers() { 504 if (!isAPIReady) { 505 debugLog('â³ API not ready yet, skipping detection'); 506 return; 507 } 508 509 const detectedVideos = autoDetectYouTubeVideos(); 510 511 if (detectedVideos.length === 0) { 512 debugLog('â¹ï¸ No new videos to initialize'); 513 return; 514 } 515 516 // Initialize players for detected videos 517 detectedVideos.forEach(function(video) { 518 debugLog(`ð¬ Initializing: ${video.id} (${video.type})`); 519 520 try { 521 // For direct iframes, replace them with divs for YouTube API control 522 if (video.type === 'direct-iframe') { 523 const $iframe = $(video.element); 524 const $newDiv = $('<div></div>').attr('id', video.id); 525 $iframe.replaceWith($newDiv); 526 } 527 528 players[video.id] = new YT.Player(video.id, { 529 height: '100%', 530 width: '100%', 531 videoId: video.videoId, 532 playerVars: { 533 'autoplay': 0, 534 'controls': 1, 535 'rel': 0, 536 'showinfo': 0, 537 'modestbranding': 1, 538 'enablejsapi': 1 539 }, 540 events: { 541 'onReady': function(event) { 542 debugLog(`â Player ready: ${video.id}`); 543 }, 544 'onError': function(event) { 545 debugLog(`â Player error: ${video.id} - ${event.data}`); 546 } 547 } 548 }); 549 } catch (e) { 550 debugLog(`â Error initializing ${video.id}: ${e.message}`); 551 } 552 }); 553 554 debugLog(`ð Total players: ${Object.keys(players).length}`); 555} 556 557function pauseAllVideos() { 558 const playerCount = Object.keys(players).length; 559 if (playerCount === 0) { 560 debugLog('â¸ï¸ No players to pause'); 561 // Try to detect videos on-demand 562 autoDetectAndInitializePlayers(); 563 return; 564 } 565 566 debugLog(`â¸ï¸ Pausing ${playerCount} video(s)`); 567 568 if (!isAPIReady) { 569 debugLog('â ï¸ API not ready, using postMessage fallback'); 570 pauseVideosWithPostMessage(); 571 return; 572 } 573 574 Object.keys(players).forEach(function(playerId) { 575 try { 576 if (players[playerId] && players[playerId].pauseVideo) { 577 players[playerId].pauseVideo(); 578 } 579 } catch (e) { 580 debugLog(`â Error pausing ${playerId}: ${e.message}`); 581 } 582 }); 583 584 // Also use postMessage as backup 585 pauseVideosWithPostMessage(); 586} 587 588function pauseVideosWithPostMessage() {
589 let iframeCount = 0; 590 $('.owl-carousel iframe[src*="youtube.com"], .owl-carousel iframe[src*="youtu.be"]').each(function() { 591 try { 592 this.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}', '*'); 593 iframeCount++; 594 } catch(e) { 595 // Silent fail for postMessage 596 } 597 }); 598 599 if (iframeCount > 0) { 600 debugLog(`ð¤ Sent pause messages to ${iframeCount} iframe(s)`); 601 } 602} 603 604function initializeCarousel() { 605 if (carouselInitialized) { 606 debugLog('â ï¸ Carousel already initialized'); 607 return; 608 } 609 610 debugLog('ð Initializing carousel...'); 611 carouselInitialized = true; 612 613 $('.owl-carousel').owlCarousel({ 614 items: 1, 615 loop: true, 616 margin: 10, 617 nav: true, 618 dots: false, 619 autoplay: false, 620 smartSpeed: 300, 621 // Disable Owl Carousel's video functionality 622 video: false, 623 videoHeight: false, 624 videoWidth: false 625 }); 626 627 // Event handlers for carousel 628 $('.owl-carousel').on('translate.owl.carousel', function(event) { 629 debugLog('ð Carousel changing - pausing videos'); 630 pauseAllVideos(); 631 }); 632 633 $('.owl-carousel').on('translated.owl.carousel', function(event) { 634 // After transition is complete, try to detect videos again 635 setTimeout(function() { 636 autoDetectAndInitializePlayers(); 637 }, 100); 638 }); 639 640 // Also pause on drag start 641 $('.owl-carousel').on('drag.owl.carousel', function(event) { 642 pauseAllVideos(); 643 }); 644} 645 646// Load YouTube API 647function loadYouTubeAPI() { 648 if (window.YT && window.YT.Player) { 649 debugLog('ð YouTube API already loaded'); 650 window.onYouTubeIframeAPIReady(); 651 return; 652 } 653 654 debugLog('ð¥ Loading YouTube API...'); 655 const tag = document.createElement('script'); 656 tag.src = 'https://www.youtube.com/iframe_api'; 657 tag.onerror = function() { 658 debugLog('â Failed to load YouTube API - using fallback only'); 659 if (!carouselInitialized) { 660 initializeCarousel(); 661 } 662 }; 663 664 const firstScriptTag = document.getElementsByTagName('script')[0]; 665 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 666} 667 668// Public function to refresh video detection 669window.refreshVideoDetection = function() { 670 debugLog('ð Manual refresh requested'); 671 autoDetectAndInitializePlayers(); 672}; 673 674// Initialize everything when DOM is ready 675$(document).ready(function() { 676 debugLog('ð DOM Ready - Starting initialization'); 677 678 // Initialize carousel first 679 setTimeout(function() { 680 initializeCarousel(); 681 loadYouTubeAPI(); 682 }, 100); 683 684 // Try to detect videos immediately and periodically 685 let attempts = 0; 686 const detectionInterval = setInterval(function() { 687 attempts++; 688 if (attempts > 5 || Object.keys(players).length > 0) { 689 clearInterval(detectionInterval); 690 return; 691 } 692 693 if (isAPIReady) { 694 autoDetectAndInitializePlayers(); 695 } 696 }, 1000); 697}); 698/*OWL END*/ 699 700 701 702})( jQuery ); 703 704 705 706function setCookie(cname, cvalue, exdays) { 707 const d = new Date(); 708 d.setTime(d.getTime() + (exdays*24*60*60*1000)); 709 let expires = "expires="+ d.toUTCString(); 710 document.cookie = cname + "=" + cvalue + ";" + expires + "; path=/"; 711} 712 713function getCookie(cName) { 714 const name = cName + "="; 715 const cDecoded = decodeURIComponent(document.cookie); //to be careful 716 const cArr = cDecoded .split('; '); 717 let res; 718 cArr.forEach(val => { 719 if (val.indexOf(name) === 0) res = val.substring(name.length); 720 }) 721 return res; 722 } 723 724function checkCookie() { 725 // Get cookie using our custom function 726 var getHelp = getCookie("getHelp"); 727 728 729 if(getHelp != null) { 730 if(getHelp == "minHelp"){ 731 732 var element = document.getElementById("need-help"); 733 /*element.classList.add("closed"); 734 element.classList.remove("open");*/ 735 element.classList.add("show"); 736 737 }else{ 738 739 var element = document.getElementById("need-help"); 740 element.classList.add("open"); 741 element.classList.remove("closed"); 742 element.classList.add("show"); 743 } 744 } 745 } 746window.onload = checkCookie; 747/*function googleTranslateElementInit() { 748 new google.translate.TranslateElement({pageLanguage: 'en', includedLanguages: 'es,vi,zh-CN,hi'}, 'menu-item-15645'); 749}*/ 750
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.