diff --git a/settings.yaml b/settings.yaml
index 615708f..9651681 100644
--- a/settings.yaml
+++ b/settings.yaml
@@ -1280,24 +1280,24 @@ spec:
label: 隐藏
- value: false
label: 关闭
- - $formkit: radio
- name: enable_baidu_push
- label: 启用百度 URL 自动推送
- value: false
- options:
- - value: true
- label: 开启
- - value: false
- label: 关闭
- - $formkit: radio
- name: enable_toutiao_push
- label: 启用头条搜索自动推送
- value: false
- options:
- - value: true
- label: 开启
- - value: false
- label: 关闭
+# - $formkit: radio
+# name: enable_baidu_push
+# label: 启用百度 URL 自动推送
+# value: false
+# options:
+# - value: true
+# label: 开启
+# - value: false
+# label: 关闭
+# - $formkit: radio
+# name: enable_toutiao_push
+# label: 启用头条搜索自动推送
+# value: false
+# options:
+# - value: true
+# label: 开启
+# - value: false
+# label: 关闭
- $formkit: radio
name: enable_debug
label: 开启 DEBUG 日志
diff --git a/src/css/theme.less b/src/css/theme.less
index ddfe2aa..2ca6f6f 100644
--- a/src/css/theme.less
+++ b/src/css/theme.less
@@ -108,81 +108,116 @@ html {
}
}
}
-}
-//組件高亮
-.color-scheme-light {
- /*搜索組件配色 - 高亮*/
- //基础字体大小
- //--halo-search-widget-base-font-size: 1rem;
- //基础元素的圆角
- //--halo-search-widget-base-border-radius: ;
- //基础字体族
- //--halo-search-widget-base-font-family: ;
- //模态层颜色
- //--halo-search-widget-color-modal-layer: ;
- //模态内容背景颜色
- //--halo-search-widget-color-modal-content-bg: ;
- //表单输入背景颜色
- //--halo-search-widget-color-form-input-bg: ;
- //表单输入文字颜色
- //--halo-search-widget-color-form-input: ;
- //表单输入占位符颜色
- //--halo-search-widget-color-form-input-placeholder: ;
- //表单分隔线颜色
- //--halo-search-widget-color-form-divider: ;
- //无结果提示颜色
- //--halo-search-widget-color-result-empty: ;
- //结果项背景颜色
- //--halo-search-widget-color-result-item-bg: ;
- //结果项悬停背景颜色
- //--halo-search-widget-color-result-item-hover-bg: ;
- //结果项标题颜色
- //--halo-search-widget-color-result-item-title: ;
- //结果项内容颜色
- //--halo-search-widget-color-result-item-content: ;
- //命令键盘项颜色
- //--halo-search-widget-color-command-kbd-item: ;
- //命令键盘边框颜色
- //--halo-search-widget-color-command-kbd-border: ;
+ //todo 插件统一方案,使用此须在主题配置中设定变量,用来应对高亮和黑暗配色切换
+ &.plugin-unified-plan {
+ /*todo 搜索組件*/
+ //基础字体大小
+ //--halo-search-widget-base-font-size: 1rem !important;
+ //基础元素的圆角
+ //--halo-search-widget-base-border-radius: !important;
+ //基础字体族
+ //--halo-search-widget-base-font-family: !important;
+ //模态层颜色
+ //--halo-search-widget-color-modal-layer: var(--theme) !important;
+ //模态内容背景颜色
+ //--halo-search-widget-color-modal-content-bg: var(--theme) !important;
+ //表单输入背景颜色
+ //--halo-search-widget-color-form-input-bg: !important;
+ //表单输入文字颜色
+ //--halo-search-widget-color-form-input: !important;
+ //表单输入占位符颜色
+ //--halo-search-widget-color-form-input-placeholder: !important;
+ //表单分隔线颜色
+ //--halo-search-widget-color-form-divider: !important;
+ //无结果提示颜色
+ //--halo-search-widget-color-result-empty: !important;
+ //结果项背景颜色
+ //--halo-search-widget-color-result-item-bg: !important;
+ //结果项悬停背景颜色
+ //--halo-search-widget-color-result-item-hover-bg: !important;
+ //结果项标题颜色
+ //--halo-search-widget-color-result-item-title: !important;
+ //结果项内容颜色
+ //--halo-search-widget-color-result-item-content: !important;
+ //命令键盘项颜色
+ //--halo-search-widget-color-command-kbd-item: !important;
+ //命令键盘边框颜色
+ //--halo-search-widget-color-command-kbd-border: !important;
+ /*todo 评论组件*/
+ //基础文字颜色
+ //--halo-comment-widget-base-color: var(--dark-c) !important;
+ //基础元素的圆角
+ //--halo-comment-widget-base-border-radius: !important;
+ ////基础字体大小
+ //--halo-comment-widget-base-font-size: !important;
+ ////基础行高
+ //--halo-comment-widget-base-line-height: !important;
+ ////基础字体族
+ //--halo-comment-widget-base-font-family: !important;
+ ////头像的圆角大小
+ //--halo-comment-widget-component-avatar-rounded: !important;
+ ////头像大小
+ //--halo-comment-widget-component-avatar-size: !important;
+ ////表单输入背景颜色
+ //--halo-comment-widget-component-form-input-bg-color: !important;
+ ////表单输入文字颜色
+ //--halo-comment-widget-component-form-input-color: !important;
+ ////表单输入边框颜色
+ //--halo-comment-widget-component-form-input-border-color: !important;
+ ////表单输入焦点时边框颜色
+ //--halo-comment-widget-component-form-input-border-color-focus: !important;
+ ////表单输入焦点时的阴影
+ //--halo-comment-widget-component-form-input-box-shadow-focus: !important;
+ ////登录按钮背景颜色
+ //--halo-comment-widget-component-form-button-login-bg-color: var(--theme) !important;
+ ////登录按钮悬停背景颜色
+ //--halo-comment-widget-component-form-button-login-bg-color-hover: var(--theme) !important;
+ ////登录按钮边框颜色
+ //--halo-comment-widget-component-form-button-login-border-color: #999 !important;
+ ////提交按钮背景颜色
+ //--halo-comment-widget-component-form-button-submit-bg-color: var(--theme) !important;
+ ////提交按钮文字颜色
+ //--halo-comment-widget-component-form-button-submit-color: #f7f7f7 !important;
+ ////提交按钮边框颜色
+ //--halo-comment-widget-component-form-button-submit-border-color: var(--theme) !important;
+ ////提交按钮悬停边框颜色
+ //--halo-comment-widget-component-form-button-submit-border-color-hover: var(--theme) !important;
+ ////表情按钮颜色
+ //--halo-comment-widget-component-form-button-emoji-color: var(--theme) !important;
+ ////评论项操作悬停背景颜色
+ //--halo-comment-widget-component-comment-item-action-bg-color-hover: !important;
+ ////评论项操作颜色
+ //--halo-comment-widget-component-comment-item-action-color: !important;
+ ////评论项操作悬停颜色
+ //--halo-comment-widget-component-comment-item-action-color-hover: !important;
+ ////分页按钮悬停背景颜色
+ //--halo-comment-widget-component-pagination-button-bg-color-hover: !important;
+ ////分页按钮活动状态背景颜色
+ //--halo-comment-widget-component-pagination-button-bg-color-active: !important;
+ ////分页按钮活动状态边框颜色
+ //--halo-comment-widget-component-pagination-button-border-color-active: !important;
+ ////表情选择器颜色
+ //--halo-comment-widget-component-emoji-picker-rgb-color: var(--theme) !important;
+ ////表情选择器强调颜色
+ //--halo-comment-widget-component-emoji-picker-rgb-accent: !important;
+ ////表情选择器背景颜色
+ //--halo-comment-widget-component-emoji-picker-rgb-background: !important;
+ ////表情选择器输入颜色
+ //--halo-comment-widget-component-emoji-picker-rgb-input: !important;
+ ////表情选择器边框颜色
+ //--halo-comment-widget-component-emoji-picker-color-border: !important;
+ ////表情选择器悬停边框颜色
+ //--halo-comment-widget-component-emoji-picker-color-border-over: !important;
+
+ }
}
-//組件暗黑
-.color-scheme-dark {
- /*搜索組件配色 - 暗黑*/
- //基础字体大小
- //--halo-search-widget-base-font-size: 1rem;
- //基础元素的圆角
- //--halo-search-widget-base-border-radius: ;
- //基础字体族
- //--halo-search-widget-base-font-family: ;
- //模态层颜色
- //--halo-search-widget-color-modal-layer: ;
- //模态内容背景颜色
- //--halo-search-widget-color-modal-content-bg: ;
- //表单输入背景颜色
- //--halo-search-widget-color-form-input-bg: ;
- //表单输入文字颜色
- //--halo-search-widget-color-form-input: ;
- //表单输入占位符颜色
- //--halo-search-widget-color-form-input-placeholder: ;
- //表单分隔线颜色
- //--halo-search-widget-color-form-divider: ;
- //无结果提示颜色
- //--halo-search-widget-color-result-empty: ;
- //结果项背景颜色
- //--halo-search-widget-color-result-item-bg: ;
- //结果项悬停背景颜色
- //--halo-search-widget-color-result-item-hover-bg: ;
- //结果项标题颜色
- //--halo-search-widget-color-result-item-title: ;
- //结果项内容颜色
- //--halo-search-widget-color-result-item-content: ;
- //命令键盘项颜色
- //--halo-search-widget-color-command-kbd-item: ;
- //命令键盘边框颜色
- //--halo-search-widget-color-command-kbd-border: ;
-
-}
\ No newline at end of file
+////組件高亮,todo 使用此方案时复制统一配色方案的相关内容后修改对应值
+//.color-scheme-light {
+//}
+////組件暗黑,todo 使用此方案时复制统一配色方案的相关内容后修改对应值
+//.color-scheme-dark {
+//}
\ No newline at end of file
diff --git a/src/js/common.js b/src/js/common.js
index 71668ab..005487a 100644
--- a/src/js/common.js
+++ b/src/js/common.js
@@ -77,11 +77,11 @@ const commonContext = {
// 配色方案
$('html').addClass('color-scheme-light').removeClass('color-scheme-dark').removeClass('night')
}
- $('.comment-section>div').each(function () {
- const shadowDom = this.shadowRoot.querySelectorAll('.halo-comment-widget')[0]
- $(shadowDom)[`${isNightValue ? 'add' : 'remove'}Class`]('dark')
- $(shadowDom)[`${isNightValue ? 'remove' : 'add'}Class`]('light')
- })
+ // $('.comment-section>div').each(function () {
+ // const shadowDom = this.shadowRoot.querySelectorAll('.halo-comment-widget')[0]
+ // $(shadowDom)[`${isNightValue ? 'add' : 'remove'}Class`]('dark')
+ // $(shadowDom)[`${isNightValue ? 'remove' : 'add'}Class`]('light')
+ // })
localStorage.setItem('night', isNightValue)
isNight = isNightValue
}
@@ -541,26 +541,26 @@ const commonContext = {
}
}
},
- /* 初始化评论区 */
- initComment() {
- if (!window.CommentWidget) {
- return
- }
- $('.comment-section').each(function (index, item) {
- let target = $(this).attr('data-target')
- let id = $(this).attr('data-id')
- CommentWidget.init(
- `.comment-section[data-id='${id}'][data-target='${target}']`,
- '/plugins/PluginCommentWidget/assets/static/style.css',
- {
- group: target === 'Moment' ? 'moment.halo.run' : 'content.halo.run',
- kind: target,
- name: id,
- colorScheme: (localStorage.getItem('night') !== 'true' ? 'light' : 'dark')
- }
- )
- })
- },
+ // /* 初始化评论区 */
+ // initComment() {
+ // if (!window.CommentWidget) {
+ // return
+ // }
+ // $('.comment-section').each(function (index, item) {
+ // let target = $(this).attr('data-target')
+ // let id = $(this).attr('data-id')
+ // CommentWidget.init(
+ // `.comment-section[data-id='${id}'][data-target='${target}']`,
+ // '/plugins/PluginCommentWidget/assets/static/style.css',
+ // {
+ // group: target === 'Moment' ? 'moment.halo.run' : 'content.halo.run',
+ // kind: target,
+ // name: id,
+ // colorScheme: (localStorage.getItem('night') !== 'true' ? 'light' : 'dark')
+ // }
+ // )
+ // })
+ // },
/* 初始化特效,只需要初始化一次,移动端设备不初始化 */
initEffects() {
if (Utils.isMobile()) return
@@ -573,11 +573,11 @@ const commonContext = {
DreamConfig.effects_universe_mode && Utils.cachedScript(`${DreamConfig.theme_base}/js/effects/universe.min.js?mew=${DreamConfig.theme_version}`)
DreamConfig.effects_circle_magic_mode && Utils.cachedScript(`${DreamConfig.theme_base}/js/effects/circleMagic.min.js?mew=${DreamConfig.theme_version}`)
},
- /* 加载主动推送、统计脚本等参数 */
- loadMaintain() {
- DreamConfig.enable_baidu_push && Utils.baiduPush()
- DreamConfig.enable_toutiao_push && Utils.toutiaoPush()
- },
+ // /* 加载主动推送、统计脚本等参数 */
+ // loadMaintain() {
+ // DreamConfig.enable_baidu_push && Utils.baiduPush()
+ // DreamConfig.enable_toutiao_push && Utils.toutiaoPush()
+ // },
/* 显示主题版本信息 */
showThemeVersion() {
window.logger(`%c页面加载耗时:${Math.round(performance.now())}ms | Theme By Dream ${DreamConfig.theme_version}`,
@@ -588,8 +588,8 @@ const commonContext = {
window.commonContext = commonContext
!(function () {
- const loads = ['initCarousel', 'sparkInput', 'websiteTime', 'initComment']
- const omits = ['initEffects', 'loadMaintain', 'showThemeVersion']
+ const loads = ['initCarousel', 'sparkInput', 'websiteTime']
+ const omits = ['initEffects', 'showThemeVersion']
Object.keys(commonContext).forEach(
(c) => !loads.includes(c) && !omits.includes(c) && commonContext[c]()
diff --git a/src/js/pjax.js b/src/js/pjax.js
index abddb07..b8c14cb 100644
--- a/src/js/pjax.js
+++ b/src/js/pjax.js
@@ -171,12 +171,12 @@ $(document).on('pjax:success', async function (event, data, status, xhr, options
window.journalPjax && window.journalPjax(serialNumber)
/* 初始化文章界面 */
window.postPjax && window.postPjax(serialNumber)
- /* 初始化评论 */
- commonContext.initComment()
+ // /* 初始化评论 */
+ // commonContext.initComment()
/* 初始化轮播 */
commonContext.initCarousel()
- /* 加载主动推送或统计脚本 */
- commonContext.loadMaintain()
+ // /* 加载主动推送或统计脚本 */
+ // commonContext.loadMaintain()
window.DProgress && DProgress.done()
})
diff --git a/src/js/utils.js b/src/js/utils.js
index a66fe90..d1dd5f7 100644
--- a/src/js/utils.js
+++ b/src/js/utils.js
@@ -199,27 +199,27 @@ const Utils = {
})
})
},
- /* 百度自动推送 */
- baiduPush() {
- let bp = document.createElement('script')
- let curProtocol = window.location.protocol.split(':')[0]
- if (curProtocol === 'https') {
- bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'
- } else {
- bp.src = 'http://push.zhanzhang.baidu.com/push.js'
- }
- $(`script[src="${bp.src}"]`).remove()
- let s = document.getElementsByTagName('script')[0]
- s.parentNode.insertBefore(bp, s)
- },
- toutiaoPush() {
- let el = document.createElement('script')
- el.src = 'https://lf1-cdn-tos.bytegoofy.com/goofy/ttzz/push.js?0fbcfbb1ed642c21419d5be02d56ade7d6ee5372ca221d12ba35df110760b2a830632485602430134f60bc55ca391050b680e2741bf7233a8f1da9902314a3fa'
- el.id = 'ttzz'
- $(`script[src="${el.src}"]`).remove()
- let s = document.getElementsByTagName('script')[0]
- s.parentNode.insertBefore(el, s)
- },
+ // /* 百度自动推送 */
+ // baiduPush() {
+ // let bp = document.createElement('script')
+ // let curProtocol = window.location.protocol.split(':')[0]
+ // if (curProtocol === 'https') {
+ // bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'
+ // } else {
+ // bp.src = 'http://push.zhanzhang.baidu.com/push.js'
+ // }
+ // $(`script[src="${bp.src}"]`).remove()
+ // let s = document.getElementsByTagName('script')[0]
+ // s.parentNode.insertBefore(bp, s)
+ // },
+ // toutiaoPush() {
+ // let el = document.createElement('script')
+ // el.src = 'https://lf1-cdn-tos.bytegoofy.com/goofy/ttzz/push.js?0fbcfbb1ed642c21419d5be02d56ade7d6ee5372ca221d12ba35df110760b2a830632485602430134f60bc55ca391050b680e2741bf7233a8f1da9902314a3fa'
+ // el.id = 'ttzz'
+ // $(`script[src="${el.src}"]`).remove()
+ // let s = document.getElementsByTagName('script')[0]
+ // s.parentNode.insertBefore(el, s)
+ // },
/* sleep */
sleep(ms = 250) {
return new Promise((resolve) => setTimeout(resolve, ms))
diff --git a/templates/common/config.html b/templates/common/config.html
index 8fb70cb..51dc3fe 100644
--- a/templates/common/config.html
+++ b/templates/common/config.html
@@ -117,8 +117,8 @@
[(${theme.config.enhance.effects_snowflake_mode != 'none'?'DreamConfig["effects_snowflake_mode"] = "' + theme.config.enhance.effects_snowflake_mode + '";': ''})]
[(${theme.config.enhance.effects_universe_mode != 'none'?'DreamConfig["effects_universe_mode"] = "' + theme.config.enhance.effects_universe_mode + '";': ''})]
[(${theme.config.enhance.effects_circle_magic_mode != 'none'?'DreamConfig["effects_circle_magic_mode"] = "' + theme.config.enhance.effects_circle_magic_mode + '";': ''})]
- [(${theme.config.enhance.enable_baidu_push?'DreamConfig["enable_baidu_push"] = true;': ''})]
- [(${theme.config.enhance.enable_toutiao_push?'DreamConfig["enable_toutiao_push"] = true;': ''})]
+ // [(${theme.config.enhance.enable_baidu_push?'DreamConfig["enable_baidu_push"] = true;': ''})]
+ // [(${theme.config.enhance.enable_toutiao_push?'DreamConfig["enable_toutiao_push"] = true;': ''})]
[(${theme.config.post.show_img_name?'DreamConfig["show_img_name"] = true;': ''})]
[(${theme.config.basic_style.load_progress != 'none'?'DreamConfig["load_progress"] = "' + theme.config.basic_style.load_progress + '";': ''})]
[(${!#strings.isEmpty(theme.config.page_config.journals_share_image)?'DreamConfig["journals_share_image"] = "' + theme.config.page_config.journals_share_image + '";': ''})]
@@ -126,6 +126,18 @@
/** 配置主题模式 */
DreamConfig["default_theme"] = '[(${theme.config.basic_style.default_theme})]';
-
+ (function(){
+ let isNight = DreamConfig.default_theme === 'system'? matchMedia('(prefers-color-scheme: dark)').matches : localStorage.getItem('night') || DreamConfig.default_theme === 'night';
+ if (isNight.toString() === 'true') {
+ localStorage.setItem('night', 'true');
+ document.documentElement.classList.add('night');
+ // 组件配色方案
+ document.documentElement.classList.add('color-scheme-dark');
+ } else {
+ localStorage.setItem('night', 'false');
+ // 组件配色方案
+ document.documentElement.classList.add('color-scheme-light');
+ }
+ })();
\ No newline at end of file
diff --git a/templates/common/layout.html b/templates/common/layout.html
index a85bf80..3a757f3 100644
--- a/templates/common/layout.html
+++ b/templates/common/layout.html
@@ -1,5 +1,5 @@