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,577 @@
|
|
|
1
|
+
const RightMenu = (() => {
|
|
2
|
+
const
|
|
3
|
+
rightMenuConfig = volantis.GLOBAL_CONFIG.plugins.rightmenu,
|
|
4
|
+
messageRightMenu = volantis.GLOBAL_CONFIG.plugins.message.enable && volantis.GLOBAL_CONFIG.plugins.message.rightmenu.enable;
|
|
5
|
+
|
|
6
|
+
const
|
|
7
|
+
fn = {},
|
|
8
|
+
_rightMenuWrapper = document.getElementById('rightmenu-wrapper'),
|
|
9
|
+
_rightMenuContent = document.getElementById('rightmenu-content'),
|
|
10
|
+
_printHtml = document.getElementById('printHtml'),
|
|
11
|
+
_menuMusic = document.getElementById('menuMusic'),
|
|
12
|
+
_readingModel = document.getElementById('readingModel'),
|
|
13
|
+
_readBkg = document.getElementById('read_bkg');
|
|
14
|
+
|
|
15
|
+
const
|
|
16
|
+
_menuLoad = document.querySelectorAll('.menuLoad-Content'),
|
|
17
|
+
_menuOption = document.querySelector('.menu-Option'),
|
|
18
|
+
_searchWord = document.querySelector('.menu-Option[data-fn-type="searchWord"]'),
|
|
19
|
+
_copyText = document.querySelector('.menu-Option[data-fn-type="copyText"]'),
|
|
20
|
+
_copyPaste = document.querySelector('.menu-Option[data-fn-type="copyPaste"]'),
|
|
21
|
+
_copySelect = document.querySelector('.menu-Option[data-fn-type="copySelect"]'),
|
|
22
|
+
_copyCut = document.querySelector('.menu-Option[data-fn-type="copyCut"]'),
|
|
23
|
+
_copyHref = document.querySelector('.menu-Option[data-fn-type="copyHref"]'),
|
|
24
|
+
_copySrc = document.querySelector('.menu-Option[data-fn-type="copySrc"]'),
|
|
25
|
+
_copyImg = document.querySelector('.menu-Option[data-fn-type="copyImg"]'),
|
|
26
|
+
_openTab = document.querySelector('.menu-Option[data-fn-type="openTab"]'),
|
|
27
|
+
_backward = document.querySelector('#menuMusic .backward'),
|
|
28
|
+
_toggle = document.querySelector('#menuMusic .toggle'),
|
|
29
|
+
_forward = document.querySelector('#menuMusic .forward');
|
|
30
|
+
|
|
31
|
+
const urlRegx = /^((https|http)?:\/\/)+[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\"\"])*$/;
|
|
32
|
+
|
|
33
|
+
fn.init = () => {
|
|
34
|
+
DOMController.visible(_menuMusic, false);
|
|
35
|
+
DOMController.visible(_menuOption, false);
|
|
36
|
+
if (_readBkg) _readBkg.parentNode.removeChild(_readBkg);
|
|
37
|
+
|
|
38
|
+
const readBkg = document.createElement("div");
|
|
39
|
+
readBkg.className = "common_read_bkg common_read_hide";
|
|
40
|
+
readBkg.id = "read_bkg";
|
|
41
|
+
window.document.body.appendChild(readBkg);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
fn.initEvent = () => {
|
|
45
|
+
window.document.oncontextmenu = (event) => {
|
|
46
|
+
if (event.ctrlKey || document.body.offsetWidth <= 500) {
|
|
47
|
+
fn.hideMenu();
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
return fn.popMenu(event);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
_rightMenuWrapper.oncontextmenu = (event) => {
|
|
54
|
+
event.stopPropagation();
|
|
55
|
+
event.preventDefault();
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
window.removeEventListener('blur', fn.hideMenu);
|
|
60
|
+
window.addEventListener('blur', fn.hideMenu);
|
|
61
|
+
document.body.removeEventListener('click', fn.hideMenu);
|
|
62
|
+
document.body.addEventListener('click', fn.hideMenu);
|
|
63
|
+
|
|
64
|
+
if (_forward && _toggle && _forward) {
|
|
65
|
+
_backward.onclick = (e) => {
|
|
66
|
+
e.preventDefault();
|
|
67
|
+
e.stopPropagation();
|
|
68
|
+
RightMenuAplayer.aplayerBackward();
|
|
69
|
+
}
|
|
70
|
+
_toggle.onclick = (e) => {
|
|
71
|
+
e.preventDefault();
|
|
72
|
+
e.stopPropagation();
|
|
73
|
+
RightMenuAplayer.aplayerToggle();
|
|
74
|
+
}
|
|
75
|
+
_forward.onclick = (e) => {
|
|
76
|
+
e.preventDefault();
|
|
77
|
+
e.stopPropagation();
|
|
78
|
+
RightMenuAplayer.aplayerForward();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// 菜单位置设定
|
|
84
|
+
fn.popMenu = (event) => {
|
|
85
|
+
let mouseClientX = event.clientX;
|
|
86
|
+
let mouseClientY = event.clientY;
|
|
87
|
+
let screenWidth = document.documentElement.clientWidth || document.body.clientWidth;
|
|
88
|
+
let screenHeight = document.documentElement.clientHeight || document.body.clientHeight;
|
|
89
|
+
|
|
90
|
+
try {
|
|
91
|
+
fn.setMenuItem(event);
|
|
92
|
+
DOMController.visible(_rightMenuWrapper);
|
|
93
|
+
_rightMenuWrapper.focus();
|
|
94
|
+
_rightMenuWrapper.style.zIndex = '-2147483648';
|
|
95
|
+
let menuWidth = _rightMenuContent.offsetWidth;
|
|
96
|
+
let menuHeight = _rightMenuContent.offsetHeight;
|
|
97
|
+
let showLeft = mouseClientX + menuWidth > screenWidth ? mouseClientX - menuWidth + 10 : mouseClientX;
|
|
98
|
+
let showTop = mouseClientY + menuHeight > screenHeight ? mouseClientY - menuHeight + 10 : mouseClientY;
|
|
99
|
+
showTop = mouseClientY + menuHeight > screenHeight && showTop < menuHeight && mouseClientY < menuHeight ?
|
|
100
|
+
showTop + (screenHeight - menuHeight - showTop - 10) : showTop;
|
|
101
|
+
_rightMenuWrapper.style.left = showLeft + "px";
|
|
102
|
+
_rightMenuWrapper.style.top = showTop + "px";
|
|
103
|
+
_rightMenuWrapper.style.zIndex = '2147483648';
|
|
104
|
+
if (volantis.GLOBAL_CONFIG.plugins.message.rightmenu.notice) fn.showMessage();
|
|
105
|
+
} catch (error) {
|
|
106
|
+
_rightMenuWrapper.blur();
|
|
107
|
+
console.error(error);
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// 消息提示
|
|
115
|
+
fn.showMessage = () => {
|
|
116
|
+
const NoticeRightMenu = localStorage.getItem('NoticeRightMenu') === 'true';
|
|
117
|
+
if (messageRightMenu && !NoticeRightMenu)
|
|
118
|
+
VolantisApp.message('右键菜单', '唤醒原系统菜单请使用:<kbd>Ctrl</kbd> + <kbd>右键</kbd>', {
|
|
119
|
+
icon: rightMenuConfig.faicon + ' fa-exclamation-square red',
|
|
120
|
+
time: 9000
|
|
121
|
+
}, () => {
|
|
122
|
+
localStorage.setItem('NoticeRightMenu', 'true')
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// 菜单项设置
|
|
127
|
+
fn.setMenuItem = (event) => {
|
|
128
|
+
let optionFlag = false;
|
|
129
|
+
const eventTarget = event.target;
|
|
130
|
+
const selectText = window.getSelection().toString();
|
|
131
|
+
DOMController.visible(_openTab, false); // 隐藏新标签页打开
|
|
132
|
+
|
|
133
|
+
// 判断是否是输入框
|
|
134
|
+
if (eventTarget.tagName.toLowerCase() === 'input' || eventTarget.tagName.toLowerCase() === 'textarea') {
|
|
135
|
+
const inputStr = eventTarget.value;
|
|
136
|
+
|
|
137
|
+
// 全选
|
|
138
|
+
if (inputStr.length > 0) {
|
|
139
|
+
DOMController.visible(_copySelect);
|
|
140
|
+
_copySelect.onclick = () => {
|
|
141
|
+
event.preventDefault();
|
|
142
|
+
eventTarget.select();
|
|
143
|
+
}
|
|
144
|
+
} else {
|
|
145
|
+
DOMController.visible(_copySelect, false);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// 剪切
|
|
149
|
+
if (selectText) {
|
|
150
|
+
DOMController.visible(_copyCut);
|
|
151
|
+
_copyCut.onclick = () => {
|
|
152
|
+
const statrPos = eventTarget.selectionStart;
|
|
153
|
+
const endPos = eventTarget.selectionEnd;
|
|
154
|
+
fn.copyString(selectText);
|
|
155
|
+
eventTarget.value = inputStr.substring(0, statrPos) + inputStr.substring(endPos, inputStr.length);
|
|
156
|
+
eventTarget.selectionStart = statrPos;
|
|
157
|
+
eventTarget.selectionEnd = statrPos;
|
|
158
|
+
eventTarget.focus();
|
|
159
|
+
}
|
|
160
|
+
} else {
|
|
161
|
+
DOMController.visible(_copyCut, false);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// 粘贴
|
|
165
|
+
fn.readClipboard().then(text => {
|
|
166
|
+
// 如果剪切板存在内容
|
|
167
|
+
if (!!text) {
|
|
168
|
+
DOMController.visible(_copyPaste);
|
|
169
|
+
_copyPaste.onclick = () => {
|
|
170
|
+
fn.insertAtCaret(eventTarget, text);
|
|
171
|
+
}
|
|
172
|
+
} else {
|
|
173
|
+
DOMController.visible(_copyPaste, false);
|
|
174
|
+
}
|
|
175
|
+
}).catch((err) => {
|
|
176
|
+
console.error(err);
|
|
177
|
+
DOMController.visible(_copyPaste, false);
|
|
178
|
+
});
|
|
179
|
+
} else {
|
|
180
|
+
DOMController.visible(_copySelect, false);
|
|
181
|
+
DOMController.visible(_copyPaste, false);
|
|
182
|
+
DOMController.visible(_copyCut, false);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// 新标签打开链接
|
|
186
|
+
const eventHref = eventTarget.href;
|
|
187
|
+
if (!!eventHref && urlRegx.test(eventHref)) {
|
|
188
|
+
optionFlag = true;
|
|
189
|
+
DOMController.visible(_copyHref);
|
|
190
|
+
DOMController.visible(_openTab);
|
|
191
|
+
if (_copyHref) _copyHref.onclick = () => {
|
|
192
|
+
fn.copyString(eventHref);
|
|
193
|
+
}
|
|
194
|
+
_openTab.onclick = () => {
|
|
195
|
+
window.open(eventHref);
|
|
196
|
+
}
|
|
197
|
+
} else {
|
|
198
|
+
DOMController.visible(_copyHref, false);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// 新标签打开图片 & 复制图片链接
|
|
202
|
+
const eventSrc = eventTarget.currentSrc;
|
|
203
|
+
if (!!eventSrc && urlRegx.test(eventSrc)) {
|
|
204
|
+
optionFlag = true;
|
|
205
|
+
DOMController.visible(_copySrc);
|
|
206
|
+
DOMController.visible(_openTab);
|
|
207
|
+
|
|
208
|
+
_copySrc.onclick = () => {
|
|
209
|
+
fn.copyString(eventSrc);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
_openTab.onclick = () => {
|
|
213
|
+
window.open(eventSrc);
|
|
214
|
+
}
|
|
215
|
+
} else {
|
|
216
|
+
DOMController.visible(_copySrc, false);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// 复制图片
|
|
220
|
+
if (!!eventSrc && urlRegx.test(eventSrc) && eventSrc.trimEnd().endsWith('.png')) {
|
|
221
|
+
optionFlag = true;
|
|
222
|
+
DOMController.visible(_copyImg);
|
|
223
|
+
|
|
224
|
+
_copyImg.onclick = () => {
|
|
225
|
+
fn.writeClipImg(event, flag => {
|
|
226
|
+
if (flag && messageRightMenu) VolantisApp.message('系统提示', '图片复制成功!', {
|
|
227
|
+
icon: rightMenuConfig.faicon + ' fa-images'
|
|
228
|
+
});
|
|
229
|
+
}, (error) => {
|
|
230
|
+
if (messageRightMenu) VolantisApp.message('系统提示', '复制失败:' + error, {
|
|
231
|
+
icon: rightMenuConfig.faicon + ' fa-exclamation-square red'
|
|
232
|
+
});
|
|
233
|
+
})
|
|
234
|
+
}
|
|
235
|
+
} else {
|
|
236
|
+
DOMController.visible(_copyImg, false);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// 复制文本
|
|
240
|
+
if (selectText) {
|
|
241
|
+
optionFlag = true;
|
|
242
|
+
DOMController.visible(_copyText);
|
|
243
|
+
DOMController.visible(_searchWord);
|
|
244
|
+
|
|
245
|
+
_copyText.onclick = () => {
|
|
246
|
+
fn.copyString(selectText);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
!!_searchWord && (_searchWord.onclick = () => {
|
|
250
|
+
OpenSearch(selectText);
|
|
251
|
+
})
|
|
252
|
+
} else {
|
|
253
|
+
DOMController.visible(_copyText, false);
|
|
254
|
+
DOMController.visible(_searchWord, false);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// 打印
|
|
258
|
+
const _printArticle = document.querySelector('#post.article') || null;
|
|
259
|
+
const pathName = window.location.pathname;
|
|
260
|
+
if (!!_printArticle) {
|
|
261
|
+
DOMController.visible(_printHtml);
|
|
262
|
+
DOMController.visible(_readingModel);
|
|
263
|
+
|
|
264
|
+
if (_printHtml) {
|
|
265
|
+
_printHtml.onclick = () => {
|
|
266
|
+
if (window.location.pathname === pathName) {
|
|
267
|
+
const message = '是否打印当前页面?<br><em style="font-size: 80%">建议打印时勾选背景图形</em><br>';
|
|
268
|
+
if (messageRightMenu) VolantisApp.question('', message, {}, () => {
|
|
269
|
+
fn.printHtml();
|
|
270
|
+
})
|
|
271
|
+
} else {
|
|
272
|
+
fn.hideMenu();
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
if (_readingModel) {
|
|
278
|
+
_readingModel.onclick = () => {
|
|
279
|
+
if (window.location.pathname === pathName) {
|
|
280
|
+
fn.readingModel();
|
|
281
|
+
} else {
|
|
282
|
+
fn.readingModel();
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
} else {
|
|
288
|
+
DOMController.visible(_printHtml, false);
|
|
289
|
+
DOMController.visible(_readingModel, false);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
if (volantis.GLOBAL_CONFIG.plugins.aplayer.enable
|
|
293
|
+
&& typeof RightMenuAplayer !== 'undefined'
|
|
294
|
+
&& RightMenuAplayer.APlayer.player !== undefined) {
|
|
295
|
+
if (rightMenuConfig.music_alwaysShow) {
|
|
296
|
+
DOMController.visible(_menuMusic);
|
|
297
|
+
} else if (RightMenuAplayer.APlayer.status === 'play' || RightMenuAplayer.APlayer.status === 'undefined') {
|
|
298
|
+
optionFlag = true;
|
|
299
|
+
DOMController.visible(_menuMusic);
|
|
300
|
+
} else {
|
|
301
|
+
DOMController.visible(_menuMusic, false);
|
|
302
|
+
}
|
|
303
|
+
} else {
|
|
304
|
+
DOMController.visible(_menuMusic, false);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
_menuLoad.forEach(ele => {
|
|
308
|
+
DOMController.visible(ele, !optionFlag);
|
|
309
|
+
})
|
|
310
|
+
|
|
311
|
+
if (volantis.GLOBAL_CONFIG.plugins.aplayer.enable
|
|
312
|
+
&& rightMenuConfig.layout.includes('music')) {
|
|
313
|
+
RightMenuAplayer.checkAPlayer();
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
// 隐藏菜单
|
|
318
|
+
fn.hideMenu = () => {
|
|
319
|
+
DOMController.visible(_rightMenuWrapper, false);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// 复制字符串
|
|
323
|
+
fn.copyString = (str) => {
|
|
324
|
+
VolantisApp.utilWriteClipText(str)
|
|
325
|
+
.then(() => {
|
|
326
|
+
if (messageRightMenu) {
|
|
327
|
+
VolantisApp.messageCopyright();
|
|
328
|
+
}
|
|
329
|
+
}).catch(e => {
|
|
330
|
+
if (messageRightMenu) {
|
|
331
|
+
VolantisApp.message('系统提示', e, {
|
|
332
|
+
icon: rightMenuConfig.faicon + ' fa-exclamation-square red'
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
})
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
// 写入文本到剪切板
|
|
339
|
+
fn.writeClipText = (str) => {
|
|
340
|
+
try {
|
|
341
|
+
return navigator.clipboard
|
|
342
|
+
.writeText(str)
|
|
343
|
+
.then(() => {
|
|
344
|
+
return Promise.resolve()
|
|
345
|
+
})
|
|
346
|
+
.catch(err => {
|
|
347
|
+
return Promise.reject(err)
|
|
348
|
+
})
|
|
349
|
+
} catch (e) {
|
|
350
|
+
const input = document.createElement('input');
|
|
351
|
+
input.setAttribute('readonly', 'readonly');
|
|
352
|
+
document.body.appendChild(input);
|
|
353
|
+
input.setAttribute('value', str);
|
|
354
|
+
input.select();
|
|
355
|
+
try {
|
|
356
|
+
let result = document.execCommand('copy')
|
|
357
|
+
document.body.removeChild(input);
|
|
358
|
+
if (!result || result === 'unsuccessful') {
|
|
359
|
+
return Promise.reject('复制文本失败!')
|
|
360
|
+
} else {
|
|
361
|
+
return Promise.resolve()
|
|
362
|
+
}
|
|
363
|
+
} catch (e) {
|
|
364
|
+
document.body.removeChild(input);
|
|
365
|
+
return Promise.reject(
|
|
366
|
+
'当前浏览器不支持复制功能,请检查更新或更换其他浏览器操作!'
|
|
367
|
+
)
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
// 写入图片到剪切板
|
|
373
|
+
fn.writeClipImg = async function (event, success, error) {
|
|
374
|
+
const eventSrc = rightMenuConfig.customPicUrl.enable ?
|
|
375
|
+
event.target.currentSrc.replace(rightMenuConfig.customPicUrl.old, rightMenuConfig.customPicUrl.new) :
|
|
376
|
+
event.target.currentSrc;
|
|
377
|
+
const parentElement = event.target.parentElement;
|
|
378
|
+
try {
|
|
379
|
+
const data = await fetch(eventSrc);
|
|
380
|
+
const blob = await data.blob();
|
|
381
|
+
await navigator.clipboard
|
|
382
|
+
.write([
|
|
383
|
+
new ClipboardItem({
|
|
384
|
+
[blob.type]: blob
|
|
385
|
+
})
|
|
386
|
+
]).then(() => {
|
|
387
|
+
success(true);
|
|
388
|
+
}, (e) => {
|
|
389
|
+
console.error('图片复制失败:', e);
|
|
390
|
+
error(e);
|
|
391
|
+
});
|
|
392
|
+
} catch (e) {
|
|
393
|
+
const dom = document;
|
|
394
|
+
try {
|
|
395
|
+
if (dom.body.createTextRange) {
|
|
396
|
+
const textRange = document.body.createTextRange();
|
|
397
|
+
textRange.moveToElementText(parentElement);
|
|
398
|
+
textRange.select();
|
|
399
|
+
} else if (window.getSelection) {
|
|
400
|
+
const selection = window.getSelection();
|
|
401
|
+
const range = document.createRange();
|
|
402
|
+
range.selectNodeContents(parentElement);
|
|
403
|
+
selection.removeAllRanges();
|
|
404
|
+
selection.addRange(range);
|
|
405
|
+
}
|
|
406
|
+
document.execCommand('copy');
|
|
407
|
+
window.getSelection().removeAllRanges();
|
|
408
|
+
success(false);
|
|
409
|
+
} catch (e) {
|
|
410
|
+
console.error(e);
|
|
411
|
+
error('不支持复制当前图片!');
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
// 请求读取剪切板
|
|
417
|
+
fn.readClipboard = async () => {
|
|
418
|
+
const result = await navigator.permissions.query({
|
|
419
|
+
name: 'clipboard-read'
|
|
420
|
+
});
|
|
421
|
+
if (result.state === 'granted' || result.state === 'prompt') {
|
|
422
|
+
// 修改为 .read() 可以获取剪切板中的文字/图片
|
|
423
|
+
// 返回的是 ClipboardItem
|
|
424
|
+
return navigator.clipboard
|
|
425
|
+
.readText()
|
|
426
|
+
.then(text => text)
|
|
427
|
+
.catch(err => Promise.reject(err));
|
|
428
|
+
}
|
|
429
|
+
return Promise.reject(result);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
// 粘贴文本
|
|
433
|
+
fn.insertAtCaret = (elemt, value) => {
|
|
434
|
+
const startPos = elemt.selectionStart,
|
|
435
|
+
endPos = elemt.selectionEnd;
|
|
436
|
+
if (document.selection) {
|
|
437
|
+
elemt.focus();
|
|
438
|
+
var sel = document.selection.createRange();
|
|
439
|
+
sel.text = value;
|
|
440
|
+
elemt.focus();
|
|
441
|
+
} else {
|
|
442
|
+
if (startPos || startPos == '0') {
|
|
443
|
+
var scrollTop = elemt.scrollTop;
|
|
444
|
+
elemt.value = elemt.value.substring(0, startPos) + value + elemt.value.substring(endPos, elemt.value.length);
|
|
445
|
+
elemt.focus();
|
|
446
|
+
elemt.selectionStart = startPos + value.length;
|
|
447
|
+
elemt.selectionEnd = startPos + value.length;
|
|
448
|
+
elemt.scrollTop = scrollTop;
|
|
449
|
+
} else {
|
|
450
|
+
elemt.value += value;
|
|
451
|
+
elemt.focus();
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
// 执行打印页面
|
|
457
|
+
fn.printHtml = () => {
|
|
458
|
+
if (volantis.isReadModel) fn.readingModel();
|
|
459
|
+
DOMController.setAttribute('details', 'open', 'true');
|
|
460
|
+
DOMController.remove('.cus-article-bkg');
|
|
461
|
+
DOMController.remove('.iziToast-overlay');
|
|
462
|
+
DOMController.remove('.iziToast-wrapper');
|
|
463
|
+
DOMController.remove('.prev-next');
|
|
464
|
+
DOMController.remove('footer');
|
|
465
|
+
DOMController.remove('#l_header');
|
|
466
|
+
DOMController.remove('#l_cover');
|
|
467
|
+
DOMController.remove('#l_side');
|
|
468
|
+
DOMController.remove('#comments');
|
|
469
|
+
DOMController.remove('#s-top');
|
|
470
|
+
DOMController.remove('#BKG');
|
|
471
|
+
DOMController.remove('#rightmenu-wrapper');
|
|
472
|
+
DOMController.remove('.nav-tabs');
|
|
473
|
+
DOMController.remove('.parallax-mirror');
|
|
474
|
+
DOMController.remove('.new-meta-item.share');
|
|
475
|
+
DOMController.remove('div.footer');
|
|
476
|
+
DOMController.setStyle('body', 'backgroundColor', 'unset');
|
|
477
|
+
DOMController.setStyle('#l_main', 'width', '100%');
|
|
478
|
+
DOMController.setStyle('#post', 'boxShadow', 'none');
|
|
479
|
+
DOMController.setStyle('#post', 'background', 'none');
|
|
480
|
+
DOMController.setStyle('#post', 'padding', '0');
|
|
481
|
+
DOMController.setStyle('h1', 'textAlign', 'center');
|
|
482
|
+
DOMController.setStyle('h1', 'fontWeight', '600');
|
|
483
|
+
DOMController.setStyle('h1', 'fontSize', '2rem');
|
|
484
|
+
DOMController.setStyle('h1', 'marginBottom', '20px');
|
|
485
|
+
DOMController.setStyle('.tab-pane', 'display', 'block');
|
|
486
|
+
DOMController.setStyle('.tab-content', 'borderTop', 'none');
|
|
487
|
+
DOMController.setStyle('.highlight>table pre', 'whiteSpace', 'pre-wrap');
|
|
488
|
+
DOMController.setStyle('.highlight>table pre', 'wordBreak', 'break-all');
|
|
489
|
+
DOMController.setStyle('.fancybox img', 'height', 'auto');
|
|
490
|
+
DOMController.setStyle('.fancybox img', 'weight', 'auto');
|
|
491
|
+
|
|
492
|
+
setTimeout(() => {
|
|
493
|
+
window.print();
|
|
494
|
+
document.body.innerHTML = '';
|
|
495
|
+
window.location.reload();
|
|
496
|
+
}, 50);
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
// 阅读模式
|
|
500
|
+
fn.readingModel = () => {
|
|
501
|
+
if (typeof ScrollReveal === 'function') ScrollReveal().clean('#comments');
|
|
502
|
+
DOMController.fadeToggle(document.querySelector('#l_header'))
|
|
503
|
+
DOMController.fadeToggle(document.querySelector('footer'))
|
|
504
|
+
DOMController.fadeToggle(document.querySelector('#s-top'))
|
|
505
|
+
DOMController.fadeToggle(document.querySelector('.article-meta#bottom'))
|
|
506
|
+
DOMController.fadeToggle(document.querySelector('.prev-next'))
|
|
507
|
+
DOMController.fadeToggle(document.querySelector('#l_side'))
|
|
508
|
+
DOMController.fadeToggle(document.querySelector('#comments'))
|
|
509
|
+
|
|
510
|
+
DOMController.toggleClass(document.querySelector('#l_main'), 'common_read')
|
|
511
|
+
DOMController.toggleClass(document.querySelector('#l_main'), 'common_read_main')
|
|
512
|
+
DOMController.toggleClass(document.querySelector('#l_body'), 'common_read')
|
|
513
|
+
DOMController.toggleClass(document.querySelector('#safearea'), 'common_read')
|
|
514
|
+
DOMController.toggleClass(document.querySelector('#pjax-container'), 'common_read')
|
|
515
|
+
DOMController.toggleClass(document.querySelector('#read_bkg'), 'common_read_hide')
|
|
516
|
+
DOMController.toggleClass(document.querySelector('h1'), 'common_read_h1')
|
|
517
|
+
DOMController.toggleClass(document.querySelector('#post'), 'post_read')
|
|
518
|
+
DOMController.toggleClass(document.querySelector('#l_cover'), 'read_cover')
|
|
519
|
+
DOMController.toggleClass(document.querySelector('.widget.toc-wrapper'), 'post_read')
|
|
520
|
+
|
|
521
|
+
volantis.isReadModel = volantis.isReadModel === undefined ? true : !volantis.isReadModel;
|
|
522
|
+
if (volantis.isReadModel) {
|
|
523
|
+
const option = {
|
|
524
|
+
backgroundColor: 'var(--color-read-post)',
|
|
525
|
+
icon: rightMenuConfig.faicon + ' fa-book-reader',
|
|
526
|
+
time: 5000
|
|
527
|
+
}
|
|
528
|
+
if (messageRightMenu) VolantisApp.message('系统提示', '阅读模式已开启,您可以点击屏幕空白处退出。', option);
|
|
529
|
+
document.querySelector('#l_body').removeEventListener('click', fn.readingModel);
|
|
530
|
+
document.querySelector('#l_body').addEventListener('click', (event) => {
|
|
531
|
+
if (DOMController.hasClass(event.target, 'common_read')) {
|
|
532
|
+
fn.readingModel();
|
|
533
|
+
}
|
|
534
|
+
});
|
|
535
|
+
} else {
|
|
536
|
+
document.querySelector('#l_body').removeEventListener('click', fn.readingModel);
|
|
537
|
+
document.querySelector('#post').removeEventListener('click', fn.readingModel);
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
return {
|
|
542
|
+
init: (notice = false) => {
|
|
543
|
+
fn.init();
|
|
544
|
+
fn.initEvent();
|
|
545
|
+
if (notice && messageRightMenu) VolantisApp.message('系统提示', '自定义右键注册成功。');
|
|
546
|
+
},
|
|
547
|
+
destroy: (notice = false) => {
|
|
548
|
+
fn.hideMenu();
|
|
549
|
+
window.document.oncontextmenu = () => {
|
|
550
|
+
return true
|
|
551
|
+
};
|
|
552
|
+
if (notice && messageRightMenu) VolantisApp.message('系统提示', '自定义右键注销成功。');
|
|
553
|
+
},
|
|
554
|
+
hideMenu: fn.hideMenu,
|
|
555
|
+
readingModel: fn.readingModel
|
|
556
|
+
}
|
|
557
|
+
})()
|
|
558
|
+
|
|
559
|
+
Object.freeze(RightMenu);
|
|
560
|
+
|
|
561
|
+
volantis.requestAnimationFrame(() => {
|
|
562
|
+
if (document.readyState !== 'loading') {
|
|
563
|
+
RightMenu.init();
|
|
564
|
+
|
|
565
|
+
volantis.pjax.send(() => {
|
|
566
|
+
RightMenu.hideMenu();
|
|
567
|
+
})
|
|
568
|
+
} else {
|
|
569
|
+
document.addEventListener("DOMContentLoaded", function () {
|
|
570
|
+
RightMenu.init();
|
|
571
|
+
|
|
572
|
+
volantis.pjax.send(() => {
|
|
573
|
+
RightMenu.hideMenu();
|
|
574
|
+
})
|
|
575
|
+
})
|
|
576
|
+
}
|
|
577
|
+
});
|