Mới đây, Oppo đã chính thức công bố mẫu điện thoại Oppo A5 Vitality Edition tại Trung Quốc, một phiên bản được điều chỉnh và cải tiến hơn của dòng điện thoại A5 đã ra mắt trước đó. Với sự xuất hiện của phiên bản này, thị trường smartphone tầm trung hứa hẹn sẽ có thêm một lựa chọn chất lượng cho người tiêu dùng.
{
// Mobile Menu Logic
const mobileMenuButton = document.getElementById('mobile-menu-button');
const mobileMenu = document.getElementById('mobile-menu');
if(mobileMenuButton && mobileMenu) {
mobileMenuButton.addEventListener('click', () => {
mobileMenu.classList.toggle('hidden');
});
}
// Collapsible Description Logic (for Archive pages)
const toggleButton = document.querySelector('.collapsible-description-toggle');
if (toggleButton) {
const contentWrapper = toggleButton.closest('.collapsible-description-wrapper');
const content = contentWrapper.querySelector('.collapsible-description-content');
toggleButton.addEventListener('click', function () {
contentWrapper.classList.toggle('active');
if (content.style.maxHeight) {
content.style.maxHeight = null;
} else {
content.style.maxHeight = content.scrollHeight + "px";
}
});
}
// ========== Top Banner Ad Logic v2 ==========
const topBanner = document.getElementById('top-banner-ad');
const adIns = document.getElementById('top-banner-ad-ins');
const closeBannerBtn = document.getElementById('close-banner-btn');
if (topBanner && adIns && closeBannerBtn) {
const BANNER_CLOSED_KEY = 'bannerManuallyClosed';
const showBanner = () => {
if (sessionStorage.getItem(BANNER_CLOSED_KEY) !== 'true') {
topBanner.classList.add('banner-visible');
topBanner.classList.remove('banner-hidden');
}
};
const hideBanner = () => {
topBanner.classList.add('banner-hidden');
topBanner.classList.remove('banner-visible');
};
closeBannerBtn.addEventListener('click', () => {
hideBanner();
sessionStorage.setItem(BANNER_CLOSED_KEY, 'true');
});
const observer = new MutationObserver((mutationsList, observer) => {
for(const mutation of mutationsList) {
if (mutation.type === 'attributes' && mutation.attributeName === 'data-ad-status') {
if (adIns.getAttribute('data-ad-status') === 'filled') {
showBanner();
observer.disconnect();
}
}
}
});
observer.observe(adIns, { attributes: true });
window.addEventListener('scroll', function() {
if (topBanner.classList.contains('banner-visible') && sessionStorage.getItem(BANNER_CLOSED_KEY) !== 'true') {
let scrollTop = window.pageYOffset || document.documentElement.scrollTop;
if (scrollTop > 10) {
hideBanner();
} else {
showBanner();
}
}
}, { passive: true });
if (adIns.getAttribute('data-ad-status') === 'filled') {
showBanner();
observer.disconnect();
}
}
// ========== BẮT ĐẦU: TỰ ĐỘNG WRAP VIDEO YOUTUBE CHO RESPONSIVE ==========
const postContent = document.querySelector('.post-content-area');
if (postContent) {
// Tìm tất cả iframe của YouTube trong khu vực nội dung bài viết
const iframes = postContent.querySelectorAll('iframe[src*="youtube.com"], iframe[src*="googleusercontent.com/youtube"]');
iframes.forEach(iframe => {
// Chỉ xử lý những iframe chưa được wrap
if (!iframe.parentElement.classList.contains('tns-video-responsive-wrapper')) {
// Tạo một div mới để bao bọc
const wrapper = document.createElement('div');
wrapper.className = 'tns-video-responsive-wrapper';
// Chèn div wrapper vào trước iframe
iframe.parentNode.insertBefore(wrapper, iframe);
// Di chuyển iframe vào bên trong div wrapper
wrapper.appendChild(iframe);
}
});
}
// ========== KẾT THÚC: TỰ ĐỘNG WRAP VIDEO YOUTUBE ==========
// ========== BẮT ĐẦU: LOGIC BÀI VIẾT LIÊN QUAN VÔ TẬN (LOGIC MỚI) ==========
const infiniteContainer = document.getElementById('infinite-related-container');
if (infiniteContainer) {
const initialPostId = parseInt(infiniteContainer.dataset.originalPostId, 10);
let excludedPostIDs = [initialPostId];
const loadingIndicatorHTML = `
Đang tìm bài viết hay...