chore: 适配

This commit is contained in:
nineya 2023-03-22 18:29:26 +08:00
parent ad5d03586f
commit cafe34baa3
6 changed files with 99 additions and 110 deletions

View File

@ -1,105 +1,101 @@
<style>
<#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}")', '')};
}
/*<#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}")', '')};*/
/*}*/
</#if>
<#if settings.enable_gray_mode!false>
html {
filter: grayscale(1) !important;
}
/*</#if>*/
/*<#if settings.enable_gray_mode!false>*/
/*html {*/
/* filter: grayscale(1) !important;*/
/*}*/
</#if>
<#if settings.theme_color?? && settings.theme_color!=''>
html {
--theme: ${settings.theme_color};
}
/*</#if>*/
/*<#if settings.theme_color?? && settings.theme_color!=''>*/
/*html {*/
/* --theme: ${settings.theme_color};*/
/*}*/
</#if>
<#if settings.night_theme_color?? && settings.night_theme_color!=''>
html.night {
--theme: ${settings.night_theme_color};
}
/*</#if>*/
/*<#if settings.night_theme_color?? && settings.night_theme_color!=''>*/
/*html.night {*/
/* --theme: ${settings.night_theme_color};*/
/*}*/
</#if>
/*</#if>*/
<#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;
}
/*<#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;*/
/*}*/
</#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')};
}
/*</#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')};*/
/*}*/
@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')};
}
/*@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')};*/
/* }*/
html.night body:before {
background: ${(settings.night_background_mobile?? && settings.night_background_mobile!='')?then('url("${settings.night_background_mobile!}") center 0 no-repeat','none')};
}
}
/* html.night body:before {*/
/* background: ${(settings.night_background_mobile?? && settings.night_background_mobile!='')?then('url("${settings.night_background_mobile!}") center 0 no-repeat','none')};*/
/* }*/
/*}*/
</#if>
/*</#if>*/
</style>
<script type="text/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>
<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>
/** 主题配置 */
const DreamConfig = {};
DreamConfig["theme_version"] = '${theme_version!}';
DreamConfig["theme_base"] = '${theme_base!}';
DreamConfig["access_key"] = '${settings.access_key!'dream'}';
<#if settings.code_fold_line?? && settings.code_fold_line?number gte 20>
DreamConfig["code_fold_line"] =${settings.code_fold_line};
</#if>
<#if settings.document_hidden_title?? && settings.document_hidden_title!=''>
DreamConfig["document_hidden_title"] = '${settings.document_hidden_title}';
</#if>
DreamConfig["access_key"] = '${settings.access_key!'dream'}'
DreamConfig["code_fold_line"] = [[${theme.config.post.code_fold_line}]]
DreamConfig["document_hidden_title"] = [[${theme.config.basic_info.document_hidden_title}]]
<#if settings.document_visible_title?? && settings.document_visible_title!=''>
DreamConfig["document_visible_title"] = '${settings.document_visible_title}';
</#if>

View File

@ -25,8 +25,6 @@
<link rel="canonical" href="${canonical!}"/>
<link rel="alternative" href="${atom_url!}" title="${blog_title!}" type="application/atom+xml">
<!--<@global.head />-->
<link rel="preload stylesheet" as="style" th:href="@{/assets/css/theme.min.css(mew=${theme.spec.version})}">
<link rel="preload stylesheet" as="style" th:href="@{/assets/lib/font-awesome@4.7.0/css/font-awesome.min.css}">
<link rel="preload stylesheet" as="style" th:href="@{/assets/css/style.min.css(mew=${theme.spec.version})}">
@ -55,7 +53,7 @@
<!-- <link rel="stylesheet" th:href="@{/assets/css/cursor/${settings.cursor_style}.min.css(mew=${theme.spec.version})}">-->
<!--</#if>-->
<!--<#include "config.html">-->
<th:block th:replace="~{common/config}"/>
<script src="@{/assets/lib/jquery@3.5.1/jquery.min.js}"></script>

View File

@ -1,5 +1,5 @@
<html lang="zh" xmlns:th="https://www.thymeleaf.org"
th:fragment="layout (title, canonical, content)">
th:fragment="layout (title, canonical, content, isPost)">
<th:block th:if="${#strings.equals('',param._pjax) == false}">
<th:block th:replace="~{common/head :: head}"/>
<body>

View File

@ -8,12 +8,12 @@
<script th:src="@{/assets/js/common.min.js(mew=${theme.spec.version})}"></script>
<!--<#if post?? || is_journals?? || is_error??>-->
<!-- <script data-pjax th:src="@{/assets/lib/highlightjs@11.5.1/highlight.min.js}"></script>-->
<!-- <script data-pjax th:src="@{/assets/lib/clipboard@2.0.10/clipboard.min.js}"></script>-->
<script th:if="${isPost}" data-pjax th:src="@{/assets/lib/highlightjs@11.5.1/highlight.min.js}"></script>
<script th:if="${isPost}" data-pjax th:src="@{/assets/lib/clipboard@2.0.10/clipboard.min.js}"></script>
<!-- <#if enable_share>-->
<!-- <script data-pjax th:src="@{/assets/js/dshare.min.js(mew=${theme.spec.version})}"></script>-->
<!-- </#if>-->
<!-- <script data-pjax th:src="@{/assets/js/post.min.js(mew=${theme.spec.version})}"></script>-->
<script th:if="${isPost}" data-pjax th:src="@{/assets/js/post.min.js(mew=${theme.spec.version})}"></script>
<!-- <#if is_journals??>-->
<!-- <script data-pjax th:src="@{/assets/js/journals.min.js(mew=${theme.spec.version})}"></script>-->
<!-- </#if>-->
@ -37,9 +37,7 @@
<script th:src="@{/assets/js/pjax.min.js(mew=${theme.spec.version})}"></script>
<script async th:src="@{/assets/lib/qmsg/qmsg.min.js}"></script>
<!--<#if post?? || is_photos?? || is_journals?? >-->
<!-- <script data-pjax async th:src="@{/assets/lib/fancybox@5.3.7/jquery.fancybox.min.js}"></script>-->
<!--</#if>-->
<script th:if="${isPost}" data-pjax async th:src="@{/assets/lib/fancybox@5.3.7/jquery.fancybox.min.js}"></script>
<!--<#if settings.sidebar_music?? && settings.sidebar_music != 'none'>-->
<!-- <link rel="stylesheet" th:href="@{/assets/lib/aplayer@1.10.1/APlayer.min.css}>-->
@ -48,10 +46,5 @@
<!--</#if>-->
<script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js}"></script>
<!--${settings.external_js_body!}-->
<!--<#if settings.inline_js_body?? && settings.inline_js_body!=''>-->
<!-- <script type="text/javascript">-->
<!-- ${settings.inline_js_body!}-->
<!-- </script>-->
<!--</#if>-->
<!--<@global.statistics />-->
<script th:if="${!#strings.isEmpty(theme.config.custom.inline_js_body)}" type="text/javascript" th:text="${theme.config.custom.inline_js_body}">
</script>

View File

@ -1,6 +1,6 @@
<!DOCTYPE html>
<html xmlns:th="https://www.thymeleaf.org"
th:replace="~{common/layout :: layout (title = ${site.title}, canonical = ${site.url}, content = ~{::content})}">
th:replace="~{common/layout :: layout (title = ${site.title}, canonical = ${site.url}, content = ~{::content}, isPost = false)}">
<th:block th:fragment="content">
首页
</th:block>

View File

@ -1,4 +1,4 @@
<div class="card widget love brightness ${settings.hide_love!}">
<div class="card widget love brightness ${settings.hide_love!}" xmlns:th="https://www.thymeleaf.org">
<div class="card-title">
<i class="fa fa-heart card-title-label"></i><span>恋爱墙</span>
</div>
@ -7,8 +7,9 @@
<div class="level">
<div class="level-item">
<a class="avatar"
target="_blank"${(settings.love_oneself_url?? && settings.love_oneself_url!='')?then(' href="${settings.love_oneself_url!}"','')}>
<img class="avatar-image" src="${settings.love_oneself_avatar!user.avatar!}" alt="自己的头像">
target="_blank"
th:href="${theme.config.sidebar.love_oneself_url}">
<img class="avatar-image" th:src="${theme.config.sidebar.love_oneself_avatar}" alt="自己的头像">
</a>
</div>
<div class="level-item">
@ -22,8 +23,9 @@
</div>
<div class="level-item">
<a class="avatar"
target="_blank"${(settings.love_opposite_url?? && settings.love_opposite_url!='')?then(' href="${settings.love_opposite_url!}"','')}>
<img class="avatar-image" src="${settings.love_opposite_avatar!}" alt="对方的头像">
target="_blank"
th:href="${theme.config.sidebar.love_opposite_url}">
<img class="avatar-image" th:src="${theme.config.sidebar.love_opposite_avatar}" alt="对方的头像">
</a>
</div>
</div>