hexo-theme-shokax 0.3.1 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintrc.cjs +5 -3
- package/_config.yml +12 -12
- package/layout/_mixin/widgets.pug +1 -1
- package/package.json +18 -10
- package/scripts/generaters/script.js +17 -45
- package/scripts/helpers/asset.js +5 -2
- package/source/js/_app/components/sidebar.js +49 -35
- package/source/js/_app/fireworks.js +32 -19
- package/source/js/_app/globals/globalVars.js +96 -26
- package/source/js/_app/globals/handles.js +52 -40
- 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 +31 -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,26 +1,96 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
const
|
8
|
-
const
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
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.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;
|
7
|
+
const dom_1 = require("../library/dom");
|
8
|
+
const proto_1 = __importDefault(require("../library/proto"));
|
9
|
+
(0, proto_1.default)();
|
10
|
+
exports.statics = CONFIG.statics.indexOf('//') > 0 ? CONFIG.statics : CONFIG.root;
|
11
|
+
exports.scrollAction = { x: 0, y: 0 };
|
12
|
+
exports.diffY = 0;
|
13
|
+
exports.BODY = document.getElementsByTagName('body')[0];
|
14
|
+
exports.HTML = document.documentElement;
|
15
|
+
exports.Container = (0, dom_1.$dom)('#container');
|
16
|
+
exports.loadCat = (0, dom_1.$dom)('#loading');
|
17
|
+
exports.siteNav = (0, dom_1.$dom)('#nav');
|
18
|
+
exports.siteHeader = (0, dom_1.$dom)('#header');
|
19
|
+
exports.menuToggle = exports.siteNav.child('.toggle');
|
20
|
+
exports.quickBtn = (0, dom_1.$dom)('#quick');
|
21
|
+
exports.sideBar = (0, dom_1.$dom)('#sidebar');
|
22
|
+
exports.siteBrand = (0, dom_1.$dom)('#brand');
|
23
|
+
exports.toolBtn = (0, dom_1.$dom)('#tool');
|
24
|
+
exports.siteSearch = (0, dom_1.$dom)('#search');
|
25
|
+
exports.oWinHeight = window.innerHeight;
|
26
|
+
exports.oWinWidth = window.innerWidth;
|
27
|
+
exports.LOCAL_HASH = 0;
|
28
|
+
exports.LOCAL_URL = window.location.href;
|
29
|
+
function setSiteNavHeight(value) {
|
30
|
+
exports.siteNavHeight = value;
|
31
|
+
}
|
32
|
+
exports.setSiteNavHeight = setSiteNavHeight;
|
33
|
+
function setHeaderHightInner(value) {
|
34
|
+
exports.headerHightInner = value;
|
35
|
+
}
|
36
|
+
exports.setHeaderHightInner = setHeaderHightInner;
|
37
|
+
function setHeaderHight(value) {
|
38
|
+
exports.headerHight = value;
|
39
|
+
}
|
40
|
+
exports.setHeaderHight = setHeaderHight;
|
41
|
+
function setOWinHeight(value) {
|
42
|
+
exports.oWinHeight = value;
|
43
|
+
}
|
44
|
+
exports.setOWinHeight = setOWinHeight;
|
45
|
+
function setOWinWidth(value) {
|
46
|
+
exports.oWinWidth = value;
|
47
|
+
}
|
48
|
+
exports.setOWinWidth = setOWinWidth;
|
49
|
+
function setDiffY(value) {
|
50
|
+
exports.diffY = value;
|
51
|
+
}
|
52
|
+
exports.setDiffY = setDiffY;
|
53
|
+
function setTitleTime(value) {
|
54
|
+
exports.titleTime = value;
|
55
|
+
}
|
56
|
+
exports.setTitleTime = setTitleTime;
|
57
|
+
function setLocalHash(value) {
|
58
|
+
exports.LOCAL_HASH = value;
|
59
|
+
}
|
60
|
+
exports.setLocalHash = setLocalHash;
|
61
|
+
function setLocalUrl(value) {
|
62
|
+
exports.LOCAL_URL = value;
|
63
|
+
}
|
64
|
+
exports.setLocalUrl = setLocalUrl;
|
65
|
+
function setPjax(value) {
|
66
|
+
exports.pjax = value;
|
67
|
+
}
|
68
|
+
exports.setPjax = setPjax;
|
69
|
+
function setOriginTitle(value) {
|
70
|
+
exports.originTitle = value;
|
71
|
+
}
|
72
|
+
exports.setOriginTitle = setOriginTitle;
|
73
|
+
function setToolPlayer(value) {
|
74
|
+
exports.toolPlayer = value;
|
75
|
+
}
|
76
|
+
exports.setToolPlayer = setToolPlayer;
|
77
|
+
function setBackToTop(value) {
|
78
|
+
exports.backToTop = value;
|
79
|
+
}
|
80
|
+
exports.setBackToTop = setBackToTop;
|
81
|
+
function setGoToComment(value) {
|
82
|
+
exports.goToComment = value;
|
83
|
+
}
|
84
|
+
exports.setGoToComment = setGoToComment;
|
85
|
+
function setShowContents(value) {
|
86
|
+
exports.showContents = value;
|
87
|
+
}
|
88
|
+
exports.setShowContents = setShowContents;
|
89
|
+
function setToolBtn(value) {
|
90
|
+
exports.toolBtn = value;
|
91
|
+
}
|
92
|
+
exports.setToolBtn = setToolBtn;
|
93
|
+
function setSiteSearch(value) {
|
94
|
+
exports.siteSearch = value;
|
95
|
+
}
|
96
|
+
exports.setSiteSearch = setSiteSearch;
|
@@ -1,53 +1,63 @@
|
|
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");
|
1
9
|
const resizeHandle = () => {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
if (oWinWidth !== window.innerWidth) {
|
6
|
-
sideBarToggleHandle(null, 1);
|
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
|
};
|
19
|
+
exports.resizeHandle = resizeHandle;
|
11
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;
|