|
@@ -3,7 +3,7 @@
|
|
|
<!-- 作者:PJ568 -->
|
|
<!-- 作者:PJ568 -->
|
|
|
<!-- 项目地址:https://github.com/PJ-568/markdown.html/ -->
|
|
<!-- 项目地址:https://github.com/PJ-568/markdown.html/ -->
|
|
|
<!-- 本项目遵循 CC BY-SA 4.0 International 许可协议 -->
|
|
<!-- 本项目遵循 CC BY-SA 4.0 International 许可协议 -->
|
|
|
-<!-- v 0.7.1 -->
|
|
|
|
|
|
|
+<!-- v 0.8.0 -->
|
|
|
|
|
|
|
|
<head>
|
|
<head>
|
|
|
<meta charset="utf-8">
|
|
<meta charset="utf-8">
|
|
@@ -24,9 +24,7 @@
|
|
|
|
|
|
|
|
// 文档解析功能相关
|
|
// 文档解析功能相关
|
|
|
var existIndexPage = true; // 是否存在索引页
|
|
var existIndexPage = true; // 是否存在索引页
|
|
|
- var url = new URL(window.location.href);
|
|
|
|
|
- var params = new URLSearchParams(url.search);
|
|
|
|
|
- var pValue = formatPath(params.get('p'));
|
|
|
|
|
|
|
+ const pValue = formatPath(decodePath(window.location.href));
|
|
|
|
|
|
|
|
// Pjax 相关
|
|
// Pjax 相关
|
|
|
let pjax;
|
|
let pjax;
|
|
@@ -198,13 +196,6 @@
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 更新 p 值
|
|
|
|
|
- function updatePValue() {
|
|
|
|
|
- url = new URL(window.location.href);
|
|
|
|
|
- params = new URLSearchParams(url.search);
|
|
|
|
|
- pValue = formatPath(params.get('p'));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
// 获取文件所在目录
|
|
// 获取文件所在目录
|
|
|
function getDirectory(path) {
|
|
function getDirectory(path) {
|
|
|
path = new URL(path, 'http://example.com').pathname;
|
|
path = new URL(path, 'http://example.com').pathname;
|
|
@@ -370,7 +361,6 @@
|
|
|
});
|
|
});
|
|
|
//// 监听 Pjax 完成后,重新加载
|
|
//// 监听 Pjax 完成后,重新加载
|
|
|
document.addEventListener('pjax:complete', function () {
|
|
document.addEventListener('pjax:complete', function () {
|
|
|
- updatePValue();
|
|
|
|
|
initContent();
|
|
initContent();
|
|
|
translate.execute(); // 手动触发翻译,但是理论上 translate-js 会监听页面变化
|
|
translate.execute(); // 手动触发翻译,但是理论上 translate-js 会监听页面变化
|
|
|
initCostumedPjax(); //// 初始化自定义 PJAX
|
|
initCostumedPjax(); //// 初始化自定义 PJAX
|