2023-03-21 10:49:35 +08:00
|
|
|
<style>
|
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>*/
|
|
|
|
/*<#if settings.enable_gray_mode!false>*/
|
|
|
|
/*html {*/
|
|
|
|
/* filter: grayscale(1) !important;*/
|
|
|
|
/*}*/
|
2023-03-21 10:49:35 +08:00
|
|
|
|
2023-03-22 18:29:26 +08:00
|
|
|
/*</#if>*/
|
|
|
|
/*<#if settings.theme_color?? && settings.theme_color!=''>*/
|
|
|
|
/*html {*/
|
|
|
|
/* --theme: ${settings.theme_color};*/
|
|
|
|
/*}*/
|
2023-03-21 10:49:35 +08:00
|
|
|
|
2023-03-22 18:29:26 +08:00
|
|
|
/*</#if>*/
|
|
|
|
/*<#if settings.night_theme_color?? && settings.night_theme_color!=''>*/
|
|
|
|
/*html.night {*/
|
|
|
|
/* --theme: ${settings.night_theme_color};*/
|
|
|
|
/*}*/
|
2023-03-21 10:49:35 +08:00
|
|
|
|
2023-03-22 18:29:26 +08:00
|
|
|
/*</#if>*/
|
2023-03-21 10:49:35 +08:00
|
|
|
|
2023-03-22 18:29:26 +08:00
|
|
|
/*<#if (settings.enable_image_bg!false)==true && (settings.theme_style!'default')!='clean'>*/
|
|
|
|
/*<#if settings.background_pc?? && settings.background_pc!=''>*/
|
|
|
|
/*body:before {*/
|
|
|
|
/* background: url("${settings.background_pc!}") center 0 no-repeat;*/
|
|
|
|
/*}*/
|
2023-03-21 10:49:35 +08:00
|
|
|
|
2023-03-22 18:29:26 +08:00
|
|
|
/*</#if>*/
|
|
|
|
/*html.night body:before {*/
|
|
|
|
/* background: ${(settings.night_background_pc?? && settings.night_background_pc!='')?then('url("${settings.night_background_pc!}") center 0 no-repeat','none')};*/
|
|
|
|
/*}*/
|
2023-03-21 10:49:35 +08:00
|
|
|
|
2023-03-22 18:29:26 +08:00
|
|
|
/*@media screen and (max-width: 768px) {*/
|
|
|
|
/* body:before {*/
|
|
|
|
/* background: ${(settings.background_mobile?? && settings.background_mobile!='')?then('url("${settings.background_mobile!}") center 0 no-repeat','none')};*/
|
|
|
|
/* }*/
|
2023-03-21 10:49:35 +08:00
|
|
|
|
2023-03-22 18:29:26 +08:00
|
|
|
/* html.night body:before {*/
|
|
|
|
/* background: ${(settings.night_background_mobile?? && settings.night_background_mobile!='')?then('url("${settings.night_background_mobile!}") center 0 no-repeat','none')};*/
|
|
|
|
/* }*/
|
|
|
|
/*}*/
|
2023-03-21 10:49:35 +08:00
|
|
|
|
2023-03-22 18:29:26 +08:00
|
|
|
/*</#if>*/
|
2023-03-21 10:49:35 +08:00
|
|
|
</style>
|
2023-03-22 18:29:26 +08:00
|
|
|
<script th:inline="javascript">
|
|
|
|
// window.logger = console.log;
|
|
|
|
// <#if !(settings.enable_debug!false)>
|
|
|
|
// 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();
|
|
|
|
// }
|
|
|
|
// };
|
|
|
|
// </#if>
|
|
|
|
// <#if settings.copy_explain?? && settings.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${settings.copy_explain?trim?js_string}');
|
|
|
|
// }
|
|
|
|
// });
|
|
|
|
// </#if>
|
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 + '";': ''})]
|
|
|
|
[(${!#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>
|
|
|
|
// <#if settings.sidebar_notice?? && settings.sidebar_notice!='none'>
|
|
|
|
// DreamConfig["notice_show_mode"] = '${settings.notice_show_mode!'index'}';
|
|
|
|
// </#if>
|
|
|
|
[(${(!#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 + ';': ''})]
|
|
|
|
// <#if settings.journals_fold_height?? && settings.journals_fold_height?number gte 260>
|
|
|
|
// DreamConfig["journals_fold_height"] = ${settings.journals_fold_height};
|
|
|
|
// </#if>
|
|
|
|
[(${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 + '";': ''})]
|
|
|
|
[(${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 + '";': ''})]
|
|
|
|
// <#if settings.journals_share_image?? && settings.journals_share_image != 'none'>
|
|
|
|
// DreamConfig["journals_share_image"] = '${settings.journals_share_image}';
|
|
|
|
// </#if>
|
|
|
|
[(${!#strings.isEmpty(theme.config.sidebar.meting_api)?'var meting_api = "' + theme.config.sidebar.meting_api + '";': ''})]
|
|
|
|
// /** 看板娘相关配置 */
|
|
|
|
// <#if settings.enable_live2d!true>
|
|
|
|
// DreamConfig["enable_live2d"] = true;
|
|
|
|
// <#if settings.live2d_about_page?? && settings.live2d_about_page!=''>
|
|
|
|
// DreamConfig["live2d_about_page"] = '${settings.live2d_about_page}';
|
|
|
|
// </#if>
|
|
|
|
// DreamConfig["live2d_model_url"] = '${settings.live2d_model_url!'https://unpkg.com/live2d-widget-model@1.0.1/'}';
|
|
|
|
// DreamConfig["live2d_tips_url"] = '${settings.live2d_tips_url!'/themes/dream/source/lib/live2d@1.0.1/waifu-tips.json'}';
|
|
|
|
// DreamConfig["live2d_edge_side"] = '${settings.live2d_edge_side!'right:50'}';
|
|
|
|
// DreamConfig["live2d_waifu_size"] = '${settings.live2d_waifu_size!'280x260'}';
|
|
|
|
// DreamConfig["live2d_model_id"] = '${settings.live2d_model_id!'0'}';
|
|
|
|
// DreamConfig["live2d_model_textures_id"] = '${settings.live2d_model_textures_id!'0'}';
|
|
|
|
// DreamConfig["live2d_show_tool_menu"] = ${(settings.live2d_show_tool_menu!true)?c};
|
|
|
|
// DreamConfig["live2d_can_turn_to_home_page"] = ${(settings.live2d_can_turn_to_home_page!true)?c};
|
|
|
|
// DreamConfig["live2d_can_switch_hitokoto"] = ${(settings.live2d_can_switch_hitokoto!true)?c};
|
|
|
|
// DreamConfig["live2d_can_switch_model"] = ${(settings.live2d_can_switch_model!true)?c};
|
|
|
|
// DreamConfig["live2d_can_switch_textures"] = ${(settings.live2d_can_switch_textures!true)?c};
|
|
|
|
// DreamConfig["live2d_can_take_screenshot"] = ${(settings.live2d_can_take_screenshot!true)?c};
|
|
|
|
// DreamConfig["live2d_can_turn_to_about_page"] = ${(settings.live2d_can_turn_to_about_page!true)?c};
|
|
|
|
// DreamConfig["live2d_can_close_live2d"] = ${(settings.live2d_can_close_live2d!true)?c};
|
|
|
|
// DreamConfig["live2d_model_rand_mode"] = '${settings.live2d_model_rand_mode!'switch'}';
|
|
|
|
// DreamConfig["live2d_model_textures_rand_mode"] = '${settings.live2d_model_textures_rand_mode!'rand'}';
|
|
|
|
// </#if>
|
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(){
|
|
|
|
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');
|
|
|
|
}
|
|
|
|
})();
|
|
|
|
</script>
|