hexo-theme-shokax 0.2.0-rc4 → 0.2.0-rc6

Sign up to get free protection for your applications and to get access to all the features.
@@ -25,7 +25,7 @@ mixin CommentRender()
25
25
  setTimeout(function () {
26
26
  init({
27
27
  el: '#wcomments',
28
- serverURL: '#{theme.waline.serverURL}',
28
+ serverURL: '#{theme.waline.serverURL.replace(/\/+$/, '')}',
29
29
  lang: '#{theme.waline.lang}',
30
30
  locale: !{locale},
31
31
  emoji: !{emoji},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-shokax",
3
- "version": "0.2.0-rc4",
3
+ "version": "0.2.0-rc6",
4
4
  "description": "a hexo theme based on shoka",
5
5
  "main": "index.js",
6
6
  "repository": "https://github.com/zkz098/hexo-theme-shokaX",
@@ -37,6 +37,7 @@
37
37
  "vuepress-plugin-sitemap2": "2.0.0-beta.180"
38
38
  },
39
39
  "dependencies": {
40
- "js-yaml": "^4.1.0"
40
+ "js-yaml": "^4.1.0",
41
+ "sass": "^1.58.3"
41
42
  }
42
43
  }
@@ -1,6 +1,5 @@
1
1
  /* global hexo */
2
2
  const fs = require('hexo-fs')
3
- // const url = require('url')
4
3
 
5
4
  hexo.extend.generator.register('script', function (locals) {
6
5
  const log = hexo.log || console.log
@@ -77,6 +76,11 @@ hexo.extend.generator.register('script', function (locals) {
77
76
  }
78
77
  }
79
78
  if (theme.fireworks && theme.fireworks.enable) {
79
+ if (fs.existsSync('themes/shokaX/source/js/_app/fireworks.js')) {
80
+ text += fs.readFileSync('themes/shokaX/source/js/_app/fireworks.js').toString()
81
+ } else {
82
+ text += fs.readFileSync('node_modules/hexo-theme-shokax/source/js/_app/fireworks.js').toString()
83
+ }
80
84
  siteConfig.fireworks = theme.fireworks.color || ['rgba(255,182,185,.9)', 'rgba(250,227,217,.9)', 'rgba(187,222,214,.9)', 'rgba(138,198,209,.9)']
81
85
  }
82
86
 
@@ -42,7 +42,7 @@ hexo.extend.helper.register('_new_comments', function (mode) {
42
42
  import { RecentComments } from 'https://unpkg.com/@waline/client@v2/dist/waline.mjs'
43
43
  RecentComments({
44
44
  el: '#new-comment',
45
- serverURL: '${hexo.theme.config.waline.serverURL}',
45
+ serverURL: '${hexo.theme.config.waline.serverURL.replace(/\/+$/, '')}',
46
46
  count: 10,
47
47
  });
48
48
  </script>
@@ -8,7 +8,9 @@
8
8
  min-height: 25rem;
9
9
  z-index: -9;
10
10
  background-color: #363636;
11
-
11
+ content-visibility: auto;
12
+ contain-intrinsic-size: 100vw 70vh;
13
+
12
14
  img {
13
15
  width: 100%;
14
16
  height: 100%;
@@ -5,9 +5,12 @@
5
5
  min-height: 3.125rem;
6
6
  max-height: 9.375rem;
7
7
  position:relative;
8
+ content-visibility: auto;
9
+ contain-intrinsic-size: 100vw 15vh;
8
10
 
9
11
  +mobile() {
10
12
  height: 10vh;
13
+ contain-intrinsic-size: 100vw 10vh;
11
14
  }
12
15
  }
13
16
  /* Animation */
@@ -1,132 +1,3 @@
1
- const canvasEl = document.createElement('canvas');
2
- canvasEl.style.cssText = 'position:fixed;top:0;left:0;pointer-events:none;z-index:9999999';
3
- document.body.appendChild(canvasEl);
4
- const ctx = canvasEl.getContext('2d');
5
- const numberOfParticules = 30;
6
- let pointerX = 0;
7
- let pointerY = 0;
8
- const tap = 'click';
9
- const colors = CONFIG.fireworks;
10
- function setCanvasSize() {
11
- canvasEl.width = window.innerWidth * 2;
12
- canvasEl.height = window.innerHeight * 2;
13
- canvasEl.style.width = window.innerWidth + 'px';
14
- canvasEl.style.height = window.innerHeight + 'px';
15
- canvasEl.getContext('2d').scale(2, 2);
16
- }
17
- function updateCoords(e) {
18
- pointerX = e.clientX || (e.touches && e.touches[0].clientX);
19
- pointerY = e.clientY || (e.touches && e.touches[0].clientY);
20
- }
21
- function setParticuleDirection(p) {
22
- const angle = anime.random(0, 360) * Math.PI / 180;
23
- const value = anime.random(50, 180);
24
- const radius = [-1, 1][anime.random(0, 1)] * value;
25
- return {
26
- x: p.x + radius * Math.cos(angle),
27
- y: p.y + radius * Math.sin(angle)
28
- };
29
- }
30
- function createParticule(x, y) {
31
- const p = {
32
- x: undefined,
33
- y: undefined,
34
- color: undefined,
35
- radius: undefined,
36
- endPos: undefined,
37
- draw: undefined
38
- };
39
- p.x = x;
40
- p.y = y;
41
- p.color = colors[anime.random(0, colors.length - 1)];
42
- p.radius = anime.random(16, 32);
43
- p.endPos = setParticuleDirection(p);
44
- p.draw = function () {
45
- ctx.beginPath();
46
- ctx.arc(p.x, p.y, p.radius, 0, 2 * Math.PI, true);
47
- ctx.fillStyle = p.color;
48
- ctx.fill();
49
- };
50
- return p;
51
- }
52
- function createCircle(x, y) {
53
- const p = {
54
- x: undefined,
55
- y: undefined,
56
- color: undefined,
57
- radius: undefined,
58
- endPos: undefined,
59
- alpha: undefined,
60
- lineWidth: undefined,
61
- draw: undefined
62
- };
63
- p.x = x;
64
- p.y = y;
65
- p.color = '#FFF';
66
- p.radius = 0.1;
67
- p.alpha = 0.5;
68
- p.lineWidth = 6;
69
- p.draw = function () {
70
- ctx.globalAlpha = p.alpha;
71
- ctx.beginPath();
72
- ctx.arc(p.x, p.y, p.radius, 0, 2 * Math.PI, true);
73
- ctx.lineWidth = p.lineWidth;
74
- ctx.strokeStyle = p.color;
75
- ctx.stroke();
76
- ctx.globalAlpha = 1;
77
- };
78
- return p;
79
- }
80
- function renderParticule(anim) {
81
- for (let i = 0; i < anim.animatables.length; i++) {
82
- anim.animatables[i].target.draw();
83
- }
84
- }
85
- function animateParticules(x, y) {
86
- const circle = createCircle(x, y);
87
- const particules = [];
88
- for (let i = 0; i < numberOfParticules; i++) {
89
- particules.push(createParticule(x, y));
90
- }
91
- anime.timeline().add({
92
- targets: particules,
93
- x: function (p) {
94
- return p.endPos.x;
95
- },
96
- y: function (p) {
97
- return p.endPos.y;
98
- },
99
- radius: 0.1,
100
- duration: anime.random(1200, 1800),
101
- easing: 'easeOutExpo',
102
- update: renderParticule
103
- }).add({
104
- targets: circle,
105
- radius: anime.random(80, 160),
106
- lineWidth: 0,
107
- alpha: {
108
- value: 0,
109
- easing: 'linear',
110
- duration: anime.random(600, 800)
111
- },
112
- duration: anime.random(1200, 1800),
113
- easing: 'easeOutExpo',
114
- update: renderParticule
115
- }, 0);
116
- }
117
- const render = anime({
118
- duration: Infinity,
119
- update: function () {
120
- ctx.clearRect(0, 0, canvasEl.width, canvasEl.height);
121
- }
122
- });
123
- document.addEventListener(tap, function (e) {
124
- render.play();
125
- updateCoords(e);
126
- animateParticules(pointerX, pointerY);
127
- }, false);
128
- setCanvasSize();
129
- window.addEventListener('resize', setCanvasSize, false);
130
1
  const sideBarToggleHandle = function (event, force) {
131
2
  if (sideBar.hasClass('on')) {
132
3
  sideBar.removeClass('on');
@@ -0,0 +1,129 @@
1
+ const canvasEl = document.createElement('canvas');
2
+ canvasEl.style.cssText = 'position:fixed;top:0;left:0;pointer-events:none;z-index:9999999';
3
+ document.body.appendChild(canvasEl);
4
+ const ctx = canvasEl.getContext('2d');
5
+ const numberOfParticules = 30;
6
+ let pointerX = 0;
7
+ let pointerY = 0;
8
+ const tap = 'click';
9
+ const colors = CONFIG.fireworks;
10
+ function setCanvasSize() {
11
+ canvasEl.width = window.innerWidth * 2;
12
+ canvasEl.height = window.innerHeight * 2;
13
+ canvasEl.style.width = window.innerWidth + 'px';
14
+ canvasEl.style.height = window.innerHeight + 'px';
15
+ canvasEl.getContext('2d').scale(2, 2);
16
+ }
17
+ function updateCoords(e) {
18
+ pointerX = e.clientX || (e.touches && e.touches[0].clientX);
19
+ pointerY = e.clientY || (e.touches && e.touches[0].clientY);
20
+ }
21
+ function setParticuleDirection(p) {
22
+ const angle = anime.random(0, 360) * Math.PI / 180;
23
+ const value = anime.random(50, 180);
24
+ const radius = [-1, 1][anime.random(0, 1)] * value;
25
+ return {
26
+ x: p.x + radius * Math.cos(angle),
27
+ y: p.y + radius * Math.sin(angle)
28
+ };
29
+ }
30
+ function createParticule(x, y) {
31
+ const p = {
32
+ x: undefined,
33
+ y: undefined,
34
+ color: undefined,
35
+ radius: undefined,
36
+ endPos: undefined,
37
+ draw: undefined
38
+ };
39
+ p.x = x;
40
+ p.y = y;
41
+ p.color = colors[anime.random(0, colors.length - 1)];
42
+ p.radius = anime.random(16, 32);
43
+ p.endPos = setParticuleDirection(p);
44
+ p.draw = function () {
45
+ ctx.beginPath();
46
+ ctx.arc(p.x, p.y, p.radius, 0, 2 * Math.PI, true);
47
+ ctx.fillStyle = p.color;
48
+ ctx.fill();
49
+ };
50
+ return p;
51
+ }
52
+ function createCircle(x, y) {
53
+ const p = {
54
+ x: undefined,
55
+ y: undefined,
56
+ color: undefined,
57
+ radius: undefined,
58
+ endPos: undefined,
59
+ alpha: undefined,
60
+ lineWidth: undefined,
61
+ draw: undefined
62
+ };
63
+ p.x = x;
64
+ p.y = y;
65
+ p.color = '#FFF';
66
+ p.radius = 0.1;
67
+ p.alpha = 0.5;
68
+ p.lineWidth = 6;
69
+ p.draw = function () {
70
+ ctx.globalAlpha = p.alpha;
71
+ ctx.beginPath();
72
+ ctx.arc(p.x, p.y, p.radius, 0, 2 * Math.PI, true);
73
+ ctx.lineWidth = p.lineWidth;
74
+ ctx.strokeStyle = p.color;
75
+ ctx.stroke();
76
+ ctx.globalAlpha = 1;
77
+ };
78
+ return p;
79
+ }
80
+ function renderParticule(anim) {
81
+ for (let i = 0; i < anim.animatables.length; i++) {
82
+ anim.animatables[i].target.draw();
83
+ }
84
+ }
85
+ function animateParticules(x, y) {
86
+ const circle = createCircle(x, y);
87
+ const particules = [];
88
+ for (let i = 0; i < numberOfParticules; i++) {
89
+ particules.push(createParticule(x, y));
90
+ }
91
+ anime.timeline().add({
92
+ targets: particules,
93
+ x: function (p) {
94
+ return p.endPos.x;
95
+ },
96
+ y: function (p) {
97
+ return p.endPos.y;
98
+ },
99
+ radius: 0.1,
100
+ duration: anime.random(1200, 1800),
101
+ easing: 'easeOutExpo',
102
+ update: renderParticule
103
+ }).add({
104
+ targets: circle,
105
+ radius: anime.random(80, 160),
106
+ lineWidth: 0,
107
+ alpha: {
108
+ value: 0,
109
+ easing: 'linear',
110
+ duration: anime.random(600, 800)
111
+ },
112
+ duration: anime.random(1200, 1800),
113
+ easing: 'easeOutExpo',
114
+ update: renderParticule
115
+ }, 0);
116
+ }
117
+ const render = anime({
118
+ duration: Infinity,
119
+ update: function () {
120
+ ctx.clearRect(0, 0, canvasEl.width, canvasEl.height);
121
+ }
122
+ });
123
+ document.addEventListener(tap, function (e) {
124
+ render.play();
125
+ updateCoords(e);
126
+ animateParticules(pointerX, pointerY);
127
+ }, false);
128
+ setCanvasSize();
129
+ window.addEventListener('resize', setCanvasSize, false);
@@ -152,7 +152,7 @@ const resizeHandle = function (event) {
152
152
  }
153
153
  oWinHeight = window.innerHeight;
154
154
  oWinWidth = window.innerWidth;
155
- sideBar.child('.panels').changeOrGetHeight(oWinHeight + 'px');
155
+ // sideBar.child('.panels').changeOrGetHeight(oWinHeight + 'px');
156
156
  };
157
157
  const scrollHandle = function (event) {
158
158
  const winHeight = window.innerHeight;
@@ -475,7 +475,7 @@ const mediaPlayer = function (t, config) {
475
475
  });
476
476
  }
477
477
  }
478
- }).then(function (c) {
478
+ }).then((c) => {
479
479
  if (c) {
480
480
  playlist.create();
481
481
  controller.create();
@@ -532,7 +532,7 @@ const mediaPlayer = function (t, config) {
532
532
  this.init();
533
533
  }
534
534
  },
535
- init: function () {
535
+ init: () => {
536
536
  const item = playlist.current();
537
537
  if (!item || item.error) {
538
538
  this.mode();