hexo-theme-volantis 5.0.0-rc.10 → 5.0.0-rc.100

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.10' # This is theme's version.
4
+ theme_version: '5.0.0-rc.100' # 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 调试模式
@@ -276,19 +276,19 @@ comments:
276
276
  # https://artalk.js.org/
277
277
  # https://github.com/ArtalkJS/Artalk
278
278
  artalk:
279
- js: https://unpkg.com/artalk@2.1.3/dist/Artalk.js
280
- css: https://unpkg.com/artalk@2.1.3/dist/Artalk.css
279
+ js: https://unpkg.com/artalk@2.1.9/dist/Artalk.js
280
+ css: https://unpkg.com/artalk@2.1.9/dist/Artalk.css
281
281
  server: http://127.0.0.1:8080/api # 修改为自建的后端服务地址
282
282
  path: # 全局评论地址
283
- # 更多选项 https://artalk.js.org/guide/frontend/config.htm 按照yml格式继续填写即可
283
+ # 更多选项 https://artalk.js.org/guide/frontend/config.html 按照yml格式继续填写即可
284
284
  # 除了 [el pageKey pageTitle site] 选项
285
285
  # 下面是一些例子:
286
- placeholder: 来啊,快活啊 ( ゜- ゜) # 全局评论占位
287
- noComment: 快来成为第一个评论的人吧~ # 评论为空时,评论列表显示字符
288
- pagination:
289
- readMore: true # 加载更多模式
290
- autoLoad: false # 滚动到底部自动加载
291
- pageSize: 10 # 每次请求获取数量
286
+ #placeholder: 来啊,快活啊 ( ゜- ゜) # 全局评论占位
287
+ #noComment: 快来成为第一个评论的人吧~ # 评论为空时,评论列表显示字符
288
+ #pagination:
289
+ # readMore: true # 加载更多模式
290
+ # autoLoad: false # 滚动到底部自动加载
291
+ # pageSize: 10 # 每次请求获取数量
292
292
 
293
293
  # giscus
294
294
  # https://giscus.app
@@ -901,6 +901,7 @@ rightmenus:
901
901
  - plugins.inputBox
902
902
  - plugins.seletctText
903
903
  - plugins.elementCheck
904
+ - plugins.elementImage
904
905
  - menus.link
905
906
  - hr
906
907
  - menus.darkMode
@@ -917,7 +918,7 @@ rightmenus:
917
918
  # 注:
918
919
  # 1. link/event 二选一,同时出现时仅处理 link
919
920
  # 2. 内置事件列表: copyText, copyLink, copyPaste, copyAll, copyCut, copyImg, printMode, readMode
920
- # 3. 内置组列表:navigation, inputBox, seletctText, elementCheck, articlePage
921
+ # 3. 内置组列表:navigation, inputBox, seletctText, elementCheck, elementImage, articlePage
921
922
  # 4. plugins 列允许自定义组内项目
922
923
  # 5. menus 列允许自定义组及其内容
923
924
  # 6. 除 navigation 外的内置组,在显示时会隐藏含 link 属性的菜单项
@@ -929,7 +930,10 @@ rightmenus:
929
930
  # 例外,在 articlePage 组显示时(文章页)时依旧显示含 link 属性的菜单项
930
931
  articleShowLink: false
931
932
  # 当设定全局音乐播放器时,是否一直显示音乐控制菜单。false:仅当音乐播放时启用
932
- musicAlwaysShow: true
933
+ musicAlwaysShow: false
934
+ # 适用于复制图片文件的场景,当图片源未设置 Access-Control-Allow-Origin 时,图片复制由于 CORS 问题失败
935
+ # 你可以自行部署相应项目解决该问题,详见:https://github.com/Rob--W/cors-anywhere 或者 https://github.com/Zibri/cloudflare-cors-anywhere
936
+ corsAnywhere:
933
937
  # 右键内置组,预置实现
934
938
  plugins:
935
939
  # 导航组件
@@ -953,12 +957,16 @@ rightmenus:
953
957
  - {id: 'searchWord', name: '站内搜索', icon: 'fa-solid fa-search', event: 'OpenSearch(__text__)', group: 'seletctText'}
954
958
  - {id: 'bingSearch', name: '必应搜索', icon: 'fa-solid fa-search', event: 'window.open(`https://cn.bing.com/search?q=${__text__}`)', group: 'seletctText'}
955
959
  #- {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__ 为链接地址
960
+ # 链接判断组件
961
+ # 生效于链接处的右键行为,__link__ 为链接地址
958
962
  elementCheck:
959
963
  - {id: 'openTab', name: '新标签页打开', icon: 'fa-solid fa-external-link-square-alt', event: 'window.open(__link__)', group: 'elementCheck'}
960
964
  - {id: 'copyLink', name: '复制链接地址', icon: 'fa-solid fa-link', event: 'copyLink', group: 'elementCheck'}
961
- - {id: 'copyImg', name: '复制图片文件', icon: 'fa-solid fa-image', event: 'copyImg', group: 'elementCheck'}
965
+ # 图片判断类组件
966
+ # 生效于图片类的右键行为,__link__ 为链接地址
967
+ elementImage:
968
+ - {id: 'copyImg', name: '复制图片', icon: 'fa-solid fa-image', event: 'copyImg', group: 'elementImage'}
969
+ - {id: 'googleImg', name: '谷歌识图', icon: 'fa-solid fa-images', event: 'window.open(`https://www.google.com.hk/searchbyimage?image_url=${__link__}`)', group: 'elementImage'}
962
970
  # 文章页面组件
963
971
  # 生效于 post.article 页面
964
972
  articlePage:
@@ -64,9 +64,27 @@
64
64
  <%- partial('../../_plugins/aplayer/script') %>
65
65
  <% } %>
66
66
 
67
- <% if (theme.comments.service && theme.comments.service.length > 0) { %>
68
- <%- partial('../../_plugins/comments/' + theme.comments.service + '/script') %>
69
- <% } %>
67
+ <%
68
+ if (theme.comments.service && theme.comments.service.length > 0) {
69
+ try { %>
70
+ <%- partial('../../_plugins/comments/' + theme.comments.service + '/script') %>
71
+ <% } catch (e) {
72
+ // error friendly
73
+ console.log(`
74
+ ===============================================================================
75
+ 没有找到评论插件:${theme.comments.service}
76
+ 请检查是否存在该插件,或者检查插件名称是否正确:${theme.comments.service}
77
+ see: https://volantis.js.org/v5/theme-settings/#选择评论系统
78
+ ================================================================================
79
+ There is no comments plugin: ${theme.comments.service}
80
+ Please check if the plugin exists, or check the plugin name is correct: ${theme.comments.service}
81
+ see: https://volantis.js.org/v5/theme-settings/#选择评论系统
82
+ =================================================================================`)
83
+ }
84
+ }
85
+ %>
86
+
87
+
70
88
 
71
89
  <% if (theme.analytics.busuanzi) { %>
72
90
  <script defer src="<%- theme.analytics.busuanzi %>" data-pjax></script>
@@ -1,7 +1,27 @@
1
- <%_(page.plugins||[]).forEach(function(item){ _%>
2
- <%_if (typeof item == "string") { _%>
3
- <%- partial( item + "/index") %>
4
- <%_}else if(typeof item == "object"){ _%>
5
- <%- partial( Object.keys(item)[0] + "/index", { pagePlugin:item }) %>
6
- <%_} _%>
7
- <%_ }) _%>
1
+ <%_
2
+ (page.plugins||[]).forEach(function(item){
3
+ try {
4
+ if (typeof item == "string") { _%>
5
+ <%- partial( item + "/index") %>
6
+ <%_ }else if(typeof item == "object"){ _%>
7
+ <%- partial( Object.keys(item)[0] + "/index", { pagePlugin:item }) %>
8
+ <%_ }
9
+ } catch (error) {
10
+ // error friendly
11
+ console.log(`
12
+ ===============================================================================
13
+ 没有找到页面插件:${item}
14
+ 请检查是否存在该插件,或者检查插件名称是否正确:${item}
15
+ 出问题的页面:${page.path}
16
+ see: https://volantis.js.org/v5/page-settings/#页面插件-page-plugins
17
+ ================================================================================
18
+ There is no page plugin: ${item}
19
+ Please check if the plugin exists, or check the plugin name is correct: ${item}
20
+ The page that has problem: ${page.path}
21
+ see: https://volantis.js.org/v5/page-settings/#页面插件-page-plugins
22
+ =================================================================================`);
23
+ }
24
+
25
+ })
26
+
27
+ _%>
@@ -1,7 +1,7 @@
1
1
  <%
2
2
  const rightMenu = {
3
3
  defaultEvent: ['copyText', 'copyLink', 'copyPaste', 'copyAll', 'copyCut', 'copyImg', 'printMode', 'readMode'],
4
- defaultGroup: ['navigation', 'inputBox', 'seletctText', 'elementCheck', 'articlePage'],
4
+ defaultGroup: ['navigation', 'inputBox', 'seletctText', 'elementCheck', 'elementImage', 'articlePage'],
5
5
  dataGet: (data, keyStr) => {
6
6
  const keys = keyStr.split('.');
7
7
  let currentData = data;
@@ -45,7 +45,7 @@
45
45
 
46
46
  <% rightMenu.loadMenu = item => { %>
47
47
  <% if(item === undefined) { %>
48
- <hr class="menuLoad-Content" >
48
+ <hr class="menuLoad-Content" >
49
49
  <% } else if(item['id'] === undefined) { %>
50
50
  <hr class="menuLoad-Content" >
51
51
  <% } else if(item['link'] === undefined) { %>
@@ -85,7 +85,7 @@
85
85
  <!-- RightMenusFunction['<%- item.id %>'] = (fun) => {fun()} -->
86
86
  <% } else if (item['group'] === 'seletctText') { %>
87
87
  RightMenusFunction['<%- item.id %>'] = (__text__) => {<%- item.event %>}
88
- <% } else if (item['group'] === 'elementCheck') { %>
88
+ <% } else if (item['group'] === 'elementCheck' || item['group'] === 'elementImage') { %>
89
89
  RightMenusFunction['<%- item.id %>'] = (__link__) => {<%- item.event %>}
90
90
  <% } else { %>
91
91
  RightMenusFunction['<%- item.id %>'] = () => {<%- item.event %>}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-volantis",
3
- "version": "5.0.0-rc.10",
3
+ "version": "5.0.0-rc.100",
4
4
  "description": "Elegant and powerful theme for Hexo.",
5
5
  "main": "package.json",
6
6
  "scripts": {
package/source/js/app.js CHANGED
@@ -637,7 +637,7 @@ const VolantisApp = (() => {
637
637
  // 消息提示 复制时弹出
638
638
  if (volantis.GLOBAL_CONFIG.plugins.message.enable
639
639
  && volantis.GLOBAL_CONFIG.plugins.message.copyright.enable
640
- && messageCopyrightShow < 3) {
640
+ && messageCopyrightShow < 1) {
641
641
  messageCopyrightShow++;
642
642
  VolantisApp.message(volantis.GLOBAL_CONFIG.plugins.message.copyright.title,
643
643
  volantis.GLOBAL_CONFIG.plugins.message.copyright.message, {
@@ -43,11 +43,9 @@ const RightMenuAplayer = (() => {
43
43
  });
44
44
  APlayer.player.on('volumechange', function (e) {
45
45
  fn.onUpdateAPlayerVolume(e);
46
- APlayer.status = 'volumechange';
47
46
  });
48
47
  APlayer.player.on('loadstart', function (e) {
49
48
  fn.updateTitle(e);
50
- APlayer.status = 'loadstart';
51
49
  });
52
50
 
53
51
  // 监听音量手势
@@ -185,4 +183,4 @@ Object.freeze(RightMenuAplayer);
185
183
 
186
184
  volantis.requestAnimationFrame(() => {
187
185
  RightMenuAplayer.checkAPlayer();
188
- });
186
+ });
@@ -1,9 +1,11 @@
1
1
 
2
2
  const RightMenus = {
3
3
  defaultEvent: ['copyText', 'copyLink', 'copyPaste', 'copyAll', 'copyCut', 'copyImg', 'printMode', 'readMode'],
4
- defaultGroup: ['navigation', 'inputBox', 'seletctText', 'elementCheck', 'articlePage'],
4
+ defaultGroup: ['navigation', 'inputBox', 'seletctText', 'elementCheck', 'elementImage', 'articlePage'],
5
5
  messageRightMenu: volantis.GLOBAL_CONFIG.plugins.message.enable && volantis.GLOBAL_CONFIG.plugins.message.rightmenu.enable,
6
+ corsAnywhere: volantis.GLOBAL_CONFIG.plugins.rightmenus.options.corsAnywhere,
6
7
  urlRegx: /^((https|http)?:\/\/)+[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\"\"])*$/,
8
+ imgRegx: /\.(jpe?g|png|webp|svg|gif|jifi)$/,
7
9
 
8
10
  /**
9
11
  * 加载右键菜单
@@ -73,7 +75,7 @@ const RightMenus = {
73
75
  })
74
76
  }, 'image/png')
75
77
  }, false)
76
- image.src = link;
78
+ image.src = `${RightMenus.corsAnywhere ? RightMenus.corsAnywhere : ''}${link}`;
77
79
  },
78
80
 
79
81
  /**
@@ -116,12 +118,12 @@ RightMenus.fun = (() => {
116
118
  _rightMenuWrapper = document.getElementById('rightmenu-wrapper'),
117
119
  _rightMenuContent = document.getElementById('rightmenu-content'),
118
120
  _rightMenuList = document.querySelectorAll('#rightmenu-content li.menuLoad-Content'),
121
+ _rightMenuListWithHr = document.querySelectorAll('#rightmenu-content li, #rightmenu-content hr, #menuMusic'),
119
122
  _readBkg = document.getElementById('read_bkg'),
120
123
  _menuMusic = document.getElementById('menuMusic'),
121
124
  _backward = document.querySelector('#menuMusic .backward'),
122
125
  _toggle = document.querySelector('#menuMusic .toggle'),
123
- _forward = document.querySelector('#menuMusic .forward'),
124
- _menuHr = document.querySelectorAll('#rightmenu-content hr');
126
+ _forward = document.querySelector('#menuMusic .forward');
125
127
 
126
128
  // 公共数据
127
129
  let globalData = {
@@ -133,7 +135,7 @@ RightMenus.fun = (() => {
133
135
  linkUrl: '',
134
136
  isMediaLink: false,
135
137
  mediaLinkUrl: '',
136
- isPngImg: false,
138
+ isImage: false,
137
139
  isArticle: false,
138
140
  pathName: '',
139
141
  isReadClipboard: false,
@@ -210,28 +212,31 @@ RightMenus.fun = (() => {
210
212
  if (globalData.statusCheck || globalData.isArticle) {
211
213
  switch (groupName) {
212
214
  case 'inputBox':
213
- if (globalData.isInputBox) item.style.display = 'block';
214
- if (itemEvent === 'copyCut' && !globalData.selectText) item.style.display = 'none';
215
- // 判断剪切板是否包含文本
216
- // Note: 异步? 导致了此处判断只能写这里(存在些微时间差)
217
- if (itemEvent === 'copyPaste')
218
- RightMenus.readClipboard().then(text => {
219
- if (!!text) {
220
- globalData.isReadClipboard = true;
221
- globalData.readClipboard = text;
222
- } else {
215
+ if (globalData.isInputBox) {
216
+ item.style.display = 'block';
217
+ if (itemEvent === 'copyCut' && !globalData.selectText) item.style.display = 'none';
218
+ if (itemEvent === 'copyAll' && !globalData.inputValue) item.style.display = 'none';
219
+ if (globalData.isInputBox && itemEvent === 'copyPaste')
220
+ RightMenus.readClipboard().then(text => {
221
+ if (!!text) {
222
+ globalData.isReadClipboard = true;
223
+ globalData.readClipboard = text;
224
+ } else {
225
+ item.style.display = 'none';
226
+ }
227
+ }).catch(() => {
223
228
  item.style.display = 'none';
224
- }
225
- }).catch(() => {
226
- item.style.display = 'none';
227
- })
229
+ })
230
+ }
228
231
  break;
229
232
  case 'seletctText':
230
233
  if (!!globalData.selectText) item.style.display = 'block';
231
234
  break;
232
235
  case 'elementCheck':
233
236
  if (globalData.isLink || globalData.isMediaLink) item.style.display = 'block';
234
- if (itemEvent === 'copyImg' && !globalData.isPngImg) item.style.display = 'none';
237
+ break;
238
+ case 'elementImage':
239
+ if (globalData.isImage) item.style.display = 'block';
235
240
  break;
236
241
  case 'articlePage':
237
242
  if (globalData.isArticle) item.style.display = 'block';
@@ -248,9 +253,28 @@ RightMenus.fun = (() => {
248
253
  item.style.display = 'block';
249
254
  }
250
255
  })
251
- _menuHr.forEach(item => {
252
- item.style.display = globalData.statusCheck ? 'none' : 'block';
256
+
257
+
258
+ let elementHrItem = { item: null, hide: true };
259
+ _rightMenuListWithHr.forEach((item) => {
260
+ if (item.nodeName === "HR") {
261
+ item.style.display = 'block';
262
+ if (!elementHrItem.item) {
263
+ elementHrItem.item = item;
264
+ return;
265
+ }
266
+ if (elementHrItem.hide || elementHrItem.item.nextElementSibling.nodeName === "hr") {
267
+ elementHrItem.item.style.display = 'none';
268
+ }
269
+ elementHrItem.item = item;
270
+ elementHrItem.hide = true;
271
+ } else {
272
+ if (item.style.display === 'block' && elementHrItem.hide) {
273
+ elementHrItem.hide = false;
274
+ }
275
+ }
253
276
  })
277
+ if (!!elementHrItem.item && elementHrItem.hide) elementHrItem.item.style.display = 'none';
254
278
  }
255
279
 
256
280
  /**
@@ -280,9 +304,9 @@ RightMenus.fun = (() => {
280
304
  globalData.mediaLinkUrl = event.target.currentSrc;
281
305
  }
282
306
 
283
- // 判断是否为 png 格式的图片地址
284
- if (globalData.isMediaLink) {
285
- globalData.isPngImg = true;
307
+ // 判断是否为图片地址
308
+ if (globalData.isMediaLink && RightMenus.imgRegx.test(globalData.mediaLinkUrl)) {
309
+ globalData.isImage = true;
286
310
  }
287
311
 
288
312
  // 判断是否为文章页面
@@ -348,6 +372,8 @@ RightMenus.fun = (() => {
348
372
  RightMenusFunction[id](globalData.selectText)
349
373
  } else if (groupName === 'elementCheck') {
350
374
  RightMenusFunction[id](globalData.isLink ? globalData.linkUrl : globalData.mediaLinkUrl)
375
+ } else if (groupName === 'elementImage') {
376
+ RightMenusFunction[id](globalData.mediaLinkUrl)
351
377
  } else {
352
378
  RightMenusFunction[id]()
353
379
  }
@@ -471,18 +497,27 @@ RightMenus.fun = (() => {
471
497
  }
472
498
 
473
499
  fn.copyImg = () => {
500
+ if (volantis.GLOBAL_CONFIG.plugins.message.rightmenu.notice) {
501
+ VolantisApp.message('系统提示', '复制中,请等待。', {
502
+ icon: rightMenuConfig.options.iconPrefix + ' fa-images'
503
+ })
504
+ }
474
505
  RightMenus.writeClipImg(globalData.mediaLinkUrl, e => {
475
- if (RightMenus.messageRightMenu)
506
+ if (RightMenus.messageRightMenu) {
507
+ VolantisApp.hideMessage();
476
508
  VolantisApp.message('系统提示', '图片复制成功!', {
477
509
  icon: rightMenuConfig.options.iconPrefix + ' fa-images'
478
510
  });
511
+ }
479
512
  }, (e) => {
480
513
  console.error(e);
481
- if (RightMenus.messageRightMenu)
514
+ if (RightMenus.messageRightMenu) {
515
+ VolantisApp.hideMessage();
482
516
  VolantisApp.message('系统提示', '复制失败:' + e, {
483
517
  icon: rightMenuConfig.options.iconPrefix + ' fa-exclamation-square red',
484
518
  time: 9000
485
519
  });
520
+ }
486
521
  })
487
522
  }
488
523