hexo-theme-volantis 5.0.0-rc.3 → 5.0.0-rc.6

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.
Files changed (39) hide show
  1. package/README.md +2 -0
  2. package/_config.yml +44 -80
  3. package/layout/_meta/counter.ejs +1 -4
  4. package/layout/_partial/head.ejs +1 -8
  5. package/layout/_partial/scripts/_ctrl/cdnCtrl.ejs +12 -7
  6. package/layout/_partial/scripts/global.ejs +24 -15
  7. package/layout/_plugins/_page_plugins/fcircle/index.ejs +9 -223
  8. package/layout/_plugins/parallax/script.ejs +8 -4
  9. package/layout/_plugins/pjax/index.ejs +1 -1
  10. package/layout/_plugins/rightmenu/layout.ejs +3 -3
  11. package/package.json +4 -3
  12. package/scripts/events/lib/config.js +1 -1
  13. package/scripts/filters/CSP.js +74 -0
  14. package/scripts/tags/contributors.js +1 -1
  15. package/scripts/tags/friends.js +1 -1
  16. package/scripts/tags/site.js +2 -2
  17. package/source/css/_style/_layout/article.styl +1 -1
  18. package/source/css/_style/_layout/main.styl +2 -0
  19. package/source/css/_style/_layout/sidebar.styl +0 -1
  20. package/source/css/_style/_plugins/_dark/dark_async.styl +0 -9
  21. package/source/css/_style/_plugins/_dark/dark_plugins.styl +0 -38
  22. package/source/css/_style/_plugins/cursor.styl +0 -10
  23. package/source/css/_style/_plugins/index.styl +0 -2
  24. package/source/css/_style/_tag-plugins/Readme.md +0 -3
  25. package/source/css/_style/index.styl +1 -2
  26. package/source/js/app.js +13 -12
  27. package/source/js/plugins/aplayer.js +0 -3
  28. package/source/js/plugins/contributors.js +1 -1
  29. package/source/js/plugins/friends.js +1 -1
  30. package/source/js/plugins/rightMenu.js +55 -38
  31. package/source/js/plugins/sites.js +2 -2
  32. package/layout/_meta/valinecount.ejs +0 -15
  33. package/layout/_plugins/_page_plugins/hpptalk/index.ejs +0 -14
  34. package/layout/_plugins/comments/minivaline/script.ejs +0 -45
  35. package/layout/_plugins/comments/valine/script.ejs +0 -53
  36. package/scripts/generator/build-config.js +0 -9
  37. package/scripts/helpers/tag-plugins-style/index.js +0 -199
  38. package/source/css/_style/_plugins/valine.styl +0 -183
  39. package/source/js/thirdparty/valine.js +0 -5137
package/README.md CHANGED
@@ -31,6 +31,8 @@ npm i hexo-theme-volantis
31
31
 
32
32
  See docs: https://volantis.js.org
33
33
 
34
+ or: https://vlts.cc
35
+
34
36
  or: https://volantis.vercel.app
35
37
 
36
38
  ## Examples
package/_config.yml CHANGED
@@ -18,11 +18,38 @@ default:
18
18
  ############################### Volantis ###############################
19
19
  info:
20
20
  theme_name: Volantis # This is theme's name.
21
- theme_version: '5.0.0-rc.3' # This is theme's version.
21
+ theme_version: '5.0.0-rc.6' # This is theme's version.
22
22
  theme_docs: https://volantis.js.org/ # This is theme's URL.
23
23
  theme_repo: https://github.com/volantis-x/hexo-theme-volantis
24
24
  # Debug 调试模式
25
25
  debug: false
26
+ ############################### CSP ###############################
27
+ # 内容安全策略( CSP )
28
+ # https://developer.mozilla.org/zh-CN/docs/Web/HTTP/CSP
29
+ # https://content-security-policy.com/
30
+ csp:
31
+ content: "
32
+ default-src 'self' https:;
33
+ block-all-mixed-content;
34
+ base-uri 'self' https:;
35
+ form-action 'self' https:;
36
+ worker-src 'self' https:;
37
+ connect-src 'self' https: *;
38
+ img-src 'self' data: https: *;
39
+ media-src 'self' https: *;
40
+ font-src 'self' data: https: *;
41
+ frame-src 'self' https: *;
42
+ manifest-src 'self' https: *;
43
+ child-src https:;
44
+ script-src 'self' https: 'unsafe-inline' *;
45
+ style-src 'self' https: 'unsafe-inline' *;
46
+ "
47
+ # 可以使用自动程序替换默认的 'unsafe-inline' 和 * 生成更严格的内容安全策略.
48
+ # hexo_fliter_sha256 用于 hexo g 时替换 'unsafe-inline' 生成 script-src 'sha256-' , 只适用于外层不含有压缩工具得场景.
49
+ # 如果外层含有压缩工具会改变 hash 导致无效,hexo_fliter_sha256 需设为false, 使用 gulp 方案.
50
+ hexo_fliter_sha256: false
51
+ # 另可以参考官网的 gulp 方案.
52
+ # gulpfile.js https://github.com/volantis-x/community/blob/main/gulpfile.js
26
53
  ############################### CDN ###############################
27
54
  # 本地静态文件使用jsdelivr的min版本加速 https://www.jsdelivr.com/features
28
55
  # 默认使用 https://cdn.jsdelivr.net/npm/hexo-theme-volantis@<%- theme.info.theme_version %>/source/js/*.min.js 的CDN压缩版本(min.js),注意版本号对应关系!!可以通过修改以下配置项覆盖
@@ -32,13 +59,15 @@ cdn:
32
59
  # CDN 前缀,为空使用默认值,链接最后不加 "/",
33
60
  # 例如: https://cdn.jsdelivr.net/gh/volantis-x/volantis-x.github.io@gh-page 填写最后编译生成的源码CDN地址前缀,此路径下应该含有/js与/css目录,
34
61
  # 该配置默认值是:"https://cdn.jsdelivr.net/npm/hexo-theme-volantis@"+ theme.info.theme_version +"/source"
35
- prefix: https://npm.elemecdn.com/hexo-theme-volantis@5.0.0-rc.3/source
62
+ prefix: https://npm.elemecdn.com/hexo-theme-volantis@5.0.0-rc.6/source
36
63
  # 以下配置可以覆盖 cdn.prefix,配置项的值可以为空,但是要使用CDN必须依据路径填写配置项的键
37
64
  set:
38
65
  js:
39
66
  app: /js/app.js
40
67
  css:
41
68
  style: /css/style.css # (异步加载样式)
69
+ # 请求静态资源添加时间戳 ?time=1648684470140
70
+ cdn_version: true
42
71
  ########################################################################
43
72
  # 全局页面字符串替换 A => B (可用于临时修改错字等)
44
73
  replace:
@@ -215,10 +244,7 @@ article:
215
244
  counter:
216
245
  icon: fa-solid fa-eye
217
246
  unit: '次浏览'
218
- # 文章评论数量:支持 valine和waline
219
- valinecount:
220
- icon: fa-solid fa-comment-dots
221
- desc: '' # 条评论
247
+ # waline 文章评论数量
222
248
  walinecount:
223
249
  icon: fa-solid fa-comment-dots
224
250
  desc: '' # 条评论
@@ -273,9 +299,6 @@ comments:
273
299
  # https://giscus.app
274
300
  # https://github.com/laymonage/giscus
275
301
  giscus:
276
- theme:
277
- light: "light" # https://cdn.jsdelivr.net/gh/volantis-x/cdn-volantis@master/css/giscus/light.css
278
- dark: "dark" # https://cdn.jsdelivr.net/gh/volantis-x/cdn-volantis@master/css/giscus/dark.css
279
302
  # 以下配置按照 yml 格式增删填写即可
280
303
  # repo: xxx/xxx
281
304
  # repo-id: xxx
@@ -285,6 +308,10 @@ comments:
285
308
  # reactions-enabled: "1"
286
309
  # emit-metadata: "0"
287
310
  # lang: "zh-CN"
311
+ # 以上配置按照 yml 格式增删填写即可
312
+ theme:
313
+ light: "light" # https://cdn.jsdelivr.net/gh/volantis-x/cdn-volantis@master/css/giscus/light.css
314
+ dark: "dark" # https://cdn.jsdelivr.net/gh/volantis-x/cdn-volantis@master/css/giscus/dark.css
288
315
 
289
316
  # beaudar
290
317
  # https://beaudar.lipk.org/
@@ -311,36 +338,6 @@ comments:
311
338
  dark: github-dark
312
339
  label: ✨💬✨
313
340
 
314
- # Valine
315
- # https://valine.js.org/
316
- valine:
317
- js: https://cdn.jsdelivr.net/npm/valine@1.4/dist/Valine.min.js
318
- emojiCDN: https://cdn.jsdelivr.net/gh/volantis-x/cdn-emoji/valine/
319
- path: # 全局评论地址 目前设置全局评论地址后visitor失效,这是valine的问题
320
- placeholder: 快来评论吧~ # 评论占位提示
321
- # 其他配置项按照yml格式继续填写即可 除了 [el path placeholder emojiCDN emojiMaps] 选项
322
- appId: # your appId
323
- appKey: # your appKey
324
- meta: [nick,mail,link] # valine comment header info
325
- requiredFields: [nick,mail]
326
- enableQQ: true # Unstable avatar link
327
- recordIP: false # Record commenter IP
328
- avatar: robohash # gravatar style https://valine.js.org/avatar
329
- pageSize: 10 # comment list page size
330
- lang: zh-cn
331
- highlight: true
332
- mathJax: false
333
-
334
- # MiniValine
335
- # https://github.com/MiniValine/MiniValine
336
- minivaline:
337
- js: https://cdn.jsdelivr.net/npm/minivaline@latest
338
- path: # 全局评论地址
339
- placeholder: 快来评论吧~ # 全局评论占位提示
340
- # 更多选项 https://minivaline.js.org/docs/cn/#/Options 按照yml格式继续填写即可 (除了 [el path placeholder] 选项)
341
- # 下面是一个例子:
342
- serverURL: https://hello.com
343
-
344
341
  # Disqus
345
342
  # https://disqus.com
346
343
  disqus:
@@ -415,7 +412,7 @@ comments:
415
412
  # Waline
416
413
  # https://waline.js.org/
417
414
  waline:
418
- js: https://cdn.jsdelivr.net/npm/@waline/client/dist/Waline.min.js
415
+ js: https://npm.elemecdn.com/@waline/client@1.6.0/dist/Waline.min.js
419
416
  path: # 全局评论地址 目前设置全局评论地址后visitor失效,这是waline的问题
420
417
  placeholder: 快来评论吧~ # 评论占位提示
421
418
  # imageHosting: https://7bu.top/api/upload?token=7ffe9d626fe4315c953758efbdb6ee2e # 图床api(默认注释使用base64)
@@ -596,7 +593,7 @@ site_footer:
596
593
  <span id="lc-sv">本站总访问量为 <span id='number'><i class="fa-solid fa-circle-notch fa-spin fa-fw" aria-hidden="true"></i></span> 次</span>
597
594
  <span id="lc-uv">访客数为 <span id='number'><i class="fa-solid fa-circle-notch fa-spin fa-fw" aria-hidden="true"></i></span> 人</span>
598
595
  # site copyright
599
- copyright: '[Copyright © 2017-2020 XXX](/)'
596
+ copyright: '[Copyright © since 2017 XXX](/)'
600
597
  # You can add your own property here. (Support markdown, for example: br: '<br>')
601
598
  br: '<br>'
602
599
  ############################### Site Footer ############################### > end
@@ -607,8 +604,8 @@ plugins:
607
604
  # jquery
608
605
  globalJquery: false # 全局引入 jquery
609
606
  jquery: /libs/jquery/dist/jquery.min.js # https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js
610
- # fontawesome Pro 版本:https://cdn.jsdelivr.net/gh/inkss/fontawesome@5.15.3/css/all.min.css
611
- fontawesome: /libs/@fortawesome/fontawesome-free/css/all.min.css # https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.14/css/all.min.css
607
+ # fontawesome Pro 版本:https://cdn.jsdelivr.net/gh/inkss/fontawesome@6.0.0/css/all.min.css
608
+ fontawesome: /libs/@fortawesome/fontawesome-free/css/all.min.css # https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.1/css/all.min.css
612
609
  # katex@0.15.2
613
610
  katex:
614
611
  js: /libs/katex/katex.min.js # https://cdn.jsdelivr.net/npm/katex@0.15.2/dist/katex.min.js
@@ -831,37 +828,16 @@ plugins:
831
828
  appKey: HwCiWuxfpvKiLm4teCUgTIba # your appKEY
832
829
  serverURLs: https://bbapi.heson10.com # Request Api 域名
833
830
 
834
- # HexoPlusPlus
835
- # https://github.com/HexoPlusPlus/HexoPlusPlus
836
- # https://hexoplusplus.js.org/
837
- # 无服务器Hexo后端,支持文章编辑,自带图床功能.目标:解决静态博客所有痛点[文章编辑、图片上传、博主活跃信息统计、博主说说、Twikoo加强版、阅读量统计等
838
- hpp:
839
- # 说说功能
840
- # Set `plugins: ["hpptalk"]` to enable in front-matter
841
- # 支持 Pjax
842
- hpp_talk:
843
- css: https://cdn.jsdelivr.net/gh/HexoPlusPlus/HexoPlusPlus@latest/talk.css # 建议锁定版本
844
- js: https://cdn.jsdelivr.net/gh/HexoPlusPlus/HexoPlusPlus@latest/talk_user.js # 建议锁定版本
845
- limit: 10
846
- start: 0
847
- # 配置项按照yml格式继续填写即可
848
- # domain:
849
- # themecss:
850
- # HexoPlusPlus其他功能暂未集成
851
-
852
831
  # 友链朋友圈 hexo-circle-of-friends
853
832
  # https://github.com/Rock-Candy-Tea/hexo-circle-of-friends
854
- # https://zfe.space/post/friend-link-circle.html
833
+ # https://fcircle-doc.js.cool/
855
834
  fcircle:
856
835
  # Set `plugins: ["fcircle"]` to enable in front-matter
857
836
  # 支持 Pjax
858
837
  api: '' # api 地址
859
- max_number: 20 # 页面展示文章数量
860
- add_number: 10 # 每次加载增加的篇数
861
- opentype: '_blank' # '_blank'打开新标签,'_self'本窗口打开
862
- nofollow: true # 禁止搜索引擎抓取
863
- imgError: https://cdn.jsdelivr.net/gh/Zfour/Butterfly-friend-poor-html/friendcircle/404.png
864
- # loadingCutom: # 自定义loading图 例如: <i class="fa fa-spinner fa-spin"></i> | <img src="你的图片地址" alt="加载中...">
838
+ message: '与主机通讯中……' # 占位文字
839
+ css: 'https://cdn.jsdelivr.net/gh/lmm214/immmmm/themes/hello-friend/static/fcircle-beta.css'
840
+ js: 'https://cdn.jsdelivr.net/gh/lmm214/immmmm/themes/hello-friend/static/fcircle-beta.js'
865
841
 
866
842
  # 消息提示
867
843
  message:
@@ -891,17 +867,6 @@ plugins:
891
867
  rightmenu:
892
868
  enable: true # 是否开启右键模块的消息通知
893
869
  notice: true # 唤醒原右键菜单的通知
894
-
895
- # 标签插件样式按需加载
896
- # 注意这个配置是带缓存的, 如果修改标签插件样式每次调试需要刷新两次页面, 建议开发者关闭该配置
897
- tag_plugin_load_on_demand:
898
- enable: #true
899
- # 每个页面强制加载以下标签插件样式
900
- plugins:
901
- - note
902
- - btns
903
- - p
904
- - gallery
905
870
 
906
871
  # 聊天功能
907
872
  chat_service: # tidio or gitter
@@ -936,7 +901,6 @@ rightmenu:
936
901
  print: # 只有文章页才允许自定义打印
937
902
  name: 打印页面
938
903
  icon: fa fa-print
939
- defaultStyles: true # 是否使用预制的打印样式
940
904
  darkmode: # 需开启 plugins.darkmodejs
941
905
  name: 暗黑模式
942
906
  icon: fa fa-moon
@@ -26,10 +26,7 @@
26
26
  </p>
27
27
  </a>
28
28
  </div>
29
- <% } else if (
30
- (theme.comments.service=='valine' && theme.comments.valine.visitor) ||
31
- (theme.comments.service=='minivaline' && theme.comments.minivaline.visitor) ||
32
- (theme.comments.service=='waline' && theme.comments.waline.visitor)) { %>
29
+ -<% } else if (theme.comments.service=='waline' && theme.comments.waline.visitor) { %>
33
30
  <div class="new-meta-item browse">
34
31
  <a class='notlink'>
35
32
  <i class="<%- theme.article.body.meta_library.counter.icon %> fa-fw" aria-hidden="true"></i>
@@ -11,6 +11,7 @@
11
11
  <meta name="renderer" content="webkit">
12
12
  <meta name="force-rendering" content="webkit">
13
13
  <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
14
+ <meta http-equiv="Content-Security-Policy" content="<%- theme.csp.content %>">
14
15
  <meta name="HandheldFriendly" content="True" >
15
16
  <meta name="apple-mobile-web-app-capable" content="yes">
16
17
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5">
@@ -54,14 +55,6 @@
54
55
  /* 首屏样式 */
55
56
  <%- FirstCSS() %>
56
57
  </style>
57
- <%_ if (theme.plugins.tag_plugin_load_on_demand.enable) { _%>
58
- <pjax>
59
- <style>
60
- /* 按需加载的标签插件样式 */
61
- <%- TagCSS(page) %>
62
- </style>
63
- </pjax>
64
- <%_ } _%>
65
58
  <link rel="stylesheet" href="<%- theme.cdn.map.css.style %>" media="print" onload="this.media='all';this.onload=null">
66
59
  <noscript><link rel="stylesheet" href="<%- theme.cdn.map.css.style %>"></noscript>
67
60
  <%_ if (theme.plugins.darkmode.enable) { _%>
@@ -4,6 +4,10 @@
4
4
  // theme.cdn.addCSS("first","first",theme.cdn.set.css.first) => theme.cdn.map.css.first
5
5
 
6
6
  theme.cdnCtrl={}
7
+ theme.cdnCtrl.cdn_version = "";
8
+ if (theme.cdn_version) {
9
+ theme.cdnCtrl.cdn_version = '?time=' + theme.getStartTime;
10
+ }
7
11
  if (theme.cdn.enable&&theme.cdn.prefix) {
8
12
  theme.cdnCtrl.prefix=theme.cdn.prefix.replace(/\/$/g, "")
9
13
  } else {
@@ -14,7 +18,7 @@
14
18
  theme.cdn.map.css={}
15
19
  theme.cdn.addJS=(name,source,force)=>{
16
20
  if(force){
17
- theme.cdn.map.js[name]=force + '?time=' + Date.now()
21
+ theme.cdn.map.js[name]=force + theme.cdnCtrl.cdn_version
18
22
  }else{
19
23
  if(!source){
20
24
  source=name
@@ -23,16 +27,16 @@
23
27
  if (theme.cdn.enable) {
24
28
  let suffix=theme.cdn.prefix&&theme.cdn.prefix.match(/jsdelivr/g)?'.min.js':'.js'
25
29
  source= (suffix==".min.js")?source.replace(/\.min/g, ""):source
26
- theme.cdn.map.js[name]=theme.cdnCtrl.prefix + '/js/' + source + suffix + '?time=' + Date.now()
30
+ theme.cdn.map.js[name]=theme.cdnCtrl.prefix + '/js/' + source + suffix + theme.cdnCtrl.cdn_version
27
31
  } else {
28
- theme.cdn.map.js[name]=url_for('/js/')+ source + '.js?time=' + Date.now()
32
+ theme.cdn.map.js[name]=url_for('/js/')+ source + '.js' + theme.cdnCtrl.cdn_version
29
33
  }
30
34
  }
31
35
  return theme.cdn.map.js[name]
32
36
  }
33
37
  theme.cdn.addCSS=(name,source,force)=>{
34
38
  if(force){
35
- theme.cdn.map.css[name]=force + '?time=' + Date.now()
39
+ theme.cdn.map.css[name]=force + theme.cdnCtrl.cdn_version
36
40
  }else{
37
41
  if(!source){
38
42
  source=name
@@ -41,9 +45,9 @@
41
45
  if (theme.cdn.enable&&theme.cdn.prefix) {
42
46
  let suffix=theme.cdn.prefix.match(/jsdelivr/g)?'.min.css':'.css'
43
47
  source= (suffix==".min.js")?source.replace(/\.min/g, ""):source
44
- theme.cdn.map.css[name]=theme.cdnCtrl.prefix + '/css/' + source + suffix + '?time=' + Date.now()
48
+ theme.cdn.map.css[name]=theme.cdnCtrl.prefix + '/css/' + source + suffix + theme.cdnCtrl.cdn_version
45
49
  } else {
46
- theme.cdn.map.css[name]=url_for('/css/')+ source + '.css?time=' + Date.now()
50
+ theme.cdn.map.css[name]=url_for('/css/')+ source + '.css' + theme.cdnCtrl.cdn_version
47
51
  }
48
52
  }
49
53
  return theme.cdn.map.css[name]
@@ -85,7 +89,6 @@
85
89
  theme.cdn.addJS("rightMenu", "plugins/rightMenu")
86
90
  theme.cdn.addJS("contributors","plugins/contributors")
87
91
  theme.cdn.addJS("message", "thirdparty/message")
88
- theme.cdn.addJS("valine","thirdparty/valine",theme.comments.valine.js)
89
92
  theme.cdn.addJS("search","search/"+theme.search.service,theme.search.js)
90
93
 
91
94
  // 以下用于配置项 cdn.set 覆盖配置,下面是覆盖配置的方法
@@ -109,5 +112,7 @@
109
112
  // 在部署时加入了 ?time=' + Date.now()
110
113
  // 使用 js(theme.cdn.map.js.app) 引入的地址会形如: /js/app.js?time=1232123123.js
111
114
  // 但是无伤大雅
115
+ // 更新:
116
+ // ?time=' + Date.now() 替换为 theme.getStartTime 保证相同资源 hash 不变
112
117
  dfs(theme.cdn.set,[])
113
118
  _%>
@@ -7,7 +7,7 @@
7
7
  volantis.GLOBAL_CONFIG ={
8
8
  cdn: <%- JSON.stringify(theme.cdn.map) %>,
9
9
  default: <%- JSON.stringify(theme.default) %>,
10
- lastupdate: new Date('<%- new Date() %>'),
10
+ lastupdate: new Date(<%- theme.getStartTime %>),
11
11
  sidebar: {
12
12
  for_page: <%- JSON.stringify(theme.sidebar.for_page) %>,
13
13
  for_post: <%- JSON.stringify(theme.sidebar.for_post) %>,
@@ -33,8 +33,7 @@
33
33
  faicon: <%- JSON.stringify(theme.rightmenu.faicon) %>,
34
34
  layout: <%- JSON.stringify(theme.rightmenu.layout) %>,
35
35
  music_alwaysShow: <%- JSON.stringify(theme.rightmenu.music.alwaysShow) %>,
36
- customPicUrl: <%- JSON.stringify(theme.rightmenu.customPicUrl) %>,
37
- print: <%- JSON.stringify(theme.rightmenu.print.defaultStyles) %>
36
+ customPicUrl: <%- JSON.stringify(theme.rightmenu.customPicUrl) %>
38
37
  }
39
38
  }
40
39
  }
@@ -371,18 +370,28 @@
371
370
  window.scrollTo(opt);
372
371
  // 监视器
373
372
  // 监视并矫正元素滚动到指定位置
374
- // 目前用于处理 toc 部分 lazyload 引起的 cls 导致的定位失败问题
375
- if (option.observer) {
376
- volantis.scroll.unengine.push(()=>{
377
- let me = ele.getBoundingClientRect().top
378
- if(!(me >= -option.observerDic && me <= option.observerDic)){
379
- volantis.scroll.to(ele, option)
380
- }else{
381
- volantis.scroll.unengine.remove("unengineObserver")
382
- }
383
- },"unengineObserver")
384
- }
373
+ // 目前用于处理 toc 部分 lazyload 引起的 cls 导致的定位失败问题 [存在Bug]
374
+ // if (option.observer) {
375
+ // volantis.scroll.unengine.push(()=>{
376
+ // let me = ele.getBoundingClientRect().top
377
+ // if(!(me >= -option.observerDic && me <= option.observerDic)){
378
+ // volantis.scroll.to(ele, option)
379
+ // }else{
380
+ // volantis.scroll.unengine.remove("unengineObserver")
381
+ // }
382
+ // },"unengineObserver")
383
+ // }
385
384
  }
386
385
  /******************************************************************************/
387
386
  /******************************************************************************/
388
- </script>
387
+ //图像加载出错时的处理
388
+ function errorImgAvatar(img) {
389
+ img.src = "<%- theme.default.avatar %>";
390
+ img.onerror = null;
391
+ }
392
+ function errorImgCover(img) {
393
+ img.src = "<%- theme.default.cover %>";
394
+ img.onerror = null;
395
+ }
396
+ /******************************************************************************/
397
+ </script>
@@ -1,226 +1,12 @@
1
1
  <script>
2
- volantis.layoutHelper("page-plugins",`<div id="moments_container"></div>`,{pjax:false}) // 外层有 pjax 标签
2
+ volantis.layoutHelper("page-plugins",`<div class="post-content"><div id="cf-container"><%- theme.plugins.fcircle.message %></div></div>`,{pjax:false}) // 外层有 pjax 标签
3
3
  </script>
4
- <script>
5
- var requests_url = '<%- theme.plugins.fcircle.api %>';
6
- var orign_data = [];
7
- var maxnumber = <%- theme.plugins.fcircle.max_number %>;
8
- var addnumber = <%- theme.plugins.fcircle.add_number %>;
9
- var opentype = '<%- theme.plugins.fcircle.opentype %>';
10
- var nofollow = <%- theme.plugins.fcircle.nofollow %>;
11
- var loadingCutom = '<%- theme.plugins.fcircle.loadingCutom %>';
12
- var fcircleImgError = '<%- theme.plugins.fcircle.imgError %>';
13
-
14
- //处理数据
15
-
16
- if (document.getElementById('moments_container')) {
17
- //添加加载动画
18
- var loading_pic = document.getElementById('moments_container');
19
-
20
- // 判断loadingCutom值是否为空
21
- if (typeof loadingCutom == "undefined" || loadingCutom == null || loadingCutom === "") {
22
- loading_pic.innerHTML = '<style>.loader { color: #d9dad8; font-size: 90px; text-indent: -9999em; overflow: hidden; width: 1em; height: 1em; border-radius: 50%; margin: 72px auto; position: relative; -webkit-transform: translateZ(0); -ms-transform: translateZ(0); transform: translateZ(0); -webkit-animation: load6 1.7s infinite ease, round 1.7s infinite ease; animation: load6 1.7s infinite ease, round 1.7s infinite ease; } @-webkit-keyframes load6 { 0% { box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em; } 5%, 95% { box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em; } 10%, 59% { box-shadow: 0 -0.83em 0 -0.4em, -0.087em -0.825em 0 -0.42em, -0.173em -0.812em 0 -0.44em, -0.256em -0.789em 0 -0.46em, -0.297em -0.775em 0 -0.477em; } 20% { box-shadow: 0 -0.83em 0 -0.4em, -0.338em -0.758em 0 -0.42em, -0.555em -0.617em 0 -0.44em, -0.671em -0.488em 0 -0.46em, -0.749em -0.34em 0 -0.477em; } 38% { box-shadow: 0 -0.83em 0 -0.4em, -0.377em -0.74em 0 -0.42em, -0.645em -0.522em 0 -0.44em, -0.775em -0.297em 0 -0.46em, -0.82em -0.09em 0 -0.477em; } 100% { box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em; } } @keyframes load6 { 0% { box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em; } 5%, 95% { box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em; } 10%, 59% { box-shadow: 0 -0.83em 0 -0.4em, -0.087em -0.825em 0 -0.42em, -0.173em -0.812em 0 -0.44em, -0.256em -0.789em 0 -0.46em, -0.297em -0.775em 0 -0.477em; } 20% { box-shadow: 0 -0.83em 0 -0.4em, -0.338em -0.758em 0 -0.42em, -0.555em -0.617em 0 -0.44em, -0.671em -0.488em 0 -0.46em, -0.749em -0.34em 0 -0.477em; } 38% { box-shadow: 0 -0.83em 0 -0.4em, -0.377em -0.74em 0 -0.42em, -0.645em -0.522em 0 -0.44em, -0.775em -0.297em 0 -0.46em, -0.82em -0.09em 0 -0.477em; } 100% { box-shadow: 0 -0.83em 0 -0.4em, 0 -0.83em 0 -0.42em, 0 -0.83em 0 -0.44em, 0 -0.83em 0 -0.46em, 0 -0.83em 0 -0.477em; } } @-webkit-keyframes round { 0% { -webkit-transform: rotate(0deg); transform: rotate(0deg); } 100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); } } @keyframes round { 0% { -webkit-transform: rotate(0deg); transform: rotate(0deg); } 100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); } }</style><center><span id="moments_loading"><div class="loader"></div></span></center>';
23
- } else {
24
- loading_pic.innerHTML = '<center><span id="moments_loading">' + loadingCutom + '</span></center>';
25
- }
26
-
27
- fetch(requests_url).then(
28
- data => data.json()
29
- ).then(
30
- data => {
31
- orign_data = data;
32
- data_handle(nofollow, orign_data, maxnumber)
33
- }
34
- )
35
- }
36
-
37
- var data_handle = (nofollow, data, maxnumber) => {
38
- var today = todaypost();
39
- var Datetody = new Date(today);
40
- for (var item = 0; item < data[1].length; item++) {
41
- var Datedate = new Date(data[1][item][1]);
42
- if (Datedate > Datetody) {
43
- data[1].splice(item--, 1);
44
- }
45
- }
46
- var today_post = 0;
47
- var error = 0;
48
- var unique_live_link;
49
- var datalist = data[1].slice(0, maxnumber);
50
- var listlenth = data[1].length;
51
- var user_lenth = data[0].length;
52
- var datalist_slice = slice_month(datalist);
53
- var last_update_time = timezoon(datalist_slice);
54
- var link_list = [];
55
- for (var item of data[1]) {
56
- if (item[1] === today) {
57
- today_post += 1;
58
- }
59
- link_list.push(item[3]);
60
- }
61
- var arr = unique(link_list);
62
- unique_live_link = arr.length;
63
- for (var item of data[0]) {
64
- if (item[3] === 'true') {
65
- error += 1;
66
- }
67
- }
68
- var html_item = '<h2>统计信息</h2>';
69
- html_item += '<div id="info_user_pool" class="moments-item info_user_pool" style="">';
70
- html_item += '<div class="moments_chart"><span class="moments_post_info_title">当前友链数:</span><span class="moments_post_info_number">' + user_lenth + ' 个</span><br><span class="moments_post_info_title">失败数:</span><span class="moments_post_info_number">' + error + ' 个</span><br></div>';
71
- html_item += '<div class="moments_chart"><span class="moments_post_info_title">活跃友链数:</span><span class="moments_post_info_number">' + unique_live_link + ' 个</span><br><span class="moments_post_info_title">当前库存:</span><span class="moments_post_info_number">' + listlenth + ' 篇</span><br></div>';
72
- html_item += '<div class="moments_chart"><span class="moments_post_info_title">今日更新:</span><span class="moments_post_info_number">' + today_post + ' 篇</span><br><span class="moments_post_info_title">最近更新:</span><span class="moments_post_info_number">' + last_update_time + '</span><br></div>';
73
- html_item += '</div>';
74
-
75
- for (var month_item of datalist_slice) {
76
- html_item += '<h2>' + month_item[0] + '</h2>';
77
- for (var post_item of month_item[1]) {
78
- var rel = '';
79
- if (nofollow && opentype == '_blank') {
80
- rel = 'noopener nofollow';
81
- } else if (nofollow) {
82
- rel = 'nofollow';
83
- } else if (opentype == '_blank') {
84
- rel = 'noopener';
85
- } else {
86
- rel = '';
87
- }
88
- html_item += ' <div class="moments-item">';
89
- html_item += ' <a target="' + opentype + '" class="moments-item-img" href="' + post_item[2] + '" title="' + post_item[0] + '"rel="' + rel + '">';
90
- html_item += '<img onerror="this.onerror=null,this.src=&quot;' + fcircleImgError + '&quot;"';
91
- html_item += ' src="' + post_item[4] + '"></a>';
92
- html_item += '<div class="moments-item-info"><div class="moments-item-time"><i class="far fa-user"></i>';
93
- html_item += '<span>' + post_item[3] + '</span>';
94
- html_item += ' <div class="moments_post_time"><i class="far fa-calendar-alt"></i>' +
95
- '<time datetime="' + post_item[1] + '" title="' + post_item[1] + '">' + post_item[1] + '</time></div>';
96
- html_item += `</div><a target="${opentype}" class="moments-item-title" href="${post_item[2]}" title="${post_item[0]}"rel="${rel}">${post_item[0]}</a></div>`;
97
- html_item += '</div>';
98
-
99
- }
100
- }
101
- if (data[1].length - maxnumber > 0) {
102
- html_item += '<div style="text-align: center"><button type="button" class="moments_load_button" ' +
103
- 'onclick="load_more_post()">加载更多...</button>' +
104
- '</div>'
105
- }
106
- html_item += '<style>.moments-item-info span{padding-left:.3rem;padding-right:.3rem}.moments_post_time time{padding-left:.3rem;cursor:default}.moments_post_info_title{font-weight:700}.moments_post_info_number{float:right}.moments_chart{align-items:flex-start;flex:1;width:100px;height:60px;margin:20px}@media screen and (max-width:500px){.info_user_pool{padding:10px;flex-direction:column;max-height:200px}.moments_chart{flex:0;width:100%;height:160px;margin:0}}.moments-item:before{border:0}@media screen and (min-width:500px){.moments_post_time{float:right}}.moments_load_button{-webkit-transition-duration:.4s;transition-duration:.4s;text-align:center;border:1px solid #ededed;border-radius:.3em;display:inline-block;background:transparent;color:#555;padding:.5em 1.25em}.moments_load_button:hover{color:#3090e4;border-color:#3090e4}.moments-item{position:relative;display:-webkit-box;display:-moz-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-moz-box-align:center;-o-box-align:center;-ms-flex-align:center;-webkit-align-items:center;align-items:center;margin:0 0 1rem .5rem;-webkit-transition:all .2s ease-in-out;-moz-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;-ms-transition:all .2s ease-in-out;transition:all .2s ease-in-out;box-shadow:rgba(0,0,0,0.07) 0 2px 2px 0,rgba(0,0,0,0.1) 0 1px 5px 0;border-radius:2px}.moments-item-img{overflow:hidden;width:80px;height:80px}.moments-item-img img{max-width:100%;width:100%;height:100%;object-fit:cover}.moments-item-info{-webkit-box-flex:1;-moz-box-flex:1;-o-box-flex:1;box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1;padding:0 .8rem}.moments-item-title{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;font-size:1.1em;-webkit-transition:all .3s;-moz-transition:all .3s;-o-transition:all .3s;-ms-transition:all .3s;transition:all .3s;-webkit-line-clamp:1}</style>'
107
-
108
-
109
-
110
- var moments_container = document.getElementById('moments_container');
111
- append_div(moments_container, html_item)
112
- };
113
-
114
- var load_more_post = () => {
115
- if (document.getElementById('moments_container')) {
116
- maxnumber = maxnumber + addnumber;
117
- document.getElementById('moments_container').innerHTML = "";
118
- data_handle(nofollow, orign_data, maxnumber)
119
- }
120
- };
121
-
122
-
123
-
124
- //加载更多文章
125
- //将html放入指定id的div容器
126
- var append_div = (parent, text) => {
127
- if (document.getElementById('moments_container')) {
128
- loading_pic.innerHTML = ``;
129
- };
130
- if (typeof text === 'string') {
131
- var temp = document.createElement('div');
132
- temp.innerHTML = text;
133
- // 防止元素太多 进行提速
134
- var frag = document.createDocumentFragment();
135
- while (temp.firstChild) {
136
- frag.appendChild(temp.firstChild);
137
- }
138
- parent.appendChild(frag);
139
- } else {
140
- parent.appendChild(text);
141
- }
142
- };
143
-
144
- //去重
145
- var unique = (arr) => {
146
- return Array.from(new Set(arr))
147
- };
148
-
149
- //时区优化
150
- var formatDate = (strDate) => {
151
- try {
152
- var date = new Date(Date.parse(strDate.replace(/-/g, "/")));
153
- var gettimeoffset;
154
- if (new Date().getTimezoneOffset()) {
155
- gettimeoffset = new Date().getTimezoneOffset();
156
- } else {
157
- gettimeoffset = 8;
158
- }
159
- var timeoffset = gettimeoffset * 60 * 1000;
160
- var len = date.getTime();
161
- var date2 = new Date(len - timeoffset);
162
- var sec = date2.getSeconds().toString();
163
- var min = date2.getMinutes().toString();
164
- if (sec.length === 1) {
165
- sec = "0" + sec;
166
- }
167
- if (min.length === 1) {
168
- min = "0" + min;
169
- }
170
- return date2.getFullYear().toString() + "/" + (date2.getMonth() + 1).toString() + "/" + date2.getDate().toString() + " " + date2.getHours().toString() + ":" + min + ":" + sec
171
- } catch (e) {
172
- return ""
173
- }
174
- };
175
-
176
- var timezoon = (datalist_slice) => {
177
- var time = datalist_slice[0][1][0][5];
178
- return formatDate(time)
179
- };
180
-
181
- //今日时间
182
- var todaypost = () => {
183
- var date = new Date();
184
- var year = date.getFullYear();
185
- var month = (date.getMonth() + 1).toString();
186
- var day = (date.getDate()).toString();
187
- if (month.length === 1) {
188
- month = "0" + month;
189
- }
190
- if (day.length === 1) {
191
- day = "0" + day;
192
- }
193
- return year + "-" + month + "-" + day
194
- };
195
-
196
- //月份切片
197
- var slice_month = (data) => {
198
- var monthlist = [];
199
- var datalist = [];
200
- var data_slice = data;
201
- for (var item in data_slice) {
202
- data_slice[item].push(item);
203
- if (data_slice[item][1].lenth !== 10) {
204
- var list = data_slice[item][1].split('-');
205
- if (list[1].length < 2) {
206
- list[1] = "0" + list[1]
207
- }
208
- if (list[2].length < 2) {
209
- list[2] = "0" + list[2]
210
- }
211
- data_slice[item][1] = list.join('-')
212
- }
213
- var month = data_slice[item][1].slice(0, 7);
214
- if (monthlist.indexOf(month) !== -1) {
215
- datalist[monthlist.length - 1][1].push(data_slice[item])
216
- } else {
217
- monthlist.push(month);
218
- datalist.push([month, [data_slice[item]]])
219
- }
220
- }
221
- for (var mounthgroup of datalist) {
222
- mounthgroup.push(mounthgroup[1][0][6]);
223
- }
224
- return datalist
225
- };
4
+ <script type="text/javascript">
5
+ var fdataUser = {
6
+ apiurl: '<%- theme.plugins.fcircle.api %>'
7
+ }
8
+ </script>
9
+ <link rel="stylesheet" href="<%- theme.plugins.fcircle.css %>">
10
+ <script type="text/javascript"
11
+ src="<%- theme.plugins.fcircle.js %>">
226
12
  </script>
@@ -1,7 +1,11 @@
1
1
  <%_
2
- var imgs = theme.plugins.parallax.images || page.images;
3
- if (theme.plugins.parallax.shuffle) {
4
- shuffle(imgs);
2
+ theme.plugins.parallax.images = theme.plugins.parallax.images || page.images;
3
+ if (theme.plugins.parallax.shuffle) {
4
+ // shuffle 只一次 防止 hash 变化
5
+ if (typeof theme.plugins.parallax.shuffle_end==='undefined') {
6
+ shuffle(theme.plugins.parallax.images);
7
+ theme.plugins.parallax.shuffle_end=1;
8
+ }
5
9
  }
6
10
  function shuffle(arr){
7
11
  var n = arr.length;
@@ -14,7 +18,7 @@ function shuffle(arr){
14
18
  }
15
19
  _%>
16
20
  <script>
17
- let imgs = <%- JSON.stringify(imgs) %>;
21
+ let imgs = <%- JSON.stringify(theme.plugins.parallax.images) %>;
18
22
  let index = 0;
19
23
  let IntervalParallax = null;
20
24