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> <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}'), '')> /*<#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!=''>*/
<#if fontSrc?ends_with(".woff")> /* <#if fontSrc?ends_with(".woff")>*/
<#assign fontFormat="woff"> /* <#assign fontFormat="woff">*/
<#elseif fontSrc?ends_with(".woff2")> /* <#elseif fontSrc?ends_with(".woff2")>*/
<#assign fontFormat="woff2"> /* <#assign fontFormat="woff2">*/
<#elseif fontSrc?ends_with(".ttf")> /* <#elseif fontSrc?ends_with(".ttf")>*/
<#assign fontFormat="truetype"> /* <#assign fontFormat="truetype">*/
<#elseif fontSrc?ends_with(".eot")> /* <#elseif fontSrc?ends_with(".eot")>*/
<#assign fontFormat="embedded-opentype"> /* <#assign fontFormat="embedded-opentype">*/
<#elseif fontSrc?ends_with(".svg")> /* <#elseif fontSrc?ends_with(".svg")>*/
<#assign fontFormat="svg"> /* <#assign fontFormat="svg">*/
</#if> /* </#if>*/
@font-face { /*@font-face {*/
font-family: "Dream Font"; /* font-family: "Dream Font";*/
font-display: swap; /* font-display: swap;*/
font-weight: 400; /* font-weight: 400;*/
src: url("${fontSrc!}")${(fontFormat??)?then(' format("${fontFormat}")', '')}; /* src: url("${fontSrc!}")${(fontFormat??)?then(' format("${fontFormat}")', '')};*/
} /*}*/
</#if> /*</#if>*/
<#if settings.enable_gray_mode!false> /*<#if settings.enable_gray_mode!false>*/
html { /*html {*/
filter: grayscale(1) !important; /* filter: grayscale(1) !important;*/
} /*}*/
</#if> /*</#if>*/
<#if settings.theme_color?? && settings.theme_color!=''> /*<#if settings.theme_color?? && settings.theme_color!=''>*/
html { /*html {*/
--theme: ${settings.theme_color}; /* --theme: ${settings.theme_color};*/
} /*}*/
</#if> /*</#if>*/
<#if settings.night_theme_color?? && settings.night_theme_color!=''> /*<#if settings.night_theme_color?? && settings.night_theme_color!=''>*/
html.night { /*html.night {*/
--theme: ${settings.night_theme_color}; /* --theme: ${settings.night_theme_color};*/
} /*}*/
</#if> /*</#if>*/
<#if (settings.enable_image_bg!false)==true && (settings.theme_style!'default')!='clean'> /*<#if (settings.enable_image_bg!false)==true && (settings.theme_style!'default')!='clean'>*/
<#if settings.background_pc?? && settings.background_pc!=''> /*<#if settings.background_pc?? && settings.background_pc!=''>*/
body:before { /*body:before {*/
background: url("${settings.background_pc!}") center 0 no-repeat; /* background: url("${settings.background_pc!}") center 0 no-repeat;*/
} /*}*/
</#if> /*</#if>*/
html.night body:before { /*html.night body:before {*/
background: ${(settings.night_background_pc?? && settings.night_background_pc!='')?then('url("${settings.night_background_pc!}") center 0 no-repeat','none')}; /* 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) { /*@media screen and (max-width: 768px) {*/
body:before { /* body:before {*/
background: ${(settings.background_mobile?? && settings.background_mobile!='')?then('url("${settings.background_mobile!}") center 0 no-repeat','none')}; /* background: ${(settings.background_mobile?? && settings.background_mobile!='')?then('url("${settings.background_mobile!}") center 0 no-repeat','none')};*/
} /* }*/
html.night body:before { /* html.night body:before {*/
background: ${(settings.night_background_mobile?? && settings.night_background_mobile!='')?then('url("${settings.night_background_mobile!}") center 0 no-repeat','none')}; /* background: ${(settings.night_background_mobile?? && settings.night_background_mobile!='')?then('url("${settings.night_background_mobile!}") center 0 no-repeat','none')};*/
} /* }*/
} /*}*/
</#if> /*</#if>*/
</style> </style>
<script type="text/javascript"> <script th:inline="javascript">
window.logger = console.log; // window.logger = console.log;
<#if !(settings.enable_debug!false)> // <#if !(settings.enable_debug!false)>
console.logStorage = []; // console.logStorage = [];
console.log = function (message, ...optionalParams) { // console.log = function (message, ...optionalParams) {
console.logStorage.push(()=>window.logger(message, optionalParams)); // console.logStorage.push(()=>window.logger(message, optionalParams));
if (console.logStorage.length > 100) { // if (console.logStorage.length > 100) {
console.logStorage.shift() // console.logStorage.shift()
} // }
}; // };
console.logPrint = function () { // console.logPrint = function () {
for (let logItem of console.logStorage) { // for (let logItem of console.logStorage) {
logItem(); // logItem();
} // }
}; // };
</#if> // </#if>
<#if settings.copy_explain?? && settings.copy_explain!=''> // <#if settings.copy_explain?? && settings.copy_explain!=''>
document.addEventListener('copy', function (event) { // document.addEventListener('copy', function (event) {
let clipboardData = event.clipboardData || window.clipboardData; // let clipboardData = event.clipboardData || window.clipboardData;
if (!clipboardData) { return; } // if (!clipboardData) { return; }
let text = window.getSelection().toString(); // let text = window.getSelection().toString();
if (text) { // if (text) {
event.preventDefault(); // event.preventDefault();
clipboardData.setData('text/plain', text + '\n${settings.copy_explain?trim?js_string}'); // clipboardData.setData('text/plain', text + '\n${settings.copy_explain?trim?js_string}');
} // }
}); // });
</#if> // </#if>
/** 主题配置 */ /** 主题配置 */
const DreamConfig = {}; const DreamConfig = {};
DreamConfig["theme_version"] = '${theme_version!}'; DreamConfig["theme_version"] = '${theme_version!}';
DreamConfig["theme_base"] = '${theme_base!}'; DreamConfig["theme_base"] = '${theme_base!}';
DreamConfig["access_key"] = '${settings.access_key!'dream'}'; DreamConfig["access_key"] = '${settings.access_key!'dream'}'
<#if settings.code_fold_line?? && settings.code_fold_line?number gte 20> DreamConfig["code_fold_line"] = [[${theme.config.post.code_fold_line}]]
DreamConfig["code_fold_line"] =${settings.code_fold_line}; DreamConfig["document_hidden_title"] = [[${theme.config.basic_info.document_hidden_title}]]
</#if>
<#if settings.document_hidden_title?? && settings.document_hidden_title!=''>
DreamConfig["document_hidden_title"] = '${settings.document_hidden_title}';
</#if>
<#if settings.document_visible_title?? && settings.document_visible_title!=''> <#if settings.document_visible_title?? && settings.document_visible_title!=''>
DreamConfig["document_visible_title"] = '${settings.document_visible_title}'; DreamConfig["document_visible_title"] = '${settings.document_visible_title}';
</#if> </#if>

View File

@ -25,8 +25,6 @@
<link rel="canonical" href="${canonical!}"/> <link rel="canonical" href="${canonical!}"/>
<link rel="alternative" href="${atom_url!}" title="${blog_title!}" type="application/atom+xml"> <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/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/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})}"> <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})}">--> <!-- <link rel="stylesheet" th:href="@{/assets/css/cursor/${settings.cursor_style}.min.css(mew=${theme.spec.version})}">-->
<!--</#if>--> <!--</#if>-->
<!--<#include "config.html">--> <th:block th:replace="~{common/config}"/>
<script src="@{/assets/lib/jquery@3.5.1/jquery.min.js}"></script> <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" <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:if="${#strings.equals('',param._pjax) == false}">
<th:block th:replace="~{common/head :: head}"/> <th:block th:replace="~{common/head :: head}"/>
<body> <body>

View File

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

View File

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