优化:

建站时间改为时间组件,支持选择到分钟;
灰色模式支持自定义时间段显示,使用时间组件选择开始和结束时间。
This commit is contained in:
mjsoftware 2024-03-04 13:11:58 +08:00
parent 69e51e8959
commit 86039958e4
4 changed files with 61 additions and 15 deletions

View File

@ -46,11 +46,10 @@ spec:
name: record_number_ps
label: 公安部备案
placeholder: 'X公网安备 XXXXXXXXXXXXXX号'
- $formkit: text
- $formkit: datetime-local
name: website_time
label: 建站时间
placeholder: 'YYYY/MM/dd HH:mm:ss'
help: '按YYYY/MM/dd HH:mm:ss格式输入时间进行倒计时非时间格式则直接显示文本。'
help: '请选择建站时间,未选择时不显示。'
- $formkit: attachment
name: cloud_by_logo
label: '云服务提供商 Logo'
@ -1236,16 +1235,39 @@ spec:
label: 黑暗模式
- value: all
label: 全模式
- $formkit: radio
name: enable_gray_mode
label: 灰色模式
value: false
- $formkit: group
name: gray_mode_group
label: 灰色模式
help: '向英雄致敬,愿精神长存!'
options:
- value: true
label: 开启
- value: false
label: 关闭
value:
enable_gray_mode: false
gray_mode_start_time:
gray_mode_end_time:
children:
- $formkit: radio
name: enable_gray_mode
id: enable_gray_mode
label: 开启灰色模式
options:
- value: true
label: 开启
- value: custom
label: 自定义
- value: false
label: 关闭
- $formkit: datetime-local
name: gray_mode_start_time
id: gray_mode_start_time
if: $get(enable_gray_mode).value === 'custom'
validation: required
help: 请选择开始时间,包含开始时间。
label: 灰色模式 - 开始时间
- $formkit: datetime-local
name: gray_mode_end_time
if: $get(enable_gray_mode).value === 'custom'
validation: required
help: 请选择结束时间,结束时间须大于开始时间,不包含结束时间。
label: 灰色模式 - 结束时间
- $formkit: radio
name: enable_busuanzi
label: 开启 busuanzi 访客统计

View File

@ -21,6 +21,10 @@
-webkit-tap-highlight-color: transparent;
}
.gray-mode {
filter: grayscale(1) !important;
}
body > .footer, body > .navbar, body > .section {
opacity: 0;
transition: opacity 0.3s ease-out, transform 0.3s ease-out;

View File

@ -385,8 +385,11 @@ const commonContext = {
return
}
const websiteDate = document.getElementById('websiteDate')
if (!/^\d{4}\/\d{2}\/\d{2} \d{2}:\d{2}:\d{2}$/.test(DreamConfig.website_time)) {
websiteDate.innerText = DreamConfig.website_time
// if (!/^\d{4}\/\d{2}\/\d{2} \d{2}:\d{2}:\d{2}$/.test(DreamConfig.website_time)) {
// websiteDate.innerText = DreamConfig.website_time
// return
// }
if (DreamConfig.website_time === '') {
return
}
const now = new Date()
@ -519,6 +522,19 @@ const commonContext = {
})
$('.aside-timelife').html(htmlStr)
},
/* 灰色模式 */
initGrayMode() {
if(DreamConfig.gray_mode === true) {
$('html').addClass('gray-mode')
} else if(DreamConfig.gray_mode === 'custom') {
var now = new Date().getTime()
var startTime = new Date(DreamConfig.gray_mode_start_time).getTime()
var endTime = new Date(DreamConfig.gray_mode_end_time).getTime()
if(now >= startTime && now <= endTime) {
$('html').addClass('gray-mode')
}
}
},
/* 初始化评论区 */
initComment() {
if (!window.CommentWidget) {

View File

@ -12,7 +12,7 @@
html {
--theme: [(${theme.config.basic_style.theme_color})];
filter: [(${theme.config.enhance.enable_gray_mode ? 'grayscale(1) !important' : 'none'})];
/*filter: [(${theme.config.enhance.enable_gray_mode ? 'grayscale(1) !important' : 'none'})];*/
[(${theme.config.enhance.cursor_style == 'breeze' ? '--cursor-default:url(/themes/theme-dream/assets/cursor/breeze/Arrow.cur),auto;--cursor-pointer:url(/themes/theme-dream/assets/cursor/breeze/Hand.cur),pointer;--cursor-text:url(/themes/theme-dream/assets/cursor/breeze/IBeam.cur),auto;--cursor-zoom-in:url(/themes/theme-dream/assets/cursor/breeze/Cross.cur),zoom-in;'
: theme.config.enhance.cursor_style == 'black_cat' ? '--cursor-default:url(/themes/theme-dream/assets/cursor/black_cat/normal.cur),auto;--cursor-pointer:url(/themes/theme-dream/assets/cursor/black_cat/ayuda.cur),pointer;--cursor-text:url(/themes/theme-dream/assets/cursor/black_cat/texto.cur),auto;--cursor-zoom-in:url(/themes/theme-dream/assets/cursor/black_cat/precision.cur),zoom-in;'
: theme.config.enhance.cursor_style == 'overwatch' ? '--cursor-default:url(/themes/theme-dream/assets/cursor/overwatch/pointer.cur),auto;--cursor-pointer:url(/themes/theme-dream/assets/cursor/overwatch/link.cur),pointer;--cursor-text:url(/themes/theme-dream/assets/cursor/overwatch/text.cur),auto;--cursor-zoom-in:url(/themes/theme-dream/assets/cursor/overwatch/cross.cur),zoom-in;'
@ -72,6 +72,10 @@
const DreamConfig = {};
/** 站点名 */
DreamConfig["site_title"] = [[${site.title}]];
/** 灰色模式 */
DreamConfig["gray_mode"] = [[${theme.config.enhance.gray_mode_group.enable_gray_mode}]];
DreamConfig["gray_mode_start_time"] = [[${theme.config.enhance.gray_mode_group.gray_mode_start_time}]];
DreamConfig["gray_mode_end_time"] = [[${theme.config.enhance.gray_mode_group.gray_mode_end_time}]];
/** 配置分享方式 */
let post_share = []
for (let share of [[${theme.config.post.custom_post_share}]]) {