|
@@ -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.9.1 -->
|
|
|
|
|
|
|
+<!-- v 0.10.0 -->
|
|
|
|
|
|
|
|
<head>
|
|
<head>
|
|
|
<meta charset="utf-8">
|
|
<meta charset="utf-8">
|
|
@@ -18,8 +18,6 @@
|
|
|
// 使用 IIFE 包裹以避免全局变量污染
|
|
// 使用 IIFE 包裹以避免全局变量污染
|
|
|
(function () {
|
|
(function () {
|
|
|
// 加载动画相关
|
|
// 加载动画相关
|
|
|
- var loadingBar = document.querySelector('.loading-bar');
|
|
|
|
|
- var progress = document.querySelector('.loading-bar .progress');
|
|
|
|
|
var timer = null;
|
|
var timer = null;
|
|
|
|
|
|
|
|
// 文档解析功能相关
|
|
// 文档解析功能相关
|
|
@@ -37,14 +35,10 @@
|
|
|
// 自定义 PJAX 相关
|
|
// 自定义 PJAX 相关
|
|
|
const existPushState = (history && history.pushState);
|
|
const existPushState = (history && history.pushState);
|
|
|
|
|
|
|
|
- // 初始化加载动画相关元素
|
|
|
|
|
- function initAni() {
|
|
|
|
|
- loadingBar = document.querySelector('.loading-bar');
|
|
|
|
|
- progress = document.querySelector('.loading-bar .progress');
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
// 开始加载动画
|
|
// 开始加载动画
|
|
|
function startLoad() {
|
|
function startLoad() {
|
|
|
|
|
+ const loadingBar = document.querySelector('.loading-bar');
|
|
|
|
|
+ const progress = document.querySelector('.loading-bar .progress');
|
|
|
var loadingBarWidth = 20;
|
|
var loadingBarWidth = 20;
|
|
|
var MAX_LOADING_WIDTH = 95;
|
|
var MAX_LOADING_WIDTH = 95;
|
|
|
|
|
|
|
@@ -65,6 +59,8 @@
|
|
|
|
|
|
|
|
// 停止加载动画
|
|
// 停止加载动画
|
|
|
function endLoad() {
|
|
function endLoad() {
|
|
|
|
|
+ const loadingBar = document.querySelector('.loading-bar');
|
|
|
|
|
+ const progress = document.querySelector('.loading-bar .progress');
|
|
|
clearInterval(timer);
|
|
clearInterval(timer);
|
|
|
progress.style.width = '100%';
|
|
progress.style.width = '100%';
|
|
|
loadingBar.classList.remove('loading');
|
|
loadingBar.classList.remove('loading');
|
|
@@ -318,7 +314,6 @@
|
|
|
initTranslate(); //// 初始化页面翻译
|
|
initTranslate(); //// 初始化页面翻译
|
|
|
initPjax(); //// 初始化 Pjax
|
|
initPjax(); //// 初始化 Pjax
|
|
|
initCostumedPjax(); //// 初始化自定义 PJAX
|
|
initCostumedPjax(); //// 初始化自定义 PJAX
|
|
|
- initAni(); //// 初始化加载动画
|
|
|
|
|
if (existPushState) {
|
|
if (existPushState) {
|
|
|
history.pushState({ url: window.location.href, title: document.title, uid: window.location.href }, null, window.location.href);
|
|
history.pushState({ url: window.location.href, title: document.title, uid: window.location.href }, null, window.location.href);
|
|
|
}
|
|
}
|