feat(pjax): 支持配置关闭pjax

This commit is contained in:
nineya 2023-07-12 17:53:27 +08:00
parent 0da46f418c
commit 6e0a72ad93
3 changed files with 15 additions and 3 deletions

View File

@ -915,6 +915,16 @@ spec:
label: 开启全站离线 label: 开启全站离线
- value: "uninstall" - value: "uninstall"
label: 卸载 label: 卸载
- $formkit: radio
name: enable_pjax
label: Pjax加载
value: false
help: '使用Pjax加载可极大提升页面跳转的速度但可能和部分插件不兼容。'
options:
- value: true
label: 开启
- value: false
label: 关闭
- $formkit: radio - $formkit: radio
name: effects_sakura_mode name: effects_sakura_mode
label: 樱花飘落特效显示模式 label: 樱花飘落特效显示模式

View File

@ -1,7 +1,7 @@
<head xmlns:th="https://www.thymeleaf.org" th:fragment="head" <head xmlns:th="https://www.thymeleaf.org" th:fragment="head"
th:with="description=${isPost ? post != null ? post.status.excerpt : singlePage != null ? singlePage.status.excerpt : site.seo.description : site.seo.description}"> th:with="description=${isPost ? post != null ? post.status.excerpt : singlePage != null ? singlePage.status.excerpt : site.seo.description : site.seo.description}">
<title th:text="${title + (#strings.isEmpty(site.subtitle) ? '' : '|' + site.subtitle)}"></title> <title th:text="${title + (#strings.isEmpty(site.subtitle) ? '' : '|' + site.subtitle)}"></title>
<script th:if="${(theme.config.enhance.enable_sw != 'false')}" th:src="${(theme.config.enhance.enable_sw == 'uninstall')? #theme.assets('/assets/js/sw.min.js') + '?mew=0.0.1' : '/sw.min.js?mew=0.0.1' + theme.config.enhance.enable_sw}"></script> <script th:if="${theme.config.enhance.enable_sw}" th:src="${(theme.config.enhance.enable_sw == 'uninstall')? #theme.assets('/assets/js/sw.min.js') + '?mew=0.0.1' : '/sw.min.js?mew=0.0.1' + theme.config.enhance.enable_sw}"></script>
<meta charset="utf-8"/> <meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta http-equiv="x-dns-prefetch-control" content="on"> <meta http-equiv="x-dns-prefetch-control" content="on">

View File

@ -19,9 +19,11 @@
<script th:src="@{/assets/js/mew-custom.min.js(mew=${theme.spec.version})}"></script> <script th:src="@{/assets/js/mew-custom.min.js(mew=${theme.spec.version})}"></script>
<script th:src="@{/assets/lib/jquery-pjax@2.0.1/jquery.pjax.min.js}"></script>
<script th:if="${theme.config.basic_style.load_progress != 'none'}" th:src="@{/assets/js/dprogress.min.js(mew=${theme.spec.version})}"></script> <script th:if="${theme.config.basic_style.load_progress != 'none'}" th:src="@{/assets/js/dprogress.min.js(mew=${theme.spec.version})}"></script>
<script th:src="@{/assets/js/pjax.min.js(mew=${theme.spec.version})}"></script> <th:block th:if="${theme.config.enhance.enable_pjax}">
<script th:src="@{/assets/lib/jquery-pjax@2.0.1/jquery.pjax.min.js}"></script>
<script th:src="@{/assets/js/pjax.min.js(mew=${theme.spec.version})}"></script>
</th:block>
<script async th:src="@{/assets/lib/qmsg/qmsg.min.js}"></script> <script async th:src="@{/assets/lib/qmsg/qmsg.min.js}"></script>
<script th:if="${isPost}" data-pjax async th:src="@{/assets/lib/fancybox@5.3.7/jquery.fancybox.min.js}"></script> <script th:if="${isPost}" data-pjax async th:src="@{/assets/lib/fancybox@5.3.7/jquery.fancybox.min.js}"></script>