- 兼容typecho 1.3.0版本
    - 修复pjax黑暗模式下闪烁问题
    - 修复说说页面的pjax加载问题
    - 修复上一篇与下一篇文章的链接
    - 增加归属地显示设置
    - 增加系统显示设置
    - 增加浏览器信息显示设置
    - 修复pjax模式下的404跳转
This commit is contained in:
浪子
2025-07-05 12:09:23 +08:00
parent 28a72cb279
commit c7efd5abd6
13 changed files with 240 additions and 308 deletions
+24 -5
View File
@@ -18,23 +18,42 @@
document.addEventListener('DOMContentLoaded', function() {
var countdown = 5; // 设置倒计时时间(秒)
var countdownElement = document.getElementById('time-count-down');
// 检查是否在 PJAX 环境中
var isPjax = typeof window.Pjax !== 'undefined' ||
(typeof jQuery !== 'undefined' && jQuery.pjax);
// 更新倒计时显示
function updateCountdown() {
countdownElement.textContent = countdown;
countdown--;
countdown--;
if (countdown < 0) {
// 倒计时结束,跳转到首页
window.location.href = "<?php $this->options->siteUrl(); ?>";
var homeUrl = "<?php $this->options->siteUrl(); ?>";
if (isPjax) {
// 使用 PJAX 方式跳转
if (typeof window.Pjax !== 'undefined') {
// 使用原生 PJAX
var pjax = new Pjax();
pjax.loadUrl(homeUrl);
} else if (typeof jQuery !== 'undefined' && jQuery.pjax) {
// 使用 jQuery PJAX
$.pjax({url: homeUrl, container: '[data-pjax-container]'});
}
} else {
// 普通跳转
window.location.href = homeUrl;
}
} else {
// 继续倒计时
setTimeout(updateCountdown, 1000);
}
}
// 开始倒计时
updateCountdown();
// 如果是 PJAX 加载,需要手动执行一些初始化
if (isPjax && typeof window.puockInit !== 'undefined') {
window.puockInit();
}
});
</script>
<?php $this->need('footer.php'); ?>