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,105 +1,111 @@
|
|
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
|
-
|
27
|
-
this
|
28
|
-
}
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
this.
|
34
|
-
}
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
return this.
|
46
|
-
}
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
},
|
55
|
-
insertAfter(element) {
|
56
|
-
const parent = this.parentNode;
|
57
|
-
if (parent.lastChild === this) {
|
58
|
-
parent.appendChild(element);
|
59
|
-
}
|
60
|
-
else {
|
61
|
-
parent.insertBefore(element, this.nextSibling);
|
62
|
-
}
|
63
|
-
},
|
64
|
-
display(d) {
|
65
|
-
if (d == null) {
|
66
|
-
return this.style.display;
|
67
|
-
}
|
68
|
-
else {
|
69
|
-
this.style.display = d;
|
70
|
-
return this;
|
71
|
-
}
|
72
|
-
},
|
73
|
-
child(selector) {
|
74
|
-
return $dom(selector, this);
|
75
|
-
},
|
76
|
-
find(selector) {
|
77
|
-
return $dom.all(selector, this);
|
78
|
-
},
|
79
|
-
_class(type, className, display) {
|
80
|
-
const classNames = className.indexOf(' ') ? className.split(' ') : [className];
|
81
|
-
classNames.forEach((name) => {
|
82
|
-
if (type === 'toggle') {
|
83
|
-
this.classList.toggle(name, display);
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const dom_1 = require("./dom");
|
4
|
+
function initProto() {
|
5
|
+
Object.assign(HTMLElement.prototype, {
|
6
|
+
createChild(tag, obj, positon) {
|
7
|
+
const child = document.createElement(tag);
|
8
|
+
Object.assign(child, obj);
|
9
|
+
switch (positon) {
|
10
|
+
case 'after':
|
11
|
+
this.insertAfter(child);
|
12
|
+
break;
|
13
|
+
case 'replace':
|
14
|
+
this.innerHTML = '';
|
15
|
+
this.appendChild(child);
|
16
|
+
break;
|
17
|
+
default:
|
18
|
+
this.appendChild(child);
|
19
|
+
}
|
20
|
+
return child;
|
21
|
+
},
|
22
|
+
wrapObject(obj) {
|
23
|
+
const box = document.createElement('div');
|
24
|
+
Object.assign(box, obj);
|
25
|
+
this.parentNode.insertBefore(box, this);
|
26
|
+
this.parentNode.removeChild(this);
|
27
|
+
box.appendChild(this);
|
28
|
+
},
|
29
|
+
changeOrGetHeight(h) {
|
30
|
+
if (h) {
|
31
|
+
this.style.height = typeof h === 'number' ? h + 'rem' : h;
|
32
|
+
}
|
33
|
+
return this.getBoundingClientRect().height;
|
34
|
+
},
|
35
|
+
changeOrGetWidth(w) {
|
36
|
+
if (w) {
|
37
|
+
this.style.width = typeof w === 'number' ? w + 'rem' : w;
|
38
|
+
}
|
39
|
+
return this.getBoundingClientRect().width;
|
40
|
+
},
|
41
|
+
getTop() {
|
42
|
+
return this.getBoundingClientRect().top;
|
43
|
+
},
|
44
|
+
left() {
|
45
|
+
return this.getBoundingClientRect().left;
|
46
|
+
},
|
47
|
+
attr(type, value) {
|
48
|
+
if (value === null) {
|
49
|
+
return this.removeAttribute(type);
|
50
|
+
}
|
51
|
+
if (value) {
|
52
|
+
this.setAttribute(type, value);
|
53
|
+
return this;
|
84
54
|
}
|
85
55
|
else {
|
86
|
-
this.
|
56
|
+
return this.getAttribute(type);
|
57
|
+
}
|
58
|
+
},
|
59
|
+
insertAfter(element) {
|
60
|
+
const parent = this.parentNode;
|
61
|
+
if (parent.lastChild === this) {
|
62
|
+
parent.appendChild(element);
|
63
|
+
}
|
64
|
+
else {
|
65
|
+
parent.insertBefore(element, this.nextSibling);
|
66
|
+
}
|
67
|
+
},
|
68
|
+
display(d) {
|
69
|
+
if (d == null) {
|
70
|
+
return this.style.display;
|
87
71
|
}
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
72
|
+
else {
|
73
|
+
this.style.display = d;
|
74
|
+
return this;
|
75
|
+
}
|
76
|
+
},
|
77
|
+
child(selector) {
|
78
|
+
return (0, dom_1.$dom)(selector, this);
|
79
|
+
},
|
80
|
+
find(selector) {
|
81
|
+
return dom_1.$dom.all(selector, this);
|
82
|
+
},
|
83
|
+
_class(type, className, display) {
|
84
|
+
const classNames = className.indexOf(' ') ? className.split(' ') : [className];
|
85
|
+
classNames.forEach((name) => {
|
86
|
+
if (type === 'toggle') {
|
87
|
+
this.classList.toggle(name, display);
|
88
|
+
}
|
89
|
+
else {
|
90
|
+
this.classList[type](name);
|
91
|
+
}
|
92
|
+
});
|
93
|
+
},
|
94
|
+
addClass(className) {
|
95
|
+
this._class('add', className);
|
96
|
+
return this;
|
97
|
+
},
|
98
|
+
removeClass(className) {
|
99
|
+
this._class('remove', className);
|
100
|
+
return this;
|
101
|
+
},
|
102
|
+
toggleClass(className, display) {
|
103
|
+
this._class('toggle', className, display);
|
104
|
+
return this;
|
105
|
+
},
|
106
|
+
hasClass(className) {
|
107
|
+
return this.classList.contains(className);
|
108
|
+
}
|
109
|
+
});
|
110
|
+
}
|
111
|
+
exports.default = initProto;
|
@@ -1,15 +1,21 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
window.addEventListener('
|
7
|
-
|
8
|
-
window.dispatchEvent(new Event('DOMContentLoaded'));
|
9
|
-
console.log('%c ☁️cloudflare patch ' + '%c running(rocket & minify)', 'color: white; background: #ff8c00; padding: 5px 3px;', 'padding: 4px;border:1px solid #ff8c00');
|
10
|
-
}
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.pjaxScript = exports.getScript = exports.cloudflareInit = void 0;
|
4
|
+
function cloudflareInit() {
|
5
|
+
let inCloudFlare = true;
|
6
|
+
window.addEventListener('DOMContentLoaded', function () {
|
7
|
+
inCloudFlare = false;
|
11
8
|
});
|
9
|
+
if (document.readyState === 'loading') {
|
10
|
+
window.addEventListener('load', function () {
|
11
|
+
if (inCloudFlare) {
|
12
|
+
window.dispatchEvent(new Event('DOMContentLoaded'));
|
13
|
+
console.log('%c ☁️cloudflare patch ' + '%c running(rocket & minify)', 'color: white; background: #ff8c00; padding: 5px 3px;', 'padding: 4px;border:1px solid #ff8c00');
|
14
|
+
}
|
15
|
+
});
|
16
|
+
}
|
12
17
|
}
|
18
|
+
exports.cloudflareInit = cloudflareInit;
|
13
19
|
const getScript = (url, callback, condition) => {
|
14
20
|
if (condition) {
|
15
21
|
callback();
|
@@ -29,6 +35,7 @@ const getScript = (url, callback, condition) => {
|
|
29
35
|
document.head.appendChild(script);
|
30
36
|
}
|
31
37
|
};
|
38
|
+
exports.getScript = getScript;
|
32
39
|
const pjaxScript = (element) => {
|
33
40
|
const { text, parentNode, id, className, type, src, dataset } = element;
|
34
41
|
const code = text || element.textContent || element.innerHTML || '';
|
@@ -55,3 +62,4 @@ const pjaxScript = (element) => {
|
|
55
62
|
}
|
56
63
|
parentNode.appendChild(script);
|
57
64
|
};
|
65
|
+
exports.pjaxScript = pjaxScript;
|
@@ -1,3 +1,10 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const storage_1 = require("./storage");
|
4
|
+
const anime_1 = require("./anime");
|
5
|
+
const dom_1 = require("./dom");
|
6
|
+
const globalVars_1 = require("../globals/globalVars");
|
7
|
+
const themeColor_1 = require("../globals/themeColor");
|
1
8
|
Vue.createApp({
|
2
9
|
data() {
|
3
10
|
return {};
|
@@ -5,24 +12,24 @@ Vue.createApp({
|
|
5
12
|
methods: {
|
6
13
|
changeThemeByBtn() {
|
7
14
|
let c;
|
8
|
-
const btn =
|
9
|
-
const neko = BODY.createChild('div', {
|
15
|
+
const btn = (0, dom_1.$dom)('.theme').child('.ic');
|
16
|
+
const neko = globalVars_1.BODY.createChild('div', {
|
10
17
|
id: 'neko',
|
11
18
|
innerHTML: '<div class="planet"><div class="sun"></div><div class="moon"></div></div><div class="body"><div class="face"><section class="eyes left"><span class="pupil"></span></section><section class="eyes right"><span class="pupil"></span></section><span class="nose"></span></div></div>'
|
12
19
|
});
|
13
20
|
const hideNeko = () => {
|
14
|
-
transition(neko, {
|
21
|
+
(0, anime_1.transition)(neko, {
|
15
22
|
delay: 2500,
|
16
23
|
opacity: 0
|
17
24
|
}, () => {
|
18
|
-
BODY.removeChild(neko);
|
25
|
+
globalVars_1.BODY.removeChild(neko);
|
19
26
|
});
|
20
27
|
};
|
21
28
|
if (btn.hasClass('i-sun')) {
|
22
29
|
c = () => {
|
23
30
|
neko.addClass('dark');
|
24
|
-
changeTheme('dark');
|
25
|
-
|
31
|
+
(0, themeColor_1.changeTheme)('dark');
|
32
|
+
storage_1.$storage.set('theme', 'dark');
|
26
33
|
hideNeko();
|
27
34
|
};
|
28
35
|
}
|
@@ -30,12 +37,12 @@ Vue.createApp({
|
|
30
37
|
neko.addClass('dark');
|
31
38
|
c = () => {
|
32
39
|
neko.removeClass('dark');
|
33
|
-
changeTheme();
|
34
|
-
|
40
|
+
(0, themeColor_1.changeTheme)();
|
41
|
+
storage_1.$storage.set('theme', 'light');
|
35
42
|
hideNeko();
|
36
43
|
};
|
37
44
|
}
|
38
|
-
transition(neko, 1, () => {
|
45
|
+
(0, anime_1.transition)(neko, 1, () => {
|
39
46
|
setTimeout(c, 210);
|
40
47
|
}, () => {
|
41
48
|
neko.display('block');
|
@@ -1,19 +1,26 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const dom_1 = require("../library/dom");
|
4
|
+
const anime_1 = require("../library/anime");
|
5
|
+
const globalVars_1 = require("../globals/globalVars");
|
6
|
+
const loadFile_1 = require("../library/loadFile");
|
7
|
+
function loadComments() {
|
8
|
+
const element = (0, dom_1.$dom)('#comments');
|
3
9
|
if (!element) {
|
4
|
-
goToComment.display('none');
|
10
|
+
globalVars_1.goToComment.display('none');
|
5
11
|
return;
|
6
12
|
}
|
7
13
|
else {
|
8
|
-
goToComment.display('');
|
14
|
+
globalVars_1.goToComment.display('');
|
9
15
|
}
|
10
16
|
const io = new IntersectionObserver((entries, observer) => {
|
11
17
|
const entry = entries[0];
|
12
|
-
vendorCss('valine');
|
18
|
+
(0, loadFile_1.vendorCss)('valine');
|
13
19
|
if (entry.isIntersecting || entry.intersectionRatio > 0) {
|
14
|
-
transition(
|
20
|
+
(0, anime_1.transition)((0, dom_1.$dom)('#comments'), 'bounceUpIn');
|
15
21
|
observer.disconnect();
|
16
22
|
}
|
17
23
|
});
|
18
24
|
io.observe(element);
|
19
|
-
}
|
25
|
+
}
|
26
|
+
exports.default = loadComments;
|
@@ -1,5 +1,9 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.registerExtURL = exports.cardActive = void 0;
|
4
|
+
const dom_1 = require("../library/dom");
|
1
5
|
const cardActive = () => {
|
2
|
-
if (
|
6
|
+
if (!(0, dom_1.$dom)('.index.wrap')) {
|
3
7
|
return;
|
4
8
|
}
|
5
9
|
const io = new IntersectionObserver((entries) => {
|
@@ -18,15 +22,15 @@ const cardActive = () => {
|
|
18
22
|
root: null,
|
19
23
|
threshold: [0.3]
|
20
24
|
});
|
21
|
-
|
25
|
+
dom_1.$dom.each('.index.wrap article.item, .index.wrap section.item', (article) => {
|
22
26
|
io.observe(article);
|
23
27
|
});
|
24
|
-
|
25
|
-
|
28
|
+
(0, dom_1.$dom)('.index.wrap .item:first-child').addClass('show');
|
29
|
+
dom_1.$dom.each('.cards .item', (element) => {
|
26
30
|
['mouseenter', 'touchstart'].forEach((item) => {
|
27
31
|
element.addEventListener(item, () => {
|
28
|
-
if (
|
29
|
-
|
32
|
+
if ((0, dom_1.$dom)('.cards .item.active')) {
|
33
|
+
(0, dom_1.$dom)('.cards .item.active').removeClass('active');
|
30
34
|
}
|
31
35
|
element.addClass('active');
|
32
36
|
}, { passive: true });
|
@@ -38,8 +42,9 @@ const cardActive = () => {
|
|
38
42
|
});
|
39
43
|
});
|
40
44
|
};
|
45
|
+
exports.cardActive = cardActive;
|
41
46
|
const registerExtURL = () => {
|
42
|
-
|
47
|
+
dom_1.$dom.each('span.exturl', (element) => {
|
43
48
|
const link = document.createElement('a');
|
44
49
|
link.href = decodeURIComponent(window.atob(element.dataset.url).split('').map((c) => {
|
45
50
|
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
|
@@ -55,3 +60,4 @@ const registerExtURL = () => {
|
|
55
60
|
element.parentNode.replaceChild(link, element);
|
56
61
|
});
|
57
62
|
};
|
63
|
+
exports.registerExtURL = registerExtURL;
|
@@ -1,9 +1,14 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.postFancybox = void 0;
|
4
|
+
const dom_1 = require("../library/dom");
|
5
|
+
const loadFile_1 = require("../library/loadFile");
|
1
6
|
const postFancybox = (p) => {
|
2
|
-
if (
|
3
|
-
vendorCss('fancybox');
|
4
|
-
vendorJs('fancybox', () => {
|
7
|
+
if ((0, dom_1.$dom)(p + ' .md img')) {
|
8
|
+
(0, loadFile_1.vendorCss)('fancybox');
|
9
|
+
(0, loadFile_1.vendorJs)('fancybox', () => {
|
5
10
|
const q = jQuery.noConflict();
|
6
|
-
|
11
|
+
dom_1.$dom.each(p + ' p.gallery', (element) => {
|
7
12
|
const box = document.createElement('div');
|
8
13
|
box.className = 'gallery';
|
9
14
|
box.attr('data-height', String(element.attr('data-height') || 220));
|
@@ -11,7 +16,7 @@ const postFancybox = (p) => {
|
|
11
16
|
element.parentNode.insertBefore(box, element);
|
12
17
|
element.remove();
|
13
18
|
});
|
14
|
-
|
19
|
+
dom_1.$dom.each(p + ' .md img:not(.emoji):not(.vemoji)', (element) => {
|
15
20
|
const $image = q(element);
|
16
21
|
const imageLink = $image.attr('data-src') || $image.attr('src');
|
17
22
|
const $imageWrapLink = $image.wrap('<a class="fancybox" href="' + imageLink + '" itemscope itemtype="https://schema.org/ImageObject" itemprop="url"></a>').parent('a');
|
@@ -35,7 +40,7 @@ const postFancybox = (p) => {
|
|
35
40
|
element.insertAfter(para);
|
36
41
|
}
|
37
42
|
});
|
38
|
-
|
43
|
+
dom_1.$dom.each(p + ' div.gallery', (el, i) => {
|
39
44
|
q(el).justifiedGallery({
|
40
45
|
rowHeight: q(el).data('height') || 120,
|
41
46
|
rel: 'gallery-' + i
|
@@ -57,3 +62,4 @@ const postFancybox = (p) => {
|
|
57
62
|
}, window.jQuery);
|
58
63
|
}
|
59
64
|
};
|
65
|
+
exports.postFancybox = postFancybox;
|
@@ -1,16 +1,29 @@
|
|
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.postBeauty = void 0;
|
7
|
+
const comment_1 = __importDefault(require("./comment"));
|
8
|
+
const dom_1 = require("../library/dom");
|
9
|
+
const fancybox_1 = require("./fancybox");
|
10
|
+
const tools_1 = require("../globals/tools");
|
11
|
+
const globalVars_1 = require("../globals/globalVars");
|
12
|
+
const anime_1 = require("../library/anime");
|
13
|
+
const player_1 = require("../player");
|
1
14
|
const postBeauty = () => {
|
2
|
-
|
3
|
-
if (
|
15
|
+
(0, comment_1.default)();
|
16
|
+
if (!(0, dom_1.$dom)('.md')) {
|
4
17
|
return;
|
5
18
|
}
|
6
|
-
postFancybox('.post.block');
|
7
|
-
|
8
|
-
showtip(LOCAL.copyright);
|
19
|
+
(0, fancybox_1.postFancybox)('.post.block');
|
20
|
+
(0, dom_1.$dom)('.post.block').oncopy = async (event) => {
|
21
|
+
(0, tools_1.showtip)(LOCAL.copyright);
|
9
22
|
if (LOCAL.nocopy) {
|
10
23
|
event.preventDefault();
|
11
24
|
return;
|
12
25
|
}
|
13
|
-
const copyright = await
|
26
|
+
const copyright = await dom_1.$dom.asyncify('#copyright');
|
14
27
|
if (window.getSelection().toString().length > 30 && copyright) {
|
15
28
|
event.preventDefault();
|
16
29
|
const author = '# ' + copyright.child('.author').innerText;
|
@@ -29,25 +42,25 @@ const postBeauty = () => {
|
|
29
42
|
}
|
30
43
|
}
|
31
44
|
};
|
32
|
-
|
45
|
+
dom_1.$dom.each('li ruby', (element) => {
|
33
46
|
let parent = element.parentNode;
|
34
47
|
if (element.parentNode.tagName !== 'LI') {
|
35
48
|
parent = element.parentNode.parentNode;
|
36
49
|
}
|
37
50
|
parent.addClass('ruby');
|
38
51
|
});
|
39
|
-
|
52
|
+
dom_1.$dom.each('ol[start]', (element) => {
|
40
53
|
element.style.counterReset = 'counter ' + parseInt(element.attr('start') - 1);
|
41
54
|
});
|
42
|
-
|
55
|
+
dom_1.$dom.each('.md table', (element) => {
|
43
56
|
element.wrapObject({
|
44
57
|
className: 'table-container'
|
45
58
|
});
|
46
59
|
});
|
47
|
-
|
60
|
+
dom_1.$dom.each('.highlight > .table-container', (element) => {
|
48
61
|
element.className = 'code-container';
|
49
62
|
});
|
50
|
-
|
63
|
+
dom_1.$dom.each('figure.highlight', (element) => {
|
51
64
|
const code_container = element.child('.code-container');
|
52
65
|
const caption = element.child('figcaption');
|
53
66
|
element.insertAdjacentHTML('beforeend', '<div class="operation"><span class="breakline-btn"><i class="ic i-align-left"></i></span><span class="copy-btn"><i class="ic i-clipboard"></i></span><span class="fullscreen-btn"><i class="ic i-expand"></i></span></div>');
|
@@ -64,10 +77,10 @@ const postBeauty = () => {
|
|
64
77
|
code += comma + line.innerText;
|
65
78
|
comma = '\n';
|
66
79
|
});
|
67
|
-
clipBoard(code, (result) => {
|
80
|
+
(0, tools_1.clipBoard)(code, (result) => {
|
68
81
|
target.child('.ic').className = result ? 'ic i-check' : 'ic i-times';
|
69
82
|
target.blur();
|
70
|
-
showtip(LOCAL.copyright);
|
83
|
+
(0, tools_1.showtip)(LOCAL.copyright);
|
71
84
|
});
|
72
85
|
}, { passive: true });
|
73
86
|
copyBtn.addEventListener('mouseleave', (event) => {
|
@@ -92,7 +105,7 @@ const postBeauty = () => {
|
|
92
105
|
const removeFullscreen = () => {
|
93
106
|
element.removeClass('fullscreen');
|
94
107
|
element.scrollTop = 0;
|
95
|
-
BODY.removeClass('fullscreen');
|
108
|
+
globalVars_1.BODY.removeClass('fullscreen');
|
96
109
|
fullscreenBtn.child('.ic').className = 'ic i-expand';
|
97
110
|
};
|
98
111
|
const fullscreenHandle = () => {
|
@@ -103,11 +116,11 @@ const postBeauty = () => {
|
|
103
116
|
code_container.style.maxHeight = '300px';
|
104
117
|
showBtn.removeClass('open');
|
105
118
|
}
|
106
|
-
pageScroll(element);
|
119
|
+
(0, anime_1.pageScroll)(element);
|
107
120
|
}
|
108
121
|
else {
|
109
122
|
element.addClass('fullscreen');
|
110
|
-
BODY.addClass('fullscreen');
|
123
|
+
globalVars_1.BODY.addClass('fullscreen');
|
111
124
|
fullscreenBtn.child('.ic').className = 'ic i-compress';
|
112
125
|
if (code_container && code_container.find('tr').length > 15) {
|
113
126
|
const showBtn = code_container.child('.show-btn');
|
@@ -134,7 +147,7 @@ const postBeauty = () => {
|
|
134
147
|
if (showBtn.hasClass('open')) {
|
135
148
|
removeFullscreen();
|
136
149
|
hideCode();
|
137
|
-
pageScroll(code_container);
|
150
|
+
(0, anime_1.pageScroll)(code_container);
|
138
151
|
}
|
139
152
|
else {
|
140
153
|
showCode();
|
@@ -142,25 +155,25 @@ const postBeauty = () => {
|
|
142
155
|
});
|
143
156
|
}
|
144
157
|
});
|
145
|
-
|
158
|
+
dom_1.$dom.asyncifyEach('pre.mermaid > svg', (element) => {
|
146
159
|
const temp = element;
|
147
160
|
temp.style.maxWidth = '';
|
148
161
|
});
|
149
|
-
|
162
|
+
dom_1.$dom.each('.reward button', (element) => {
|
150
163
|
element.addEventListener('click', (event) => {
|
151
164
|
event.preventDefault();
|
152
|
-
const qr =
|
165
|
+
const qr = (0, dom_1.$dom)('#qr');
|
153
166
|
if (qr.display() === 'inline-flex') {
|
154
|
-
transition(qr, 0);
|
167
|
+
(0, anime_1.transition)(qr, 0);
|
155
168
|
}
|
156
169
|
else {
|
157
|
-
transition(qr, 1, () => {
|
170
|
+
(0, anime_1.transition)(qr, 1, () => {
|
158
171
|
qr.display('inline-flex');
|
159
172
|
});
|
160
173
|
}
|
161
174
|
});
|
162
175
|
});
|
163
|
-
|
176
|
+
dom_1.$dom.asyncifyEach('.quiz > ul.options li', (element) => {
|
164
177
|
element.addEventListener('click', () => {
|
165
178
|
if (element.hasClass('correct')) {
|
166
179
|
element.toggleClass('right');
|
@@ -171,12 +184,12 @@ const postBeauty = () => {
|
|
171
184
|
}
|
172
185
|
});
|
173
186
|
});
|
174
|
-
|
187
|
+
dom_1.$dom.asyncifyEach('.quiz > p', (element) => {
|
175
188
|
element.addEventListener('click', () => {
|
176
189
|
element.parentNode.toggleClass('show');
|
177
190
|
});
|
178
191
|
});
|
179
|
-
|
192
|
+
dom_1.$dom.asyncifyEach('.quiz > p:first-child', (element) => {
|
180
193
|
const quiz = element.parentNode;
|
181
194
|
let type = 'choice';
|
182
195
|
if (quiz.hasClass('true') || quiz.hasClass('false')) {
|
@@ -193,14 +206,14 @@ const postBeauty = () => {
|
|
193
206
|
}
|
194
207
|
element.attr('data-type', LOCAL.quiz[type]);
|
195
208
|
});
|
196
|
-
|
209
|
+
dom_1.$dom.asyncifyEach('.quiz .mistake', (element) => {
|
197
210
|
element.attr('data-type', LOCAL.quiz.mistake);
|
198
211
|
});
|
199
|
-
|
212
|
+
dom_1.$dom.each('div.tags a', (element) => {
|
200
213
|
element.className = ['primary', 'success', 'info', 'warning', 'danger'][Math.floor(Math.random() * 5)];
|
201
214
|
});
|
202
|
-
|
203
|
-
mediaPlayer(element, {
|
215
|
+
dom_1.$dom.asyncifyEach('.md div.player', (element) => {
|
216
|
+
(0, player_1.mediaPlayer)(element, {
|
204
217
|
type: element.attr('data-type'),
|
205
218
|
mode: 'order',
|
206
219
|
btns: []
|
@@ -230,3 +243,4 @@ const postBeauty = () => {
|
|
230
243
|
});
|
231
244
|
}
|
232
245
|
};
|
246
|
+
exports.postBeauty = postBeauty;
|