hexo-theme-volantis 5.0.0-rc.7 → 5.0.0-rc.8

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/_config.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  ############################### Volantis ###############################
2
2
  info:
3
3
  theme_name: Volantis # This is theme's name.
4
- theme_version: '5.0.0-rc.7' # This is theme's version.
4
+ theme_version: '5.0.0-rc.8' # This is theme's version.
5
5
  theme_docs: https://volantis.js.org/ # This is theme's URL.
6
6
  theme_repo: https://github.com/volantis-x/hexo-theme-volantis
7
7
  # Debug 调试模式
@@ -35,9 +35,6 @@ csp:
35
35
  style-src 'self' https: 'unsafe-inline' *;
36
36
  "
37
37
  # 可以使用自动程序替换默认的 'unsafe-inline' 和 * 生成更严格的内容安全策略.
38
- # hexo_fliter_sha256 用于 hexo g 时替换 'unsafe-inline' 生成 script-src 'sha256-' , 只适用于外层不含有压缩工具得场景.
39
- # 如果外层含有压缩工具会改变 hash 导致无效,hexo_fliter_sha256 需设为false, 使用 gulp 方案.
40
- hexo_fliter_sha256: false
41
38
  # 另可以参考官网的 gulp 方案.
42
39
  # gulpfile.js https://github.com/volantis-x/community/blob/main/gulpfile.js
43
40
  ############################### CDN ###############################
@@ -892,9 +889,98 @@ plugins:
892
889
  ############################### Plugins ############################### > end
893
890
 
894
891
  ############################### Rightmenu ############################### > start
892
+
893
+ ### 自定义右键 新
894
+ rightmenus:
895
+ enable: true
896
+ # 右键菜单项及加载顺序
897
+ # 内容示例:plugins.[组名], menus.[组名], hr(分割线,推荐去线留白), music(音乐控制器)
898
+ order:
899
+ - plugins.navigation
900
+ - hr
901
+ - plugins.inputBox
902
+ - plugins.seletctText
903
+ - plugins.elementCheck
904
+ - menus.link
905
+ - hr
906
+ - menus.darkMode
907
+ - plugins.articlePage
908
+ - music
909
+ ############################
910
+ # - {id: '', name: '', icon: '', link: '', event: '', group: ''}
911
+ # id: 唯一值
912
+ # name: 用于菜单名称显示
913
+ # icon: 用于菜单图标显示
914
+ # link: 跳转链接
915
+ # event: 事件,当输入内容不为内置事件时,作 JavaScript 代码执行
916
+ # group: 菜单项所处分组名称
917
+ # 注:
918
+ # 1. link/event 二选一,同时出现时仅处理 link
919
+ # 2. 内置事件列表: copyText, copyLink, copyPaste, copyAll, copyCut, copyImg, printMode, readMode
920
+ # 3. 内置组列表:navigation, inputBox, seletctText, elementCheck, articlePage
921
+ # 4. plugins 列允许自定义组内项目
922
+ # 5. menus 列允许自定义组及其内容
923
+ # 6. 除 navigation 外的内置组,在显示时会隐藏含 link 属性的菜单项
924
+ ###########################
925
+ # 基础项设置
926
+ options:
927
+ # 图标前缀 fa-solid, fa-regular, fa-light, fa-thin, fa-duotone, fa-brands
928
+ iconPrefix: fa-solid
929
+ # 例外,在 articlePage 组显示时(文章页)时依旧显示含 link 属性的菜单项
930
+ articleShowLink: false
931
+ # 当设定全局音乐播放器时,是否一直显示音乐控制菜单。false:仅当音乐播放时启用
932
+ musicAlwaysShow: true
933
+ # 右键内置组,预置实现
934
+ plugins:
935
+ # 导航组件
936
+ # 横向排列,共用一行,仅显示图标 (原则上支持的数量不限)
937
+ navigation:
938
+ - {id: 'left', name: '转到上一页', icon: 'fa-solid fa-arrow-left', event: 'history.back()', group: 'navigation'}
939
+ - {id: 'right', name: '转到下一页', icon: 'fa-solid fa-arrow-right', event: 'history.forward()', group: 'navigation'}
940
+ - {id: 'redo', name: '刷新当前页面', icon: 'fa-solid fa-redo', event: 'window.location.reload()', group: 'navigation'}
941
+ - {id: 'up', name: '回到顶部', icon: 'fa-solid fa-arrow-up', event: 'VolantisApp.scrolltoElement(volantis.dom.bodyAnchor)', group: 'navigation'}
942
+ #- {id: 'home', name: '回到首页', icon: 'fa-solid fa-home', link: '/', group: 'navigation'}
943
+ # 文本输入框相关组件
944
+ # 生效于 input/textarea,粘贴、剪切、全选
945
+ inputBox:
946
+ - {id: 'copyPaste', name: '粘贴文本', icon: 'fa-solid fa-paste', event: 'copyPaste', group: 'inputBox'}
947
+ - {id: 'copyAll', name: '全选文本', icon: 'fa-solid fa-object-ungroup', event: 'copyAll', group: 'inputBox'}
948
+ - {id: 'copyCut', name: '剪切文本', icon: 'fa-solid fa-cut', event: 'copyCut', group: 'inputBox'}
949
+ # 文本选中类组件
950
+ # 生效于右键选中文本,__text__ 为选中的文本。
951
+ seletctText:
952
+ - {id: 'copyText', name: '复制文本', icon: 'fa-solid fa-copy', event: 'copyText', group: 'seletctText'}
953
+ - {id: 'searchWord', name: '站内搜索', icon: 'fa-solid fa-search', event: 'OpenSearch(__text__)', group: 'seletctText'}
954
+ - {id: 'bingSearch', name: '必应搜索', icon: 'fa-solid fa-search', event: 'window.open(`https://cn.bing.com/search?q=${__text__}`)', group: 'seletctText'}
955
+ #- {id: 'googleSearch', name: '谷歌搜索', icon: 'fa-solid fa-search', event: 'window.open(`https://www.google.com/search?q=${__text__}`)', group: 'seletctText'}
956
+ # 元素判断组件
957
+ # 生效于 a/img 处的右键行为,__link__ 为链接地址
958
+ elementCheck:
959
+ - {id: 'openTab', name: '新标签页打开', icon: 'fa-solid fa-external-link-square-alt', event: 'window.open(__link__)', group: 'elementCheck'}
960
+ - {id: 'copyLink', name: '复制链接地址', icon: 'fa-solid fa-link', event: 'copyLink', group: 'elementCheck'}
961
+ # 复制图片文件至剪切板,仅支持 png 格式
962
+ - {id: 'copyImg', name: '复制图片文件', icon: 'fa-solid fa-image', event: 'copyImg', group: 'elementCheck'}
963
+ # 文章页面组件
964
+ # 生效于 post.article 页面
965
+ articlePage:
966
+ - {id: 'printMode', name: '打印页面', icon: 'fa-solid fa-print', event: 'printMode', group: 'articlePage'}
967
+ - {id: 'readMode', name: '阅读模式', icon: 'fa-solid fa-book-open', event: 'readMode', group: 'articlePage'}
968
+ # 右键自定义菜单区域
969
+ menus:
970
+ link:
971
+ - {id: 'help', name: '常见问题', icon: 'fa-solid fa-question', link: 'https://volantis.js.org/faqs/', group: 'link'}
972
+ - {id: 'examples', name: '示例博客', icon: 'fa-solid fa-rss', link: 'https://volantis.js.org/examples/', group: 'link'}
973
+ - {id: 'contributors', name: '加入社区', icon: 'fa-solid fa-fan', link: 'https://volantis.js.org/contributors/', group: 'link'}
974
+ - hr
975
+ - {id: 'source_docs', name: '本站源码', icon: 'fa-solid fa-code-branch', link: 'https://github.com/volantis-x/volantis-docs/', group: 'link'}
976
+ - {id: 'source_theme', name: '主题源码', icon: 'fa-solid fa-code-branch', link: 'https://github.com/volantis-x/hexo-theme-volantis/', group: 'link'}
977
+ darkMode:
978
+ - {id: 'darkMode', name: '暗黑模式', icon: 'fa-solid fa-moon', event: 'volantis.dark.toggle()', group: 'darkMode'}
979
+ ###
980
+
895
981
  # 自定义右键菜单
896
982
  rightmenu:
897
- enable: true
983
+ enable: false
898
984
  faicon: fa # 公共图标类型 fa fal fa-solid fa-duotone
899
985
  # hr: 分割线, music: 音乐控制器
900
986
  layout: [home, hr, help, examples, contributors, hr, source_docs, source_theme, hr, print, darkmode, reading, music]
@@ -949,12 +1035,13 @@ search:
949
1035
 
950
1036
  ############################### Color Scheme ############################### > start
951
1037
  # Accessibility: 背景色和前景色要有足够的对比度 https://web.dev/color-contrast/
1038
+ # https://ant.design/docs/spec/colors-cn
952
1039
  color_scheme:
953
1040
  # ------------
954
1041
  # 通用颜色
955
1042
  common:
956
1043
  # 主题色
957
- theme: '#44D7B6'
1044
+ theme: '#3dd9b6'
958
1045
  # 链接色
959
1046
  link: '#1b79c4'
960
1047
  # 按钮色
@@ -1004,40 +1091,43 @@ color_scheme:
1004
1091
  meta: '#888'
1005
1092
  # ------------
1006
1093
  # 暗色主题
1094
+ # https://www.maijisheji.com/2094.html
1007
1095
  dark:
1008
- # 网站背景色
1009
- site_bg: '#222'
1096
+ # 网站最深底色 # Dark Grey 1
1097
+ site_bd: '#121212'
1098
+ # 网站背景色 # Dark Grey 2
1099
+ site_bg: '#1f1f1f'
1100
+ # 卡片背景色 # Dark Grey 3
1101
+ card: '#262626'
1010
1102
  # 网站背景上的文字
1011
1103
  site_inner: '#eee'
1012
1104
  # 网站页脚文字
1013
1105
  site_footer: '#aaa'
1014
- # 卡片背景色
1015
- card: '#333'
1016
1106
  # 卡片上的普通文字
1017
1107
  text: '#eee'
1018
1108
 
1019
- # 区块和代码块背景色
1020
- block: '#3a3a3a'
1021
- # 代码块高亮时的背景色
1022
- codeblock: '#343a3c'
1109
+ # 区块和代码块背景色 # Dark Grey 4
1110
+ block: '#434343'
1111
+ # 代码块高亮时的背景色 # Dark Grey 2
1112
+ codeblock: '#1f1f1f'
1023
1113
  # 行内代码颜色
1024
1114
  inlinecode: '#D56D28'
1025
1115
 
1026
1116
  # 文章部分
1027
- h1: '#eee'
1028
- h2: '#eee'
1029
- h3: '#ddd'
1030
- h4: '#ddd'
1031
- h5: '#ddd'
1032
- h6: '#ddd'
1033
- p: '#bbb'
1034
-
1035
- # 列表文字
1036
- list: '#aaa'
1117
+ h1: '#f5f5f5' # Dark Grey 8
1118
+ h2: '#f5f5f5'
1119
+ h3: '#f0f0f0' # Dark Grey 7
1120
+ h4: '#f0f0f0'
1121
+ h5: '#f0f0f0'
1122
+ h6: '#f0f0f0'
1123
+ p: '#d9d9d9e6' # Dark Grey 6
1124
+
1125
+ # 列表文字 # Dark Grey 6
1126
+ list: '#d9d9d9d9'
1037
1127
  # 列表 hover 时的文字
1038
1128
  list_hl: 'mix($color-theme, #fff, 80)'
1039
- # 辅助性文字
1040
- meta: '#888'
1129
+ # 辅助性文字 # Dark Grey 5
1130
+ meta: '#bfbfbf'
1041
1131
  # 夜间图片亮度
1042
1132
  brightness: 70%
1043
1133
  ############################### Color Scheme ############################### > end
@@ -1061,11 +1151,11 @@ custom_css:
1061
1151
  navbar:
1062
1152
  height: 64px
1063
1153
  width: auto # auto, max
1064
- effect: [shadow, blur] # [shadow, floatable, blur]
1154
+ effect: [shadow, floatable, blur] # [shadow, floatable, blur]
1065
1155
  sidebar:
1066
- effect: [shadow] # [shadow, floatable, blur]
1156
+ effect: [shadow, floatable, blur] # [shadow, floatable, blur]
1067
1157
  body:
1068
- effect: [shadow] # [shadow, floatable, blur]
1158
+ effect: [shadow, floatable, blur] # [shadow, floatable, blur]
1069
1159
  highlight:
1070
1160
  language: true # show language of codeblock
1071
1161
  grayscale: false # Enable grayscale effect
@@ -114,13 +114,13 @@
114
114
  <div class="prev-next">
115
115
  <% if (post.prev) { %>
116
116
  <a class='prev' href='<%- url_for(post.prev.path) %>'>
117
- <p class='title'><i class="fa-solid fa-chevron-left" aria-hidden="true"></i><%- post.prev.title || '' %></p>
117
+ <p class='title'><i class="fa-solid fa-chevron-left" aria-hidden="true"></i><%- post.prev.title || post.prev.seo_title || '' %></p>
118
118
  <p class='content'><%- truncate(strip_html(page.prev.content), {length: 100}) %></p>
119
119
  </a>
120
120
  <% } %>
121
121
  <% if (post.next) { %>
122
122
  <a class='next' href='<%- url_for(post.next.path) %>'>
123
- <p class='title'><%- post.next.title || '' %><i class="fa-solid fa-chevron-right" aria-hidden="true"></i></p>
123
+ <p class='title'><%- post.next.title || post.next.seo_title || '' %><i class="fa-solid fa-chevron-right" aria-hidden="true"></i></p>
124
124
  <p class='content'><%- truncate(strip_html(page.next.content), {length: 100}) %></p>
125
125
  </a>
126
126
  <% } %>
@@ -28,9 +28,12 @@
28
28
  <link rel="preload" href="<%- theme.cdn.map.css.style %>" as="style">
29
29
  <%- generate_preload_fontfamily(theme) %>
30
30
  <!-- 页面元数据 -->
31
+ <pjax>
31
32
  <%- generate_title(config, theme, page) %>
32
33
  <%- generate_keywords(config, theme, page) %>
34
+ <%- generate_description(config, theme, page) %>
33
35
  <%- open_graph(theme.open_graph) %>
36
+ </pjax>
34
37
  <!-- feed -->
35
38
  <%_ if (config.feed && config.feed.path){ _%>
36
39
  <%_ if (typeof(config.feed.path)=="string"){ _%>
@@ -92,6 +92,7 @@
92
92
  theme.cdn.addJS("app")
93
93
  theme.cdn.addJS("parallax", "plugins/parallax")
94
94
  theme.cdn.addJS("rightMenu", "plugins/rightMenu")
95
+ theme.cdn.addJS("rightMenus", "plugins/rightMenus")
95
96
  theme.cdn.addJS("sites","plugins/tags/sites")
96
97
  theme.cdn.addJS("friends","plugins/tags/friends")
97
98
  theme.cdn.addJS("contributors","plugins/tags/contributors")
@@ -5,6 +5,7 @@
5
5
  volantis.dom = {}; // 页面Dom see: /source/js/app.js etc.
6
6
 
7
7
  volantis.GLOBAL_CONFIG ={
8
+ debug: <%- JSON.stringify(theme.debug) %>,
8
9
  cdn: <%- JSON.stringify(theme.cdn.map) %>,
9
10
  default: <%- JSON.stringify(theme.default) %>,
10
11
  lastupdate: new Date(<%- theme.getStartTime %>),
@@ -34,7 +35,8 @@
34
35
  layout: <%- JSON.stringify(theme.rightmenu.layout) %>,
35
36
  music_alwaysShow: <%- JSON.stringify(theme.rightmenu.music.alwaysShow) %>,
36
37
  customPicUrl: <%- JSON.stringify(theme.rightmenu.customPicUrl) %>
37
- }
38
+ },
39
+ rightmenus: <%- JSON.stringify(theme.rightmenus) %>
38
40
  }
39
41
  }
40
42
 
@@ -35,6 +35,10 @@
35
35
  <%- partial('../../_plugins/rightmenu/layout') %>
36
36
  <% } %>
37
37
 
38
+ <% if (theme.rightmenus.enable) { %>
39
+ <%- partial('../../_plugins/rightmenus/layout') %>
40
+ <% } %>
41
+
38
42
  <!-- rightmenu要在darkmode之前(ToggleButton) darkmode要在comments之前(volantis.dark.push)-->
39
43
  <% if (theme.plugins.darkmode.enable) { %>
40
44
  <%- partial('../../_plugins/darkmode/script') %>
@@ -4,7 +4,7 @@
4
4
  // APlayer 需要在 MetingJS 之前加载
5
5
  await volantis.js("<%- theme.plugins.aplayer.js.aplayer %>")
6
6
  await volantis.js("<%- theme.plugins.aplayer.js.meting %>")
7
- <% if (theme.rightmenu.enable && theme.rightmenu.layout.includes('music')) { %>
7
+ <% if ((theme.rightmenu.enable || theme.rightmenus.enable) && theme.rightmenu.layout.includes('music')) { %>
8
8
  // 右键 music 需要在 APlayer MetingJS 之后加载
9
9
  await volantis.js('<%- theme.cdn.addJS("plugins/aplayer") %>')
10
10
  <% } %>
@@ -19,10 +19,6 @@
19
19
  pjax = new Pjax({
20
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
21
  selectors: [
22
- "head title",
23
- "head meta[name='description']",
24
- "head meta[name='keywords']",
25
- "head meta[property^='og']",
26
22
  <% if (!theme.plugins.pjax.cover){ %>"#l_cover",<% } %>
27
23
  "#l_main",
28
24
  "#pjax-header-nav-list",
@@ -31,7 +31,6 @@ if (page && page.layout == 'post' && page.title) {
31
31
  <script>
32
32
  window.pdata={}
33
33
  pdata.ispage=<%=ispage%>;
34
- pdata.postTitle="<%=postTitle%>";
35
34
  pdata.commentPath="<%=commentPath%>";
36
35
  pdata.commentPlaceholder="<%=commentPlaceholder%>";
37
36
  pdata.commentConfig=<%- JSON.stringify(commentConfig) %>;
@@ -0,0 +1,137 @@
1
+ <%
2
+ const rightMenu = {
3
+ defaultEvent: ['copyText', 'copyLink', 'copyPaste', 'copyAll', 'copyCut', 'copyImg', 'printMode', 'readMode'],
4
+ defaultGroup: ['navigation', 'inputBox', 'seletctText', 'elementCheck', 'articlePage'],
5
+ dataGet: (data, keyStr) => {
6
+ const keys = keyStr.split('.');
7
+ let currentData = data;
8
+ for (const key of keys) {
9
+ currentData = currentData?.[key];
10
+ }
11
+ return currentData;
12
+ },
13
+ initMenu: () => {
14
+ theme.rightmenus.order.forEach(item => {
15
+ let data = rightMenu.dataGet(theme.rightmenus, item);
16
+ if(item.includes('navigation')) {
17
+ rightMenu.loadNavigation(data)
18
+ } else if (item === 'music') {
19
+ rightMenu.loadMusic()
20
+ } else {
21
+ if(Array.isArray(data)) {
22
+ data.forEach(item => {
23
+ rightMenu.loadMenu(item)
24
+ })
25
+ } else {
26
+ rightMenu.loadMenu(data)
27
+ }
28
+ }
29
+ })
30
+ },
31
+ initFunction: () => {
32
+ theme.rightmenus.order.forEach(item => {
33
+ let data = rightMenu.dataGet(theme.rightmenus, item);
34
+ if(Array.isArray(data)) {
35
+ data.forEach(item => {
36
+ rightMenu.rederFunction(item)
37
+ })
38
+ } else {
39
+ rightMenu.rederFunction(data)
40
+ }
41
+ })
42
+ }
43
+ }
44
+ %>
45
+
46
+ <% rightMenu.loadMenu = item => { %>
47
+ <% if(item === undefined) { %>
48
+ <hr class="menuLoad-Content" >
49
+ <% } else if(item['id'] === undefined) { %>
50
+ <hr class="menuLoad-Content" >
51
+ <% } else if(item['link'] === undefined) { %>
52
+ <li class="menuLoad-Content">
53
+ <span class="vlts-menu fix-cursor-default event" id="<%- item.id %>" data-event="<%- item.event %>" data-group="<%- item.group %>">
54
+ <i class="<%- item.icon %> fa-fw"></i>
55
+ <%- item.name %>
56
+ </span>
57
+ </li>
58
+ <% } else { %>
59
+ <li class="menuLoad-Content">
60
+ <a class="vlts-menu fix-cursor-default" id="<%- item.id %>" href="<%- item.link %>" data-group="<%- item.group %>">
61
+ <i class="<%- item.icon %> fa-fw"></i>
62
+ <%- item.name %>
63
+ </a>
64
+ </li>
65
+ <% } %>
66
+ <% } %>
67
+
68
+
69
+ <% rightMenu.loadNavigation = objs => { %>
70
+ <li class='navigation menuNavigation-Content'>
71
+ <% objs.forEach(item => { %>
72
+ <% if(item.link === undefined) { %>
73
+ <a class="nav icon-only fix-cursor-default" onclick="<%- item.event %>"><i class="<%- item.icon %> fa-fw"></i></a>
74
+ <% } else { %>
75
+ <a class="nav icon-only fix-cursor-default" href="<%- item.link %>"><i class="<%- item.icon %> fa-fw"></i></a>
76
+ <% } %>
77
+ <% }) %>
78
+ </li>
79
+ <% } %>
80
+
81
+
82
+ <% rightMenu.rederFunction = item => { %>
83
+ <% if (!!item && !!item['event'] && item['group'] !== 'navigation') { %>
84
+ <% if (rightMenu.defaultEvent.some(value => { return value === item['event'] })) { %>
85
+ <!-- RightMenusFunction['<%- item.id %>'] = (fun) => {fun()} -->
86
+ <% } else if (item['group'] === 'seletctText') { %>
87
+ RightMenusFunction['<%- item.id %>'] = (__text__) => {<%- item.event %>}
88
+ <% } else if (item['group'] === 'elementCheck') { %>
89
+ RightMenusFunction['<%- item.id %>'] = (__link__) => {<%- item.event %>}
90
+ <% } else { %>
91
+ RightMenusFunction['<%- item.id %>'] = () => {<%- item.event %>}
92
+ <% } %>
93
+ <% } %>
94
+ <% } %>
95
+
96
+
97
+ <% rightMenu.loadMusic = () => { %>
98
+ <div id="menuMusic">
99
+ <li class='music name menuOption-Content'>
100
+ <p class='nav music-title fix-cursor-default'></p>
101
+ </li>
102
+ <li class='music ctrl'>
103
+ <a class='nav icon-only backward fix-cursor-default' href="/" onclick="return false;" title="backward">
104
+ <i class='<%= theme.rightmenus.options.iconPrefix %> fa-step-backward fa-fw'></i>
105
+ </a>
106
+ <a class='nav icon-only toggle fix-cursor-default' href="/" onclick="return false;" title="toggle">
107
+ <i class='<%= theme.rightmenus.options.iconPrefix %> fa-play fa-fw'></i>
108
+ </a>
109
+ <a class='nav icon-only forward fix-cursor-default' href="/" onclick="return false;" title="forward">
110
+ <i class='<%= theme.rightmenus.options.iconPrefix %> fa-step-forward fa-fw'></i>
111
+ </a>
112
+ </li>
113
+ <li class='music volume'>
114
+ <div class='nav volume'>
115
+ <div class="aplayer-volume-bar-wrap">
116
+ <div class="aplayer-volume-bar fix-cursor-pointer">
117
+ <div class="aplayer-volume"></div>
118
+ <i class='left <%= theme.rightmenus.options.iconPrefix %> fa-volume-off fa-fw'></i>
119
+ <i class='right <%= theme.rightmenus.options.iconPrefix %> fa-volume-up fa-fw'></i>
120
+ </div>
121
+ </div>
122
+ </div>
123
+ </li>
124
+ </div>
125
+ <% } %>
126
+
127
+
128
+ <div id="rightmenu-wrapper">
129
+ <ul class="list-v rightmenu" id="rightmenu-content">
130
+ <% rightMenu.initMenu() %>
131
+ </ul>
132
+ </div>
133
+ <script src="<%- theme.cdn.map.js.rightMenus %>"></script>
134
+ <script>
135
+ const RightMenusFunction = {};
136
+ <% rightMenu.initFunction() %>
137
+ </script>
@@ -1,7 +1,7 @@
1
1
  <script>
2
- const SearchServiceDataPathRoot = ("<%- config.root %>" || "/").endsWith("/")
3
- ? "<%- config.root %>" || "/"
4
- : "<%- config.root %>/" || "/";
2
+ const SearchServiceDataPathRoot = ("<%- config.root %>" || "/").endsWith("/") ?
3
+ "<%- config.root %>" || "/" :
4
+ "<%- config.root %>/" || "/";
5
5
  const SearchServiceDataPath = SearchServiceDataPathRoot + "content.json";
6
6
 
7
7
  function loadSearchScript() {
@@ -16,16 +16,23 @@
16
16
  });
17
17
 
18
18
  document.querySelectorAll(".u-search-form").forEach((e) => {
19
- e.addEventListener("submit", (event)=>{event.preventDefault();}, false);
19
+ e.addEventListener("submit", (event) => {
20
+ event.preventDefault();
21
+ }, false);
20
22
  });
21
23
  }
22
24
 
23
25
  // 打开并搜索 字符串 s
24
26
  function OpenSearch(s) {
25
- loadSearchScript().then(() => {
27
+ if (typeof SearchService === 'undefined')
28
+ loadSearchScript().then(() => {
29
+ SearchService.setQueryText(s);
30
+ SearchService.search();
31
+ });
32
+ else {
26
33
  SearchService.setQueryText(s);
27
34
  SearchService.search();
28
- });
35
+ }
29
36
  }
30
37
 
31
38
  // 访问含有 ?s=xxx 的链接时打开搜索 // 与搜索引擎 structured data 相关: /scripts/helpers/structured-data/lib/config.js
@@ -40,4 +47,4 @@
40
47
  document.querySelectorAll(".input.u-search-input").forEach((e) => {
41
48
  e.addEventListener("focus", loadSearchService, false);
42
49
  });
43
- </script>
50
+ </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-volantis",
3
- "version": "5.0.0-rc.7",
3
+ "version": "5.0.0-rc.8",
4
4
  "description": "Elegant and powerful theme for Hexo.",
5
5
  "main": "package.json",
6
6
  "scripts": {
@@ -78,14 +78,24 @@ hexo.extend.helper.register("generate_keywords", function (config, theme, page)
78
78
  }
79
79
  return `<meta name="keywords" content="${keywords}">`
80
80
  });
81
- // open_graph() 函数会生成一个 description 标签??? https://github.com/hexojs/hexo/blob/92b979f4a3fa8714aebd3d11c3295d466b870905/lib/plugins/helper/open_graph.js#L98
81
+
82
82
  hexo.extend.helper.register("generate_description", function (config, theme, page) {
83
83
  const hexo = this;
84
84
  let data = init(hexo, config, theme, page);
85
85
  let description = data.description
86
86
  if (!description) {
87
- description += config.description
87
+ if (config.description) {
88
+ description = config.description
89
+ }else{
90
+ description = config.title
91
+ }
88
92
  }
89
93
  description += ` - ${config.author} - ${config.title}`
90
- return `<meta name="description" content="${description}">`
91
- });
94
+ return `<meta desc name="description" content="${description}">`
95
+ });
96
+ // open_graph() 函数会生成一个 description 标签??? https://github.com/hexojs/hexo/blob/92b979f4a3fa8714aebd3d11c3295d466b870905/lib/plugins/helper/open_graph.js#L98
97
+ // 移除 open_graph() 函数会生成的 description
98
+ hexo.extend.filter.register('after_render:html', function(data) {
99
+ data = data.replace(/<meta name="description".*>/g, "");
100
+ return data;
101
+ },99);
@@ -65,8 +65,29 @@ $color-list-hl = convert(hexo-config('color_scheme.light.list_hl'))
65
65
  $color-meta = convert(hexo-config('color_scheme.light.meta'))
66
66
 
67
67
  // 深色配色方案在 darkmode.styl 中按需加载
68
-
69
-
68
+ $color-dark-site-body = convert(hexo-config('color_scheme.dark.site_bd')) // Dark Grey 1
69
+ $color-dark-read-bkg = convert(hexo-config('color_scheme.dark.site_bg'))
70
+ $color-dark-read-post = convert(hexo-config('color_scheme.dark.card'))
71
+ $color-dark-site-bg = convert(hexo-config('color_scheme.dark.site_bg')) // Dark Grey 2
72
+ $color-dark-site-inner = convert(hexo-config('color_scheme.dark.site_inner'))
73
+ $color-dark-site-footer = convert(hexo-config('color_scheme.dark.site_footer'))
74
+ $color-dark-card = convert(hexo-config('color_scheme.dark.card')) // Dark Grey 3
75
+ $color-dark-text = convert(hexo-config('color_scheme.dark.text'))
76
+
77
+ $color-dark-block = convert(hexo-config('color_scheme.dark.block')) // Dark Grey 4
78
+ $color-dark-codeblock = convert(hexo-config('color_scheme.dark.codeblock'))
79
+ $color-dark-inlinecode = convert(hexo-config('color_scheme.dark.inlinecode'))
80
+ $color-dark-h1 = convert(hexo-config('color_scheme.dark.h1'))
81
+ $color-dark-h2 = convert(hexo-config('color_scheme.dark.h2'))
82
+ $color-dark-h3 = convert(hexo-config('color_scheme.dark.h3'))
83
+ $color-dark-h4 = convert(hexo-config('color_scheme.dark.h4'))
84
+ $color-dark-h5 = convert(hexo-config('color_scheme.dark.h5'))
85
+ $color-dark-h6 = convert(hexo-config('color_scheme.dark.h6'))
86
+ $color-dark-p = convert(hexo-config('color_scheme.dark.p'))
87
+ $color-dark-list = convert(hexo-config('color_scheme.dark.list'))
88
+ $color-dark-list-hl = convert(hexo-config('color_scheme.dark.list_hl'))
89
+ $color-dark-meta = convert(hexo-config('color_scheme.dark.meta'))
90
+ $color-dark-link = convert(hexo-config('color_scheme.dark.meta'))
70
91
 
71
92
  bgcolor($c, $mix = 10)
72
93
  return mix($c, $color-card, $mix)
@@ -26,6 +26,7 @@
26
26
  outline: none
27
27
  margin: 0
28
28
  padding: 0
29
+ scrollbar()
29
30
 
30
31
  html
31
32
  color: var(--color-text)