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,186 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 右键音乐
|
|
3
|
+
* */
|
|
4
|
+
const RightMenuAplayer = (() => {
|
|
5
|
+
let playStatus; // 播放器状态
|
|
6
|
+
const APlayer = {}; // 右键音乐所控制的播放器
|
|
7
|
+
const fn = {};
|
|
8
|
+
|
|
9
|
+
fn.checkAPlayer = () => {
|
|
10
|
+
if (playStatus === undefined || APlayer.player === undefined) {
|
|
11
|
+
fn.setAPlayerObject();
|
|
12
|
+
} else if (APlayer.observer === undefined) {
|
|
13
|
+
fn.setAPlayerObserver();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// 设置全局播放器所对应的 aplyer 对象
|
|
18
|
+
fn.setAPlayerObject = () => {
|
|
19
|
+
let meting = document.querySelectorAll('.footer meting-js');
|
|
20
|
+
if (meting.length == 0) {
|
|
21
|
+
meting = document.querySelectorAll('meting-js');
|
|
22
|
+
}
|
|
23
|
+
APlayer.player = undefined;
|
|
24
|
+
meting.forEach((item, index) => {
|
|
25
|
+
if (item.meta.id == volantis.GLOBAL_CONFIG.plugins.aplayer.id && item.aplayer && APlayer.player === undefined) {
|
|
26
|
+
APlayer.player = item.aplayer;
|
|
27
|
+
fn.setAPlayerObserver();
|
|
28
|
+
fn.updateTitle();
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// 事件监听
|
|
34
|
+
fn.setAPlayerObserver = () => {
|
|
35
|
+
try {
|
|
36
|
+
APlayer.player.on('play', function (e) {
|
|
37
|
+
fn.updateAPlayerControllerStatus(e);
|
|
38
|
+
APlayer.status = 'play';
|
|
39
|
+
});
|
|
40
|
+
APlayer.player.on('pause', function (e) {
|
|
41
|
+
fn.updateAPlayerControllerStatus(e);
|
|
42
|
+
APlayer.status = 'pause';
|
|
43
|
+
});
|
|
44
|
+
APlayer.player.on('volumechange', function (e) {
|
|
45
|
+
fn.onUpdateAPlayerVolume(e);
|
|
46
|
+
});
|
|
47
|
+
APlayer.player.on('loadstart', function (e) {
|
|
48
|
+
fn.updateTitle(e);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// 监听音量手势
|
|
52
|
+
APlayer.volumeBarWrap = document.getElementsByClassName('nav volume')[0].children[0];
|
|
53
|
+
APlayer.volumeBar = APlayer.volumeBarWrap.children[0];
|
|
54
|
+
|
|
55
|
+
const thumbMove = (e) => {
|
|
56
|
+
fn.updateAPlayerVolume(e);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const thumbUp = (e) => {
|
|
60
|
+
APlayer.volumeBarWrap.classList.remove('aplayer-volume-bar-wrap-active');
|
|
61
|
+
document.removeEventListener('mouseup', thumbUp);
|
|
62
|
+
document.removeEventListener('mousemove', thumbMove);
|
|
63
|
+
fn.updateAPlayerVolume(e);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
APlayer.volumeBarWrap.addEventListener('mousedown', (event) => {
|
|
67
|
+
event.stopPropagation();
|
|
68
|
+
APlayer.volumeBarWrap.classList.add('aplayer-volume-bar-wrap-active');
|
|
69
|
+
document.addEventListener('mousemove', thumbMove);
|
|
70
|
+
document.addEventListener('mouseup', thumbUp);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
APlayer.volumeBarWrap.addEventListener('click', (event) => {
|
|
74
|
+
event.stopPropagation();
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
fn.updateAPlayerControllerStatus();
|
|
78
|
+
fn.onUpdateAPlayerVolume();
|
|
79
|
+
APlayer.observer = true;
|
|
80
|
+
} catch (error) {
|
|
81
|
+
console.log(error);
|
|
82
|
+
APlayer.observer = undefined;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
fn.updateAPlayerVolume = (e) => {
|
|
87
|
+
let percentage = ((e.clientX || e.changedTouches[0].clientX) -
|
|
88
|
+
APlayer.volumeBar.getBoundingClientRect().left) / APlayer.volumeBar.clientWidth;
|
|
89
|
+
percentage = Math.max(percentage, 0);
|
|
90
|
+
percentage = Math.min(percentage, 1);
|
|
91
|
+
APlayer.player.volume(percentage);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
fn.onUpdateAPlayerVolume = () => {
|
|
95
|
+
try {
|
|
96
|
+
APlayer.volumeBar.children[0].style.width = APlayer.player.audio.volume * 100 + '%';
|
|
97
|
+
} catch (error) {
|
|
98
|
+
console.log(error);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// 更新控制器状态
|
|
103
|
+
fn.updateAPlayerControllerStatus = () => {
|
|
104
|
+
try {
|
|
105
|
+
if (APlayer.player.audio.paused) {
|
|
106
|
+
playStatus = 'pause';
|
|
107
|
+
document.getElementsByClassName('nav toggle')[0].children[0].classList.add('fa-play');
|
|
108
|
+
document.getElementsByClassName('nav toggle')[0].children[0].classList.remove('fa-pause');
|
|
109
|
+
} else {
|
|
110
|
+
playStatus = 'play';
|
|
111
|
+
document.getElementsByClassName('nav toggle')[0].children[0].classList.remove('fa-play');
|
|
112
|
+
document.getElementsByClassName('nav toggle')[0].children[0].classList.add('fa-pause');
|
|
113
|
+
}
|
|
114
|
+
} catch (error) {
|
|
115
|
+
console.log(error);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// 播放/暂停
|
|
120
|
+
fn.aplayerToggle = () => {
|
|
121
|
+
fn.checkAPlayer();
|
|
122
|
+
try {
|
|
123
|
+
APlayer.player.toggle();
|
|
124
|
+
} catch (error) {
|
|
125
|
+
console.log(error);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// 上一曲
|
|
130
|
+
fn.aplayerBackward = () => {
|
|
131
|
+
fn.checkAPlayer();
|
|
132
|
+
try {
|
|
133
|
+
APlayer.player.skipBack();
|
|
134
|
+
APlayer.player.play();
|
|
135
|
+
} catch (error) {
|
|
136
|
+
console.log(error);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// 下一曲
|
|
141
|
+
fn.aplayerForward = () => {
|
|
142
|
+
fn.checkAPlayer();
|
|
143
|
+
try {
|
|
144
|
+
APlayer.player.skipForward();
|
|
145
|
+
APlayer.player.play();
|
|
146
|
+
} catch (error) {
|
|
147
|
+
console.log(error);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// 调节音量
|
|
152
|
+
fn.aplayerVolume = (percent) => {
|
|
153
|
+
fn.checkAPlayer();
|
|
154
|
+
try {
|
|
155
|
+
APlayer.player.volume(percent);
|
|
156
|
+
} catch (error) {
|
|
157
|
+
console.log(error);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// 更新音乐标题
|
|
162
|
+
fn.updateTitle = () => {
|
|
163
|
+
fn.checkAPlayer();
|
|
164
|
+
try {
|
|
165
|
+
const index = APlayer.player.list.index;
|
|
166
|
+
const obj = APlayer.player.list.audios[index];
|
|
167
|
+
document.getElementsByClassName('nav music-title')[0].innerHTML = obj.title;
|
|
168
|
+
} catch (error) {
|
|
169
|
+
//console.log(error);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return {
|
|
174
|
+
checkAPlayer: fn.checkAPlayer,
|
|
175
|
+
aplayerBackward: fn.aplayerBackward,
|
|
176
|
+
aplayerToggle: fn.aplayerToggle,
|
|
177
|
+
aplayerForward: fn.aplayerForward,
|
|
178
|
+
APlayer: APlayer
|
|
179
|
+
}
|
|
180
|
+
})()
|
|
181
|
+
|
|
182
|
+
Object.freeze(RightMenuAplayer);
|
|
183
|
+
|
|
184
|
+
volantis.requestAnimationFrame(() => {
|
|
185
|
+
RightMenuAplayer.checkAPlayer();
|
|
186
|
+
});
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
let Parallax = {};
|
|
2
|
+
Parallax.options = {};
|
|
3
|
+
Parallax.options.speed = 0.25;
|
|
4
|
+
Parallax.options.zIndex = -100;
|
|
5
|
+
Parallax.options.fade = 1500;
|
|
6
|
+
Parallax.slidein = () => {
|
|
7
|
+
let slider = Parallax.mirrors[0].slider;
|
|
8
|
+
if (Parallax.mirrors.length >= 2) {
|
|
9
|
+
slider = Parallax.mirrors[1].slider;
|
|
10
|
+
}
|
|
11
|
+
var opac = parseFloat(slider.style.opacity);
|
|
12
|
+
if (opac !== 1) {
|
|
13
|
+
if (Parallax.mirrors.length >= 2) {
|
|
14
|
+
opac = opac + 0.1;
|
|
15
|
+
slider.style.opacity = opac;
|
|
16
|
+
setTimeout(Parallax.slidein, Parallax.options.fade / 10);
|
|
17
|
+
}else{
|
|
18
|
+
slider.style.opacity = 1;
|
|
19
|
+
}
|
|
20
|
+
} else {
|
|
21
|
+
if (Parallax.mirrors.length >= 2) {
|
|
22
|
+
Parallax.mirrors[0].mirror.remove();
|
|
23
|
+
Parallax.mirrors.shift();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
Parallax.start = () => {
|
|
28
|
+
let mirror = document.createElement("div");
|
|
29
|
+
mirror.classList.add("parallax-mirror");
|
|
30
|
+
mirror.style.visibility = "hidden";
|
|
31
|
+
mirror.style.zIndex = Parallax.options.zIndex;
|
|
32
|
+
mirror.style.position = "fixed";
|
|
33
|
+
mirror.style.top = 0;
|
|
34
|
+
mirror.style.left = 0;
|
|
35
|
+
mirror.style.overflow = "hidden";
|
|
36
|
+
Parallax.window.appendChild(mirror);
|
|
37
|
+
let slider = document.createElement("img");
|
|
38
|
+
slider.src = Parallax.options.src;
|
|
39
|
+
slider.alt = "parallax";
|
|
40
|
+
slider.classList.add("parallax-slider");
|
|
41
|
+
slider.style.opacity = 0;
|
|
42
|
+
mirror.appendChild(slider);
|
|
43
|
+
if (!Parallax.mirrors) {
|
|
44
|
+
Parallax.mirrors = [];
|
|
45
|
+
}
|
|
46
|
+
let mirrorItem = {};
|
|
47
|
+
mirrorItem.mirror = mirror;
|
|
48
|
+
mirrorItem.slider = slider;
|
|
49
|
+
Parallax.mirrors.push(mirrorItem);
|
|
50
|
+
Parallax.slidein();
|
|
51
|
+
slider.addEventListener(
|
|
52
|
+
"load",
|
|
53
|
+
function () {
|
|
54
|
+
Parallax.update();
|
|
55
|
+
},
|
|
56
|
+
false
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
Parallax.init = () => {
|
|
60
|
+
function loadDimensions() {
|
|
61
|
+
Parallax.wH = document.documentElement.clientHeight;
|
|
62
|
+
Parallax.wW = document.documentElement.clientWidth;
|
|
63
|
+
}
|
|
64
|
+
function getScrollTop() {
|
|
65
|
+
var scrollPos;
|
|
66
|
+
if (window.pageYOffset) {
|
|
67
|
+
scrollPos = window.pageYOffset;
|
|
68
|
+
} else if (document.compatMode && document.compatMode != "BackCompat") {
|
|
69
|
+
scrollPos = document.documentElement.scrollTop;
|
|
70
|
+
} else if (document.body) {
|
|
71
|
+
scrollPos = document.body.scrollTop;
|
|
72
|
+
}
|
|
73
|
+
return scrollPos;
|
|
74
|
+
}
|
|
75
|
+
function loadScrollPosition() {
|
|
76
|
+
const winScrollTop = getScrollTop();
|
|
77
|
+
Parallax.sT = Math.max(0, winScrollTop);
|
|
78
|
+
Parallax.sL = Math.max(0, document.body.scrollLeft);
|
|
79
|
+
Parallax.overScroll = Math.min(winScrollTop, 0);
|
|
80
|
+
}
|
|
81
|
+
window.addEventListener(
|
|
82
|
+
"resize",
|
|
83
|
+
function () {
|
|
84
|
+
loadDimensions();
|
|
85
|
+
Parallax.update();
|
|
86
|
+
},
|
|
87
|
+
false
|
|
88
|
+
);
|
|
89
|
+
loadDimensions();
|
|
90
|
+
let lastPosition = -1;
|
|
91
|
+
(function loop() {
|
|
92
|
+
const yoffset = getScrollTop();
|
|
93
|
+
if (lastPosition !== yoffset) {
|
|
94
|
+
lastPosition = yoffset;
|
|
95
|
+
loadScrollPosition();
|
|
96
|
+
Parallax.update();
|
|
97
|
+
}
|
|
98
|
+
window.requestAnimationFrame =
|
|
99
|
+
window.requestAnimationFrame ||
|
|
100
|
+
window.mozRequestAnimationFrame ||
|
|
101
|
+
window.webkitRequestAnimationFrame;
|
|
102
|
+
window.requestAnimationFrame(loop);
|
|
103
|
+
})();
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
Parallax.refreshItem = (slider) => {
|
|
107
|
+
Parallax.options.aspectRatio =
|
|
108
|
+
slider.naturalWidth / (slider.naturalHeight || 1);
|
|
109
|
+
const aspect = Parallax.options.aspectRatio || 1;
|
|
110
|
+
Parallax.options.boxWidth = Parallax.window.clientWidth;
|
|
111
|
+
Parallax.options.boxHeight = Parallax.window.clientHeight;
|
|
112
|
+
Parallax.options.boxOffsetTop = Parallax.window.scrollTop;
|
|
113
|
+
Parallax.options.boxOffsetLeft = Parallax.window.scrollLeft;
|
|
114
|
+
Parallax.options.boxOffsetBottom =
|
|
115
|
+
Parallax.options.boxOffsetTop + Parallax.options.boxHeight;
|
|
116
|
+
const winHeight = Parallax.wH;
|
|
117
|
+
const maxOffset = Parallax.options.boxOffsetTop;
|
|
118
|
+
const minOffset = Math.max(
|
|
119
|
+
Parallax.options.boxOffsetTop + Parallax.options.boxHeight - winHeight,
|
|
120
|
+
0
|
|
121
|
+
);
|
|
122
|
+
const imageHeightMin =
|
|
123
|
+
(Parallax.options.boxHeight +
|
|
124
|
+
(maxOffset - minOffset) * (1 - Parallax.options.speed)) |
|
|
125
|
+
0;
|
|
126
|
+
const imageOffsetMin =
|
|
127
|
+
((Parallax.options.boxOffsetTop - maxOffset) *
|
|
128
|
+
(1 - Parallax.options.speed)) |
|
|
129
|
+
0;
|
|
130
|
+
let margin;
|
|
131
|
+
if (Parallax.options.boxWidth < imageHeightMin * aspect) {
|
|
132
|
+
Parallax.options.imageWidth = (imageHeightMin * aspect) | 0;
|
|
133
|
+
Parallax.options.imageHeight = imageHeightMin;
|
|
134
|
+
Parallax.options.offsetBaseTop = imageOffsetMin;
|
|
135
|
+
margin = Parallax.options.imageWidth - Parallax.options.boxWidth;
|
|
136
|
+
Parallax.options.offsetLeft = (-margin / 2) | 0;
|
|
137
|
+
} else {
|
|
138
|
+
Parallax.options.imageWidth = Parallax.options.boxWidth;
|
|
139
|
+
Parallax.options.imageHeight = (Parallax.options.boxWidth / aspect) | 0;
|
|
140
|
+
Parallax.options.offsetLeft = 0;
|
|
141
|
+
margin = Parallax.options.imageHeight - imageHeightMin;
|
|
142
|
+
Parallax.options.offsetBaseTop = (imageOffsetMin - margin / 2) | 0;
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
Parallax.renderItem = (mirror, slider) => {
|
|
146
|
+
const scrollTop = Parallax.sT;
|
|
147
|
+
const scrollLeft = Parallax.sL;
|
|
148
|
+
const scrollBottom = scrollTop + Parallax.wH;
|
|
149
|
+
if (
|
|
150
|
+
Parallax.options.boxOffsetBottom > scrollTop &&
|
|
151
|
+
Parallax.options.boxOffsetTop <= scrollBottom
|
|
152
|
+
) {
|
|
153
|
+
Parallax.options.visibility = "visible";
|
|
154
|
+
Parallax.options.mirrorTop = Parallax.options.boxOffsetTop - scrollTop;
|
|
155
|
+
Parallax.options.mirrorLeft = Parallax.options.boxOffsetLeft - scrollLeft;
|
|
156
|
+
Parallax.options.offsetTop =
|
|
157
|
+
Parallax.options.offsetBaseTop -
|
|
158
|
+
Parallax.options.mirrorTop * (1 - Parallax.options.speed);
|
|
159
|
+
} else {
|
|
160
|
+
Parallax.options.visibility = "hidden";
|
|
161
|
+
}
|
|
162
|
+
mirror.style.transform =
|
|
163
|
+
"translate3d(" +
|
|
164
|
+
Parallax.options.mirrorLeft +
|
|
165
|
+
"px, " +
|
|
166
|
+
Parallax.options.mirrorTop +
|
|
167
|
+
"px, 0px)";
|
|
168
|
+
mirror.style.visibility = Parallax.options.visibility;
|
|
169
|
+
mirror.style.height = Parallax.options.boxHeight + "px";
|
|
170
|
+
mirror.style.width = Parallax.options.boxWidth + "px";
|
|
171
|
+
|
|
172
|
+
slider.style.transform =
|
|
173
|
+
"translate3d(" +
|
|
174
|
+
Parallax.options.offsetLeft +
|
|
175
|
+
"px, " +
|
|
176
|
+
Parallax.options.offsetTop +
|
|
177
|
+
"px, 0px)";
|
|
178
|
+
slider.style.position = "absolute";
|
|
179
|
+
slider.style.height = Parallax.options.imageHeight + "px";
|
|
180
|
+
slider.style.width = Parallax.options.imageWidth + "px";
|
|
181
|
+
slider.style.maxWidth = "none";
|
|
182
|
+
};
|
|
183
|
+
Parallax.update = () => {
|
|
184
|
+
if (!Parallax.mirrors) {
|
|
185
|
+
return
|
|
186
|
+
}
|
|
187
|
+
Parallax.mirrors.forEach((e) => {
|
|
188
|
+
Parallax.refreshItem(e.slider);
|
|
189
|
+
Parallax.renderItem(e.mirror, e.slider);
|
|
190
|
+
});
|
|
191
|
+
};
|