1(function ($) { 2 'use strict'; 3 jQuery( document ).ready(function() { 4 var screen = jQuery(window).width(); 5 if ($("#home__hdkd").length && screen > 700 ) { 6 highlightCenter(); 7 $(window).on("scroll resize", highlightCenter); 8 } 9 10 function highlightCenter() { 11 var winTop = $(window).scrollTop(); 12 var winHeight = $(window).height(); 13 var winCenter = winTop + winHeight / 2; 14 15 var closestEl = null; 16 var closestDist = Infinity; 17 18 $(".business__item").each(function () { 19 var $el = $(this); 20 var elTop = $el.offset().top; 21 var elCenter = elTop + $el.outerHeight() / 2; 22 23 var dist = Math.abs(elCenter - winCenter); 24 if (dist < closestDist) { 25 closestDist = dist; 26 closestEl = $el; 27 } 28 }); 29 30 $(".business__item").removeClass("active"); 31 if (closestEl) { 32 closestEl.addClass("active"); 33 } 34 } 35 36 if ( screen <= 500 ) { 37 $('.cts-hm-tab .elementor-tabs-wrapper').slick({ 38 slidesToShow: 2, 39 arrows: false, 40 infinite: true, 41 centerMode: false, 42 autoplay: false, 43 autoplaySpeed: 2000, 44 variableWidth: true 45 }); 46 } else if( screen <= 780 ){ 47 $('.cts-hm-tab .elementor-tabs-wrapper').slick({ 48 slidesToShow: 3, 49 arrows: false, 50 infinite: true, 51 centerMode: false, 52 autoplay: false, 53 autoplaySpeed: 2000, 54 variableWidth: true 55 }); 56 57 } 58 59 // Slider post 60 if ( screen <= 550 ) { 61 $('.cts-sld-blog .ae-post-list-wrapper').slick({ 62 slidesToShow: 3, 63 arrows: false, 64 infinite: true, 65 centerMode: false, 66 autoplay: false, 67 autoplaySpeed: 2000, 68 variableWidth: true 69 }); 70 } else if( screen <= 780 ){ 71 $('.cts-sld-blog .ae-post-list-wrapper').slick({ 72 slidesToShow: 3, 73 arrows: false, 74 infinite: true, 75 centerMode: false, 76 autoplay: false, 77 autoplaySpeed: 2000, 78 variableWidth: true 79 }); 80 81 } 82 if ( screen <= 550 ) { 83 $('.cooperate-col > .e-con-inner').slick({ 84 slidesToShow: 3, 85 arrows: false, 86 infinite: true, 87 centerMode: false, 88 autoplay: false, 89 autoplaySpeed: 2000, 90 variableWidth: true 91 }); 92 } else if( screen <= 780 ){ 93 $('.cooperate-col > .e-con-inner').slick({ 94 slidesToShow: 3, 95 arrows: false, 96 infinite: true, 97 centerMode: false, 98 autoplay: false, 99 autoplaySpeed: 2000, 100 variableWidth: true 101 }); 102 103 } 104 105 // Slider Äá»i tác toà n cầu 106 if ( screen <= 550 ) { 107 $('.cts-sld-dttc .elementor-widget-image-gallery .gallery').slick({ 108 slidesToShow: 6, 109 arrows: false, 110 infinite: true, 111 centerMode: false, 112 autoplay: true, 113 autoplaySpeed: 2000, 114 // variableWidth: true 115 }); 116 } else if( screen <= 780 ){ 117 $('.cts-sld-dttc .elementor-widget-image-gallery .gallery').slick({ 118 slidesToShow: 10, 119 arrows: false, 120 infinite: true, 121 centerMode: true, 122 autoplay: false, 123 autoplaySpeed: 2000, 124 // variableWidth: true 125 }); 126 } else if( screen <= 1920 ){ 127 $('.cts-sld-dttc .elementor-widget-image-gallery .gallery').slick({ 128 slidesToShow: 10, 129 arrows: false, 130 infinite: true, 131 centerMode: true, 132 autoplay: false, 133 autoplaySpeed: 2000, 134 // variableWidth: true 135 }); 136 137 } 138 139 140 $('.cts-sld-tab .elementor-tabs .elementor-tabs-wrapper').slick({ 141 slidesToShow: 3, 142 slidesToScroll: 1, 143 autoplay: false, 144 autoplaySpeed: 2000, 145 loop: true, 146 centerMode: true, 147 }); 148 149 150 // // js cho phần MAP 151 // const groups = document.querySelectorAll('svg g'); 152 // const dots = document.querySelectorAll('.dot'); 153 // const popups = document.querySelectorAll('.popup'); 154 155 // function setActiveArea(index) { 156 // // Bá» active á» tất cả group 157 // groups.forEach(g => g.classList.remove('active-area')); 158 159 // // Thêm active cho group ÄÆ°á»£c chá»n 160 // const activeGroup = document.querySelector(`.group-${index}`); 161 // if (activeGroup) { 162 // activeGroup.classList.add('active-area'); 163 // // ÄÆ°a group ÄÆ°á»£c chá»n lên trên cùng 164 // activeGroup.parentNode.appendChild(activeGroup); 165 // } 166 167 // // Ẩn tất cả popup 168 // popups.forEach(p => p.classList.remove('active')); 169 // // Hiá»n popup tương ứng 170 // const popup = document.getElementById(`popup-${index}`); 171 // if (popup) popup.classList.add('active'); 172 // } 173 174 // // Click và o vùng map 175 // groups.forEach((g, i) => { 176 // g.addEventListener('mouseenter', () => setActiveArea(i + 1)); 177 // // g.addEventListener('click', () => setActiveArea(i + 1)); 178 // }); 179 180 // // Click và o dot
181 // dots.forEach(dot => { 182 // dot.addEventListener('click', () => { 183 // const groupNum = dot.getAttribute('data-group'); 184 // setActiveArea(groupNum); 185 // }); 186 187 // }); 188 189 190 // js cho phần MAP 191 const groups = document.querySelectorAll('svg g'); 192 const dots = document.querySelectorAll('.dot'); 193 const popups = document.querySelectorAll('.popup'); 194 195 function setActiveArea(index) { 196 // Bá» active á» tất cả group 197 groups.forEach(g => g.classList.remove('active-area')); 198 199 // Thêm active cho group ÄÆ°á»£c chá»n 200 const activeGroup = document.querySelector(`.group-${index}`); 201 if (activeGroup) { 202 activeGroup.classList.add('active-area'); 203 // ÄÆ°a group ÄÆ°á»£c chá»n lên trên cùng 204 activeGroup.parentNode.appendChild(activeGroup); 205 } 206 207 // Ẩn tất cả popup 208 popups.forEach(p => p.classList.remove('active')); 209 210 // Hiá»n popup tương ứng 211 const popup = document.getElementById(`popup-${index}`); 212 if (popup) popup.classList.add('active'); 213 } 214 215 // Hover và o từng group 216 groups.forEach((g) => { 217 g.addEventListener('mouseenter', () => { 218 // lấy sá» trong class "group-x" 219 const match = [...g.classList].find(c => c.startsWith('group-')); 220 if (match) { 221 const groupNum = match.split('-')[1]; // lấy sá» sau "group-"
222 setActiveArea(groupNum); 223 } 224 }); 225 }); 226 227 // Click và o dot 228 dots.forEach(dot => { 229 dot.addEventListener('click', () => { 230 const groupNum = dot.getAttribute('data-group'); 231 setActiveArea(groupNum); 232 }); 233 }); 234 235//css animation tab 236 jQuery(document).ready(function($) { 237 $('.elementor-tab-title').on('click', function() { 238 var tabId = $(this).data('tab'); 239 var $content = $('.elementor-tab-content[data-tab="' + tabId + '"]'); 240 241 // Reset animation 242 $content.removeClass('animate'); 243 void $content[0].offsetWidth; // trick force reflow 244 $content.addClass('animate'); 245 }); 246 }); 247 248// bá» lá»c 249 document.addEventListener("DOMContentLoaded", function() { 250 const select = document.getElementById("blogSort"); 251 select.addEventListener("change", function() { 252 const value = this.value; 253 let url = new URL(window.location.href); 254 url.searchParams.set("sort", value); 255 window.location.href = url.toString(); 256 }); 257 }); 258 259jQuery(window).on('elementor/frontend/init', function() { 260 261 // Khi animation cá»§a tab kết thúc 262 jQuery(document).on('animationend', '.elementor-tab-content.animate', function() { 263 const $tabContent = jQuery(this); 264 const $swipers = $tabContent.find('.swiper'); 265 266 if ($swipers.length) { 267 $swipers.each(function() { 268 const swiperInstance = this.swiper; 269 if (swiperInstance) { 270 swiperInstance.update(); // cáºp nháºt vá» trà và kÃch thưá»c 271 swiperInstance.autoplay?.start(); // khá»i Äá»ng autoplay (nếu có) 272 } 273 }); 274 } 275 }); 276 277 // Cho trưá»ng hợp tab Äầu tiên hiá»n thá» sẵn 278 setTimeout(() => { 279 jQuery('.swiper').each(function() { 280 const swiperInstance = this.swiper; 281 if (swiperInstance) { 282 swiperInstance.update(); 283 swiperInstance.autoplay?.start(); 284 } 285 }); 286 }, 1000); 287}); 288 289 290 291 292 293 294 295 }); 296})(jQuery); 297 298 299// js tắt báºt video 300document.addEventListener('DOMContentLoaded', function() { 301 const popup = document.getElementById('video-popup'); 302 const frame = popup.querySelector('.video-frame'); 303 const closeBtn = popup.querySelector('.video-popup-close'); 304 305 document.querySelectorAll('.video-item').forEach(item => { 306 item.addEventListener('click', () => { 307 const videoURL = item.getAttribute('data-video'); 308 if (!videoURL) return; 309 310 // Nháºn dạng YouTube/Vimeo 311 let embedURL = ''; 312 if (videoURL.includes('youtube.com') || videoURL.includes('youtu.be')) { 313 const id = videoURL.split('v=')[1] || videoURL.split('/').pop(); 314 embedURL = `https://www.youtube.com/embed/${id}?autoplay=1`; 315 } else if (videoURL.includes('vimeo.com')) { 316 const id = videoURL.split('/').pop(); 317 embedURL = `https://player.vimeo.com/video/${id}?autoplay=1`; 318 } else { 319 embedURL = videoURL; // mp4 link 320 } 321 322 frame.innerHTML = `<iframe src="${embedURL}" allow="autoplay; fullscreen" allowfullscreen></iframe>`; 323 popup.classList.add('active'); 324 }); 325 }); 326 327 closeBtn.addEventListener('click', () => { 328 popup.classList.remove('active'); 329 frame.innerHTML = ''; 330 }); 331 332 popup.addEventListener('click', e => { 333 if (e.target === popup) { 334 popup.classList.remove('active'); 335 frame.innerHTML = ''; 336 } 337 }); 338}); 339 340 341// document.addEventListener("DOMContentLoaded", function () { 342// function initMarquee(innerClass, wrapperClass, direction = "right", speed = 1) { 343// const container = document.querySelector(innerClass); 344// if (!container) return; 345 346// const clones = container.cloneNode(true); 347// container.appendChild(clones); 348 349// let scrollAmount = 0; 350// let isPaused = false; 351 352// function marqueeScroll() { 353// if (!isPaused) { 354// // nếu direction = "right" thì trừ, nếu "left" thì cá»ng 355// scrollAmount += direction === "left" ? 1 : -1; 356// container.style.transform = `translateX(${scrollAmount}px)`; 357 358// // reset vòng lặp 359// if (Math.abs(scrollAmount) >= container.scrollWidth / 2) { 360// scrollAmount = 0; 361// } 362// } 363// requestAnimationFrame(marqueeScroll); 364// } 365// marqueeScroll(); 366 367// const wrapper = document.querySelector(wrapperClass); 368// if (wrapper) { 369// wrapper.addEventListener("mouseenter", () => (isPaused = true)); 370// wrapper.addEventListener("mouseleave", () => (isPaused = false)); 371// } 372// } 373 374// // Gá»i cho nhiá»u gallery khác nhau 375// initMarquee(".marquee-inner1", ".marquee-wrapper1", "left", 1); 376// initMarquee(".marquee-inner2", ".marquee-wrapper2", "right", 1); 377// initMarquee(".marquee-inner3", ".marquee-wrapper3", "left", 2); 378// initMarquee(".marquee-inner4", ".marquee-wrapper4", "right", 1); 379// }); 380 381// marquee-wrapper3 382document.addEventListener("DOMContentLoaded", function () { 383 const container = document.querySelector(".marquee-inner3"); 384 const wrapper = document.querySelector(".marquee-wrapper3"); 385 if (!container || !wrapper) return; 386 387 const direction = "left"; // hưá»ng chạy 388 const speed = 0.5; // tá»c Äá» 389 390 const contentWidth = container.scrollWidth; 391 container.innerHTML += container.innerHTML; // clone ná»i dung 392 393 let scrollAmount = 0; 394 let isPaused = false; 395 396 function marqueeScroll() { 397 if (!isPaused) { 398 scrollAmount += direction === "left" ? -speed : speed; 399 400 if (direction === "left" && Math.abs(scrollAmount) >= contentWidth) { 401 scrollAmount = 0; 402 } else if (direction === "right" && scrollAmount >= contentWidth) { 403 scrollAmount = 0; 404 } 405 406 container.style.transform = `translateX(${scrollAmount}px)`; 407 } 408 requestAnimationFrame(marqueeScroll); 409 } 410 411 marqueeScroll(); 412 413 wrapper.addEventListener("mouseenter", () => (isPaused = true)); 414 wrapper.addEventListener("mouseleave", () => (isPaused = false)); 415}); 416 417// marquee-wrapper4 418document.addEventListener("DOMContentLoaded", function () { 419 const container = document.querySelector(".marquee-inner4"); 420 const wrapper = document.querySelector(".marquee-wrapper4"); 421 if (!container || !wrapper) return; 422 423 // Äảm bảo layout cÆ¡ bản 424 wrapper.style.overflow = "hidden"; 425 container.style.display = "flex"; 426 container.style.flexWrap = "nowrap"; 427 container.style.willChange = "transform";
428 Array.from(container.children).forEach(el => el.style.flex = "0 0 auto"); 429 430 // chá» tất cả ảnh load (tránh Äo sai kÃch thưá»c) 431 const imgs = container.querySelectorAll("img"); 432 const waitImgs = Array.from(imgs).map(img => { 433 if (img.complete) return Promise.resolve(); 434 return new Promise(res => { img.addEventListener("load", res); img.addEventListener("error", res); }); 435 }); 436 437 Promise.all(waitImgs).then(() => { 438 // Äo chiá»u rá»ng ban Äầu (chưa clone) 439 const originalWidth = container.scrollWidth; 440 441 // clone các node (preserve structure) â tạo tá»ng rá»ng = 2 * originalWidth 442 const children = Array.from(container.children); 443 children.forEach(c => container.appendChild(c.cloneNode(true))); 444 445 // cấu hình váºn hà nh 446 const direction = "right"; // chạy từ trái -> phải 447 const pxPerSecond = 30; // tá»c Äá» (pixel / giây) â chá»nh nếu muá»n nhanh/cháºm 448 let offset = (direction === "left") ? 0 : -originalWidth; 449 let isPaused = false; 450 let last = performance.now(); 451 452 function step(now) { 453 const dt = (now - last) / 1000; 454 last = now; 455 if (!isPaused) { 456 offset += (direction === "left" ? -1 : 1) * pxPerSecond * dt; 457 458 // reset hợp là Äá» seamless 459 if (direction === "left" && Math.abs(offset) >= originalWidth) { 460 offset = 0; 461 } else if (direction === "right" && offset >= 0) { 462 offset = -originalWidth; 463 } 464 465 container.style.transform = `translate3d(${offset}px, 0, 0)`; 466 } 467 requestAnimationFrame(step); 468 } 469 requestAnimationFrame(step); 470 471 // pause on hover 472 wrapper.addEventListener("mouseenter", () => isPaused = true); 473 wrapper.addEventListener("mouseleave", () => isPaused = false); 474 475 // responsive: khi resize, rebuild phần Äã clone Äá» tránh nhân Äôi nhiá»u lần 476 let resizeTimer = null; 477 window.addEventListener("resize", () => { 478 clearTimeout(resizeTimer); 479 resizeTimer = setTimeout(() => { 480 // xoá phần clone (giữ ná»a Äầu) rá»i clone lại 481 const all = Array.from(container.children); 482 const half = Math.floor(all.length / 2); 483 for (let i = all.length - 1; i >= half; i--) container.removeChild(all[i]); 484 485 // Äo lại và clone lại 486 const newOriginal = container.scrollWidth; 487 const toClone = Array.from(container.children); 488 toClone.forEach(child => container.appendChild(child.cloneNode(true))); 489 // Äặt lại offset cho hưá»ng right 490 offset = (direction === "left") ? 0 : -newOriginal; 491 }, 120); 492 }, { passive: true }); 493 }); 494}); 495 496document.addEventListener('change', function(e) { 497 const select = e.target.closest('.sort-select'); 498 if (!select) return; 499 const val = select.value; 500 const url = new URL(window.location.href); 501 url.searchParams.set('sort', val); 502 window.location.href = url.toString(); 503}); 504 505 506// js select 507document.addEventListener("DOMContentLoaded", function() { 508 const select = document.getElementById("blogSortSelect"); 509 const postsContainer = document.getElementById("blog-posts"); 510 511 function loadPosts(sort) { 512 const formData = new FormData(); 513 formData.append('action', 'filter_blog_posts'); 514 formData.append('sort', sort); 515 516 fetch('<?php echo admin_url("admin-ajax.php"); ?>', { 517 method: 'POST', 518 body: formData 519 }) 520 .then(res => res.text()) 521 .then(html => { 522 postsContainer.innerHTML = html; 523 }); 524 } 525 526 loadPosts('latest'); // tải mặc Äá»nh 527 528 select.addEventListener('change', (e) => { 529 loadPosts(e.target.value); 530 }); 531}); 532 533// Chuyá»n tab chạy slider luôn 534jQuery(window).on('elementor/frontend/init', function() { 535 536 // Khi ngưá»i dùng chuyá»n tab trong Elementor Tabs 537 jQuery(window).on('elementor/tab_switched', function(event, tabTitle, tabContent) { 538 539 // Tìm tất cả slider Swiper bên trong tab vừa má» 540 const $swipers = jQuery(tabContent).find('.swiper'); 541 542 if ($swipers.length) { 543 $swipers.each(function() { 544 const swiperInstance = this.swiper; 545 if (swiperInstance) {
546 swiperInstance.update(); // Cáºp nháºt lại vá» trà & kÃch thưá»c 547 swiperInstance.autoplay?.start(); // KÃch hoạt autoplay nếu có 548 } 549 }); 550 } 551 }); 552 553 // Chạy update 1 lần sau khi trang load (cho tab Äầu tiên) 554 setTimeout(() => { 555 jQuery('.swiper').each(function() { 556 const swiperInstance = this.swiper; 557 if (swiperInstance) { 558 swiperInstance.update(); 559 swiperInstance.autoplay?.start(); 560 } 561 }); 562 }, 1000); 563}); 564
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.