From 3ce85d9e721943a0a05e51df459bf8e80e48e160 Mon Sep 17 00:00:00 2001 From: MHuiG <616001163@qq.com> Date: Thu, 8 Sep 2022 08:38:14 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=20pacejs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit An automatic web page progress bar. https://github.com/CodeByZach/pace BREAKING CHANGE: 移除 nprogress --- _cdn.yml | 25 +-- _config.yml | 9 +- layout/_partial/scripts/index.ejs | 4 + layout/_plugins/pace/script.ejs | 7 + layout/_plugins/pjax/animate.ejs | 31 ---- layout/_plugins/pjax/index.ejs | 3 - scripts/events/lib/cdn.js | 10 +- source/css/_style/_plugins/index.styl | 4 +- source/css/_style/_plugins/pjaxanimate.styl | 160 -------------------- 9 files changed, 45 insertions(+), 208 deletions(-) create mode 100644 layout/_plugins/pace/script.ejs delete mode 100644 layout/_plugins/pjax/animate.ejs delete mode 100644 source/css/_style/_plugins/pjaxanimate.styl diff --git a/_cdn.yml b/_cdn.yml index cac9b391e..81236ab07 100644 --- a/_cdn.yml +++ b/_cdn.yml @@ -253,13 +253,6 @@ pjax: npm: true static: true cdnjs: true -nprogress: - name: nprogress - file: nprogress.min.js - version: 0.2.0 - npm: true - static: true - cdnjs: true font-awesome-animation: name: font-awesome-animation file: css/font-awesome-animation.min.css @@ -427,8 +420,22 @@ artitalk: npm: true static: false cdnjs: false - - +pace_js: + name: pace-js + cdnjs_name: pace + file: pace.min.js + version: 1.2.4 + npm: true + static: false + cdnjs: true +pace_css: + name: pace-js + cdnjs_name: pace + file: themes/${pace_color}/pace-theme-${pace_theme}.css + version: 1.2.4 + npm: true + static: false + cdnjs: true diff --git a/_config.yml b/_config.yml index 3aa1c342f..1dd3e1218 100755 --- a/_config.yml +++ b/_config.yml @@ -838,11 +838,18 @@ plugins: cover: true # 封面是否pjax处理 false:每次切换页面封面都重载,适合封面较少的情况 true:封面经过Pjax处理,适合封面较多的情况 timeout: 5000 # The timeout in milliseconds for the XHR requests. Set to 0 to disable the timeout. cacheBust: false # When set to true, Pjax appends a timestamp to skip the browser cache. - animation: false # false, nprogress, circle exclude: # 被屏蔽的 url 地址将不启用 pjax 跳转,可以在控制台下使用 window.location.pathname 获取 # - '/artitalk/' # artitalk 不支持 pjax # - '/bbtalk/' # bbtalk 不支持 pjax + # pace + # An automatic web page progress bar. + # https://github.com/CodeByZach/pace + pace: + enable: true + color: blue # black, blue, green, orange, pink, purple, red, silver, white, yellow + theme: minimal # big-counter, bounce, barber-shop, center-atom, center-circle, center-radar, center-simple, corner-indicator, fill-left, flat-top, flash, loading-bar, mac-osx, material, minimal + # 暗黑模式 darkmode # 开关按钮:在 navbar.menu 中添加: # - name: 暗黑模式 # 可自定义 diff --git a/layout/_partial/scripts/index.ejs b/layout/_partial/scripts/index.ejs index 93d43d8ea..3a9bb387d 100644 --- a/layout/_partial/scripts/index.ejs +++ b/layout/_partial/scripts/index.ejs @@ -119,6 +119,10 @@ <%- partial('../../_plugins/swiper/script') %> <% } %> +<% if (theme.plugins.pace.enable) { %> + <%- partial('../../_plugins/pace/script') %> +<% } %> + <% if (page.plugins) { %> diff --git a/layout/_plugins/pace/script.ejs b/layout/_plugins/pace/script.ejs new file mode 100644 index 000000000..0989c5af1 --- /dev/null +++ b/layout/_plugins/pace/script.ejs @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/layout/_plugins/pjax/animate.ejs b/layout/_plugins/pjax/animate.ejs deleted file mode 100644 index 081c6d097..000000000 --- a/layout/_plugins/pjax/animate.ejs +++ /dev/null @@ -1,31 +0,0 @@ - - -
- <% if (theme.plugins.pjax.animation == 'nprogress') { %> - -
- - <%} else if (theme.plugins.pjax.animation == 'circle') { %> -
- - <% } %> - -
diff --git a/layout/_plugins/pjax/index.ejs b/layout/_plugins/pjax/index.ejs index 49707adbe..554230a41 100644 --- a/layout/_plugins/pjax/index.ejs +++ b/layout/_plugins/pjax/index.ejs @@ -10,9 +10,6 @@ %> <%- js(theme.cdn.pjax) %> -<% if (theme.plugins.pjax.animation){ %> -<%- partial('animate') %> -<% } %>