Hỏi đáp với chúng tôi

Chào mừng các bạn đã tới với Bộ Ngoại Giao !

Những câu hỏi thường gặp
  • Bạn muốn biết gì về Bộ Ngoại Giao ?
Thứ Tư, ngày 26 tháng 3 năm 2025
299.6k
'); printDoc.write(''); printDoc.write(''); printDoc.write(''); printDoc.write(''); printDoc.close(); // Thêm handler onload để đảm bảo hình ảnh được tải trước khi in printFrame.onload = function() { setTimeout(function() { printFrame.contentWindow.focus(); printFrame.contentWindow.print(); setTimeout(function() { document.body.removeChild(printFrame); }, 1000); }, 1000); }; } var commentIcon = document.getElementById("commentIcon"); var commentBoxRead = document.getElementById('commentBox'); if(commentIcon && commentBoxRead){ commentIcon.addEventListener('click',function(){ commentBoxRead.scrollIntoView({behavior: 'smooth'}); }) } var audio; var index = 0; var isPlaying = false; var audioQueue = []; function readArticle() { if (isPlaying) { stopAudio(); } else { var url = "https://texttospeech.responsivevoice.org/v1/text:synthesize?lang=vi&engine=g3&name=&pitch=0.5&rate=0.5&volume=1&key=HnIuW5da&gender=male&text="; var title = $("#content-post .title").text(); var summary = $("#content-post .article-summary").text(); var content = $("#content-post .article-content").text(); var txt = title + "." + summary + "." + content; var s = txt.replace(' ', ' ').replace(';', '.').replace(',', '.').split('.'); audioQueue = []; for (var i = 0; i < s.length; i++) { if (s[i].trim().length > 1) { audioQueue.push(url + encodeURIComponent(s[i].trim())); } } audio = new Audio(audioQueue[index]); audio.preload = 'auto'; audio.play(); isPlaying = true; audio.onended = function () { index++; if (index < audioQueue.length) { audio.src = audioQueue[index]; audio.load(); audio.play(); } else { stopAudio(); } }; } } function stopAudio() { if (audio) { audio.pause(); audio.removeAttribute("src"); audio.load(); audio = null; } isPlaying = false; index = 0; audioQueue = []; } // Dừng audio khi chuyển trang (reload hoặc chuyển sang trang khác) window.addEventListener("beforeunload", function () { stopAudio(); }); // Nếu bạn đang dùng AJAX để load nội dung mới, gọi stopAudio() trước khi chuyển $(".nav-link").on("click", function () { stopAudio(); // Tiếp tục chuyển trang (hoặc load nội dung mới) });