hexo-theme-shokax 0.5.0 → 0.5.2-hotfix.1
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.
- package/CODE_OF_CONDUCT.md +128 -128
- package/LICENSE +660 -660
- package/LICENSE-shoka +21 -21
- package/README.md +74 -53
- package/UsageRestrictions.md +25 -25
- package/_config.yml +352 -350
- package/languages/README.md +19 -19
- package/languages/default.yml +1 -1
- package/languages/en.yml +155 -155
- package/languages/ja.yml +155 -155
- package/languages/zh-CN.yml +155 -155
- package/languages/zh-HK.yml +155 -155
- package/languages/zh-TW.yml +155 -155
- package/layout/_alternate/atom.ejs +30 -30
- package/layout/_alternate/json.ejs +16 -16
- package/layout/_alternate/rss.ejs +34 -34
- package/layout/_mixin/breadcrumb.pug +33 -33
- package/layout/_mixin/card.pug +37 -37
- package/layout/_mixin/comment.pug +6 -6
- package/layout/_mixin/postmeta.pug +29 -29
- package/layout/_mixin/segment.pug +35 -35
- package/layout/_mixin/sidebar.pug +40 -40
- package/layout/_mixin/widgets.pug +28 -28
- package/layout/_partials/footer.pug +43 -43
- package/layout/_partials/head/head.pug +50 -50
- package/layout/_partials/head/head_com.pug +24 -24
- package/layout/_partials/head/pwa.pug +18 -18
- package/layout/_partials/header.pug +18 -18
- package/layout/_partials/layout.pug +137 -137
- package/layout/_partials/loading.pug +13 -13
- package/layout/_partials/pagination.pug +4 -4
- package/layout/_partials/post/copyright.pug +20 -20
- package/layout/_partials/post/footer.pug +20 -20
- package/layout/_partials/post/nav.pug +17 -17
- package/layout/_partials/post/post.pug +42 -42
- package/layout/_partials/post/reward.pug +18 -18
- package/layout/_partials/sidebar/menu.pug +37 -37
- package/layout/_partials/sidebar/overview.pug +42 -42
- package/layout/_partials/third-party/baidu-analytics.pug +11 -11
- package/layout/_partials/third-party/clarity.pug +8 -8
- package/layout/_partials/third-party/google-analytics.pug +9 -9
- package/layout/archive.pug +121 -121
- package/layout/category.pug +62 -62
- package/layout/index.pug +36 -36
- package/layout/page.pug +60 -60
- package/layout/post.pug +42 -42
- package/layout/tag.pug +46 -46
- package/package.json +14 -14
- package/scripts/generaters/images.js +11 -13
- package/scripts/generaters/script.js +3 -1
- package/scripts/helpers/engine.js +5 -0
- package/scripts/plugin/check.js +48 -10
- package/scripts/plugin/index.js +2 -2
- package/source/assets/algolia_logo.svg +9 -9
- package/source/assets/logo.svg +16 -16
- package/source/css/_colors.styl +207 -207
- package/source/css/_common/components/components.styl +5 -6
- package/source/css/_common/components/pages/collapse.styl +119 -119
- package/source/css/_common/components/pages/home.styl +391 -391
- package/source/css/_common/components/pages/pages.styl +56 -56
- package/source/css/_common/components/pages/tag-cloud.styl +12 -12
- package/source/css/_common/components/post/breadcrumb.styl +39 -39
- package/source/css/_common/components/post/copyright.styl +41 -41
- package/source/css/_common/components/post/expand.styl +263 -263
- package/source/css/_common/components/post/footer.styl +11 -11
- package/source/css/_common/components/post/header.styl +79 -79
- package/source/css/_common/components/post/nav.styl +64 -64
- package/source/css/_common/components/post/post.styl +29 -29
- package/source/css/_common/components/post/reward.styl +50 -50
- package/source/css/_common/components/post/rtl.styl +12 -12
- package/source/css/_common/components/post/tags.styl +39 -39
- package/source/css/_common/components/tags/collapse.styl +72 -72
- package/source/css/_common/components/tags/container.styl +49 -49
- package/source/css/_common/components/tags/label.styl +12 -12
- package/source/css/_common/components/tags/links.styl +77 -77
- package/source/css/_common/components/tags/list.styl +131 -131
- package/source/css/_common/components/tags/note.styl +70 -70
- package/source/css/_common/components/tags/player.styl +361 -361
- package/source/css/_common/components/tags/quiz.styl +200 -200
- package/source/css/_common/components/tags/tabs.styl +89 -89
- package/source/css/_common/components/tags/tags.styl +9 -9
- package/source/css/_common/components/third-party/loading.styl +222 -222
- package/source/css/_common/components/third-party/mermaid/class.styl +90 -90
- package/source/css/_common/components/third-party/mermaid/flowchart.styl +72 -72
- package/source/css/_common/components/third-party/mermaid/gantt.styl +251 -251
- package/source/css/_common/components/third-party/mermaid/git.styl +7 -7
- package/source/css/_common/components/third-party/mermaid/mermaid.styl +37 -37
- package/source/css/_common/components/third-party/mermaid/pie.styl +9 -9
- package/source/css/_common/components/third-party/mermaid/sequence.styl +95 -95
- package/source/css/_common/components/third-party/mermaid/state.styl +130 -130
- package/source/css/_common/components/third-party/pace.styl +18 -18
- package/source/css/_common/components/third-party/search.styl +167 -167
- package/source/css/_common/components/third-party/theme.styl +151 -151
- package/source/css/_common/components/third-party/third-party.styl +22 -22
- package/source/css/_common/components/third-party/widgets.styl +57 -57
- package/source/css/_common/outline/footer/footer.styl +67 -67
- package/source/css/_common/outline/header/brand.styl +77 -77
- package/source/css/_common/outline/header/header.styl +20 -20
- package/source/css/_common/outline/header/image.styl +85 -85
- package/source/css/_common/outline/header/menu.styl +117 -117
- package/source/css/_common/outline/header/nav.styl +81 -81
- package/source/css/_common/outline/header/right.styl +15 -15
- package/source/css/_common/outline/header/tool.styl +207 -207
- package/source/css/_common/outline/header/waves.styl +57 -57
- package/source/css/_common/outline/mobile.styl +46 -46
- package/source/css/_common/outline/outline.styl +78 -78
- package/source/css/_common/outline/sidebar/author.styl +59 -59
- package/source/css/_common/outline/sidebar/dimmer.styl +23 -23
- package/source/css/_common/outline/sidebar/menu.styl +63 -63
- package/source/css/_common/outline/sidebar/quick.styl +43 -43
- package/source/css/_common/outline/sidebar/related.styl +56 -56
- package/source/css/_common/outline/sidebar/sidebar.styl +82 -82
- package/source/css/_common/outline/sidebar/social.styl +69 -69
- package/source/css/_common/outline/sidebar/state.styl +37 -37
- package/source/css/_common/outline/sidebar/tab.styl +71 -71
- package/source/css/_common/outline/sidebar/toc.styl +47 -47
- package/source/css/_common/scaffolding/animate.styl +322 -322
- package/source/css/_common/scaffolding/base.styl +192 -190
- package/source/css/_common/scaffolding/buttons.styl +48 -48
- package/source/css/_common/scaffolding/divider.styl +36 -36
- package/source/css/_common/scaffolding/iconfont.styl +443 -443
- package/source/css/_common/scaffolding/normalize.styl +273 -273
- package/source/css/_common/scaffolding/pagination.styl +81 -81
- package/source/css/_common/scaffolding/ribbon.styl +38 -38
- package/source/css/_common/scaffolding/scaffolding.styl +14 -14
- package/source/css/_common/scaffolding/scrollbar.styl +37 -37
- package/source/css/_common/scaffolding/tables.styl +50 -50
- package/source/css/_common/scaffolding/tip.styl +19 -19
- package/source/css/_common/scaffolding/toggles.styl +59 -59
- package/source/css/_iconfont.styl +455 -455
- package/source/css/_mixins.styl +148 -148
- package/source/css/_variables.styl +89 -89
- package/source/css/app.styl +25 -25
- package/source/css/mermaid.styl +5 -5
- package/source/css/page.styl +2 -2
- package/source/css/post.styl +5 -5
- package/source/css/scaffolding.styl +4 -4
- package/source/js/_app/components/cloudflare.ts +18 -18
- package/source/js/_app/components/comments.ts +88 -86
- package/source/js/_app/components/sidebar.ts +243 -243
- package/source/js/_app/components/tcomments.ts +53 -53
- package/source/js/_app/globals/globalVars.ts +84 -84
- package/source/js/_app/globals/handles.ts +124 -124
- package/source/js/_app/globals/themeColor.ts +62 -62
- package/source/js/_app/globals/thirdparty.ts +63 -63
- package/source/js/_app/globals/tools.ts +73 -73
- package/source/js/_app/library/anime.ts +121 -121
- package/source/js/_app/library/declare.d.ts +128 -126
- package/source/js/_app/library/proto.ts +70 -70
- package/source/js/_app/library/vue.ts +49 -49
- package/source/js/_app/page/common.ts +41 -41
- package/source/js/_app/page/imageviewer.ts +15 -15
- package/source/js/_app/page/post.ts +252 -248
- package/source/js/_app/page/search.ts +109 -109
- package/source/js/_app/page/tab.ts +59 -59
- package/source/js/_app/pjax/domInit.ts +102 -102
- package/source/js/_app/pjax/refresh.ts +117 -117
- package/source/js/_app/pjax/siteInit.ts +90 -90
- package/source/js/_app/player.ts +13 -13
- package/toolbox/compiler.mjs +49 -53
- package/toolbox/dev-version.mjs +14 -14
- package/toolbox/hoistdep.mjs +5 -5
- package/toolbox/lib.mjs +63 -63
- package/source/css/_common/components/highlight/highlight.styl +0 -357
- package/source/css/_common/components/highlight/operation.styl +0 -21
@@ -1,126 +1,128 @@
|
|
1
|
-
type vendorUrl = {
|
2
|
-
url: string
|
3
|
-
local: boolean
|
4
|
-
sri?: string
|
5
|
-
}
|
6
|
-
|
7
|
-
interface AudioItem {
|
8
|
-
title: string;
|
9
|
-
list: string[];
|
10
|
-
}
|
11
|
-
|
12
|
-
declare interface EventTarget {
|
13
|
-
changeOrGetHeight(h: number | string): void;
|
14
|
-
changeOrGetHeight(): number;
|
15
|
-
changeOrGetWidth(w: number | string): void;
|
16
|
-
changeOrGetWidth(): number;
|
17
|
-
getTop(): number;
|
18
|
-
left(): number;
|
19
|
-
insertAfter(element: HTMLElement): void;
|
20
|
-
display(d: string): EventTarget;
|
21
|
-
display():string
|
22
|
-
find(selector: string): NodeListOf<HTMLElement>;
|
23
|
-
_class(type: string, className: string, display?: boolean): void;
|
24
|
-
addClass(className: string): EventTarget;
|
25
|
-
removeClass(className: string): EventTarget;
|
26
|
-
toggleClass(className: string, display?: boolean): EventTarget;
|
27
|
-
hasClass(className: string): boolean;
|
28
|
-
}
|
29
|
-
|
30
|
-
type walineMeta = 'nick'|'mail'|'link'
|
31
|
-
|
32
|
-
declare const LOCAL: {
|
33
|
-
ispost: boolean;
|
34
|
-
path: string;
|
35
|
-
ignores: Array<(uri:string)=>boolean>;
|
36
|
-
audio: string[];
|
37
|
-
search: {
|
38
|
-
placeholder: string,
|
39
|
-
empty: string,
|
40
|
-
stats: string
|
41
|
-
};
|
42
|
-
quiz: {
|
43
|
-
choice: string,
|
44
|
-
multiple: string,
|
45
|
-
true_false: string,
|
46
|
-
essay: string,
|
47
|
-
gap_fill: string,
|
48
|
-
mistake: string
|
49
|
-
};
|
50
|
-
nocopy: boolean;
|
51
|
-
copyright: string;
|
52
|
-
outime: boolean
|
53
|
-
template: string
|
54
|
-
favicon: {
|
55
|
-
hide: string
|
56
|
-
show: string
|
57
|
-
}
|
58
|
-
}
|
59
|
-
interface configType {
|
60
|
-
hostname: string;
|
61
|
-
fireworks: any;
|
62
|
-
audio: AudioItem[];
|
63
|
-
version: number
|
64
|
-
root: string
|
65
|
-
statics: string
|
66
|
-
outime: {
|
67
|
-
enable: boolean
|
68
|
-
days: number
|
69
|
-
}
|
70
|
-
favicon: {
|
71
|
-
normal: string,
|
72
|
-
hidden: string
|
73
|
-
}
|
74
|
-
darkmode: boolean
|
75
|
-
auto_dark: {
|
76
|
-
enable: boolean
|
77
|
-
start: number
|
78
|
-
end: number
|
79
|
-
}
|
80
|
-
auto_scroll: boolean
|
81
|
-
loader: {
|
82
|
-
start: boolean
|
83
|
-
switch: boolean
|
84
|
-
}
|
85
|
-
js: {
|
86
|
-
copy_tex: vendorUrl
|
87
|
-
}
|
88
|
-
css: {
|
89
|
-
katex: vendorUrl
|
90
|
-
mermaid: vendorUrl
|
91
|
-
}
|
92
|
-
search: any,
|
93
|
-
waline: {
|
94
|
-
serverURL: string
|
95
|
-
lang: string
|
96
|
-
locale: object
|
97
|
-
emoji: boolean
|
98
|
-
meta: walineMeta[]
|
99
|
-
requiredMeta: walineMeta[]
|
100
|
-
wordLimit: number
|
101
|
-
pageSize: number
|
102
|
-
pageview: boolean
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
declare const
|
118
|
-
declare const
|
119
|
-
declare const
|
120
|
-
declare const
|
121
|
-
declare const
|
122
|
-
declare const
|
123
|
-
declare const
|
124
|
-
declare const
|
125
|
-
declare const
|
126
|
-
declare const
|
1
|
+
type vendorUrl = {
|
2
|
+
url: string
|
3
|
+
local: boolean
|
4
|
+
sri?: string
|
5
|
+
}
|
6
|
+
|
7
|
+
interface AudioItem {
|
8
|
+
title: string;
|
9
|
+
list: string[];
|
10
|
+
}
|
11
|
+
|
12
|
+
declare interface EventTarget {
|
13
|
+
changeOrGetHeight(h: number | string): void;
|
14
|
+
changeOrGetHeight(): number;
|
15
|
+
changeOrGetWidth(w: number | string): void;
|
16
|
+
changeOrGetWidth(): number;
|
17
|
+
getTop(): number;
|
18
|
+
left(): number;
|
19
|
+
insertAfter(element: HTMLElement): void;
|
20
|
+
display(d: string): EventTarget;
|
21
|
+
display():string
|
22
|
+
find(selector: string): NodeListOf<HTMLElement>;
|
23
|
+
_class(type: string, className: string, display?: boolean): void;
|
24
|
+
addClass(className: string): EventTarget;
|
25
|
+
removeClass(className: string): EventTarget;
|
26
|
+
toggleClass(className: string, display?: boolean): EventTarget;
|
27
|
+
hasClass(className: string): boolean;
|
28
|
+
}
|
29
|
+
|
30
|
+
type walineMeta = 'nick'|'mail'|'link'
|
31
|
+
|
32
|
+
declare const LOCAL: {
|
33
|
+
ispost: boolean;
|
34
|
+
path: string;
|
35
|
+
ignores: Array<(uri:string)=>boolean>;
|
36
|
+
audio: string[];
|
37
|
+
search: {
|
38
|
+
placeholder: string,
|
39
|
+
empty: string,
|
40
|
+
stats: string
|
41
|
+
};
|
42
|
+
quiz: {
|
43
|
+
choice: string,
|
44
|
+
multiple: string,
|
45
|
+
true_false: string,
|
46
|
+
essay: string,
|
47
|
+
gap_fill: string,
|
48
|
+
mistake: string
|
49
|
+
};
|
50
|
+
nocopy: boolean;
|
51
|
+
copyright: string;
|
52
|
+
outime: boolean
|
53
|
+
template: string
|
54
|
+
favicon: {
|
55
|
+
hide: string
|
56
|
+
show: string
|
57
|
+
}
|
58
|
+
}
|
59
|
+
interface configType {
|
60
|
+
hostname: string;
|
61
|
+
fireworks: any;
|
62
|
+
audio: AudioItem[];
|
63
|
+
version: number
|
64
|
+
root: string
|
65
|
+
statics: string
|
66
|
+
outime: {
|
67
|
+
enable: boolean
|
68
|
+
days: number
|
69
|
+
}
|
70
|
+
favicon: {
|
71
|
+
normal: string,
|
72
|
+
hidden: string
|
73
|
+
}
|
74
|
+
darkmode: boolean
|
75
|
+
auto_dark: {
|
76
|
+
enable: boolean
|
77
|
+
start: number
|
78
|
+
end: number
|
79
|
+
}
|
80
|
+
auto_scroll: boolean
|
81
|
+
loader: {
|
82
|
+
start: boolean
|
83
|
+
switch: boolean
|
84
|
+
}
|
85
|
+
js: {
|
86
|
+
copy_tex: vendorUrl
|
87
|
+
}
|
88
|
+
css: {
|
89
|
+
katex: vendorUrl
|
90
|
+
mermaid: vendorUrl
|
91
|
+
}
|
92
|
+
search: any,
|
93
|
+
waline: {
|
94
|
+
serverURL: string
|
95
|
+
lang: string
|
96
|
+
locale: object
|
97
|
+
emoji: boolean
|
98
|
+
meta: walineMeta[]
|
99
|
+
requiredMeta: walineMeta[]
|
100
|
+
wordLimit: number
|
101
|
+
pageSize: number
|
102
|
+
pageview: boolean
|
103
|
+
recaptchaV3Key: string
|
104
|
+
turnstileKey: string
|
105
|
+
}
|
106
|
+
twikoo: {
|
107
|
+
envId: string
|
108
|
+
region: string
|
109
|
+
}
|
110
|
+
walinePageView: boolean
|
111
|
+
playerAPI: string
|
112
|
+
experiments: {
|
113
|
+
copyrightLength: number;
|
114
|
+
}
|
115
|
+
}
|
116
|
+
// esbuild 静态常量
|
117
|
+
declare const __shokax_player__:boolean
|
118
|
+
declare const __shokax_fireworks__:boolean
|
119
|
+
declare const __shokax_search__:boolean
|
120
|
+
declare const __shokax_VL__:boolean
|
121
|
+
declare const __shokax_outime__:boolean
|
122
|
+
declare const __shokax_tabs__: boolean
|
123
|
+
declare const __shokax_quiz__: boolean
|
124
|
+
declare const __shokax_waline__:boolean
|
125
|
+
declare const __shokax_twikoo__:boolean
|
126
|
+
declare const shokax_CONFIG:configType
|
127
|
+
declare const shokax_siteURL:string
|
128
|
+
declare const __shokax_antiFakeWebsite__:boolean
|
@@ -1,70 +1,70 @@
|
|
1
|
-
export const insertAfter = function (el: Element, element: HTMLElement): void {
|
2
|
-
const parent = el.parentNode
|
3
|
-
if (parent.lastChild === el) {
|
4
|
-
parent.appendChild(element)
|
5
|
-
} else {
|
6
|
-
parent.insertBefore(element, el.nextSibling)
|
7
|
-
}
|
8
|
-
}
|
9
|
-
|
10
|
-
/**
|
11
|
-
* 创建一个子节点并放置
|
12
|
-
*/
|
13
|
-
export const createChild = function (parent: Element, tag: string, obj: object, positon?: string): HTMLElement {
|
14
|
-
const child = document.createElement(tag)
|
15
|
-
Object.assign(child, obj)
|
16
|
-
switch (positon) {
|
17
|
-
case 'after':
|
18
|
-
insertAfter(parent, child)
|
19
|
-
break
|
20
|
-
case 'replace':
|
21
|
-
parent.innerHTML = ''
|
22
|
-
parent.appendChild(child)
|
23
|
-
break
|
24
|
-
default:
|
25
|
-
parent.appendChild(child)
|
26
|
-
}
|
27
|
-
return child
|
28
|
-
}
|
29
|
-
|
30
|
-
/**
|
31
|
-
* 此方法使用`<div>`包装一个 DOM 元素
|
32
|
-
* @param parent
|
33
|
-
* @param obj 需要被包装的对象
|
34
|
-
*/
|
35
|
-
export const wrapObject = function (parent: HTMLElement, obj: any): void {
|
36
|
-
const box = document.createElement('div')
|
37
|
-
Object.assign(box, obj)
|
38
|
-
parent.parentNode.insertBefore(box, parent)
|
39
|
-
parent.parentNode.removeChild(parent)
|
40
|
-
box.appendChild(parent)
|
41
|
-
}
|
42
|
-
|
43
|
-
export const getHeight = function (el: HTMLElement): number {
|
44
|
-
return el.getBoundingClientRect().height
|
45
|
-
}
|
46
|
-
|
47
|
-
export const setWidth = function (el: HTMLElement, w: number|string): void {
|
48
|
-
el.style.width = typeof w === 'number' ? w + 'rem' : w
|
49
|
-
}
|
50
|
-
|
51
|
-
export const getWidth = function (el: HTMLElement): number {
|
52
|
-
return el.getBoundingClientRect().width
|
53
|
-
}
|
54
|
-
|
55
|
-
export const getTop = function (el: HTMLElement): number {
|
56
|
-
return el.getBoundingClientRect().top
|
57
|
-
}
|
58
|
-
|
59
|
-
export const getLeft = function (el: HTMLElement): number {
|
60
|
-
return el.getBoundingClientRect().left
|
61
|
-
}
|
62
|
-
|
63
|
-
export const getDisplay = function (el: HTMLElement): string {
|
64
|
-
return el.style.display
|
65
|
-
}
|
66
|
-
|
67
|
-
export const setDisplay = function (el: HTMLElement, d: string): HTMLElement {
|
68
|
-
el.style.display = d
|
69
|
-
return el
|
70
|
-
}
|
1
|
+
export const insertAfter = function (el: Element, element: HTMLElement): void {
|
2
|
+
const parent = el.parentNode
|
3
|
+
if (parent.lastChild === el) {
|
4
|
+
parent.appendChild(element)
|
5
|
+
} else {
|
6
|
+
parent.insertBefore(element, el.nextSibling)
|
7
|
+
}
|
8
|
+
}
|
9
|
+
|
10
|
+
/**
|
11
|
+
* 创建一个子节点并放置
|
12
|
+
*/
|
13
|
+
export const createChild = function (parent: Element, tag: string, obj: object, positon?: string): HTMLElement {
|
14
|
+
const child = document.createElement(tag)
|
15
|
+
Object.assign(child, obj)
|
16
|
+
switch (positon) {
|
17
|
+
case 'after':
|
18
|
+
insertAfter(parent, child)
|
19
|
+
break
|
20
|
+
case 'replace':
|
21
|
+
parent.innerHTML = ''
|
22
|
+
parent.appendChild(child)
|
23
|
+
break
|
24
|
+
default:
|
25
|
+
parent.appendChild(child)
|
26
|
+
}
|
27
|
+
return child
|
28
|
+
}
|
29
|
+
|
30
|
+
/**
|
31
|
+
* 此方法使用`<div>`包装一个 DOM 元素
|
32
|
+
* @param parent
|
33
|
+
* @param obj 需要被包装的对象
|
34
|
+
*/
|
35
|
+
export const wrapObject = function (parent: HTMLElement, obj: any): void {
|
36
|
+
const box = document.createElement('div')
|
37
|
+
Object.assign(box, obj)
|
38
|
+
parent.parentNode.insertBefore(box, parent)
|
39
|
+
parent.parentNode.removeChild(parent)
|
40
|
+
box.appendChild(parent)
|
41
|
+
}
|
42
|
+
|
43
|
+
export const getHeight = function (el: HTMLElement): number {
|
44
|
+
return el.getBoundingClientRect().height
|
45
|
+
}
|
46
|
+
|
47
|
+
export const setWidth = function (el: HTMLElement, w: number|string): void {
|
48
|
+
el.style.width = typeof w === 'number' ? w + 'rem' : w
|
49
|
+
}
|
50
|
+
|
51
|
+
export const getWidth = function (el: HTMLElement): number {
|
52
|
+
return el.getBoundingClientRect().width
|
53
|
+
}
|
54
|
+
|
55
|
+
export const getTop = function (el: HTMLElement): number {
|
56
|
+
return el.getBoundingClientRect().top
|
57
|
+
}
|
58
|
+
|
59
|
+
export const getLeft = function (el: HTMLElement): number {
|
60
|
+
return el.getBoundingClientRect().left
|
61
|
+
}
|
62
|
+
|
63
|
+
export const getDisplay = function (el: HTMLElement): string {
|
64
|
+
return el.style.display
|
65
|
+
}
|
66
|
+
|
67
|
+
export const setDisplay = function (el: HTMLElement, d: string): HTMLElement {
|
68
|
+
el.style.display = d
|
69
|
+
return el
|
70
|
+
}
|
@@ -1,49 +1,49 @@
|
|
1
|
-
import { transition } from './anime'
|
2
|
-
import { BODY } from '../globals/globalVars'
|
3
|
-
import { changeTheme } from '../globals/themeColor'
|
4
|
-
import { createChild, setDisplay } from './proto'
|
5
|
-
|
6
|
-
export function initVue () {
|
7
|
-
function changeThemeByBtn () {
|
8
|
-
let c: { (): void; (): void; (): void }
|
9
|
-
const btn = document.querySelector('.theme').querySelector('.ic')
|
10
|
-
|
11
|
-
const neko = createChild(BODY, 'div', {
|
12
|
-
id: 'neko',
|
13
|
-
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>'
|
14
|
-
})
|
15
|
-
|
16
|
-
const hideNeko = () => {
|
17
|
-
transition(neko, {
|
18
|
-
// @ts-ignore
|
19
|
-
delay: 2500,
|
20
|
-
opacity: 0
|
21
|
-
}, () => {
|
22
|
-
BODY.removeChild(neko)
|
23
|
-
})
|
24
|
-
}
|
25
|
-
|
26
|
-
if (btn.classList.contains('i-sun')) {
|
27
|
-
c = () => {
|
28
|
-
neko.classList.add('dark')
|
29
|
-
changeTheme('dark')
|
30
|
-
localStorage.setItem('theme', 'dark')
|
31
|
-
hideNeko()
|
32
|
-
}
|
33
|
-
} else {
|
34
|
-
neko.classList.add('dark')
|
35
|
-
c = () => {
|
36
|
-
neko.classList.remove('dark')
|
37
|
-
changeTheme()
|
38
|
-
localStorage.setItem('theme', 'light')
|
39
|
-
hideNeko()
|
40
|
-
}
|
41
|
-
}
|
42
|
-
transition(neko, 1, () => {
|
43
|
-
setTimeout(c, 210)
|
44
|
-
}, () => {
|
45
|
-
setDisplay(neko, 'block')
|
46
|
-
})
|
47
|
-
}
|
48
|
-
document.getElementById('rightNav').querySelector('.theme .ic').addEventListener('click', changeThemeByBtn)
|
49
|
-
}
|
1
|
+
import { transition } from './anime'
|
2
|
+
import { BODY } from '../globals/globalVars'
|
3
|
+
import { changeTheme } from '../globals/themeColor'
|
4
|
+
import { createChild, setDisplay } from './proto'
|
5
|
+
|
6
|
+
export function initVue () {
|
7
|
+
function changeThemeByBtn () {
|
8
|
+
let c: { (): void; (): void; (): void }
|
9
|
+
const btn = document.querySelector('.theme').querySelector('.ic')
|
10
|
+
|
11
|
+
const neko = createChild(BODY, 'div', {
|
12
|
+
id: 'neko',
|
13
|
+
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>'
|
14
|
+
})
|
15
|
+
|
16
|
+
const hideNeko = () => {
|
17
|
+
transition(neko, {
|
18
|
+
// @ts-ignore
|
19
|
+
delay: 2500,
|
20
|
+
opacity: 0
|
21
|
+
}, () => {
|
22
|
+
BODY.removeChild(neko)
|
23
|
+
})
|
24
|
+
}
|
25
|
+
|
26
|
+
if (btn.classList.contains('i-sun')) {
|
27
|
+
c = () => {
|
28
|
+
neko.classList.add('dark')
|
29
|
+
changeTheme('dark')
|
30
|
+
localStorage.setItem('theme', 'dark')
|
31
|
+
hideNeko()
|
32
|
+
}
|
33
|
+
} else {
|
34
|
+
neko.classList.add('dark')
|
35
|
+
c = () => {
|
36
|
+
neko.classList.remove('dark')
|
37
|
+
changeTheme()
|
38
|
+
localStorage.setItem('theme', 'light')
|
39
|
+
hideNeko()
|
40
|
+
}
|
41
|
+
}
|
42
|
+
transition(neko, 1, () => {
|
43
|
+
setTimeout(c, 210)
|
44
|
+
}, () => {
|
45
|
+
setDisplay(neko, 'block')
|
46
|
+
})
|
47
|
+
}
|
48
|
+
document.getElementById('rightNav').querySelector('.theme .ic').addEventListener('click', changeThemeByBtn)
|
49
|
+
}
|
@@ -1,41 +1,41 @@
|
|
1
|
-
export const cardActive = () => {
|
2
|
-
if (!document.querySelector('.index.wrap')) { return }
|
3
|
-
const io = new IntersectionObserver((entries) => {
|
4
|
-
entries.forEach((article) => {
|
5
|
-
if (article.target.classList.contains('show')) {
|
6
|
-
io.unobserve(article.target)
|
7
|
-
} else {
|
8
|
-
if (article.isIntersecting || article.intersectionRatio > 0) {
|
9
|
-
article.target.classList.add('show')
|
10
|
-
io.unobserve(article.target)
|
11
|
-
}
|
12
|
-
}
|
13
|
-
})
|
14
|
-
}, {
|
15
|
-
root: null,
|
16
|
-
threshold: [0.3]
|
17
|
-
})
|
18
|
-
|
19
|
-
document.querySelectorAll('.index.wrap article.item, .index.wrap section.item').forEach((article) => {
|
20
|
-
io.observe(article)
|
21
|
-
})
|
22
|
-
|
23
|
-
document.querySelector('.index.wrap .item:first-child').classList.add('show')
|
24
|
-
|
25
|
-
document.querySelectorAll('.cards .item').forEach((element) => {
|
26
|
-
['mouseenter', 'touchstart'].forEach((item) => {
|
27
|
-
element.addEventListener(item, () => {
|
28
|
-
const cardEle = document.querySelector('.cards .item.active')
|
29
|
-
if (cardEle) {
|
30
|
-
cardEle.classList.remove('active')
|
31
|
-
}
|
32
|
-
element.classList.add('active')
|
33
|
-
}, { passive: true })
|
34
|
-
});
|
35
|
-
['mouseleave'].forEach((item) => {
|
36
|
-
element.addEventListener(item, () => {
|
37
|
-
element.classList.remove('active')
|
38
|
-
}, { passive: true })
|
39
|
-
})
|
40
|
-
})
|
41
|
-
}
|
1
|
+
export const cardActive = () => {
|
2
|
+
if (!document.querySelector('.index.wrap')) { return }
|
3
|
+
const io = new IntersectionObserver((entries) => {
|
4
|
+
entries.forEach((article) => {
|
5
|
+
if (article.target.classList.contains('show')) {
|
6
|
+
io.unobserve(article.target)
|
7
|
+
} else {
|
8
|
+
if (article.isIntersecting || article.intersectionRatio > 0) {
|
9
|
+
article.target.classList.add('show')
|
10
|
+
io.unobserve(article.target)
|
11
|
+
}
|
12
|
+
}
|
13
|
+
})
|
14
|
+
}, {
|
15
|
+
root: null,
|
16
|
+
threshold: [0.3]
|
17
|
+
})
|
18
|
+
|
19
|
+
document.querySelectorAll('.index.wrap article.item, .index.wrap section.item').forEach((article) => {
|
20
|
+
io.observe(article)
|
21
|
+
})
|
22
|
+
|
23
|
+
document.querySelector('.index.wrap .item:first-child').classList.add('show')
|
24
|
+
|
25
|
+
document.querySelectorAll('.cards .item').forEach((element) => {
|
26
|
+
['mouseenter', 'touchstart'].forEach((item) => {
|
27
|
+
element.addEventListener(item, () => {
|
28
|
+
const cardEle = document.querySelector('.cards .item.active')
|
29
|
+
if (cardEle) {
|
30
|
+
cardEle.classList.remove('active')
|
31
|
+
}
|
32
|
+
element.classList.add('active')
|
33
|
+
}, { passive: true })
|
34
|
+
});
|
35
|
+
['mouseleave'].forEach((item) => {
|
36
|
+
element.addEventListener(item, () => {
|
37
|
+
element.classList.remove('active')
|
38
|
+
}, { passive: true })
|
39
|
+
})
|
40
|
+
})
|
41
|
+
}
|
@@ -1,15 +1,15 @@
|
|
1
|
-
import { HanaImgViewer } from 'hana-img-viewer'
|
2
|
-
import { createApp } from 'vue';
|
3
|
-
|
4
|
-
export const postImageViewer = (p: string) => {
|
5
|
-
document.querySelectorAll(`${p} .md img:not(.emoji):not(.vemoji)`).forEach((element) => {
|
6
|
-
const img = element as HTMLImageElement;
|
7
|
-
const imgSrc = img.src
|
8
|
-
|
9
|
-
const wrapper = document.createElement('div');
|
10
|
-
img.replaceWith(wrapper);
|
11
|
-
|
12
|
-
const app = createApp(HanaImgViewer, { src: imgSrc, maskOpacity: 0.8 });
|
13
|
-
app.mount(wrapper);
|
14
|
-
});
|
15
|
-
};
|
1
|
+
import { HanaImgViewer } from 'hana-img-viewer'
|
2
|
+
import { createApp } from 'vue';
|
3
|
+
|
4
|
+
export const postImageViewer = (p: string) => {
|
5
|
+
document.querySelectorAll(`${p} .md img:not(.emoji):not(.vemoji)`).forEach((element) => {
|
6
|
+
const img = element as HTMLImageElement;
|
7
|
+
const imgSrc = img.src
|
8
|
+
|
9
|
+
const wrapper = document.createElement('div');
|
10
|
+
img.replaceWith(wrapper);
|
11
|
+
|
12
|
+
const app = createApp(HanaImgViewer, { src: imgSrc, maskOpacity: 0.8 });
|
13
|
+
app.mount(wrapper);
|
14
|
+
});
|
15
|
+
};
|