hexo-theme-shokax 0.3.0 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintrc.cjs +5 -3
- package/README.md +11 -2
- package/_config.yml +12 -12
- package/layout/_mixin/comment.pug +1 -2
- package/layout/_mixin/widgets.pug +1 -1
- package/layout/_partials/layout.pug +23 -23
- package/package.json +27 -19
- package/scripts/generaters/script.js +17 -50
- package/scripts/helpers/asset.js +5 -2
- package/scripts/helpers/summary_ai.js +0 -1
- package/scripts/plugin/index.js +2 -2
- package/source/css/_common/scaffolding/normalize.styl +165 -180
- package/source/js/_app/components/sidebar.js +49 -35
- package/source/js/_app/fireworks.js +32 -19
- package/source/js/_app/globals/globalVars.js +91 -26
- package/source/js/_app/globals/handles.js +54 -42
- package/source/js/_app/globals/themeColor.js +22 -12
- package/source/js/_app/globals/thirdparty.js +17 -7
- package/source/js/_app/globals/tools.js +25 -14
- package/source/js/_app/library/anime.js +13 -3
- package/source/js/_app/library/dom.js +5 -0
- package/source/js/_app/library/loadFile.js +7 -1
- package/source/js/_app/library/proto.js +108 -102
- package/source/js/_app/library/scriptPjax.js +18 -10
- package/source/js/_app/library/storage.js +4 -1
- package/source/js/_app/library/vue.js +16 -9
- package/source/js/_app/page/comment.js +14 -7
- package/source/js/_app/page/common.js +13 -7
- package/source/js/_app/page/fancybox.js +12 -6
- package/source/js/_app/page/post.js +43 -29
- package/source/js/_app/page/search.js +21 -14
- package/source/js/_app/page/tab.js +9 -3
- package/source/js/_app/pjax/domInit.js +36 -23
- package/source/js/_app/pjax/refresh.js +48 -30
- package/source/js/_app/pjax/siteInit.js +30 -13
- package/source/js/_app/player.js +29 -16
- package/test/dom.test.js +86 -0
@@ -1,3 +1,10 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.initFireworks = void 0;
|
7
|
+
const theme_shokax_anime_1 = __importDefault(require("theme-shokax-anime"));
|
1
8
|
const canvasEl = document.createElement('canvas');
|
2
9
|
canvasEl.style.cssText = 'position:fixed;top:0;left:0;pointer-events:none;z-index:9999999';
|
3
10
|
document.body.appendChild(canvasEl);
|
@@ -19,9 +26,9 @@ function updateCoords(e) {
|
|
19
26
|
pointerY = e.clientY || (e.touches && e.touches[0].clientY);
|
20
27
|
}
|
21
28
|
function setParticuleDirection(p) {
|
22
|
-
const angle =
|
23
|
-
const value =
|
24
|
-
const radius = [-1, 1][
|
29
|
+
const angle = theme_shokax_anime_1.default.random(0, 360) * Math.PI / 180;
|
30
|
+
const value = theme_shokax_anime_1.default.random(50, 180);
|
31
|
+
const radius = [-1, 1][theme_shokax_anime_1.default.random(0, 1)] * value;
|
25
32
|
return {
|
26
33
|
x: p.x + radius * Math.cos(angle),
|
27
34
|
y: p.y + radius * Math.sin(angle)
|
@@ -41,8 +48,8 @@ function createParticule(x, y) {
|
|
41
48
|
ctx.fill();
|
42
49
|
}
|
43
50
|
};
|
44
|
-
p.color = colors[
|
45
|
-
p.radius =
|
51
|
+
p.color = colors[theme_shokax_anime_1.default.random(0, colors.length - 1)];
|
52
|
+
p.radius = theme_shokax_anime_1.default.random(16, 32);
|
46
53
|
p.endPos = setParticuleDirection(p);
|
47
54
|
return p;
|
48
55
|
}
|
@@ -78,9 +85,9 @@ function animateParticules(x, y) {
|
|
78
85
|
for (let i = 0; i < numberOfParticules; i++) {
|
79
86
|
particules.push(createParticule(x, y));
|
80
87
|
}
|
81
|
-
|
88
|
+
(0, theme_shokax_anime_1.default)().timeline().add({
|
82
89
|
targets: particules,
|
83
|
-
duration:
|
90
|
+
duration: theme_shokax_anime_1.default.random(1200, 1800),
|
84
91
|
easing: 'easeOutExpo',
|
85
92
|
update: renderParticule,
|
86
93
|
x: p => p.endPos.x,
|
@@ -88,19 +95,19 @@ function animateParticules(x, y) {
|
|
88
95
|
radius: 0.1
|
89
96
|
}).add({
|
90
97
|
targets: circle,
|
91
|
-
duration:
|
98
|
+
duration: theme_shokax_anime_1.default.random(1200, 1800),
|
92
99
|
easing: 'easeOutExpo',
|
93
100
|
update: renderParticule,
|
94
|
-
radius:
|
101
|
+
radius: theme_shokax_anime_1.default.random(80, 160),
|
95
102
|
lineWidth: 0,
|
96
103
|
alpha: {
|
97
104
|
value: 0,
|
98
105
|
easing: 'linear',
|
99
|
-
duration:
|
106
|
+
duration: theme_shokax_anime_1.default.random(600, 800)
|
100
107
|
}
|
101
108
|
}).play();
|
102
109
|
}
|
103
|
-
const render =
|
110
|
+
const render = (0, theme_shokax_anime_1.default)({
|
104
111
|
duration: Infinity,
|
105
112
|
update() {
|
106
113
|
ctx.clearRect(0, 0, canvasEl.width, canvasEl.height);
|
@@ -116,13 +123,19 @@ const hasAncestor = (node, name) => {
|
|
116
123
|
} while ((node = node.parentNode) !== null);
|
117
124
|
return false;
|
118
125
|
};
|
119
|
-
|
120
|
-
if (
|
126
|
+
function initFireworks() {
|
127
|
+
if (typeof CONFIG.fireworks === 'undefined') {
|
121
128
|
return;
|
122
129
|
}
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
}
|
127
|
-
|
128
|
-
|
130
|
+
document.addEventListener(tap, (e) => {
|
131
|
+
if (hasAncestor(e.target, 'a')) {
|
132
|
+
return;
|
133
|
+
}
|
134
|
+
render.play();
|
135
|
+
updateCoords(e);
|
136
|
+
animateParticules(pointerX, pointerY);
|
137
|
+
}, false);
|
138
|
+
setCanvasSize();
|
139
|
+
window.addEventListener('resize', setCanvasSize, false);
|
140
|
+
}
|
141
|
+
exports.initFireworks = initFireworks;
|
@@ -1,26 +1,91 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.setSiteSearch = exports.setToolBtn = exports.setShowContents = exports.setGoToComment = exports.setBackToTop = exports.setToolPlayer = exports.setOriginTitle = exports.setPjax = exports.setLocalUrl = exports.setLocalHash = exports.setTitleTime = exports.setDiffY = exports.setOWinWidth = exports.setOWinHeight = exports.setHeaderHight = exports.setHeaderHightInner = exports.setSiteNavHeight = exports.pjax = exports.LOCAL_URL = exports.LOCAL_HASH = exports.oWinWidth = exports.oWinHeight = exports.headerHight = exports.headerHightInner = exports.siteNavHeight = exports.siteSearch = exports.showContents = exports.goToComment = exports.backToTop = exports.toolPlayer = exports.toolBtn = exports.siteBrand = exports.sideBar = exports.quickBtn = exports.menuToggle = exports.siteHeader = exports.siteNav = exports.loadCat = exports.Container = exports.HTML = exports.BODY = exports.titleTime = exports.originTitle = exports.diffY = exports.scrollAction = exports.statics = void 0;
|
4
|
+
const dom_1 = require("../library/dom");
|
5
|
+
exports.statics = CONFIG.statics.indexOf('//') > 0 ? CONFIG.statics : CONFIG.root;
|
6
|
+
exports.scrollAction = { x: 0, y: 0 };
|
7
|
+
exports.diffY = 0;
|
8
|
+
exports.BODY = document.getElementsByTagName('body')[0];
|
9
|
+
exports.HTML = document.documentElement;
|
10
|
+
exports.Container = (0, dom_1.$dom)('#container');
|
11
|
+
exports.loadCat = (0, dom_1.$dom)('#loading');
|
12
|
+
exports.siteNav = (0, dom_1.$dom)('#nav');
|
13
|
+
exports.siteHeader = (0, dom_1.$dom)('#header');
|
14
|
+
exports.menuToggle = exports.siteNav.child('.toggle');
|
15
|
+
exports.quickBtn = (0, dom_1.$dom)('#quick');
|
16
|
+
exports.sideBar = (0, dom_1.$dom)('#sidebar');
|
17
|
+
exports.siteBrand = (0, dom_1.$dom)('#brand');
|
18
|
+
exports.toolBtn = (0, dom_1.$dom)('#tool');
|
19
|
+
exports.siteSearch = (0, dom_1.$dom)('#search');
|
20
|
+
exports.oWinHeight = window.innerHeight;
|
21
|
+
exports.oWinWidth = window.innerWidth;
|
22
|
+
exports.LOCAL_HASH = 0;
|
23
|
+
exports.LOCAL_URL = window.location.href;
|
24
|
+
function setSiteNavHeight(value) {
|
25
|
+
exports.siteNavHeight = value;
|
26
|
+
}
|
27
|
+
exports.setSiteNavHeight = setSiteNavHeight;
|
28
|
+
function setHeaderHightInner(value) {
|
29
|
+
exports.headerHightInner = value;
|
30
|
+
}
|
31
|
+
exports.setHeaderHightInner = setHeaderHightInner;
|
32
|
+
function setHeaderHight(value) {
|
33
|
+
exports.headerHight = value;
|
34
|
+
}
|
35
|
+
exports.setHeaderHight = setHeaderHight;
|
36
|
+
function setOWinHeight(value) {
|
37
|
+
exports.oWinHeight = value;
|
38
|
+
}
|
39
|
+
exports.setOWinHeight = setOWinHeight;
|
40
|
+
function setOWinWidth(value) {
|
41
|
+
exports.oWinWidth = value;
|
42
|
+
}
|
43
|
+
exports.setOWinWidth = setOWinWidth;
|
44
|
+
function setDiffY(value) {
|
45
|
+
exports.diffY = value;
|
46
|
+
}
|
47
|
+
exports.setDiffY = setDiffY;
|
48
|
+
function setTitleTime(value) {
|
49
|
+
exports.titleTime = value;
|
50
|
+
}
|
51
|
+
exports.setTitleTime = setTitleTime;
|
52
|
+
function setLocalHash(value) {
|
53
|
+
exports.LOCAL_HASH = value;
|
54
|
+
}
|
55
|
+
exports.setLocalHash = setLocalHash;
|
56
|
+
function setLocalUrl(value) {
|
57
|
+
exports.LOCAL_URL = value;
|
58
|
+
}
|
59
|
+
exports.setLocalUrl = setLocalUrl;
|
60
|
+
function setPjax(value) {
|
61
|
+
exports.pjax = value;
|
62
|
+
}
|
63
|
+
exports.setPjax = setPjax;
|
64
|
+
function setOriginTitle(value) {
|
65
|
+
exports.originTitle = value;
|
66
|
+
}
|
67
|
+
exports.setOriginTitle = setOriginTitle;
|
68
|
+
function setToolPlayer(value) {
|
69
|
+
exports.toolPlayer = value;
|
70
|
+
}
|
71
|
+
exports.setToolPlayer = setToolPlayer;
|
72
|
+
function setBackToTop(value) {
|
73
|
+
exports.backToTop = value;
|
74
|
+
}
|
75
|
+
exports.setBackToTop = setBackToTop;
|
76
|
+
function setGoToComment(value) {
|
77
|
+
exports.goToComment = value;
|
78
|
+
}
|
79
|
+
exports.setGoToComment = setGoToComment;
|
80
|
+
function setShowContents(value) {
|
81
|
+
exports.showContents = value;
|
82
|
+
}
|
83
|
+
exports.setShowContents = setShowContents;
|
84
|
+
function setToolBtn(value) {
|
85
|
+
exports.toolBtn = value;
|
86
|
+
}
|
87
|
+
exports.setToolBtn = setToolBtn;
|
88
|
+
function setSiteSearch(value) {
|
89
|
+
exports.siteSearch = value;
|
90
|
+
}
|
91
|
+
exports.setSiteSearch = setSiteSearch;
|
@@ -1,53 +1,63 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.visibilityListener = exports.clickMenu = exports.scrollHandle = exports.resizeHandle = void 0;
|
4
|
+
const sidebar_1 = require("../components/sidebar");
|
5
|
+
const dom_1 = require("../library/dom");
|
6
|
+
const globalVars_1 = require("./globalVars");
|
7
|
+
const themeColor_1 = require("./themeColor");
|
8
|
+
const thirdparty_1 = require("./thirdparty");
|
9
|
+
const resizeHandle = () => {
|
10
|
+
(0, globalVars_1.setSiteNavHeight)(globalVars_1.siteNav.changeOrGetHeight());
|
11
|
+
(0, globalVars_1.setHeaderHightInner)(globalVars_1.siteHeader.changeOrGetHeight());
|
12
|
+
(0, globalVars_1.setHeaderHight)(globalVars_1.headerHightInner + (0, dom_1.$dom)('#waves').changeOrGetHeight());
|
13
|
+
if (globalVars_1.oWinWidth !== window.innerWidth) {
|
14
|
+
(0, sidebar_1.sideBarToggleHandle)(null, 1);
|
7
15
|
}
|
8
|
-
|
9
|
-
|
16
|
+
(0, globalVars_1.setOWinHeight)(window.innerHeight);
|
17
|
+
(0, globalVars_1.setOWinWidth)(window.innerWidth);
|
10
18
|
};
|
11
|
-
|
19
|
+
exports.resizeHandle = resizeHandle;
|
20
|
+
const scrollHandle = () => {
|
12
21
|
const winHeight = window.innerHeight;
|
13
|
-
const docHeight = getDocHeight();
|
22
|
+
const docHeight = (0, dom_1.getDocHeight)();
|
14
23
|
const contentVisibilityHeight = docHeight > winHeight ? docHeight - winHeight : document.body.scrollHeight - winHeight;
|
15
|
-
const SHOW = window.scrollY > headerHightInner;
|
24
|
+
const SHOW = window.scrollY > globalVars_1.headerHightInner;
|
16
25
|
const startScroll = window.scrollY > 0;
|
17
26
|
if (SHOW) {
|
18
|
-
changeMetaTheme('#FFF');
|
27
|
+
(0, themeColor_1.changeMetaTheme)('#FFF');
|
19
28
|
}
|
20
29
|
else {
|
21
|
-
changeMetaTheme('#222');
|
30
|
+
(0, themeColor_1.changeMetaTheme)('#222');
|
22
31
|
}
|
23
|
-
siteNav.toggleClass('show', SHOW);
|
24
|
-
toolBtn.toggleClass('affix', startScroll);
|
25
|
-
siteBrand.toggleClass('affix', startScroll);
|
26
|
-
sideBar.toggleClass('affix', window.scrollY > headerHight && document.body.offsetWidth > 991);
|
27
|
-
if (typeof scrollAction.y === 'undefined') {
|
28
|
-
scrollAction.y = window.scrollY;
|
32
|
+
globalVars_1.siteNav.toggleClass('show', SHOW);
|
33
|
+
globalVars_1.toolBtn.toggleClass('affix', startScroll);
|
34
|
+
globalVars_1.siteBrand.toggleClass('affix', startScroll);
|
35
|
+
globalVars_1.sideBar.toggleClass('affix', window.scrollY > globalVars_1.headerHight && document.body.offsetWidth > 991);
|
36
|
+
if (typeof globalVars_1.scrollAction.y === 'undefined') {
|
37
|
+
globalVars_1.scrollAction.y = window.scrollY;
|
29
38
|
}
|
30
|
-
|
31
|
-
if (diffY < 0) {
|
32
|
-
siteNav.removeClass('up');
|
33
|
-
siteNav.toggleClass('down', SHOW);
|
39
|
+
(0, globalVars_1.setDiffY)(globalVars_1.scrollAction.y - window.scrollY);
|
40
|
+
if (globalVars_1.diffY < 0) {
|
41
|
+
globalVars_1.siteNav.removeClass('up');
|
42
|
+
globalVars_1.siteNav.toggleClass('down', SHOW);
|
34
43
|
}
|
35
|
-
else if (diffY > 0) {
|
36
|
-
siteNav.removeClass('down');
|
37
|
-
siteNav.toggleClass('up', SHOW);
|
44
|
+
else if (globalVars_1.diffY > 0) {
|
45
|
+
globalVars_1.siteNav.removeClass('down');
|
46
|
+
globalVars_1.siteNav.toggleClass('up', SHOW);
|
38
47
|
}
|
39
48
|
else { }
|
40
|
-
scrollAction.y = window.scrollY;
|
49
|
+
globalVars_1.scrollAction.y = window.scrollY;
|
41
50
|
const scrollPercent = Math.round(Math.min(100 * window.scrollY / contentVisibilityHeight, 100)) + '%';
|
42
|
-
if (backToTop.child('span').innerText !== scrollPercent) {
|
43
|
-
backToTop.child('span').innerText = scrollPercent;
|
51
|
+
if (globalVars_1.backToTop.child('span').innerText !== scrollPercent) {
|
52
|
+
globalVars_1.backToTop.child('span').innerText = scrollPercent;
|
44
53
|
}
|
45
|
-
if (
|
46
|
-
|
54
|
+
if ((0, dom_1.$dom)('#sidebar').hasClass('affix') || (0, dom_1.$dom)('#sidebar').hasClass('on')) {
|
55
|
+
(0, dom_1.$dom)('.percent').changeOrGetWidth(scrollPercent);
|
47
56
|
}
|
48
57
|
};
|
58
|
+
exports.scrollHandle = scrollHandle;
|
49
59
|
const clickMenu = () => {
|
50
|
-
const menuElement =
|
60
|
+
const menuElement = (0, dom_1.$dom)('#clickMenu');
|
51
61
|
window.oncontextmenu = function (event) {
|
52
62
|
if (event.ctrlKey) {
|
53
63
|
return;
|
@@ -64,7 +74,7 @@ const clickMenu = () => {
|
|
64
74
|
menuElement.style.top = y + 'px';
|
65
75
|
menuElement.style.left = x + 'px';
|
66
76
|
menuElement.classList.add('active');
|
67
|
-
|
77
|
+
dom_1.$dom.each('.clickSubmenu', (submenu) => {
|
68
78
|
if (x > (winWidth - menuWidth - submenu.offsetWidth)) {
|
69
79
|
submenu.style.left = '-200px';
|
70
80
|
}
|
@@ -78,28 +88,30 @@ const clickMenu = () => {
|
|
78
88
|
menuElement.classList.remove('active');
|
79
89
|
});
|
80
90
|
};
|
91
|
+
exports.clickMenu = clickMenu;
|
81
92
|
const visibilityListener = () => {
|
82
|
-
const iconNode =
|
93
|
+
const iconNode = (0, dom_1.$dom)('[rel="icon"]');
|
83
94
|
document.addEventListener('visibilitychange', () => {
|
84
95
|
switch (document.visibilityState) {
|
85
96
|
case 'hidden':
|
86
|
-
iconNode.attr('href', statics + CONFIG.favicon.hidden);
|
97
|
+
iconNode.attr('href', globalVars_1.statics + CONFIG.favicon.hidden);
|
87
98
|
document.title = LOCAL.favicon.hide;
|
88
99
|
if (CONFIG.loader.switch) {
|
89
|
-
Loader.show();
|
100
|
+
thirdparty_1.Loader.show();
|
90
101
|
}
|
91
|
-
clearTimeout(titleTime);
|
102
|
+
clearTimeout(globalVars_1.titleTime);
|
92
103
|
break;
|
93
104
|
case 'visible':
|
94
|
-
iconNode.attr('href', statics + CONFIG.favicon.normal);
|
105
|
+
iconNode.attr('href', globalVars_1.statics + CONFIG.favicon.normal);
|
95
106
|
document.title = LOCAL.favicon.show;
|
96
107
|
if (CONFIG.loader.switch) {
|
97
|
-
Loader.hide(1000);
|
108
|
+
thirdparty_1.Loader.hide(1000);
|
98
109
|
}
|
99
|
-
|
100
|
-
document.title = originTitle;
|
101
|
-
}, 2000);
|
110
|
+
(0, globalVars_1.setTitleTime)(setTimeout(() => {
|
111
|
+
document.title = globalVars_1.originTitle;
|
112
|
+
}, 2000));
|
102
113
|
break;
|
103
114
|
}
|
104
115
|
});
|
105
116
|
};
|
117
|
+
exports.visibilityListener = visibilityListener;
|
@@ -1,48 +1,58 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.themeColorListener = exports.changeMetaTheme = exports.autoDarkmode = exports.changeTheme = void 0;
|
4
|
+
const storage_1 = require("../library/storage");
|
5
|
+
const dom_1 = require("../library/dom");
|
6
|
+
const globalVars_1 = require("./globalVars");
|
1
7
|
const changeTheme = (type) => {
|
2
|
-
const btn =
|
8
|
+
const btn = (0, dom_1.$dom)('.theme .ic');
|
3
9
|
if (type === 'dark') {
|
4
|
-
HTML.attr('data-theme', type);
|
10
|
+
globalVars_1.HTML.attr('data-theme', type);
|
5
11
|
btn.removeClass('i-sun');
|
6
12
|
btn.addClass('i-moon');
|
7
13
|
}
|
8
14
|
else {
|
9
|
-
HTML.attr('data-theme', null);
|
15
|
+
globalVars_1.HTML.attr('data-theme', null);
|
10
16
|
btn.removeClass('i-moon');
|
11
17
|
btn.addClass('i-sun');
|
12
18
|
}
|
13
19
|
};
|
20
|
+
exports.changeTheme = changeTheme;
|
14
21
|
const autoDarkmode = () => {
|
15
22
|
if (CONFIG.auto_dark.enable) {
|
16
23
|
if (new Date().getHours() >= CONFIG.auto_dark.start || new Date().getHours() <= CONFIG.auto_dark.end) {
|
17
|
-
changeTheme('dark');
|
24
|
+
(0, exports.changeTheme)('dark');
|
18
25
|
}
|
19
26
|
else {
|
20
|
-
changeTheme();
|
27
|
+
(0, exports.changeTheme)();
|
21
28
|
}
|
22
29
|
}
|
23
30
|
};
|
31
|
+
exports.autoDarkmode = autoDarkmode;
|
24
32
|
const changeMetaTheme = (color) => {
|
25
|
-
if (HTML.attr('data-theme') === 'dark') {
|
33
|
+
if (globalVars_1.HTML.attr('data-theme') === 'dark') {
|
26
34
|
color = '#222';
|
27
35
|
}
|
28
|
-
|
36
|
+
(0, dom_1.$dom)('meta[name="theme-color"]').attr('content', color);
|
29
37
|
};
|
38
|
+
exports.changeMetaTheme = changeMetaTheme;
|
30
39
|
const themeColorListener = () => {
|
31
40
|
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (mediaQueryList) => {
|
32
41
|
if (mediaQueryList.matches) {
|
33
|
-
changeTheme('dark');
|
42
|
+
(0, exports.changeTheme)('dark');
|
34
43
|
}
|
35
44
|
else {
|
36
|
-
changeTheme();
|
45
|
+
(0, exports.changeTheme)();
|
37
46
|
}
|
38
47
|
});
|
39
|
-
const t =
|
48
|
+
const t = storage_1.$storage.get('theme');
|
40
49
|
if (t) {
|
41
|
-
changeTheme(t);
|
50
|
+
(0, exports.changeTheme)(t);
|
42
51
|
}
|
43
52
|
else {
|
44
53
|
if (CONFIG.darkmode) {
|
45
|
-
changeTheme('dark');
|
54
|
+
(0, exports.changeTheme)('dark');
|
46
55
|
}
|
47
56
|
}
|
48
57
|
};
|
58
|
+
exports.themeColorListener = themeColorListener;
|
@@ -1,16 +1,25 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.isOutime = exports.Loader = exports.lazyload = void 0;
|
7
|
+
const lozad_1 = __importDefault(require("lozad"));
|
8
|
+
const globalVars_1 = require("./globalVars");
|
9
|
+
const anime_1 = require("../library/anime");
|
10
|
+
exports.lazyload = (0, lozad_1.default)('img, [data-background-image]', {
|
2
11
|
loaded(el) {
|
3
12
|
el.addClass('lozaded');
|
4
13
|
}
|
5
14
|
});
|
6
|
-
|
15
|
+
exports.Loader = {
|
7
16
|
timer: undefined,
|
8
17
|
lock: false,
|
9
18
|
show() {
|
10
19
|
clearTimeout(this.timer);
|
11
20
|
document.body.removeClass('loaded');
|
12
|
-
loadCat.attr('style', 'display:block');
|
13
|
-
Loader.lock = false;
|
21
|
+
globalVars_1.loadCat.attr('style', 'display:block');
|
22
|
+
exports.Loader.lock = false;
|
14
23
|
},
|
15
24
|
hide(sec) {
|
16
25
|
if (!CONFIG.loader.start) {
|
@@ -19,14 +28,14 @@ const Loader = {
|
|
19
28
|
this.timer = setTimeout(this.vanish, sec || 3000);
|
20
29
|
},
|
21
30
|
vanish() {
|
22
|
-
if (Loader.lock) {
|
31
|
+
if (exports.Loader.lock) {
|
23
32
|
return;
|
24
33
|
}
|
25
34
|
if (CONFIG.loader.start) {
|
26
|
-
transition(loadCat, 0);
|
35
|
+
(0, anime_1.transition)(globalVars_1.loadCat, 0);
|
27
36
|
}
|
28
37
|
document.body.addClass('loaded');
|
29
|
-
Loader.lock = true;
|
38
|
+
exports.Loader.lock = true;
|
30
39
|
}
|
31
40
|
};
|
32
41
|
const isOutime = () => {
|
@@ -58,3 +67,4 @@ const isOutime = () => {
|
|
58
67
|
}
|
59
68
|
}
|
60
69
|
};
|
70
|
+
exports.isOutime = isOutime;
|
@@ -1,45 +1,55 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.clipBoard = exports.positionInit = exports.pagePosition = exports.showtip = void 0;
|
4
|
+
const anime_1 = require("../library/anime");
|
5
|
+
const dom_1 = require("../library/dom");
|
6
|
+
const storage_1 = require("../library/storage");
|
7
|
+
const globalVars_1 = require("./globalVars");
|
1
8
|
const showtip = (msg) => {
|
2
9
|
if (!msg) {
|
3
10
|
return;
|
4
11
|
}
|
5
|
-
const tipbox = BODY.createChild('div', {
|
12
|
+
const tipbox = globalVars_1.BODY.createChild('div', {
|
6
13
|
innerHTML: msg,
|
7
14
|
className: 'tip'
|
8
15
|
});
|
9
16
|
setTimeout(() => {
|
10
17
|
tipbox.addClass('hide');
|
11
18
|
setTimeout(() => {
|
12
|
-
BODY.removeChild(tipbox);
|
19
|
+
globalVars_1.BODY.removeChild(tipbox);
|
13
20
|
}, 300);
|
14
21
|
}, 3000);
|
15
22
|
};
|
23
|
+
exports.showtip = showtip;
|
16
24
|
const pagePosition = () => {
|
17
25
|
if (CONFIG.auto_scroll) {
|
18
|
-
|
26
|
+
storage_1.$storage.set(globalVars_1.LOCAL_URL, String(globalVars_1.scrollAction.y));
|
19
27
|
}
|
20
28
|
};
|
29
|
+
exports.pagePosition = pagePosition;
|
21
30
|
const positionInit = (comment) => {
|
22
31
|
const anchor = window.location.hash;
|
23
32
|
let target = null;
|
24
|
-
if (LOCAL_HASH) {
|
25
|
-
|
33
|
+
if (globalVars_1.LOCAL_HASH) {
|
34
|
+
storage_1.$storage.del(globalVars_1.LOCAL_URL);
|
26
35
|
return;
|
27
36
|
}
|
28
37
|
if (anchor) {
|
29
|
-
target =
|
38
|
+
target = (0, dom_1.$dom)(decodeURI(anchor));
|
30
39
|
}
|
31
40
|
else {
|
32
|
-
target = CONFIG.auto_scroll ? parseInt(
|
41
|
+
target = CONFIG.auto_scroll ? parseInt(storage_1.$storage.get(globalVars_1.LOCAL_URL)) : 0;
|
33
42
|
}
|
34
43
|
if (target) {
|
35
|
-
pageScroll(target);
|
36
|
-
|
44
|
+
(0, anime_1.pageScroll)(target);
|
45
|
+
(0, globalVars_1.setLocalHash)(1);
|
37
46
|
}
|
38
|
-
if (comment && anchor && !LOCAL_HASH) {
|
39
|
-
pageScroll(target);
|
40
|
-
|
47
|
+
if (comment && anchor && !globalVars_1.LOCAL_HASH) {
|
48
|
+
(0, anime_1.pageScroll)(target);
|
49
|
+
(0, globalVars_1.setLocalHash)(1);
|
41
50
|
}
|
42
51
|
};
|
52
|
+
exports.positionInit = positionInit;
|
43
53
|
const clipBoard = (str, callback) => {
|
44
54
|
if (navigator.clipboard && window.isSecureContext) {
|
45
55
|
navigator.clipboard.writeText(str).then(() => {
|
@@ -49,7 +59,7 @@ const clipBoard = (str, callback) => {
|
|
49
59
|
});
|
50
60
|
}
|
51
61
|
else {
|
52
|
-
const ta = BODY.createChild('textarea', {
|
62
|
+
const ta = globalVars_1.BODY.createChild('textarea', {
|
53
63
|
style: {
|
54
64
|
top: window.scrollY + 'px',
|
55
65
|
position: 'absolute',
|
@@ -70,6 +80,7 @@ const clipBoard = (str, callback) => {
|
|
70
80
|
selection.removeAllRanges();
|
71
81
|
selection.addRange(selected);
|
72
82
|
}
|
73
|
-
BODY.removeChild(ta);
|
83
|
+
globalVars_1.BODY.removeChild(ta);
|
74
84
|
}
|
75
85
|
};
|
86
|
+
exports.clipBoard = clipBoard;
|
@@ -1,3 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.pageScroll = exports.transition = void 0;
|
7
|
+
const theme_shokax_anime_1 = __importDefault(require("theme-shokax-anime"));
|
8
|
+
const globalVars_1 = require("../globals/globalVars");
|
1
9
|
const transition = (target, type, complete, begin) => {
|
2
10
|
let animation;
|
3
11
|
let display = 'none';
|
@@ -58,7 +66,7 @@ const transition = (target, type, complete, begin) => {
|
|
58
66
|
display = type.display;
|
59
67
|
break;
|
60
68
|
}
|
61
|
-
|
69
|
+
(0, theme_shokax_anime_1.default)(Object.assign({
|
62
70
|
targets: target,
|
63
71
|
duration: 200,
|
64
72
|
easing: 'linear',
|
@@ -71,15 +79,17 @@ const transition = (target, type, complete, begin) => {
|
|
71
79
|
}
|
72
80
|
}, animation)).play();
|
73
81
|
};
|
82
|
+
exports.transition = transition;
|
74
83
|
const pageScroll = (target, offset, complete) => {
|
75
84
|
const opt = {
|
76
85
|
targets: typeof offset === 'number' ? target.parentNode : document.scrollingElement,
|
77
86
|
duration: 500,
|
78
87
|
easing: 'easeInOutQuad',
|
79
|
-
scrollTop: offset || (typeof target === 'number' ? target : (target ? target.getTop() + document.documentElement.scrollTop - siteNavHeight : 0)),
|
88
|
+
scrollTop: offset || (typeof target === 'number' ? target : (target ? target.getTop() + document.documentElement.scrollTop - globalVars_1.siteNavHeight : 0)),
|
80
89
|
complete() {
|
81
90
|
complete && complete();
|
82
91
|
}
|
83
92
|
};
|
84
|
-
|
93
|
+
(0, theme_shokax_anime_1.default)(opt).play();
|
85
94
|
};
|
95
|
+
exports.pageScroll = pageScroll;
|
@@ -1,10 +1,15 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.getDocHeight = exports.$dom = void 0;
|
1
4
|
const getDocHeight = () => $dom('main > .inner').offsetHeight;
|
5
|
+
exports.getDocHeight = getDocHeight;
|
2
6
|
const $dom = (selector, element = document) => {
|
3
7
|
if (selector[0] === '#') {
|
4
8
|
return element.getElementById(selector.substring(1));
|
5
9
|
}
|
6
10
|
return element.querySelector(selector);
|
7
11
|
};
|
12
|
+
exports.$dom = $dom;
|
8
13
|
$dom.all = (selector, element = document) => {
|
9
14
|
return element.querySelectorAll(selector);
|
10
15
|
};
|
@@ -1,3 +1,7 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.vendorCss = exports.vendorJs = void 0;
|
4
|
+
const scriptPjax_1 = require("./scriptPjax");
|
1
5
|
const assetUrl = (asset, type) => {
|
2
6
|
const str = CONFIG[asset][type];
|
3
7
|
if (str.includes('gh') || str.includes('combine')) {
|
@@ -13,11 +17,12 @@ const assetUrl = (asset, type) => {
|
|
13
17
|
};
|
14
18
|
const vendorJs = (type, callback, condition) => {
|
15
19
|
if (LOCAL[type]) {
|
16
|
-
getScript(assetUrl('js', type), callback || function () {
|
20
|
+
(0, scriptPjax_1.getScript)(assetUrl('js', type), callback || function () {
|
17
21
|
window[type] = true;
|
18
22
|
}, condition || window[type]);
|
19
23
|
}
|
20
24
|
};
|
25
|
+
exports.vendorJs = vendorJs;
|
21
26
|
const vendorCss = (type, condition) => {
|
22
27
|
if (window['css' + type]) {
|
23
28
|
return;
|
@@ -30,3 +35,4 @@ const vendorCss = (type, condition) => {
|
|
30
35
|
window['css' + type] = true;
|
31
36
|
}
|
32
37
|
};
|
38
|
+
exports.vendorCss = vendorCss;
|