mirror of
https://github.com/jkjoy/Typecho-Theme-Puock.git
synced 2026-06-27 23:44:13 +00:00
Compare commits
14 Commits
58b2e80883
...
1.2.2
| Author | SHA1 | Date | |
|---|---|---|---|
| b416e58596 | |||
| 5d67235be0 | |||
| 134bb0d66c | |||
| 8afb1934dd | |||
| b73e465a79 | |||
| ae990a722b | |||
| 35806ea2fb | |||
| 3bb53afcea | |||
| 9f389fbb34 | |||
| 4c1c795dc2 | |||
| b3b1407647 | |||
| 6b9cc81754 | |||
| c313e29d99 | |||
| 33bc5d53f5 |
@@ -32,4 +32,37 @@
|
||||
- 增加系统显示设置
|
||||
- 增加浏览器信息显示设置
|
||||
- 修复pjax模式下的404跳转
|
||||
|
||||
|
||||
- 2025.07.07 表情短代码解析集成
|
||||
- 1.1.5
|
||||
|
||||
- 将表情短代码(如 :smile:)自动解析为图片表情,集成到主题评论内容输出中。
|
||||
|
||||
- 2025.07.08
|
||||
|
||||
- 1.1.6
|
||||
|
||||
- 修复头像区域背景的bug
|
||||
- 优化php8.3兼容性
|
||||
|
||||
- 1.1.8
|
||||
|
||||
- 优化github链接的正则表达式,只解析主仓库链接(如 https://github.com/用户名/仓库名),不再解析子路径(如 /tree/、/blob/ 等)为卡片。
|
||||
- 实现文章内容图片懒加载,自动将常见图片格式(jpg、jpeg、png、webp)的<img>标签替换为带懒加载属性的格式。
|
||||
- 修正getPostCover函数,确保只从原始内容中提取第一张真实图片地址,不受懒加载替换影响,避免首页首图变成load.svg。
|
||||
|
||||
- 新增支持[success]、[primary]、[danger]、[warning]、[info]、[dark]等alert类短代码,自动渲染为对应的Bootstrap风格提示框。
|
||||
- 新增支持[collapse title='xxx']内容[/collapse]折叠面板短代码,自动渲染为带唯一ID的Bootstrap折叠结构。
|
||||
- 新增支持[download file='xxx.zip' size='12MB']文件地址[/download]下载短代码,自动渲染为带文件名、大小、声明和下载地址的下载信息块。
|
||||
- 新增支持[reply]隐藏内容[/reply]回复可见短代码,未满足条件时前端显示提示,已评论且审核通过后显示隐藏内容。
|
||||
|
||||
- 1.2.0
|
||||
|
||||
- 新增支持首页登录
|
||||
|
||||
- 2025.08.02
|
||||
|
||||
- 1.2.2
|
||||
|
||||
- 增加侧边栏显示的全局开关
|
||||
- 修复代码块中的短代码解析问题
|
||||
+15
-5
@@ -3,10 +3,16 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit;
|
||||
$this->need('header.php');
|
||||
?>
|
||||
<div class="row row-cols-1">
|
||||
<?php if ($this->options->showsidebar): ?>
|
||||
<div class="col-lg-8 col-md-12 animated fadeInLeft ">
|
||||
<div class="animated fadeInLeft ">
|
||||
<?php else: ?>
|
||||
<div class="col-lg-12 col-md-12">
|
||||
<div class="row box-plr15">
|
||||
<?php endif; ?>
|
||||
<div> <!--文章列表-->
|
||||
<div id="posts">
|
||||
<?php if ($this->options->listmodel): ?>
|
||||
<div class=" mr-0 ml-0">
|
||||
<?php while ($this->next()): ?>
|
||||
<?php
|
||||
@@ -61,21 +67,25 @@ $coverImage = getPostCover($this->content, $this->cid);
|
||||
</article>
|
||||
<?php endwhile; ?>
|
||||
</div>
|
||||
<div class="mt20 p-flex-s-right" data-no-instant>
|
||||
<?php $this->pageNav('«', '»', 1, '...', array(
|
||||
<div class="mt20 p-flex-s-right" data-no-instant>
|
||||
<?php $this->pageNav('«', '»', 1, '...', array(
|
||||
'wrapTag' => 'ul',
|
||||
'wrapClass' => 'pagination comment-ajax-load',
|
||||
'itemTag' => 'li',
|
||||
'textTag' => 'span',
|
||||
'currentClass' => 'active',
|
||||
'currentClass' => 'cur',
|
||||
'prevClass' => 'prev',
|
||||
'nextClass' => 'next'
|
||||
)); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<?php $this->need('card.php'); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($this->options->showsidebar): ?>
|
||||
<?php $this->need('sidebar.php'); ?>
|
||||
|
||||
<?php endif; ?>
|
||||
<?php $this->need('footer.php'); ?>
|
||||
File diff suppressed because one or more lines are too long
+80
-43
@@ -74,9 +74,6 @@ class Puock {
|
||||
this.registerModeChangeEvent()
|
||||
this.eventCommentPageChangeEvent()
|
||||
this.eventCommentPreSubmit()
|
||||
this.eventSmiley()
|
||||
this.eventOpenCommentBox()
|
||||
this.eventCloseCommentBox()
|
||||
this.eventSendPostLike()
|
||||
this.eventPostMainBoxResize()
|
||||
this.swiperOnceEvent()
|
||||
@@ -84,6 +81,8 @@ class Puock {
|
||||
this.detectDevice()
|
||||
window.addEventListener('resize', ()=>this.detectDevice());
|
||||
layer.config({shade: 0.5})
|
||||
// 新增:首次加载时初始化评论相关事件
|
||||
this.initCommentEvents();
|
||||
}
|
||||
|
||||
pageInit() {
|
||||
@@ -144,6 +143,10 @@ class Puock {
|
||||
});
|
||||
// form ajax submit
|
||||
$(document).on("submit", ".ajax-form", (e) => {
|
||||
// 如果是登录弹窗表单,允许原生提交
|
||||
if ($(e.target).attr('id') === 'front-login-form') {
|
||||
return true;
|
||||
}
|
||||
e.preventDefault();
|
||||
const form = $(this.ct(e));
|
||||
const formEls = form.find(":input")
|
||||
@@ -209,6 +212,32 @@ class Puock {
|
||||
}
|
||||
return false;
|
||||
})
|
||||
// 登录弹窗表单AJAX提交(集成Puock插件接口)
|
||||
$(document).off('submit', '#front-login-form');
|
||||
$(document).on('submit', '#front-login-form', function(e) {
|
||||
e.preventDefault();
|
||||
var $form = $(this);
|
||||
var data = $form.serialize();
|
||||
$.ajax({
|
||||
url: '/index.php/ajaxlogin/',
|
||||
type: 'POST',
|
||||
data: data,
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
if (res.success) {
|
||||
window.Puock.toast(res.msg || '登录成功', TYPE_SUCCESS);
|
||||
setTimeout(function() {
|
||||
window.location.reload();
|
||||
}, 800);
|
||||
} else {
|
||||
window.Puock.toast(res.msg || '登录失败', TYPE_DANGER);
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
window.Puock.toast('请求失败', TYPE_DANGER);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
pageLinkBlankOpenInit() {
|
||||
@@ -416,7 +445,7 @@ class Puock {
|
||||
this.pageLinkBlankOpenInit()
|
||||
this.initGithubCard();
|
||||
this.keyUpHandle();
|
||||
this.loadHitokoto();
|
||||
// this.loadHitokoto();
|
||||
// this.asyncCacheViews();
|
||||
this.swiperInit();
|
||||
// this.validateInit();
|
||||
@@ -465,6 +494,8 @@ class Puock {
|
||||
// $('#post-main, #sidebar').theiaStickySidebar({
|
||||
// additionalMarginTop: 20
|
||||
// });
|
||||
// 新增:pjax切换后重新初始化评论相关事件
|
||||
this.initCommentEvents();
|
||||
}
|
||||
|
||||
|
||||
@@ -770,12 +801,14 @@ class Puock {
|
||||
}
|
||||
|
||||
parseFormData(formEl, args = {}) {
|
||||
// 先获取表单所有字段
|
||||
const dataArr = formEl.serializeArray();
|
||||
const data = {...args};
|
||||
const data = {};
|
||||
for (let i = 0; i < dataArr.length; i++) {
|
||||
data[dataArr[i].name] = dataArr[i].value;
|
||||
}
|
||||
return jQuery.param(data);
|
||||
// 合并额外参数
|
||||
return jQuery.param(Object.assign(data, args));
|
||||
}
|
||||
|
||||
eventCommentPreSubmit() {
|
||||
@@ -879,33 +912,49 @@ class Puock {
|
||||
}
|
||||
|
||||
eventOpenCommentBox() {
|
||||
$(document).on("click", "[id^=comment-reply-]", (e) => {
|
||||
this.data.comment.replyId = $(this.ct(e)).attr("data-id");
|
||||
if ($.trim(this.data.comment.replyId) === '') {
|
||||
this.toast('结构有误', TYPE_DANGER);
|
||||
$(document).off("click", ".comment-reply");
|
||||
$(document).on("click", ".comment-reply", function(e) {
|
||||
e.preventDefault();
|
||||
const replyBtn = $(e.currentTarget);
|
||||
const replyId = replyBtn.attr("data-coid");
|
||||
if ($.trim(replyId) === '') {
|
||||
window.Puock.toast('结构有误', TYPE_DANGER);
|
||||
return;
|
||||
}
|
||||
const cf = $("#comment-form"),
|
||||
cb = $("#comment-box-" + this.data.comment.replyId);
|
||||
cf.addClass("box-sw");
|
||||
cb.removeClass("d-none").append(cf);
|
||||
const cf = $("#comment-form");
|
||||
const commentLi = replyBtn.closest('.post-comment');
|
||||
// 只在表单在原位时插入占位符
|
||||
if (!$("#comment-form-place-holder").length && cf.parent().attr("id") === "comment-form-box") {
|
||||
cf.before('<div id="comment-form-place-holder"></div>');
|
||||
}
|
||||
// 每次都append到目标评论下方
|
||||
commentLi.append(cf);
|
||||
$("#comment-cancel").removeClass("d-none");
|
||||
$("#comment").val("");
|
||||
$("#comment_parent").val(this.data.comment.replyId);
|
||||
})
|
||||
|
||||
$("#comment_parent").val(replyId);
|
||||
window.Puock.data.comment.replyId = replyId;
|
||||
// 滚动至表单
|
||||
if (cf.length && cf[0].scrollIntoView) {
|
||||
cf[0].scrollIntoView({behavior: "smooth", block: "center"});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
eventCloseCommentBox() {
|
||||
$(document).off("click", "#comment-cancel");
|
||||
$(document).on("click", "#comment-cancel", () => {
|
||||
const cf = $("#comment-form"),
|
||||
cb = $("#comment-box-" + this.data.comment.replyId);
|
||||
cf.removeClass("box-sw");
|
||||
cb.addClass("d-none");
|
||||
$("#comment-form-box").append(cf);
|
||||
const cf = $("#comment-form");
|
||||
const holder = $("#comment-form-place-holder");
|
||||
if (holder.length) {
|
||||
holder.before(cf);
|
||||
holder.remove();
|
||||
} else {
|
||||
$("#comment-form-box").append(cf);
|
||||
}
|
||||
$("#comment-cancel").addClass("d-none");
|
||||
this.data.comment.replyId = null;
|
||||
})
|
||||
$("#comment_parent").val('');
|
||||
});
|
||||
}
|
||||
|
||||
eventSendPostLike() {
|
||||
@@ -949,11 +998,12 @@ class Puock {
|
||||
}
|
||||
|
||||
eventSmiley() {
|
||||
$(document).off('click', '.smiley-img');
|
||||
$(document).on('click', '.smiley-img', (e) => {
|
||||
const comment = $("#comment");
|
||||
comment.val(comment.val() + ' ' + $(this.ct(e)).attr("data-id") + ' ');
|
||||
layer.closeAll();
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
startLoading() {
|
||||
@@ -1135,25 +1185,6 @@ class Puock {
|
||||
});
|
||||
}
|
||||
|
||||
loadHitokoto() {
|
||||
setTimeout(() => {
|
||||
$(".widget-puock-hitokoto").each((_, v) => {
|
||||
const el = $(v);
|
||||
const api = el.attr("data-api") || "https://v1.hitokoto.cn/"
|
||||
$.get(api, (res) => {
|
||||
el.find(".t").text(res.hitokoto ?? res.content ?? "无内容");
|
||||
el.find('.f').text(res.from);
|
||||
el.find('.fb').removeClass("d-none");
|
||||
}, 'json').fail((err) => {
|
||||
console.error(err)
|
||||
el.find(".t").text("加载失败:" + err.responseText || err);
|
||||
el.remove(".fb");
|
||||
})
|
||||
})
|
||||
}, 300)
|
||||
}
|
||||
|
||||
|
||||
toast(msg, type = TYPE_PRIMARY, options = {}) {
|
||||
options = Object.assign({
|
||||
duration: 2600,
|
||||
@@ -1171,6 +1202,12 @@ class Puock {
|
||||
return t;
|
||||
}
|
||||
|
||||
// 新增:统一初始化评论相关事件
|
||||
initCommentEvents() {
|
||||
this.eventOpenCommentBox();
|
||||
this.eventCloseCommentBox();
|
||||
this.eventSmiley();
|
||||
}
|
||||
}
|
||||
|
||||
jQuery(() => {
|
||||
|
||||
@@ -73,7 +73,7 @@ if ($pageprev == '1' && $this->have()):
|
||||
'wrapClass' => 'pagination comment-ajax-load',
|
||||
'itemTag' => 'li',
|
||||
'textTag' => 'span',
|
||||
'currentClass' => 'active',
|
||||
'currentClass' => 'cur',
|
||||
'prevClass' => 'prev',
|
||||
'nextClass' => 'next'
|
||||
)); ?>
|
||||
|
||||
+6
-61
@@ -43,9 +43,9 @@
|
||||
<div>
|
||||
<?php if(!$this->user->hasLogin()): ?>
|
||||
<div class="d-inline-block">
|
||||
<a class="btn btn-primary btn-ssm" href="<?php $this->options->loginUrl(); ?>" title="登录" target="_blank">
|
||||
<i class="fa fa-right-to-bracket"></i> 登录
|
||||
</a>
|
||||
<button class="btn btn-primary btn-ssm pk-modal-toggle" type="button" data-once-load="true" data-id="front-login" title="快捷登录" data-url="<?php echo get_correct_url('/login/'); ?>">
|
||||
<i class="fa fa-right-to-bracket"></i> 快捷登录
|
||||
</button>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
@@ -59,7 +59,7 @@
|
||||
<i class="fa-regular fa-face-smile t-md"></i>
|
||||
</button>
|
||||
<?php endif; ?>
|
||||
<input type="hidden" name="parent" id="comment-parent" value="">
|
||||
<input type="hidden" name="parent" id="comment_parent" value="">
|
||||
<button type="submit" id="comment-submit" class="btn btn-primary btn-ssm">
|
||||
<i class="fa-regular fa-paper-plane"></i> 发布评论
|
||||
</button>
|
||||
@@ -178,7 +178,7 @@
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="content-text t-md mt10 puock-text">
|
||||
<?php if ($comments->parent) {echo getPermalinkFromCoid($comments->parent);} $comments->content();?>
|
||||
<?php if ($comments->parent) {echo getPermalinkFromCoid($comments->parent);} echo parse_smiley_shortcode($comments->content);?>
|
||||
<div class="comment-os c-sub">
|
||||
<?php
|
||||
$deviceInfo = getBrowsersInfo($comments->agent);
|
||||
@@ -217,59 +217,4 @@
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<script>
|
||||
// 评论局部回复,表单移动到评论下方
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// 监听评论区的回复按钮
|
||||
document.body.addEventListener('click', function(e) {
|
||||
var target = e.target;
|
||||
if (
|
||||
target.classList.contains('comment-reply') ||
|
||||
(target.parentNode && target.parentNode.classList && target.parentNode.classList.contains('comment-reply'))
|
||||
) {
|
||||
e.preventDefault();
|
||||
// 兼容span嵌套与a标签直接点击
|
||||
var replyBtn = target.classList.contains('comment-reply') ? target : target.parentNode;
|
||||
var commentId = replyBtn.getAttribute('data-coid');
|
||||
var commentLi = replyBtn.closest('.post-comment');
|
||||
var respondBox = document.getElementById('comment-form-box');
|
||||
var commentForm = document.getElementById('comment-form');
|
||||
var cancelBtn = document.getElementById('comment-cancel');
|
||||
var parentInput = document.getElementById('comment-parent');
|
||||
// 记录原位置
|
||||
if (!document.getElementById('comment-form-place-holder')) {
|
||||
var holder = document.createElement('div');
|
||||
holder.id = 'comment-form-place-holder';
|
||||
respondBox.parentNode.insertBefore(holder, respondBox);
|
||||
}
|
||||
// 移动表单
|
||||
commentLi.appendChild(respondBox);
|
||||
// 设置parent
|
||||
if (parentInput) parentInput.value = commentId;
|
||||
// 展示取消按钮
|
||||
if(cancelBtn) cancelBtn.classList.remove('d-none');
|
||||
// 聚焦文本域
|
||||
var textarea = commentForm.querySelector('textarea');
|
||||
if (textarea) textarea.focus();
|
||||
// 滚动至表单
|
||||
respondBox.scrollIntoView({behavior: "smooth", block: "center"});
|
||||
return false;
|
||||
}
|
||||
// 取消回复
|
||||
if (target.id === 'comment-cancel') {
|
||||
e.preventDefault();
|
||||
var respondBox = document.getElementById('comment-form-box');
|
||||
var holder = document.getElementById('comment-form-place-holder');
|
||||
var parentInput = document.getElementById('comment-parent');
|
||||
if (holder) {
|
||||
holder.parentNode.insertBefore(respondBox, holder);
|
||||
holder.parentNode.removeChild(holder);
|
||||
}
|
||||
if (parentInput) parentInput.value = '';
|
||||
target.classList.add('d-none');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php } ?>
|
||||
+1
-1
@@ -68,7 +68,7 @@
|
||||
© <?php echo date('Y'); ?> <a href="<?php $this->options->siteUrl(); ?>"><?php $this->options->title(); ?></a>
|
||||
<div class="fs12 mt10 c-sub">
|
||||
<span> Theme by
|
||||
<a target="_blank" class="c-sub" title="Puock v2.8.14" href="https://github.com/jkjoy/typecho-theme-puock">Puock</a>
|
||||
<a target="_blank" class="c-sub" title="Puock v1.2.2" href="https://github.com/jkjoy/typecho-theme-puock">Puock</a>
|
||||
</span>
|
||||
<span> Powered by
|
||||
<a target="_blank" class="c-sub" title="Typecho" href="https://typecho.org">Typecho</a> <p><a target="_blank" class="c-sub" title="老孙博客" href="https://imsun.org">老孙博客</a>制作</p>
|
||||
|
||||
+724
-183
File diff suppressed because it is too large
Load Diff
+54
-10
@@ -10,7 +10,11 @@
|
||||
'search' => _t('包含关键字 %s 的文章'),
|
||||
'tag' => _t('标签 %s 下的文章'),
|
||||
'author' => _t('%s 发布的文章')
|
||||
], '', ' - '); ?><?php $this->options->title(); ?></title>
|
||||
], '', ' - '); ?>
|
||||
<?php $this->options->title(); ?>
|
||||
<?php if ($this->is('index')) echo ' - '; ?>
|
||||
<?php if ($this->is('index')) $this->options->description() ?>
|
||||
</title>
|
||||
<link rel="canonical" href="<?php $this->options->siteUrl(); ?>">
|
||||
<meta name='robots' content='max-image-preview:large' />
|
||||
<?php $this->options->addhead(); ?>
|
||||
@@ -71,7 +75,7 @@
|
||||
</li>
|
||||
<?php \Widget\Contents\Page\Rows::alloc()->to($pages); ?>
|
||||
<?php while ($pages->next()): ?>
|
||||
<li <?php if ($this->is('page', $pages->slug)): ?> class='current-menu-item current_page_item menu-current<?php endif; ?> menu-item menu-item-type-post_type menu-item-object-page '>
|
||||
<li class="menu-item menu-item-type-post_type menu-item-object-page<?php if ($this->is('page', $pages->slug)) echo ' current-menu-item current_page_item menu-current'; ?>">
|
||||
<a class='ww'
|
||||
href="<?php $pages->permalink(); ?>"
|
||||
title="<?php $pages->title(); ?>">
|
||||
@@ -79,6 +83,15 @@
|
||||
</a>
|
||||
</li>
|
||||
<?php endwhile; ?>
|
||||
<?php if($this->user->hasLogin()): ?>
|
||||
<li>
|
||||
<a data-bs-toggle="tooltip" title="用户中心" href="/admin" target="_blank">
|
||||
<img alt="用户中心" src="<?php $stats = get_site_statistics();echo $stats['avatar']; ?>" class="min-avatar">
|
||||
</a>
|
||||
</li>
|
||||
<?php else: ?>
|
||||
<li><a data-no-instant data-bs-toggle="tooltip" title="登入" data-title="登入" href="javascript:void(0)" class="pk-modal-toggle" data-once-load="true" data-url="<?php echo get_correct_url('/login/'); ?>"><i class="fa fa-right-to-bracket"></i></a></li>
|
||||
<?php endif; ?>
|
||||
<li><a class="colorMode" data-bs-toggle="tooltip" title="模式切换" href="javascript:void(0)"><i class="fa fa-circle-half-stroke"></i></a></li>
|
||||
<li><a class="search-modal-btn" data-bs-toggle="tooltip" title="搜索" href="javascript:void(0)"><i class="fa fa-search"></i></a></li>
|
||||
</ul>
|
||||
@@ -126,8 +139,8 @@
|
||||
<?php endwhile; ?>
|
||||
<li class='menu-item menu-item-type-post_type menu-item-object-page'>
|
||||
<span><a href="#">分类</a>
|
||||
<a href="#menu-sub-689" data-bs-toggle="collapse"><i class="fa fa-chevron-down t-sm ml-1 menu-sub-icon"></i></a></span>
|
||||
<ul id="menu-sub-689" class="sub-menu collapse">
|
||||
<a href="#menu" data-bs-toggle="collapse"><i class="fa fa-chevron-down t-sm ml-1 menu-sub-icon"></i></a></span>
|
||||
<ul id="menu" class="sub-menu collapse">
|
||||
<?php $categories = Typecho_Widget::widget('Widget_Metas_Category_List'); ?>
|
||||
<?php while($categories->next()): ?>
|
||||
<li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-child">
|
||||
@@ -139,6 +152,15 @@
|
||||
</li>
|
||||
<?php endwhile; ?>
|
||||
</ul>
|
||||
<?php if($this->user->hasLogin()): ?>
|
||||
<li>
|
||||
<a data-bs-toggle="tooltip" title="用户中心" href="/admin" target="_blank">
|
||||
<img alt="用户中心" src="<?php $stats = get_site_statistics();echo $stats['avatar']; ?>" class="min-avatar">
|
||||
</a>
|
||||
</li>
|
||||
<?php else: ?>
|
||||
<li><a data-no-instant data-bs-toggle="tooltip" title="登入" data-title="登入" href="javascript:void(0)" class="pk-modal-toggle" data-once-load="true" data-url="<?php echo get_correct_url('/login/'); ?>"><i class="fa fa-right-to-bracket"></i></a></li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
@@ -155,12 +177,34 @@
|
||||
<div data-swiper="init" data-swiper-class="global-top-notice-swiper" data-swiper-args='{"direction":"vertical","autoplay":{"delay":3000,"disableOnInteraction":false},"loop":true}'>
|
||||
<div class="swiper global-top-notice-swiper">
|
||||
<div class="swiper-wrapper">
|
||||
<div class="swiper-slide t-line-1">
|
||||
<a class="ta3" data-no-instant href="javascript:void(0)">
|
||||
<span class="notice-icon"><i class="fa-regular fa-bell"></i></span>
|
||||
<span><?php $this->options->gonggao(); ?></span>
|
||||
</a>
|
||||
</div>
|
||||
<?php
|
||||
// 获取公告内容
|
||||
$gonggao = $this->options->gonggao;
|
||||
if ($gonggao) {
|
||||
// 按行分割
|
||||
$lines = explode("\n", $gonggao);
|
||||
foreach ($lines as $line) {
|
||||
$parts = explode('|', $line);
|
||||
// 只处理格式正确的行
|
||||
if (count($parts) >= 3) {
|
||||
$title = trim($parts[0]);
|
||||
$url = trim($parts[1]);
|
||||
$icon = trim($parts[2]);
|
||||
// 链接为空时使用 javascript:void(0)
|
||||
$href = $url !== '' ? htmlspecialchars($url) : 'javascript:void(0)';
|
||||
// 图标为空时使用默认
|
||||
$icon_class = $icon !== '' ? $icon : 'fa-regular fa-bell';
|
||||
// 输出 HTML
|
||||
echo '<div class="swiper-slide t-line-1">';
|
||||
echo '<a class="ta3" data-no-instant href="' . $href . '">';
|
||||
echo '<span class="notice-icon"><i class="' . $icon_class . '"></i></span>';
|
||||
echo '<span>' . htmlspecialchars($title) . '</span>';
|
||||
echo '</a>';
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* Pouck theme for Typecho
|
||||
*
|
||||
* 老孙移植
|
||||
*
|
||||
* @package Typecho Pouck Theme
|
||||
* @author 老孙博客
|
||||
* @version 1.1.4
|
||||
* @version 1.2.2
|
||||
* @link http://www.imsun.org
|
||||
*/
|
||||
|
||||
@@ -13,8 +14,13 @@ $this->need('header.php');
|
||||
$this->need('sticky.php');
|
||||
?>
|
||||
<div class="row row-cols-1">
|
||||
<?php if ($this->options->showsidebar): ?>
|
||||
<div class="col-lg-8 col-md-12 animated fadeInLeft ">
|
||||
<div class="animated fadeInLeft ">
|
||||
<?php else: ?>
|
||||
<div class="col-lg-12 col-md-12">
|
||||
<div class="row box-plr15">
|
||||
<?php endif; ?>
|
||||
<div> <!--文章列表-->
|
||||
<div id="posts">
|
||||
<?php if ($this->options->listmodel): ?>
|
||||
@@ -82,7 +88,7 @@ if ($pageprev == '1' && $this->have()):
|
||||
'wrapClass' => 'pagination comment-ajax-load',
|
||||
'itemTag' => 'li',
|
||||
'textTag' => 'span',
|
||||
'currentClass' => 'active',
|
||||
'currentClass' => 'cur',
|
||||
'prevClass' => 'prev',
|
||||
'nextClass' => 'next'
|
||||
)); ?>
|
||||
@@ -96,5 +102,7 @@ if ($pageprev == '1' && $this->have()):
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($this->options->showsidebar): ?>
|
||||
<?php $this->need('sidebar.php'); ?>
|
||||
<?php endif; ?>
|
||||
<?php $this->need('footer.php'); ?>
|
||||
+8
-2
@@ -17,7 +17,11 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<?php $commenters = getAllCommenters(); ?>
|
||||
<div id="page-reads">
|
||||
<div id="page" class="row row-cols-1">
|
||||
<?php if ($this->options->showsidebar): ?>
|
||||
<div id="posts" class="col-lg-8 col-md-12 animated fadeInLeft ">
|
||||
<?php else: ?>
|
||||
<div id="posts" class="col-lg-12 col-md-12">
|
||||
<?php endif; ?>
|
||||
<div class="p-block puock-text">
|
||||
<h2 class="t-lg"><?php $this->title() ?></h2>
|
||||
<div class="mt20 row pd-links">
|
||||
@@ -44,5 +48,7 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php $this->need('sidebar.php'); ?>
|
||||
<?php $this->need('footer.php'); ?>
|
||||
<?php if ($this->options->showsidebar): ?>
|
||||
<?php $this->need('sidebar.php'); ?>
|
||||
<?php endif; ?>
|
||||
<?php $this->need('footer.php'); ?>
|
||||
+7
-1
@@ -15,7 +15,11 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
</nav>
|
||||
<div id="page-moments">
|
||||
<div class="row">
|
||||
<?php if ($this->options->showsidebar): ?>
|
||||
<div id="posts" class="col-lg-8 col-md-12 animated fadeInLeft ">
|
||||
<?php else: ?>
|
||||
<div id="posts" class="col-lg-12 col-md-12">
|
||||
<?php endif; ?>
|
||||
<?php $tooot = $this->fields->tooot ? $this->fields->tooot : 'https://www.imsun.org/toot.json'; ?>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/15.0.12/marked.min.js" integrity="sha512-rCQgmUulW6f6QegOvTntKKb5IAoxTpGVCdWqYjkXEpzAns6XUFs8NKVqWe+KQpctp/EoRSFSuykVputqknLYMg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/lightbox2/2.11.5/css/lightbox.min.css" integrity="sha512-xtV3HfYNbQXS/1R1jP53KbFcU9WXiSA1RFKzl5hRlJgdOJm4OxHCWYpskm6lN0xp0XtKGpAfVShpbvlFH3MDAA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
|
||||
@@ -161,8 +165,10 @@ img {
|
||||
height: 480px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
<?php if ($this->options->showsidebar): ?>
|
||||
<?php $this->need('sidebar.php'); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php $this->need('footer.php'); ?>
|
||||
@@ -10,7 +10,11 @@
|
||||
</div>
|
||||
<div id="page-empty">
|
||||
<div id="page" class="row row-cols-1">
|
||||
<?php if ($this->options->showsidebar): ?>
|
||||
<div id="post-main" class="col-lg-8 col-md-12 animated fadeInLeft ">
|
||||
<?php else: ?>
|
||||
<div id="post-main" class="col-lg-12 col-md-12">
|
||||
<?php endif; ?>
|
||||
<div class="p-block"><div>
|
||||
<h1 id="post-title" class="mb-0 puock-text t-xxl"><?php $this->title() ?></h1>
|
||||
</div>
|
||||
@@ -60,5 +64,7 @@ if($days > 180){
|
||||
<?php $this->need('comments.php'); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php if ($this->options->showsidebar): ?>
|
||||
<?php $this->need('sidebar.php'); ?>
|
||||
<?php endif; ?>
|
||||
<?php $this->need('footer.php'); ?>
|
||||
@@ -15,7 +15,11 @@
|
||||
<div class="puock-text p-block t-md ad-page-top"><?php $this->options->articletop(); ?></div>
|
||||
<?php endif; ?>
|
||||
<div class="row row-cols-1 post-row">
|
||||
<?php if ($this->options->showsidebar): ?>
|
||||
<div id="post-main" class="col-lg-8 col-md-12 animated fadeInLeft ">
|
||||
<?php else: ?>
|
||||
<div id="post-main" class="col-lg-12 col-md-12">
|
||||
<?php endif; ?>
|
||||
<div class="p-block"><div>
|
||||
<h1 id="post-title" class="mb-0 puock-text t-xxl"><?php $this->title() ?></h1>
|
||||
</div>
|
||||
@@ -216,5 +220,7 @@ if($days > 180){
|
||||
<div class="puock-text p-block t-md ad-comment-top"><?php $this->options->articlefoot(); ?></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php if ($this->options->showsidebar): ?>
|
||||
<?php $this->need('sidebar.php'); ?>
|
||||
<?php endif; ?>
|
||||
<?php $this->need('footer.php'); ?>
|
||||
+10
-33
@@ -18,57 +18,34 @@
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- 个人信息 -->
|
||||
<?php
|
||||
// 获取数据库连接
|
||||
$db = Typecho_Db::get();
|
||||
$prefix = $db->getPrefix();
|
||||
// 1. 获取uid=1的用户信息
|
||||
$user = $db->fetchRow($db->select()->from('table.users')->where('uid = ?', 1));
|
||||
$email = $user['mail'];
|
||||
$nickname = $user['screenName'];
|
||||
// 获取用户设置的 Gravatar 镜像
|
||||
$cnavatar = Helper::options()->cnavatar ? Helper::options()->cnavatar : 'https://cravatar.cn/avatar/';
|
||||
$hash = md5($email);
|
||||
$avatar = rtrim($cnavatar, '/') . '/' . $hash . '?s=80&d=identicon';
|
||||
// 2. 获取用户总数
|
||||
$userCount = $db->fetchObject($db->select(array('COUNT(*)' => 'num'))->from('table.users'))->num;
|
||||
// 3. 获取文章总数(只统计 type='post' 且 status='publish')
|
||||
$postCount = $db->fetchObject($db->select(array('COUNT(*)' => 'num'))->from('table.contents')->where('type = ?', 'post')->where('status = ?', 'publish'))->num;
|
||||
// 4. 获取评论总数
|
||||
$commentCount = $db->fetchObject($db->select(array('COUNT(*)' => 'num'))->from('table.comments'))->num;
|
||||
// 5. 获取文章浏览总量(累加所有文章的 views 字段)
|
||||
$totalViews = $db->fetchObject(
|
||||
$db->select(array('SUM(views)' => 'viewsum'))->from('table.contents')->where('type = ?', 'post')
|
||||
)->viewsum;
|
||||
if ($totalViews === null) $totalViews = 0;
|
||||
?>
|
||||
<!-- 个人信息 -->
|
||||
<?php $stats = get_site_statistics(); ?>
|
||||
<?php if (!empty($this->options->sidebarBlock) && in_array('ShowAdmin', $this->options->sidebarBlock)): ?>
|
||||
<div class="widget-puock-author widget">
|
||||
<div class="header" style="background-image: url('<?php echo $this->options->bgUrl() ?: $this->options->themeUrl('assets/img/cover.png'); ?>')">
|
||||
<img src='<?php $this->options->themeUrl('assets/img/load.svg'); ?>' class='lazy avatar' data-src='<?php echo $avatar; ?>' >
|
||||
<div class="header" style="background-image: url('<?php echo !empty($this->options->bgUrl) ? $this->options->bgUrl : $this->options->themeUrl('assets/img/cover.png'); ?>')">
|
||||
<img src='<?php $this->options->themeUrl('assets/img/load.svg'); ?>' class='lazy avatar' data-src='<?php echo $stats['avatar']; ?>' >
|
||||
</div>
|
||||
<div class="content t-md puock-text">
|
||||
<div class="text-center p-2">
|
||||
<div class="t-lg"><?php echo $nickname; ?></div>
|
||||
<div class="t-lg"><?php echo $stats['nickname']; ?></div>
|
||||
<div class="mt10 t-sm"><?php $this->options->description(); ?></div>
|
||||
</div>
|
||||
<div class="row mt10">
|
||||
<div class="col-3 text-center">
|
||||
<div class="c-sub t-sm">用户数</div>
|
||||
<div><?php echo $userCount; ?></div>
|
||||
<div><?php echo $stats['userCount']; ?></div>
|
||||
</div>
|
||||
<div class="col-3 text-center">
|
||||
<div class="c-sub t-sm">文章数</div>
|
||||
<div><?php echo $postCount; ?></div>
|
||||
<div><?php echo $stats['postCount']; ?></div>
|
||||
</div>
|
||||
<div class="col-3 text-center">
|
||||
<div class="c-sub t-sm">评论数</div>
|
||||
<div><?php echo $commentCount; ?></div>
|
||||
<div><?php echo $stats['commentCount']; ?></div>
|
||||
</div>
|
||||
<div class="col-3 text-center">
|
||||
<div class="c-sub t-sm">阅读量</div>
|
||||
<div><?php echo $totalViews; ?></div>
|
||||
<div><?php echo $stats['totalViews']; ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -132,7 +109,7 @@ if ($totalViews === null) $totalViews = 0;
|
||||
<div class="pk-widget p-block">
|
||||
<div>
|
||||
<span class="t-lg border-bottom border-primary puock-text pb-2">
|
||||
<i class="fa fa-chart-simple mr-1"></i>热门文章
|
||||
<i class="fa-solid fa-fire"></i> 热门文章
|
||||
</span>
|
||||
</div>
|
||||
<div class="mt20">
|
||||
|
||||
Reference in New Issue
Block a user