hexo-theme-volantis 4.3.1 → 5.0.0-alpha.112
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -4
- package/_config.yml +599 -246
- package/languages/en.yml +7 -0
- package/languages/zh-CN.yml +13 -2
- package/languages/zh-TW.yml +7 -0
- package/layout/404.ejs +1 -1
- package/layout/_meta/author.ejs +4 -4
- package/layout/_meta/category.ejs +11 -8
- package/layout/_meta/counter.ejs +29 -7
- package/layout/_meta/date.ejs +1 -1
- package/layout/_meta/music.ejs +1 -1
- package/layout/_meta/share.ejs +1 -1
- package/layout/_meta/tags.ejs +3 -0
- package/layout/_meta/thumbnail.ejs +3 -1
- package/layout/_meta/updated.ejs +1 -1
- package/layout/_meta/walinecount.ejs +2 -1
- package/layout/{_cover → _partial/_cover}/blank.ejs +0 -0
- package/layout/{_cover → _partial/_cover}/dock.ejs +1 -1
- package/layout/{_cover → _partial/_cover}/featured.ejs +1 -1
- package/layout/{_cover → _partial/_cover}/focus.ejs +1 -1
- package/layout/_partial/_cover/layout.ejs +8 -0
- package/layout/{_cover → _partial/_cover}/search.ejs +2 -2
- package/layout/_partial/archive.ejs +2 -2
- package/layout/_partial/article.ejs +21 -16
- package/layout/_partial/categories.ejs +1 -1
- package/layout/_partial/cover.ejs +8 -28
- package/layout/_partial/footer.ejs +19 -11
- package/layout/_partial/head.ejs +70 -116
- package/layout/_partial/header.ejs +17 -11
- package/layout/_partial/meta.ejs +18 -4
- package/layout/_partial/post.ejs +35 -9
- package/layout/_partial/scripts/_ctrl/cdnCtrl.ejs +126 -0
- package/layout/_partial/scripts/{coverCtrl.ejs → _ctrl/coverCtrl.ejs} +17 -25
- package/layout/_partial/scripts/_ctrl.ejs +2 -0
- package/layout/_partial/scripts/content-visibility-scroll-fix.ejs +88 -0
- package/layout/_partial/scripts/global.ejs +422 -109
- package/layout/_partial/scripts/index.ejs +91 -46
- package/layout/_partial/scripts/toc.ejs +98 -68
- package/layout/_partial/side.ejs +4 -1
- package/layout/_plugins/_page_plugins/artitalk/index.ejs +15 -0
- package/layout/_plugins/_page_plugins/bbtalk/index.ejs +10 -0
- package/layout/_plugins/_page_plugins/fcircle/index.ejs +12 -0
- package/layout/_plugins/_page_plugins/gitter/index.ejs +14 -0
- package/layout/_plugins/_page_plugins/indent/index.ejs +16 -0
- package/layout/_plugins/_page_plugins/index.ejs +27 -0
- package/layout/_plugins/_page_plugins/katex/index.ejs +13 -0
- package/layout/{_third-party/math/mathjax/script.ejs → _plugins/_page_plugins/mathjax/index.ejs} +2 -2
- package/layout/_plugins/_page_plugins/snackbar/index.ejs +55 -0
- package/layout/{_partial/scripts/counter.ejs → _plugins/analytics/LCCounter.ejs} +0 -0
- package/layout/{_third-party → _plugins}/analytics/script.ejs +43 -5
- package/layout/{_third-party → _plugins}/aplayer/layout.ejs +0 -0
- package/layout/_plugins/aplayer/script.ejs +74 -0
- package/layout/_plugins/chat/gitter/script.ejs +17 -0
- package/layout/_plugins/chat/index.ejs +1 -0
- package/layout/_plugins/chat/tidio/script.ejs +1 -0
- package/layout/_plugins/comments/artalk/script.ejs +59 -0
- package/layout/_plugins/comments/beaudar/script.ejs +61 -0
- package/layout/_plugins/comments/discuss/script.ejs +30 -0
- package/layout/_plugins/comments/disqus/script.ejs +98 -0
- package/layout/_plugins/comments/disqusjs/script.ejs +35 -0
- package/layout/_plugins/comments/giscus/script.ejs +47 -0
- package/layout/_plugins/comments/gitalk/script.ejs +24 -0
- package/layout/_plugins/comments/hashover/script.ejs +5 -0
- package/layout/{_third-party → _plugins}/comments/index.ejs +10 -3
- package/layout/_plugins/comments/isso/script.ejs +27 -0
- package/layout/_plugins/comments/livere/script.ejs +15 -0
- package/layout/_plugins/comments/twikoo/script.ejs +40 -0
- package/layout/_plugins/comments/utterances/script.ejs +43 -0
- package/layout/_plugins/comments/vssue/script.ejs +37 -0
- package/layout/_plugins/comments/waline/script.ejs +62 -0
- package/layout/_plugins/comments/z-custom/script.ejs +1 -0
- package/layout/_plugins/darkmode/script.ejs +114 -0
- package/layout/{_third-party → _plugins}/end-of-support/script.ejs +25 -8
- package/layout/_plugins/github-api/script.ejs +27 -0
- package/layout/_plugins/highlight/highlightjs/script.ejs +26 -0
- package/layout/_plugins/highlight/prismjs/script.ejs +25 -0
- package/layout/_plugins/highlight/script.ejs +1 -0
- package/layout/{_third-party → _plugins}/lazyload/script.ejs +1 -1
- package/layout/{_third-party → _plugins}/nodewaves/script.ejs +1 -1
- package/layout/_plugins/parallax/script.ejs +74 -0
- package/layout/{_third-party → _plugins}/pjax/animate.ejs +31 -31
- package/layout/_plugins/pjax/index.ejs +73 -0
- package/layout/_plugins/pjax/pdata.ejs +56 -0
- package/layout/{_third-party → _plugins}/preload/script.ejs +3 -3
- package/layout/_plugins/rightmenu/layout.ejs +119 -0
- package/layout/_plugins/rightmenus/layout.ejs +137 -0
- package/layout/_plugins/scrollreveal/script.ejs +25 -0
- package/layout/_plugins/search/script.ejs +50 -0
- package/layout/{_third-party → _plugins}/share/layout.ejs +0 -0
- package/layout/_plugins/swiper/script.ejs +37 -0
- package/layout/_pre.ejs +2 -2
- package/layout/_widget/_pre.ejs +5 -0
- package/layout/_widget/blogger.ejs +1 -1
- package/layout/_widget/category.ejs +2 -2
- package/layout/_widget/copyright.ejs +1 -1
- package/layout/_widget/grid.ejs +3 -3
- package/layout/_widget/lastupdate.ejs +27 -0
- package/layout/_widget/list.ejs +2 -2
- package/layout/_widget/load.ejs +18 -0
- package/layout/_widget/music.ejs +3 -2
- package/layout/_widget/page.ejs +1 -1
- package/layout/_widget/qrcode.ejs +1 -1
- package/layout/_widget/related_posts.ejs +1 -1
- package/layout/_widget/tagcloud.ejs +1 -1
- package/layout/_widget/text.ejs +1 -1
- package/layout/_widget/toc.ejs +6 -2
- package/layout/_widget/webinfo.ejs +13 -76
- package/layout/archive.ejs +4 -4
- package/layout/category.ejs +9 -4
- package/layout/docs.ejs +1 -1
- package/layout/friends.ejs +6 -25
- package/layout/index.ejs +1 -1
- package/layout/layout.ejs +30 -12
- package/layout/list.ejs +1 -1
- package/layout/page.ejs +1 -1
- package/layout/post.ejs +1 -1
- package/layout/tag.ejs +8 -3
- package/package.json +5 -3
- package/scripts/events/index.js +13 -0
- package/scripts/events/lib/check-configuration.js +43 -0
- package/scripts/events/lib/check-environment.js +74 -0
- package/scripts/events/lib/config.js +34 -9
- package/scripts/events/lib/render-stylus.js +78 -0
- package/scripts/events/lib/stellar-tag-utils.js +76 -0
- package/scripts/filters/content-visibility.js +25 -0
- package/scripts/{render → filters}/img.js +0 -0
- package/scripts/filters/replace.js +15 -0
- package/scripts/{z-lazyload/lib/process.js → filters/z-lazyload.js} +6 -3
- package/scripts/helpers/custom-files.js +165 -0
- package/scripts/helpers/first-style.js +19 -0
- package/scripts/helpers/head/autoCanonical.js +15 -0
- package/scripts/helpers/head/generate_preload_fontfamily.js +22 -0
- package/scripts/helpers/head/generate_seo.js +24 -0
- package/scripts/helpers/head/generate_title__keywords__description.js +101 -0
- package/scripts/{related_posts/index.js → helpers/related-posts.js} +1 -1
- package/scripts/helpers/revisioned.js +158 -0
- package/scripts/helpers/structured-data/index.js +2 -0
- package/scripts/helpers/structured-data/lib/blogposting.js +77 -0
- package/scripts/helpers/structured-data/lib/breadcrumblist.js +152 -0
- package/scripts/helpers/structured-data/lib/config.js +31 -0
- package/scripts/helpers/structured-data/lib/index.js +30 -0
- package/scripts/helpers/structured-data/lib/organization.js +15 -0
- package/scripts/helpers/structured-data/lib/person.js +16 -0
- package/scripts/helpers/structured-data/lib/website.js +42 -0
- package/scripts/tags/btn.js +6 -1
- package/scripts/tags/btns.js +7 -2
- package/scripts/tags/checkbox.js +12 -2
- package/scripts/tags/contributors.js +100 -0
- package/scripts/tags/dropmenu.js +18 -3
- package/scripts/tags/fancybox.js +44 -10
- package/scripts/tags/folding.js +6 -1
- package/scripts/tags/frame.js +6 -1
- package/scripts/tags/friends.js +99 -0
- package/scripts/tags/ghcard.js +6 -1
- package/scripts/tags/image.js +14 -2
- package/scripts/tags/link.js +6 -1
- package/scripts/tags/md.js +59 -0
- package/scripts/tags/media.js +25 -1
- package/scripts/tags/note.js +36 -3
- package/scripts/tags/site.js +87 -51
- package/scripts/tags/span.js +12 -2
- package/scripts/tags/swiper.js +38 -0
- package/scripts/tags/tabs.js +33 -3
- package/scripts/tags/timeline.js +6 -1
- package/source/css/Readme.md +28 -0
- package/source/css/_defines/AutoPrefixCSS.styl +347 -0
- package/source/css/_defines/Readme.md +3 -0
- package/source/css/_defines/color.styl +41 -1
- package/source/css/_defines/effect.styl +0 -13
- package/source/css/_defines/fonts.styl +17 -18
- package/source/css/_defines/func.styl +12 -30
- package/source/css/_first/base_first.styl +118 -0
- package/source/css/_first/{cover.styl → cover_first.styl} +113 -87
- package/source/css/_first/dark_first.styl +76 -0
- package/source/css/_first/fontfamily_first.styl +17 -0
- package/source/css/_first/{navbar.styl → navbar_first.styl} +4 -10
- package/source/css/_first/search_first.styl +12 -0
- package/source/css/{_base/index.styl → _style/_base/base.styl} +9 -93
- package/source/css/_style/_base/fontfamily_async.styl +8 -0
- package/source/css/{_layout → _style/_layout}/archive.styl +0 -0
- package/source/css/{_layout → _style/_layout}/article.styl +3 -30
- package/source/css/{_layout → _style/_layout}/footer.styl +0 -0
- package/source/css/_style/_layout/friends-simpleuser.styl +23 -0
- package/source/css/_style/_layout/friends-traditional.styl +81 -0
- package/source/css/{_layout → _style/_layout}/img.styl +0 -0
- package/source/css/_style/_layout/loading.styl +14 -0
- package/source/css/{_layout → _style/_layout}/main.styl +19 -7
- package/source/css/{_layout → _style/_layout}/md.styl +0 -0
- package/source/css/{_layout → _style/_layout}/pagination.styl +1 -1
- package/source/css/{_layout → _style/_layout}/posts.styl +2 -0
- package/source/css/{_first → _style/_layout}/search.styl +0 -103
- package/source/css/{_layout → _style/_layout}/sidebar.styl +23 -3
- package/source/css/{_layout → _style/_layout}/snackbar.styl +0 -0
- package/source/css/{_layout → _style/_layout}/toc.styl +3 -3
- package/source/css/{_layout → _style/_layout}/video.styl +0 -0
- package/source/css/_style/_plugins/_dark/dark_async.styl +41 -0
- package/source/css/_style/_plugins/_dark/dark_plugins.styl +136 -0
- package/source/css/_style/_plugins/_highlight/highlightjs/clipboard.styl +36 -0
- package/source/css/_style/_plugins/_highlight/highlightjs/color.styl +96 -0
- package/source/css/_style/_plugins/_highlight/highlightjs/index.styl +102 -0
- package/source/css/_style/_plugins/_highlight/highlightjs/language.styl +63 -0
- package/source/css/_style/_plugins/_highlight/index.styl +1 -0
- package/source/css/_style/_plugins/_highlight/prismjs/clipboard.styl +33 -0
- package/source/css/_style/_plugins/_highlight/prismjs/index.styl +8 -0
- package/source/css/_style/_plugins/_highlight/prismjs/language.styl +63 -0
- package/source/css/_style/_plugins/_rightmenu/reading.styl +56 -0
- package/source/css/{_plugins → _style/_plugins/_rightmenu}/rightmenu.styl +22 -2
- package/source/css/{_plugins → _style/_plugins}/aplayer.styl +8 -1
- package/source/css/{_plugins → _style/_plugins}/cursor.styl +49 -19
- package/source/css/_style/_plugins/fontcolor.styl +84 -0
- package/source/css/{_plugins → _style/_plugins}/gitalk.styl +0 -0
- package/source/css/_style/_plugins/index.styl +24 -0
- package/source/css/{_plugins → _style/_plugins}/mathjax.styl +0 -0
- package/source/css/_style/_plugins/message.styl +14 -0
- package/source/css/{_plugins → _style/_plugins}/pjaxanimate.styl +0 -0
- package/source/css/_style/_tag-plugins/Readme.md +6 -0
- package/source/css/{_tag-plugins → _style/_tag-plugins}/btns.styl +0 -0
- package/source/css/{_tag-plugins → _style/_tag-plugins}/checkbox.styl +0 -0
- package/source/css/{_tag-plugins → _style/_tag-plugins}/dropmenu.styl +0 -0
- package/source/css/{_plugins → _style/_tag-plugins}/fancybox.styl +8 -9
- package/source/css/{_tag-plugins → _style/_tag-plugins}/folding.styl +0 -0
- package/source/css/{_tag-plugins → _style/_tag-plugins}/frame.styl +0 -0
- package/source/css/_style/_tag-plugins/friends.styl +72 -0
- package/source/css/{_tag-plugins → _style/_tag-plugins}/ghcard.styl +0 -0
- package/source/css/{_tag-plugins → _style/_tag-plugins}/image.styl +0 -0
- package/source/css/{_tag-plugins → _style/_tag-plugins}/link.styl +0 -0
- package/source/css/{_tag-plugins → _style/_tag-plugins}/media.styl +0 -0
- package/source/css/{_tag-plugins → _style/_tag-plugins}/note.styl +0 -0
- package/source/css/_style/_tag-plugins/sites.styl +87 -0
- package/source/css/{_tag-plugins → _style/_tag-plugins}/span.styl +0 -0
- package/source/css/_style/_tag-plugins/swiper.styl +44 -0
- package/source/css/{_tag-plugins → _style/_tag-plugins}/table.styl +0 -0
- package/source/css/{_tag-plugins → _style/_tag-plugins}/tabs.styl +0 -0
- package/source/css/_style/_tag-plugins/tag.json +35 -0
- package/source/css/_style/_tag-plugins/text.styl +31 -0
- package/source/css/{_tag-plugins → _style/_tag-plugins}/timeline.styl +0 -0
- package/source/css/_style/index.styl +8 -0
- package/source/css/first.styl +17 -6
- package/source/css/style.styl +9 -7
- package/source/js/app.js +1051 -278
- package/source/js/plugins/aplayer.js +186 -0
- package/source/js/plugins/parallax.js +191 -0
- package/source/js/plugins/rightMenu.js +577 -0
- package/source/js/plugins/rightMenus.js +616 -0
- package/source/js/plugins/tags/contributors.js +92 -0
- package/source/js/plugins/tags/friends.js +93 -0
- package/source/js/plugins/tags/sites.js +96 -0
- package/source/js/search/hexo.js +180 -373
- package/.eslintrc.json +0 -111
- package/layout/_meta/valinecount.ejs +0 -15
- package/layout/_partial/rightmenu.ejs +0 -199
- package/layout/_partial/scripts/cover.ejs +0 -45
- package/layout/_partial/scripts/darkmode.ejs +0 -85
- package/layout/_partial/scripts/import.ejs +0 -3
- package/layout/_partial/scripts/issues.ejs +0 -18
- package/layout/_partial/scripts/search.ejs +0 -62
- package/layout/_partial/snackbar.ejs +0 -22
- package/layout/_third-party/aplayer/script.ejs +0 -26
- package/layout/_third-party/clipboard/script.ejs +0 -54
- package/layout/_third-party/comments/disqus/layout.ejs +0 -5
- package/layout/_third-party/comments/disqus/script.ejs +0 -90
- package/layout/_third-party/comments/disqusjs/layout.ejs +0 -1
- package/layout/_third-party/comments/disqusjs/script.ejs +0 -34
- package/layout/_third-party/comments/gitalk/layout.ejs +0 -1
- package/layout/_third-party/comments/gitalk/script.ejs +0 -22
- package/layout/_third-party/comments/hashover/layout.ejs +0 -2
- package/layout/_third-party/comments/hashover/script.ejs +0 -1
- package/layout/_third-party/comments/isso/layout.ejs +0 -1
- package/layout/_third-party/comments/isso/script.ejs +0 -1
- package/layout/_third-party/comments/livere/layout.ejs +0 -3
- package/layout/_third-party/comments/livere/script.ejs +0 -10
- package/layout/_third-party/comments/minivaline/layout.ejs +0 -3
- package/layout/_third-party/comments/minivaline/script.ejs +0 -34
- package/layout/_third-party/comments/twikoo/layout.ejs +0 -3
- package/layout/_third-party/comments/twikoo/script.ejs +0 -32
- package/layout/_third-party/comments/valine/layout.ejs +0 -3
- package/layout/_third-party/comments/valine/script.ejs +0 -49
- package/layout/_third-party/comments/vssue/layout.ejs +0 -1
- package/layout/_third-party/comments/vssue/script.ejs +0 -21
- package/layout/_third-party/comments/waline/layout.ejs +0 -3
- package/layout/_third-party/comments/waline/script.ejs +0 -33
- package/layout/_third-party/fancybox/script.ejs +0 -61
- package/layout/_third-party/highlightjs/script.ejs +0 -11
- package/layout/_third-party/pjax/index.ejs +0 -78
- package/layout/_third-party/pjax/pdata.ejs +0 -53
- package/layout/_third-party/scrollreveal/script.ejs +0 -21
- package/layout/_third-party/tidio/script.ejs +0 -3
- package/layout/artitalk.ejs +0 -13
- package/layout/bb.ejs +0 -10
- package/package-lock.json +0 -916
- package/scripts/tags/issues.js +0 -41
- package/scripts/z-lazyload/index.js +0 -4
- package/source/css/_highlight/index.styl +0 -316
- package/source/css/_layout/friends.styl +0 -79
- package/source/css/_plugins/clipboard.styl +0 -37
- package/source/css/_plugins/dark.styl +0 -149
- package/source/css/_plugins/darkmode.styl +0 -9
- package/source/css/_plugins/index.styl +0 -18
- package/source/css/_plugins/twikoo.styl +0 -21
- package/source/css/_plugins/valine.styl +0 -183
- package/source/css/_tag-plugins/simpleuser.styl +0 -21
- package/source/css/_tag-plugins/site-card.styl +0 -70
- package/source/js/aplayer.js +0 -167
- package/source/js/issues.js +0 -186
- package/source/js/search/algolia.js +0 -344
- package/source/js/search/azure.js +0 -355
- package/source/js/search/baidu.js +0 -340
- package/source/js/search/google.js +0 -339
- package/source/js/valine.js +0 -5137
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
volantis.layoutHelper("comments",`<div id="waline"><i class="fa-solid fa-cog fa-spin fa-fw fa-2x"></i></div>`)
|
|
3
|
+
|
|
4
|
+
function pjax_waline() {
|
|
5
|
+
if(!document.querySelector("#waline"))return;
|
|
6
|
+
let locale = {};
|
|
7
|
+
let path = pdata.commentPath;
|
|
8
|
+
let pagePlaceholder = pdata.commentPlaceholder || "<%= theme.comments.waline.placeholder %>";
|
|
9
|
+
if (path.length == 0) {
|
|
10
|
+
let defaultPath = '<%= theme.comments.waline.path %>';
|
|
11
|
+
path = defaultPath || decodeURI(window.location.pathname);
|
|
12
|
+
}
|
|
13
|
+
if(pagePlaceholder.length != 0) {
|
|
14
|
+
locale.placeholder = pagePlaceholder;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
try {
|
|
18
|
+
Waline.init(Object.assign(Object.assign(<%- JSON.stringify(theme.comments.waline) %>, {
|
|
19
|
+
el: '#waline',
|
|
20
|
+
path: path,
|
|
21
|
+
// https://github.com/volantis-x/hexo-theme-volantis/issues/713
|
|
22
|
+
<% if(!!theme.comments.waline.imageUploader?.api){ %>
|
|
23
|
+
imageUploader: function(file) {
|
|
24
|
+
let headers = new Headers();
|
|
25
|
+
headers.set('Accept', 'application/json');
|
|
26
|
+
<% if(!!theme.comments.waline.imageUploader?.token) { %>
|
|
27
|
+
headers.set('Authorization', '<%= theme.comments.waline.imageUploader?.token %>')
|
|
28
|
+
<% } %>
|
|
29
|
+
let formData = new FormData();
|
|
30
|
+
formData.append('file', file);
|
|
31
|
+
return fetch('<%= theme.comments.waline.imageUploader?.api %>',{
|
|
32
|
+
method: 'POST',
|
|
33
|
+
body: formData,
|
|
34
|
+
headers: headers
|
|
35
|
+
}).then((resp) => resp.json())
|
|
36
|
+
.then((resp) => resp.<%= theme.comments.waline.imageUploader?.resp %>)
|
|
37
|
+
},
|
|
38
|
+
<% } %>
|
|
39
|
+
locale,
|
|
40
|
+
}),pdata.commentConfig));
|
|
41
|
+
} catch (error) {
|
|
42
|
+
alert(`Waline ${error}`)
|
|
43
|
+
}
|
|
44
|
+
fancybox_waline()
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function fancybox_waline() {
|
|
48
|
+
if(typeof VolantisFancyBox === "undefined") {
|
|
49
|
+
const checkFancyBox = setInterval(() => {
|
|
50
|
+
if(typeof VolantisFancyBox === "undefined") return;
|
|
51
|
+
clearInterval(checkFancyBox);
|
|
52
|
+
VolantisFancyBox.bind('#waline .wl-content img:not(.wl-emoji)');
|
|
53
|
+
})
|
|
54
|
+
} else {
|
|
55
|
+
VolantisFancyBox.bind('#waline .wl-content img:not(.wl-emoji)');
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
volantis.css('<%= theme.comments.waline.css %>')
|
|
60
|
+
volantis.js('<%- theme.comments.waline.js %>').then(pjax_waline)
|
|
61
|
+
volantis.pjax.push(pjax_waline);
|
|
62
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<!-- 这里是使用 Custom Files 自定义文件 注入评论系统的占位 -->
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
const rootElement = document.documentElement;
|
|
3
|
+
const darkModeStorageKey = "color-scheme";
|
|
4
|
+
const rootElementDarkModeAttributeName = "color-scheme";
|
|
5
|
+
const setLS = (k, v) => {
|
|
6
|
+
localStorage.setItem(k, v);
|
|
7
|
+
};
|
|
8
|
+
const removeLS = (k) => {
|
|
9
|
+
localStorage.removeItem(k);
|
|
10
|
+
};
|
|
11
|
+
const getLS = (k) => {
|
|
12
|
+
return localStorage.getItem(k);
|
|
13
|
+
};
|
|
14
|
+
const getModeFromCSSMediaQuery = () => {
|
|
15
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches
|
|
16
|
+
? "dark"
|
|
17
|
+
: "light";
|
|
18
|
+
};
|
|
19
|
+
const resetRootDarkModeAttributeAndLS = () => {
|
|
20
|
+
rootElement.removeAttribute(rootElementDarkModeAttributeName);
|
|
21
|
+
removeLS(darkModeStorageKey);
|
|
22
|
+
};
|
|
23
|
+
const validColorModeKeys = {
|
|
24
|
+
dark: true,
|
|
25
|
+
light: true,
|
|
26
|
+
};
|
|
27
|
+
const applyCustomDarkModeSettings = (mode) => {
|
|
28
|
+
const currentSetting = mode || getLS(darkModeStorageKey);
|
|
29
|
+
getCustomDarkMode();
|
|
30
|
+
if (currentSetting === getModeFromCSSMediaQuery()) {
|
|
31
|
+
resetRootDarkModeAttributeAndLS();
|
|
32
|
+
} else if (validColorModeKeys[currentSetting]) {
|
|
33
|
+
rootElement.setAttribute(rootElementDarkModeAttributeName, currentSetting);
|
|
34
|
+
} else {
|
|
35
|
+
resetRootDarkModeAttributeAndLS();
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
const invertDarkModeObj = {
|
|
39
|
+
dark: "light",
|
|
40
|
+
light: "dark",
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* get target mode
|
|
44
|
+
*/
|
|
45
|
+
const getCustomDarkMode = () => {
|
|
46
|
+
let currentSetting = getLS(darkModeStorageKey);
|
|
47
|
+
if (validColorModeKeys[currentSetting]) {
|
|
48
|
+
currentSetting = invertDarkModeObj[currentSetting];
|
|
49
|
+
} else if (currentSetting === null) {
|
|
50
|
+
currentSetting = invertDarkModeObj[getModeFromCSSMediaQuery()];
|
|
51
|
+
} else {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if(currentSetting=="dark"){
|
|
55
|
+
volantis.dark.mode="light";
|
|
56
|
+
}else{
|
|
57
|
+
volantis.dark.mode="dark";
|
|
58
|
+
}
|
|
59
|
+
// console.log(volantis.dark.mode)
|
|
60
|
+
};
|
|
61
|
+
const toggleCustomDarkMode = () => {
|
|
62
|
+
let currentSetting = getLS(darkModeStorageKey);
|
|
63
|
+
if (validColorModeKeys[currentSetting]) {
|
|
64
|
+
currentSetting = invertDarkModeObj[currentSetting];
|
|
65
|
+
} else if (currentSetting === null) {
|
|
66
|
+
currentSetting = invertDarkModeObj[getModeFromCSSMediaQuery()];
|
|
67
|
+
} else {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
setLS(darkModeStorageKey, currentSetting);
|
|
71
|
+
return currentSetting;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* 暗黑模式触发器
|
|
75
|
+
*/
|
|
76
|
+
volantis.dark.toggle=()=>{
|
|
77
|
+
const mode = toggleCustomDarkMode();
|
|
78
|
+
applyCustomDarkModeSettings(mode);
|
|
79
|
+
// 使用 volantis.dark.push 方法传入volantis.dark.toggle回调函数 参见layout/_partial/scripts/global.ejs
|
|
80
|
+
volantis.dark.method.toggle.start();
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* bind event for toggle button
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
function bindToggleButton() {
|
|
87
|
+
var btn= document.querySelectorAll("#wrapper .toggle-mode-btn,#rightmenu-wrapper .toggle-mode-btn")
|
|
88
|
+
btn.forEach(function (e) {
|
|
89
|
+
volantis.dom.$(e).on('click',volantis.dark.toggle);
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
applyCustomDarkModeSettings();
|
|
93
|
+
document.addEventListener("DOMContentLoaded", ()=>{
|
|
94
|
+
volantis.requestAnimationFrame(bindToggleButton)
|
|
95
|
+
});
|
|
96
|
+
volantis.pjax.push(bindToggleButton);
|
|
97
|
+
|
|
98
|
+
const darkModelListeners={
|
|
99
|
+
dark:(mediaQueryList )=>{
|
|
100
|
+
if(mediaQueryList.matches){
|
|
101
|
+
volantis.dark.mode = "dark";
|
|
102
|
+
}
|
|
103
|
+
volantis.dark.method.toggle.start();
|
|
104
|
+
},
|
|
105
|
+
light:(mediaQueryList)=>{
|
|
106
|
+
if(mediaQueryList.matches){
|
|
107
|
+
volantis.dark.mode = "light";
|
|
108
|
+
}
|
|
109
|
+
volantis.dark.method.toggle.start();
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
window.matchMedia('(prefers-color-scheme: dark)').addListener(darkModelListeners.dark)
|
|
113
|
+
window.matchMedia('(prefers-color-scheme: light)').addListener(darkModelListeners.light)
|
|
114
|
+
</script>
|
|
@@ -13,12 +13,20 @@ if (/*@cc_on!@*/false || (!!window.MSInputMethodContext && !!document.documentMo
|
|
|
13
13
|
'margin-top: 15%;'+
|
|
14
14
|
'margin-bottom: 5500%;'+
|
|
15
15
|
'}'+
|
|
16
|
+
'.kill-t{'+
|
|
17
|
+
'font-size: 2rem;'+
|
|
18
|
+
'}'+
|
|
19
|
+
'.kill-c{'+
|
|
20
|
+
'font-size: 1.2rem;'+
|
|
21
|
+
'}'+
|
|
22
|
+
'#l_header,#l_body{'+
|
|
23
|
+
'display: none;'+
|
|
24
|
+
'}'+
|
|
16
25
|
'</style>'+
|
|
17
26
|
'<div class="kill-ie">'+
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
'<a href="https://www.microsoft.com/zh-cn/WindowsForBusiness/End-of-IE-support"><strong>了解详情 ></strong></a>'+
|
|
27
|
+
`<span class="kill-t"><b><%- __('kill.title')%></b></span><br/>`+
|
|
28
|
+
`<span class="kill-c"><%- __('kill.ie')%></span><br/>`+
|
|
29
|
+
`<a href="https://www.microsoft.com/zh-cn/WindowsForBusiness/End-of-IE-support"><strong><%- __('kill.more')%></strong></a>`+
|
|
22
30
|
'</div>');
|
|
23
31
|
</script>
|
|
24
32
|
<% } %>
|
|
@@ -35,11 +43,20 @@ if (/*@cc_on!@*/false || (!!window.MSInputMethodContext && !!document.documentMo
|
|
|
35
43
|
margin-top: 15%;
|
|
36
44
|
margin-bottom: 5500%;
|
|
37
45
|
}
|
|
46
|
+
.kill-t{
|
|
47
|
+
font-size: 2rem;
|
|
48
|
+
}
|
|
49
|
+
.kill-c{
|
|
50
|
+
font-size: 1.2rem;
|
|
51
|
+
}
|
|
52
|
+
#l_header,#l_body{
|
|
53
|
+
display: none;
|
|
54
|
+
}
|
|
38
55
|
</style>
|
|
39
56
|
<div class="kill-noscript">
|
|
40
|
-
<
|
|
41
|
-
<
|
|
42
|
-
<a href="https://www.baidu.com/s?wd=启用JavaScript"><strong
|
|
57
|
+
<span class="kill-t"><b><%- __('kill.title')%></b></span><br/>
|
|
58
|
+
<span class="kill-c"><%- __('kill.noscript')%></span><br/>
|
|
59
|
+
<a href="https://www.baidu.com/s?wd=启用JavaScript"><strong><%- __('kill.more')%></strong></a>
|
|
43
60
|
</div>
|
|
44
61
|
</noscript>
|
|
45
|
-
<% } %>
|
|
62
|
+
<% } %>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
function loadIssuesJS() {
|
|
3
|
+
<% if (theme.plugins.sitesjs.enable) { %>
|
|
4
|
+
const sites_api = document.getElementById('sites-api');
|
|
5
|
+
if (sites_api != undefined && typeof SitesJS === 'undefined') {
|
|
6
|
+
volantis.js("<%- theme.cdn.map.js.sites %>")
|
|
7
|
+
}
|
|
8
|
+
<% } %>
|
|
9
|
+
<% if (theme.plugins.friendsjs.enable) { %>
|
|
10
|
+
const friends_api = document.getElementById('friends-api');
|
|
11
|
+
if (friends_api != undefined && typeof FriendsJS === 'undefined') {
|
|
12
|
+
volantis.js("<%- theme.cdn.map.js.friends %>")
|
|
13
|
+
}
|
|
14
|
+
<% } %>
|
|
15
|
+
<% if (theme.plugins.contributorsjs.enable) { %>
|
|
16
|
+
const contributors_api = document.getElementById('contributors-api');
|
|
17
|
+
if (contributors_api != undefined && typeof ContributorsJS === 'undefined') {
|
|
18
|
+
volantis.js("<%- theme.cdn.map.js.contributors %>")
|
|
19
|
+
}
|
|
20
|
+
<% } %>
|
|
21
|
+
};
|
|
22
|
+
loadIssuesJS()
|
|
23
|
+
volantis.pjax.push(()=>{
|
|
24
|
+
loadIssuesJS();
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
</script>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
<% if (theme.plugins.highlightjs.css) { %>
|
|
3
|
+
volantis.css("<%- theme.plugins.highlightjs.css %>");
|
|
4
|
+
<% } %>
|
|
5
|
+
<% if (theme.plugins.highlightjs.js) { %>
|
|
6
|
+
volantis.js("<%- theme.plugins.highlightjs.js %>").then(()=>{
|
|
7
|
+
volantis.requestAnimationFrame(hljs.highlightAll)
|
|
8
|
+
})
|
|
9
|
+
volantis.pjax.push(()=>{
|
|
10
|
+
document.querySelectorAll('pre code').forEach((block) => {
|
|
11
|
+
hljs.highlightElement(block);
|
|
12
|
+
});
|
|
13
|
+
},"highlightjs")
|
|
14
|
+
<% } %>
|
|
15
|
+
<% if(theme.plugins.highlightjs.copy_code){ %>
|
|
16
|
+
function pjax_highlightjs_copyCode(){
|
|
17
|
+
if (!(document.querySelector(".highlight .code pre") ||
|
|
18
|
+
document.querySelector(".article pre code"))) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
VolantisApp.utilCopyCode(".highlight .code pre, .article pre code")
|
|
22
|
+
}
|
|
23
|
+
volantis.requestAnimationFrame(pjax_highlightjs_copyCode)
|
|
24
|
+
volantis.pjax.push(pjax_highlightjs_copyCode)
|
|
25
|
+
<% } %>
|
|
26
|
+
</script>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<% (theme.plugins.prismjs.js||[]).forEach(function(item) { %>
|
|
2
|
+
<%- js(item) %>
|
|
3
|
+
<% }) %>
|
|
4
|
+
<% (theme.plugins.prismjs.css||[]).forEach(function(item) { %>
|
|
5
|
+
<%- css(item) %>
|
|
6
|
+
<% }) %>
|
|
7
|
+
<script>
|
|
8
|
+
<% if(theme.plugins.prismjs.copy_code){ %>
|
|
9
|
+
function pjax_prismjs_copyCode(){
|
|
10
|
+
if (!document.querySelector("pre")) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
let pres = document.querySelectorAll("pre")
|
|
14
|
+
pres.forEach(pre=>{
|
|
15
|
+
var wrapper = document.createElement('div');
|
|
16
|
+
wrapper.classList.add('code-toolbar');
|
|
17
|
+
pre.parentNode.insertBefore(wrapper, pre);
|
|
18
|
+
wrapper.appendChild(pre);
|
|
19
|
+
})
|
|
20
|
+
VolantisApp.utilCopyCode(".code-toolbar pre")
|
|
21
|
+
}
|
|
22
|
+
volantis.requestAnimationFrame(pjax_prismjs_copyCode)
|
|
23
|
+
volantis.pjax.push(pjax_prismjs_copyCode)
|
|
24
|
+
<% } %>
|
|
25
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%- partial(theme.plugins.code_highlight + '/script') %>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script defer src="<%- theme.plugins.lazyload.js
|
|
1
|
+
<script defer src="<%- theme.plugins.lazyload.js %>"></script>
|
|
2
2
|
<script>
|
|
3
3
|
// https://www.npmjs.com/package/vanilla-lazyload
|
|
4
4
|
// Set the options globally
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<%- js({src: theme.plugins.nodewaves.js}) %>
|
|
2
2
|
<script type="text/javascript">
|
|
3
|
-
|
|
3
|
+
document.addEventListener("DOMContentLoaded", function () {
|
|
4
4
|
Waves.attach('.flat-btn', ['waves-button']);
|
|
5
5
|
Waves.attach('.float-btn', ['waves-button', 'waves-float']);
|
|
6
6
|
Waves.attach('.float-btn-light', ['waves-button', 'waves-float', 'waves-light']);
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<%_
|
|
2
|
+
theme.plugins.parallax.images = theme.plugins.parallax.images || page.images;
|
|
3
|
+
if (theme.plugins.parallax.shuffle) {
|
|
4
|
+
// shuffle 只一次 防止 hash 变化
|
|
5
|
+
if (typeof theme.plugins.parallax.shuffle_end==='undefined') {
|
|
6
|
+
shuffle(theme.plugins.parallax.images);
|
|
7
|
+
theme.plugins.parallax.shuffle_end=1;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
function shuffle(arr){
|
|
11
|
+
var n = arr.length;
|
|
12
|
+
while(n--) {
|
|
13
|
+
var index = Math.floor(Math.random() * n);
|
|
14
|
+
var temp = arr[index];
|
|
15
|
+
arr[index] = arr[n];
|
|
16
|
+
arr[n] = temp;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
_%>
|
|
20
|
+
<script>
|
|
21
|
+
let imgs = <%- JSON.stringify(theme.plugins.parallax.images) %>;
|
|
22
|
+
let index = 0;
|
|
23
|
+
let IntervalParallax = null;
|
|
24
|
+
|
|
25
|
+
function parallax(){
|
|
26
|
+
let ParallaxWindow = document.querySelector("#parallax-window");
|
|
27
|
+
<% if (theme.plugins.parallax.position=="fixed") { %>
|
|
28
|
+
ParallaxWindow = document.querySelector("html");
|
|
29
|
+
<% } %>
|
|
30
|
+
Parallax.window = ParallaxWindow;
|
|
31
|
+
Parallax.options.fade = <%- theme.plugins.parallax.fade %>;
|
|
32
|
+
Parallax.cache = 1;
|
|
33
|
+
next_parallax();
|
|
34
|
+
Parallax.init();
|
|
35
|
+
if (imgs.length>1) {
|
|
36
|
+
IntervalParallax = setInterval(function () {
|
|
37
|
+
next_parallax();
|
|
38
|
+
}, '<%- theme.plugins.parallax.duration %>');
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function next_parallax() {
|
|
43
|
+
if (typeof Parallax == "undefined") {
|
|
44
|
+
return
|
|
45
|
+
}
|
|
46
|
+
<% if (theme.plugins.parallax.position!="fixed") { %>
|
|
47
|
+
if (!document.querySelector("#full")&&!document.querySelector("#half")) {
|
|
48
|
+
return
|
|
49
|
+
}
|
|
50
|
+
<% } %>
|
|
51
|
+
if (imgs.length>=1) {
|
|
52
|
+
Parallax.options.src = imgs[index % imgs.length];
|
|
53
|
+
Parallax.start();
|
|
54
|
+
index++;
|
|
55
|
+
if (Parallax.cache) {
|
|
56
|
+
fetch(imgs[index % imgs.length] +"?t=" + new Date().getTime());
|
|
57
|
+
if (index == imgs.length) {
|
|
58
|
+
Parallax.cache = 0;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
var runningOnBrowser = typeof window !== "undefined";
|
|
64
|
+
var isBot = runningOnBrowser && !("onscroll" in window) || typeof navigator !== "undefined" && /(gle|ing|ro|msn)bot|crawl|spider|yand|duckgo/i.test(navigator.userAgent);
|
|
65
|
+
if (!isBot) {
|
|
66
|
+
volantis.js('<%- theme.cdn.map.js.parallax %>').then(()=>{
|
|
67
|
+
parallax()
|
|
68
|
+
})
|
|
69
|
+
volantis.pjax.send(()=>{
|
|
70
|
+
clearInterval(IntervalParallax)
|
|
71
|
+
},"clearIntervalParallax");
|
|
72
|
+
volantis.pjax.push(parallax);
|
|
73
|
+
}
|
|
74
|
+
</script>
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
<!-- 样式位于:source/css/
|
|
2
|
-
|
|
3
|
-
<div class="pjax-animate">
|
|
4
|
-
<% if (theme.plugins.pjax.animation == 'nprogress') { %>
|
|
5
|
-
<script src="
|
|
6
|
-
<div id="loading-bar-wrapper"><script>NProgress.configure({parent:"#loading-bar-wrapper",trickleSpeed: 100})</script></div>
|
|
7
|
-
<script>
|
|
8
|
-
window.ShowLoading = function() {
|
|
9
|
-
NProgress.start();
|
|
10
|
-
};
|
|
11
|
-
window.HideLoading = function() {
|
|
12
|
-
NProgress.done();
|
|
13
|
-
}
|
|
14
|
-
</script>
|
|
15
|
-
<%} else if (theme.plugins.pjax.animation == 'circle') { %>
|
|
16
|
-
<div class="loading-circle"><div id="loader-circle"></div></div>
|
|
17
|
-
<script>
|
|
18
|
-
window.ShowLoading = function() {
|
|
19
|
-
|
|
20
|
-
};
|
|
21
|
-
window.HideLoading = function() {
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
</script>
|
|
25
|
-
<% } %>
|
|
26
|
-
<script>
|
|
27
|
-
volantis.pjax.push(window.HideLoading,'HideLoading');
|
|
28
|
-
volantis.pjax.send(window.ShowLoading,'ShowLoading');
|
|
29
|
-
volantis.pjax.error(window.HideLoading,'HideLoading');
|
|
30
|
-
</script>
|
|
31
|
-
</div>
|
|
1
|
+
<!-- 样式位于:source/css/_plugins/pjaxanimate.styl -->
|
|
2
|
+
|
|
3
|
+
<div class="pjax-animate">
|
|
4
|
+
<% if (theme.plugins.pjax.animation == 'nprogress') { %>
|
|
5
|
+
<script src="<%- theme.plugins.pjax.nprogress %>"></script>
|
|
6
|
+
<div id="loading-bar-wrapper"><script>NProgress.configure({parent:"#loading-bar-wrapper",trickleSpeed: 100})</script></div>
|
|
7
|
+
<script>
|
|
8
|
+
window.ShowLoading = function() {
|
|
9
|
+
NProgress.start();
|
|
10
|
+
};
|
|
11
|
+
window.HideLoading = function() {
|
|
12
|
+
NProgress.done();
|
|
13
|
+
}
|
|
14
|
+
</script>
|
|
15
|
+
<%} else if (theme.plugins.pjax.animation == 'circle') { %>
|
|
16
|
+
<div class="loading-circle"><div id="loader-circle"></div></div>
|
|
17
|
+
<script>
|
|
18
|
+
window.ShowLoading = function() {
|
|
19
|
+
document.querySelector(".loading-circle").style.display="block"
|
|
20
|
+
};
|
|
21
|
+
window.HideLoading = function() {
|
|
22
|
+
document.querySelector(".loading-circle").style.display="none"
|
|
23
|
+
}
|
|
24
|
+
</script>
|
|
25
|
+
<% } %>
|
|
26
|
+
<script>
|
|
27
|
+
volantis.pjax.push(window.HideLoading,'HideLoading');
|
|
28
|
+
volantis.pjax.send(window.ShowLoading,'ShowLoading');
|
|
29
|
+
volantis.pjax.error(window.HideLoading,'HideLoading');
|
|
30
|
+
</script>
|
|
31
|
+
</div>
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
pjax重载区域接口:
|
|
3
|
+
1. <pjax></pjax> 标签 pjax 标签必须存在于所有页面 否则 pjax error
|
|
4
|
+
2. script[data-pjax]
|
|
5
|
+
3. .pjax-reload script
|
|
6
|
+
4. .pjax
|
|
7
|
+
-->
|
|
8
|
+
<%
|
|
9
|
+
var banUrl = theme.plugins.pjax.banUrl || [];
|
|
10
|
+
%>
|
|
11
|
+
|
|
12
|
+
<%- js(theme.plugins.pjax.js) %>
|
|
13
|
+
<% if (theme.plugins.pjax.animation){ %>
|
|
14
|
+
<%- partial('animate') %>
|
|
15
|
+
<% } %>
|
|
16
|
+
<script>
|
|
17
|
+
var pjax;
|
|
18
|
+
document.addEventListener('DOMContentLoaded', function () {
|
|
19
|
+
pjax = new Pjax({
|
|
20
|
+
elements: 'a[href]:not([href^="#"]):not([href="javascript:void(0)"]):not([pjax-fancybox]):not([onclick="return false;"]):not([onclick="return!1"]):not([target="_blank"]):not([target="view_window"]):not([href$=".xml"])',
|
|
21
|
+
selectors: [
|
|
22
|
+
"head title",
|
|
23
|
+
"head meta[name=keywords]",
|
|
24
|
+
"head meta[name=description]",
|
|
25
|
+
<% if (!theme.plugins.pjax.cover){ %>"#l_cover",<% } %>
|
|
26
|
+
"#l_main",
|
|
27
|
+
"#pjax-header-nav-list",
|
|
28
|
+
".pjax",
|
|
29
|
+
"pjax", // <pjax></pjax> 标签
|
|
30
|
+
"script[data-pjax], .pjax-reload script" // script标签添加data-pjax 或 script标签外层添加.pjax-reload 的script代码段重载
|
|
31
|
+
],
|
|
32
|
+
cacheBust: <%= theme.plugins.pjax.cacheBust %>, // url 地址追加时间戳,用以避免浏览器缓存
|
|
33
|
+
timeout: <%= theme.plugins.pjax.timeout %>,
|
|
34
|
+
<% if (theme.debug){ %> debug: true,<% } %>
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
document.addEventListener('pjax:send', function (e) {
|
|
39
|
+
//window.stop(); // 相当于点击了浏览器的停止按钮
|
|
40
|
+
|
|
41
|
+
try {
|
|
42
|
+
var currentUrl = window.location.pathname;
|
|
43
|
+
var targetUrl = e.triggerElement.href;
|
|
44
|
+
var banUrl = <%- '["' + banUrl.join('", "') + '"]' %>;
|
|
45
|
+
if (banUrl[0] != "") {
|
|
46
|
+
banUrl.forEach(item => {
|
|
47
|
+
if(currentUrl.indexOf(item) != -1 || targetUrl.indexOf(item) != -1) {
|
|
48
|
+
window.location.href = targetUrl;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
} catch (error) {}
|
|
53
|
+
|
|
54
|
+
// 使用 volantis.pjax.send 方法传入pjax:send回调函数 参见layout/_partial/scripts/global.ejs
|
|
55
|
+
volantis.pjax.method.send.start();
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
document.addEventListener('pjax:complete', function () {
|
|
59
|
+
// 使用 volantis.pjax.push 方法传入重载函数 参见layout/_partial/scripts/global.ejs
|
|
60
|
+
volantis.pjax.method.complete.start();
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
document.addEventListener('pjax:error', function (e) {
|
|
64
|
+
if(volantis.debug) {
|
|
65
|
+
console.error(e);
|
|
66
|
+
console.log('pjax error: \n' + JSON.stringify(e));
|
|
67
|
+
}else{
|
|
68
|
+
// 使用 volantis.pjax.error 方法传入pjax:error回调函数 参见layout/_partial/scripts/global.ejs
|
|
69
|
+
volantis.pjax.method.error.start();
|
|
70
|
+
window.location.href = e.triggerElement.href;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
</script>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<!--此文件用来存放一些不方便取值的变量-->
|
|
2
|
+
<!--思路大概是将值藏到重加载的区域内-->
|
|
3
|
+
<%
|
|
4
|
+
var commentPath = ''; // 自定义的评论路径
|
|
5
|
+
var commentPlaceholder = ''; // 自定义的评论描述
|
|
6
|
+
var commentConfig = {}; // 自定义的评论配置
|
|
7
|
+
var ispage = false; // 一二级导航栏切换控制
|
|
8
|
+
var postTitle = ''; // 当前文章标题,用于二级导航栏赋值
|
|
9
|
+
if (theme.comments.service && theme.comments.service.length > 0) {
|
|
10
|
+
let service = theme.comments.service;
|
|
11
|
+
if (page.comments == undefined || page.comments != false) {
|
|
12
|
+
if (service in page) {
|
|
13
|
+
if (page[service].path) {
|
|
14
|
+
commentPath = page[service].path;
|
|
15
|
+
}
|
|
16
|
+
if (page[service].placeholder) {
|
|
17
|
+
commentPlaceholder = page[service].placeholder;
|
|
18
|
+
}
|
|
19
|
+
if (page[service].config) {
|
|
20
|
+
commentConfig = page[service].config;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (page && page.layout == 'post' && page.title) {
|
|
26
|
+
ispage = true;
|
|
27
|
+
postTitle = page.title;
|
|
28
|
+
}
|
|
29
|
+
%>
|
|
30
|
+
<pjax>
|
|
31
|
+
<script>
|
|
32
|
+
window.pdata={}
|
|
33
|
+
pdata.ispage=<%=ispage%>;
|
|
34
|
+
pdata.commentPath="<%=commentPath%>";
|
|
35
|
+
pdata.commentPlaceholder="<%=commentPlaceholder%>";
|
|
36
|
+
pdata.commentConfig=<%- JSON.stringify(commentConfig) %>;
|
|
37
|
+
// see: /layout/_partial/scripts/_ctrl/coverCtrl.ejs
|
|
38
|
+
<% if (theme.plugins.pjax.enable) {%>
|
|
39
|
+
// header
|
|
40
|
+
var l_header=document.getElementById("l_header");
|
|
41
|
+
<% if (theme.pjax_cover.frontMatterCover == "none") {%>
|
|
42
|
+
l_header.classList.add("show");
|
|
43
|
+
<% } else {%>
|
|
44
|
+
l_header.classList.remove("show");
|
|
45
|
+
<% }%>
|
|
46
|
+
<% if (theme.plugins.pjax.cover) {%>
|
|
47
|
+
// cover
|
|
48
|
+
var cover_wrapper=document.querySelector('#l_cover .cover-wrapper');
|
|
49
|
+
var scroll_down=document.getElementById('scroll-down');
|
|
50
|
+
cover_wrapper.id="<%=theme.pjax_cover.frontMatterCover%>";
|
|
51
|
+
cover_wrapper.style.display="<%=theme.pjax_cover.coverWrapperDisplay%>";
|
|
52
|
+
scroll_down.style.display="<%=theme.pjax_cover.scrollDownDisplay%>";
|
|
53
|
+
<% }%>
|
|
54
|
+
<% }%>
|
|
55
|
+
</script>
|
|
56
|
+
</pjax>
|