自定义 CSS & 旧文设置优化

This commit is contained in:
Skywt2003 2021-12-03 14:39:05 +08:00
parent 17ba907382
commit 8814c3dedf
4 changed files with 9 additions and 8 deletions

View File

@ -21,6 +21,9 @@ function themeConfig($form) {
$notificationIcon = new Typecho_Widget_Helper_Form_Element_Text('notificationIcon', NULL, NULL, '网站公告图标', '显示在首页网站公告信息框前的 FontAwesome 图标代码,留空则不显示'); $notificationIcon = new Typecho_Widget_Helper_Form_Element_Text('notificationIcon', NULL, NULL, '网站公告图标', '显示在首页网站公告信息框前的 FontAwesome 图标代码,留空则不显示');
$form->addInput($notificationIcon); $form->addInput($notificationIcon);
$oldPosts = new Typecho_Widget_Helper_Form_Element_Text('oldPosts', NULL, '365', '文章有效期', '单位:天。在此天数之前发布的文章将会显示「这是一篇旧文」的提示。留空则不显示');
$form->addInput($oldPosts);
$commentsNotice = new Typecho_Widget_Helper_Form_Element_Text('commentsNotice', NULL, NULL, '评论区公告', '显示在评论区,留空则不显示'); $commentsNotice = new Typecho_Widget_Helper_Form_Element_Text('commentsNotice', NULL, NULL, '评论区公告', '显示在评论区,留空则不显示');
$form->addInput($commentsNotice); $form->addInput($commentsNotice);
@ -33,12 +36,8 @@ function themeConfig($form) {
$footerCode = new Typecho_Widget_Helper_Form_Element_Textarea('footerCode', NULL, NULL, '页脚代码', '在页脚添加的 HTML 代码,可以插入 JavsScript 代码'); $footerCode = new Typecho_Widget_Helper_Form_Element_Textarea('footerCode', NULL, NULL, '页脚代码', '在页脚添加的 HTML 代码,可以插入 JavsScript 代码');
$form->addInput($footerCode); $form->addInput($footerCode);
$oldPosts = new Typecho_Widget_Helper_Form_Element_Radio('oldPosts', $cunstomCSS = new Typecho_Widget_Helper_Form_Element_Textarea('cunstomCSS', NULL, NULL, '自定义 CSS', '加入自定义的 CSS 代码');
array('able' => '启用', $form->addInput($cunstomCSS);
'disable' => '禁用',
),
'disable', '是否显示旧文提示', '启用则会在一年前发布的文章页面显示“这是一篇旧文”');
$form->addInput($oldPosts);
} }
function themeFields($layout) { function themeFields($layout) {

View File

@ -53,6 +53,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css">
<?php $this->options->headerCode(); ?> <?php $this->options->headerCode(); ?>
<style><?php $this->options->cutsomCSS(); ?></style>
<?php $this->header(); ?> <?php $this->header(); ?>
</head> </head>

View File

@ -53,6 +53,7 @@ $this->need('functions.php'); // 不知道为啥,似乎模版页面不会自
<!-- <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/katex@latest/dist/katex.min.css"> --> <!-- <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/katex@latest/dist/katex.min.css"> -->
<?php $this->options->headerCode(); ?> <?php $this->options->headerCode(); ?>
<style><?php $this->options->cutsomCSS(); ?></style>
<?php $this->header(); ?> <?php $this->header(); ?>
</head> </head>

View File

@ -27,7 +27,7 @@
</div> </div>
<hr> <hr>
<?php $date1=date_create(date('c',$this->date->timeStamp)); $date2=date_create(date('c')); $days=date_diff($date1,$date2); ?> <?php $date1=date_create(date('c',$this->date->timeStamp)); $date2=date_create(date('c')); $days=date_diff($date1,$date2); ?>
<?php if ($this->options->oldPosts == 'able' && $days->format('%a') > 365): ?> <?php if ($this->options->oldPosts != '' && $days->format('%a') > $this->options->oldPosts): ?>
<div class="alert alert-primary alert-dismissible fade show shadow mb-5" role="alert"> <div class="alert alert-primary alert-dismissible fade show shadow mb-5" role="alert">
<span class="alert-inner--icon"><i class="fas fa-clock"></i></span> <span class="alert-inner--icon"><i class="fas fa-clock"></i></span>
<span class="alert-inner--text">这是一篇发布于 <?php echo $days->format('%a'); ?> 天以前的旧文。其中的部分内容可能已经过时。</span> <span class="alert-inner--text">这是一篇发布于 <?php echo $days->format('%a'); ?> 天以前的旧文。其中的部分内容可能已经过时。</span>