2023-03-24 20:25:04 +08:00
|
|
|
<head xmlns:th="https://www.thymeleaf.org">
|
|
|
|
<style th:inline="css">
|
2023-03-22 18:29:26 +08:00
|
|
|
/*<#assign fontSrc=(settings.web_font?? && settings.web_font!='default')?then((settings.web_font=='custom')?then((settings.custom_font?? && settings.custom_font!='')?then(settings.custom_font, ''), '${theme_base!}/source/font/${settings.web_font}'), '')>*/
|
|
|
|
/*<#if fontSrc!=''>*/
|
|
|
|
/* <#if fontSrc?ends_with(".woff")>*/
|
|
|
|
/* <#assign fontFormat="woff">*/
|
|
|
|
/* <#elseif fontSrc?ends_with(".woff2")>*/
|
|
|
|
/* <#assign fontFormat="woff2">*/
|
|
|
|
/* <#elseif fontSrc?ends_with(".ttf")>*/
|
|
|
|
/* <#assign fontFormat="truetype">*/
|
|
|
|
/* <#elseif fontSrc?ends_with(".eot")>*/
|
|
|
|
/* <#assign fontFormat="embedded-opentype">*/
|
|
|
|
/* <#elseif fontSrc?ends_with(".svg")>*/
|
|
|
|
/* <#assign fontFormat="svg">*/
|
|
|
|
/* </#if>*/
|
|
|
|
/*@font-face {*/
|
|
|
|
/* font-family: "Dream Font";*/
|
|
|
|
/* font-display: swap;*/
|
|
|
|
/* font-weight: 400;*/
|
|
|
|
/* src: url("${fontSrc!}")${(fontFormat??)?then(' format("${fontFormat}")', '')};*/
|
|
|
|
/*}*/
|
2023-03-21 10:49:35 +08:00
|
|
|
|
2023-03-22 18:29:26 +08:00
|
|
|
/*</#if>*/
|
2023-03-24 20:25:04 +08:00
|
|
|
html {
|
|
|
|
--theme: [(${theme.config.basic_style.theme_color})];
|
|
|
|
filter: [(${theme.config.enhance.enable_gray_mode ? 'grayscale(1) !important' : 'none'})];
|
|
|
|
}
|
2023-03-21 10:49:35 +08:00
|
|
|
|
2023-03-24 20:25:04 +08:00
|
|
|
html.night {
|
|
|
|
--theme: [(${theme.config.basic_style.night_theme_color})];
|
|
|
|
}
|
2023-03-21 10:49:35 +08:00
|
|
|
|
2023-03-24 20:25:04 +08:00
|
|
|
body:before {
|
|
|
|
[(${(theme.config.basic_style.enable_image_bg && theme.config.basic_style.theme_style != 'clean' && !#strings.isEmpty(theme.config.basic_style.background_pc)) ? 'background: url("' + theme.config.basic_style.background_pc + '") center 0 no-repeat;' : ''})]
|
|
|
|
}
|
2023-03-21 10:49:35 +08:00
|
|
|
|
2023-03-24 20:25:04 +08:00
|
|
|
html.night body:before {
|
|
|
|
[(${(theme.config.basic_style.enable_image_bg && theme.config.basic_style.theme_style != 'clean' && !#strings.isEmpty(theme.config.basic_style.night_background_pc)) ? 'background: url("' + theme.config.basic_style.night_background_pc + '") center 0 no-repeat;' : ''})]
|
|
|
|
}
|
2023-03-21 10:49:35 +08:00
|
|
|
|
2023-03-24 20:25:04 +08:00
|
|
|
@media screen and (max-width: 768px) {
|
|
|
|
body:before {
|
|
|
|
[(${(theme.config.basic_style.enable_image_bg && theme.config.basic_style.theme_style != 'clean' && !#strings.isEmpty(theme.config.basic_style.background_mobile)) ? 'background: url("' + theme.config.basic_style.background_mobile + '") center 0 no-repeat;' : ''})]
|
|
|
|
}
|
|
|
|
html.night body:before {
|
|
|
|
[(${(theme.config.basic_style.enable_image_bg && theme.config.basic_style.theme_style != 'clean' && !#strings.isEmpty(theme.config.basic_style.night_background_mobile)) ? 'background: url("' + theme.config.basic_style.night_background_mobile + '") center 0 no-repeat;' : ''})]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
<script th:inline="javascript">
|
|
|
|
window.logger = console.log;
|
|
|
|
[(${theme.config.enhance.enable_debug ? '' : '
|
|
|
|
console.logStorage = [];
|
|
|
|
console.log = function (message, ...optionalParams) {
|
|
|
|
console.logStorage.push(()=>window.logger(message, optionalParams));
|
|
|
|
if (console.logStorage.length > 100) {
|
|
|
|
console.logStorage.shift()
|
|
|
|
}
|
|
|
|
};
|
|
|
|
console.logPrint = function () {
|
|
|
|
for (let logItem of console.logStorage) {
|
|
|
|
logItem();
|
|
|
|
}
|
|
|
|
};'})]
|
|
|
|
[(${#strings.isEmpty(theme.config.basic_info.copy_explain) ? '' : '
|
|
|
|
document.addEventListener("copy", function (event) {
|
|
|
|
let clipboardData = event.clipboardData || window.clipboardData;
|
|
|
|
if (!clipboardData) { return; }
|
|
|
|
let text = window.getSelection().toString();
|
|
|
|
if (text) {
|
|
|
|
event.preventDefault();
|
|
|
|
clipboardData.setData("text/plain", text + "\\n' + #strings.escapeJavaScript(theme.config.basic_info.copy_explain) + '");
|
|
|
|
}
|
|
|
|
});'})]
|
2023-03-21 10:49:35 +08:00
|
|
|
/** 主题配置 */
|
|
|
|
const DreamConfig = {};
|
2023-03-23 18:25:48 +08:00
|
|
|
DreamConfig["theme_version"] = [[${theme.spec.version}]];
|
|
|
|
DreamConfig["theme_base"] = "[(${#theme.assets('/')})]";
|
|
|
|
[(${!#strings.isEmpty(theme.config.post.code_fold_line)?'DreamConfig["code_fold_line"] = "' + theme.config.post.code_fold_line + '";': ''})]
|
2023-03-24 20:25:04 +08:00
|
|
|
[(${!#strings.isEmpty(theme.config.basic_info.document_hidden_title)?'DreamConfig["document_hidden_title"] = "' + theme.config.basic_info.document_hidden_title + '";': ''})]
|
|
|
|
[(${!#strings.isEmpty(theme.config.basic_info.document_visible_title)?'DreamConfig["document_visible_title"] = "' + theme.config.basic_info.document_visible_title + '";' : ''})]
|
|
|
|
[(${!#strings.isEmpty(theme.config.basic_info.website_time)?'DreamConfig["website_time"] = "' + theme.config.basic_info.website_time + '";' : ''})]
|
|
|
|
// <#if settings.enable_color_character!false>
|
|
|
|
// DreamConfig["spark_input_content"] = ['${user.description?trim?replace('\n', '')?js_string}'<#if settings.color_character?? && settings.color_character?trim!=''>, '${settings.color_character?trim?js_string?replace('\\n', "','")}'</#if>];
|
|
|
|
// </#if>
|
|
|
|
DreamConfig["notice_show_mode"] = '[(${theme.config.basic_info.notice_show_mode})]';
|
|
|
|
[(${(!#strings.isEmpty(theme.config.post.img_fold_height) && #numbers.sequence(theme.config.post.img_fold_height,theme.config.post.img_fold_height)[0] >= 400)?'DreamConfig["img_fold_height"] = ' + theme.config.post.img_fold_height + ';': ''})]
|
|
|
|
[(${theme.config.enhance.cursor_move != 'none'?'DreamConfig["cursor_move"] = "' + theme.config.enhance.cursor_move + '";': ''})]
|
|
|
|
[(${theme.config.enhance.cursor_click != 'none'?'DreamConfig["cursor_click"] = "' + theme.config.enhance.cursor_click + '";': ''})]
|
|
|
|
[(${theme.config.enhance.effects_sakura_mode != 'none'?'DreamConfig["effects_sakura_mode"] = "' + theme.config.enhance.effects_sakura_mode + '";': ''})]
|
|
|
|
[(${theme.config.enhance.effects_universe_mode != 'none'?'DreamConfig["effects_universe_mode"] = "' + theme.config.enhance.effects_universe_mode + '";': ''})]
|
2023-03-23 18:25:48 +08:00
|
|
|
[(${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.basic_style.load_progress != 'none'?'DreamConfig["load_progress"] = "' + theme.config.basic_style.load_progress + '";': ''})]
|
|
|
|
[(${!#strings.isEmpty(theme.config.sidebar.meting_api)?'var meting_api = "' + theme.config.sidebar.meting_api + '";': ''})]
|
2023-03-21 10:49:35 +08:00
|
|
|
|
|
|
|
/** 配置主题模式 */
|
2023-03-23 18:25:48 +08:00
|
|
|
DreamConfig["default_theme"] = '[(${theme.config.basic_style.default_theme})]';
|
2023-03-21 10:49:35 +08:00
|
|
|
(function(){
|
2023-03-24 20:25:04 +08:00
|
|
|
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');
|
|
|
|
} else {
|
|
|
|
localStorage.setItem('night', 'false');
|
|
|
|
}
|
2023-03-21 10:49:35 +08:00
|
|
|
})();
|
2023-03-24 20:25:04 +08:00
|
|
|
</script>
|
|
|
|
</head>
|