✈ DU LỊCH

Bài nổi bật

Đang tải bài viết...

Hệ thống đang tải bài viết nổi bật.

Đọc Bài Viết →

Bài Viết mới nhất

/* ===================================================== ĐẬU KHÁM PHÁ - Travel PRO V1 ===================================================== */ /* ------------------------------- TÌM KIẾM -------------------------------- */ document.getElementById("searchBox").addEventListener("keyup",function(){ const keyword=this.value.toLowerCase(); const cards=document.querySelectorAll(".news-card"); cards.forEach(card=>{ const text=card.innerText.toLowerCase(); card.style.display=text.includes(keyword)?"":"none"; }); }); /* ------------------------------- HIỆU ỨNG XUẤT HIỆN -------------------------------- */ const observer=new IntersectionObserver((entries)=>{ entries.forEach(entry=>{ if(entry.isIntersecting){ entry.target.style.opacity=1; entry.target.style.transform="translateY(0px)"; } }); },{threshold:.15}); function activeAnimation(){ document.querySelectorAll(".news-card").forEach(card=>{ card.style.opacity=0; card.style.transform="translateY(30px)"; card.style.transition=".6s"; observer.observe(card); }); } /* ------------------------------- TỰ LẤY LABEL CỦA BÀI -------------------------------- */ function getCategory(post){ if(post.category){ return post.category[0].term; } return " Du Lịch"; } /* ------------------------------- THỜI GIAN ĐỌC -------------------------------- */ function readTime(text){ const words=text.split(" ").length; const minute=Math.max(1,Math.ceil(words/220)); return minute+" phút đọc"; } /* ------------------------------- CHỈNH renderGrid -------------------------------- */ const oldRenderGrid=renderGrid; renderGrid=function(posts){ let html=""; posts.forEach(post=>{ const title=post.title.$t; const summary=getSummary(post); const image=getImage(post); const link=getLink(post); const date=formatDate(post.published.$t); const category=getCategory(post); const time=readTime(summary); html+=`
${title}
${category}

${title}

🗓 ${date}    •    🕒 ${time}

${summary}

`; }); document.getElementById("newsGrid").innerHTML=html; activeAnimation(); } /* ------------------------------- HERO CLICK -------------------------------- */ document.getElementById("heroLink").target="_self"; /* ------------------------------- HERO SHADOW -------------------------------- */ window.addEventListener("scroll",()=>{ const hero=document.querySelector(".hero"); if(window.scrollY>20){ hero.style.transform="scale(.995)"; }else{ hero.style.transform="scale(1)"; } }); /* ------------------------------- NÚT LÊN ĐẦU TRANG -------------------------------- */ const topBtn=document.createElement("button"); topBtn.innerHTML="↑"; topBtn.id="topButton"; document.body.appendChild(topBtn); topBtn.style.cssText=` position:fixed; right:30px; bottom:30px; width:55px; height:55px; border:none; border-radius:50%; background:#0F4C81; color:white; font-size:22px; cursor:pointer; display:none; box-shadow:0 12px 25px rgba(0,0,0,.2); z-index:999; `; window.addEventListener("scroll",()=>{ topBtn.style.display= window.scrollY>500 ?"block" :"none"; }); topBtn.onclick=function(){ window.scrollTo({ top:0, behavior:"smooth" }); }; /* ------------------------------- THAY LOADING -------------------------------- */ window.onload=function(){ const loading=document.querySelector(".loading"); if(loading){ loading.remove(); } }; /* ------------------------------- FOOTER -------------------------------- */ const footer=document.createElement("div"); footer.style.marginTop="80px"; footer.style.textAlign="center"; footer.style.color="#888"; footer.style.fontSize="15px"; footer.innerHTML= "© Đậu Khám Phá Du Lịch"; document.querySelector(".news-container").appendChild(footer);
Đang tải dữ liệu...

Đăng nhận xét