Skip to content

Commit 2d36802

Browse files
committed
【修复】优化 updateContent 函数参数设计
- 将 updateContent 函数的 mdPath 参数默认值改为 pValue - 移除了冗余的参数设计,简化了函数调用 - 优化了代码结构,提高了代码的可读性和维护性
1 parent c40c8ab commit 2d36802

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!doctype html>
22

33
<html>
4-
<markdown-html version="1.18.0" author="PJ568" repo="https://github.com/PJ-568/markdown.html"
4+
<markdown-html version="1.18.1" author="PJ568" repo="https://github.com/PJ-568/markdown.html"
55
license="CC BY-SA 4.0 International"></markdown-html>
66

77
<head>
@@ -316,7 +316,7 @@
316316
}
317317

318318
// 处理错误
319-
function updateContent(article, title = null, mdPath = null) {
319+
function updateContent(article, title = null, mdPath = pValue) {
320320
try {
321321
document.querySelector('.markdown-body').innerHTML = `<div class="old-content Animated Animated-remove Animated--reverse Animate--fast Animate--noDelay Animate--slideInLeft">${document.querySelector('.markdown-body .content').innerHTML}</div><div class="content Animated Animate--slideInRight">${article}</div>`;
322322
firstH1 = document.querySelector('.markdown-body .content h1');
@@ -444,7 +444,7 @@
444444
}
445445
try {
446446
pValue = mdPath ? mdPath : path;
447-
updateContent(await getMarkdown((mdPath ? mdPath : path), response), pValue)
447+
updateContent(await getMarkdown((mdPath ? mdPath : path), response))
448448
document.querySelector('html').classList.add('loaded'); //// 防止缓存的页面被自定义 PJAX 中覆写的处理响应的函数捕获
449449
waitForAnimationsEnd(document.querySelector('.markdown-body'), '.content, .old-content', ['Animation-slideInRight', 'Animation-slideInLeft']).then(async () => {
450450
await showMarkdownEnded();

0 commit comments

Comments
 (0)