hexo-theme-shokax 0.5.0-dev-f787465 → 0.5.0-dev-36bb58f
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/README.md +2 -2
- package/UsageRestrictions.md +1 -1
- package/_config.yml +14 -15
- package/languages/en.yml +2 -0
- package/languages/ja.yml +2 -0
- package/languages/zh-CN.yml +2 -0
- package/languages/zh-HK.yml +2 -0
- package/languages/zh-TW.yml +2 -0
- package/layout/_partials/layout.pug +10 -5
- package/layout/_partials/post/footer.pug +8 -5
- package/package.json +31 -21
- package/scripts/generaters/config.js +12 -7
- package/scripts/generaters/images.js +9 -8
- package/scripts/generaters/script.js +21 -33
- package/scripts/generaters/summary_ai.js +130 -0
- package/scripts/helpers/summary_ai.js +1 -108
- package/scripts/plugin/index.js +32 -69
- package/source/css/_common/outline/sidebar/quick.styl +1 -1
- package/source/css/_common/outline/sidebar/sidebar.styl +2 -0
- package/source/js/_app/components/comments.ts +0 -2
- package/source/js/_app/components/sidebar.ts +37 -36
- package/source/js/_app/globals/globalVars.ts +0 -3
- package/source/js/_app/globals/handles.ts +9 -9
- package/source/js/_app/globals/themeColor.ts +5 -6
- package/source/js/_app/globals/thirdparty.ts +2 -2
- package/source/js/_app/globals/tools.ts +4 -6
- package/source/js/_app/library/anime.ts +30 -19
- package/source/js/_app/library/declare.d.ts +1 -0
- package/source/js/_app/library/proto.ts +0 -67
- package/source/js/_app/library/vue.ts +6 -7
- package/source/js/_app/page/common.ts +8 -10
- package/source/js/_app/page/fancybox.ts +13 -13
- package/source/js/_app/page/post.ts +42 -44
- package/source/js/_app/page/search.ts +0 -1
- package/source/js/_app/page/tab.ts +8 -9
- package/source/js/_app/pjax/domInit.ts +2 -5
- package/source/js/_app/pjax/refresh.ts +9 -0
- package/source/js/_app/pjax/siteInit.ts +18 -14
- package/source/js/_app/player.ts +26 -27
- package/toolbox/compiler.mjs +20 -48
- package/scripts/plugin/lib/injects-point.js +0 -41
- package/scripts/plugin/lib/injects.js +0 -105
- package/source/js/_app/library/dom.ts +0 -28
- package/source/js/_app/library/storage.ts +0 -12
package/source/js/_app/player.ts
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
import { CONFIG, originTitle } from './globals/globalVars'
|
4
4
|
import { showtip } from './globals/tools'
|
5
5
|
import { pageScroll } from './library/anime'
|
6
|
-
import { $storage } from './library/storage'
|
7
6
|
import { tabFormat } from './page/tab'
|
8
7
|
import { createChild, getLeft, getWidth, setDisplay, setWidth } from './library/proto'
|
9
8
|
|
@@ -85,7 +84,7 @@ export const mediaPlayer = (t, config?) => {
|
|
85
84
|
}
|
86
85
|
|
87
86
|
controller.btns.mode.className = 'mode ' + t.player.options.mode + ' btn'
|
88
|
-
|
87
|
+
localStorage.setItem('_PlayerMode', t.player.options.mode)
|
89
88
|
},
|
90
89
|
volume (e) {
|
91
90
|
e.preventDefault()
|
@@ -148,7 +147,7 @@ export const mediaPlayer = (t, config?) => {
|
|
148
147
|
|
149
148
|
if (current) {
|
150
149
|
if (progress.el) {
|
151
|
-
progress.el.parentNode.
|
150
|
+
progress.el.parentNode.classList.remove('current')
|
152
151
|
.removeEventListener(utils.nameMap.dragStart, progress.drag)
|
153
152
|
progress.el.remove()
|
154
153
|
}
|
@@ -163,7 +162,7 @@ export const mediaPlayer = (t, config?) => {
|
|
163
162
|
className: 'bar'
|
164
163
|
})
|
165
164
|
|
166
|
-
current.
|
165
|
+
current.classList.add('current')
|
167
166
|
|
168
167
|
current.addEventListener(utils.nameMap.dragStart, progress.drag)
|
169
168
|
|
@@ -175,7 +174,7 @@ export const mediaPlayer = (t, config?) => {
|
|
175
174
|
(progress.el as HTMLElement).setAttribute('data-ptime', utils.secondToTime(percent * source.duration))
|
176
175
|
},
|
177
176
|
seeking (type) {
|
178
|
-
if (type) { progress.el.
|
177
|
+
if (type) { progress.el.classList.add('seeking') } else { progress.el.classList.remove('seeking') }
|
179
178
|
},
|
180
179
|
percent (e, el) {
|
181
180
|
let percentage = ((e.clientX || e.changedTouches[0].clientX) - getLeft(el)) / getWidth(el)
|
@@ -301,13 +300,13 @@ export const mediaPlayer = (t, config?) => {
|
|
301
300
|
scroll () {
|
302
301
|
const item = this.current()
|
303
302
|
let li = this.el.querySelector('li.active')
|
304
|
-
li && li.
|
303
|
+
li && li.classList.remove('active')
|
305
304
|
let tab = this.el.querySelector('.tab.active')
|
306
|
-
tab && tab.
|
305
|
+
tab && tab.classList.remove('active')
|
307
306
|
li = this.el.querySelectorAll('.nav li')[item.group]
|
308
|
-
li && li.
|
307
|
+
li && li.classList.add('active')
|
309
308
|
tab = this.el.querySelectorAll('.tab')[item.group]
|
310
|
-
tab && tab.
|
309
|
+
tab && tab.classList.add('active')
|
311
310
|
|
312
311
|
pageScroll(item.el, item.el.offsetTop)
|
313
312
|
|
@@ -321,7 +320,7 @@ export const mediaPlayer = (t, config?) => {
|
|
321
320
|
},
|
322
321
|
error () {
|
323
322
|
const current = this.current()
|
324
|
-
current.el.
|
323
|
+
current.el.classList.remove('current').classList.add('error')
|
325
324
|
current.error = true
|
326
325
|
this.errnum++
|
327
326
|
}
|
@@ -342,9 +341,9 @@ export const mediaPlayer = (t, config?) => {
|
|
342
341
|
},
|
343
342
|
hide () {
|
344
343
|
const el = this.el
|
345
|
-
el.
|
344
|
+
el.classList.add('hide')
|
346
345
|
window.setTimeout(() => {
|
347
|
-
el.
|
346
|
+
el.classList.remove('show hide')
|
348
347
|
}, 300)
|
349
348
|
}
|
350
349
|
}
|
@@ -362,10 +361,10 @@ export const mediaPlayer = (t, config?) => {
|
|
362
361
|
}
|
363
362
|
},
|
364
363
|
music (event) {
|
365
|
-
if (info.el.
|
364
|
+
if (info.el.classList.contains('show')) {
|
366
365
|
info.hide()
|
367
366
|
} else {
|
368
|
-
info.el.
|
367
|
+
info.el.classList.add('show')
|
369
368
|
playlist.scroll().title()
|
370
369
|
}
|
371
370
|
}
|
@@ -409,7 +408,7 @@ export const mediaPlayer = (t, config?) => {
|
|
409
408
|
const meta = utils.parse(raw)
|
410
409
|
if (meta[0]) {
|
411
410
|
const skey = JSON.stringify(meta)
|
412
|
-
const playlist =
|
411
|
+
const playlist = localStorage.getItem(skey)
|
413
412
|
if (playlist) {
|
414
413
|
// list.push.apply(list, JSON.parse(playlist))
|
415
414
|
list.push(...JSON.parse(playlist))
|
@@ -419,7 +418,7 @@ export const mediaPlayer = (t, config?) => {
|
|
419
418
|
.then((response) => {
|
420
419
|
return response.json()
|
421
420
|
}).then((json) => {
|
422
|
-
|
421
|
+
localStorage.setItem(skey, JSON.stringify(json))
|
423
422
|
// list.push.apply(list, json)
|
424
423
|
list.push(...json)
|
425
424
|
resolve(list)
|
@@ -583,8 +582,8 @@ export const mediaPlayer = (t, config?) => {
|
|
583
582
|
|
584
583
|
source.setAttribute('src', item.url)
|
585
584
|
source.setAttribute('title', item.name + ' - ' + item.artist)
|
586
|
-
this.volume(
|
587
|
-
this.muted(
|
585
|
+
this.volume(localStorage.getItem('_PlayerVolume') || '0.7')
|
586
|
+
this.muted(localStorage.getItem('_PlayerMuted'))
|
588
587
|
|
589
588
|
progress.create()
|
590
589
|
|
@@ -625,10 +624,10 @@ export const mediaPlayer = (t, config?) => {
|
|
625
624
|
muted (status?) {
|
626
625
|
if (status === 'muted') {
|
627
626
|
source.muted = status
|
628
|
-
|
627
|
+
localStorage.setItem('_PlayerMuted', status)
|
629
628
|
controller.update(0)
|
630
629
|
} else {
|
631
|
-
|
630
|
+
localStorage.removeItem('_PlayerMuted')
|
632
631
|
source.muted = false
|
633
632
|
controller.update(source.volume)
|
634
633
|
}
|
@@ -636,7 +635,7 @@ export const mediaPlayer = (t, config?) => {
|
|
636
635
|
volume (percentage) {
|
637
636
|
if (!isNaN(percentage)) {
|
638
637
|
controller.update(percentage)
|
639
|
-
|
638
|
+
localStorage.setItem('_PlayerVolume', percentage)
|
640
639
|
source.volume = percentage
|
641
640
|
}
|
642
641
|
},
|
@@ -684,8 +683,8 @@ export const mediaPlayer = (t, config?) => {
|
|
684
683
|
const y = -(this.index - 1)
|
685
684
|
this.el.style.transform = 'translateY(' + y + 'rem)'
|
686
685
|
// this.el.style.webkitTransform = 'translateY(' + y + 'rem)';
|
687
|
-
this.el.getElementsByClassName('current')[0].
|
688
|
-
this.el.getElementsByTagName('p')[i].
|
686
|
+
this.el.getElementsByClassName('current')[0].classList.remove('current')
|
687
|
+
this.el.getElementsByTagName('p')[i].classList.add('current')
|
689
688
|
}
|
690
689
|
}
|
691
690
|
}
|
@@ -755,12 +754,12 @@ export const mediaPlayer = (t, config?) => {
|
|
755
754
|
progress.el.setAttribute('data-dtime', utils.secondToTime(source.duration))
|
756
755
|
},
|
757
756
|
onplay () {
|
758
|
-
t.parentNode.
|
757
|
+
t.parentNode.classList.add('playing')
|
759
758
|
showtip(this.getAttribute('title'))
|
760
759
|
NOWPLAYING = t
|
761
760
|
},
|
762
761
|
onpause () {
|
763
|
-
t.parentNode.
|
762
|
+
t.parentNode.classList.remove('playing')
|
764
763
|
NOWPLAYING = null
|
765
764
|
},
|
766
765
|
ontimeupdate () {
|
@@ -779,7 +778,7 @@ export const mediaPlayer = (t, config?) => {
|
|
779
778
|
if (t.player.created) { return }
|
780
779
|
|
781
780
|
t.player.options = Object.assign(option, config)
|
782
|
-
t.player.options.mode =
|
781
|
+
t.player.options.mode = localStorage.getItem('_PlayerMode') || t.player.options.mode
|
783
782
|
|
784
783
|
// 初始化button、controls以及click事件
|
785
784
|
buttons.create()
|
@@ -789,7 +788,7 @@ export const mediaPlayer = (t, config?) => {
|
|
789
788
|
// 初始化播放列表、预览、控件按钮等
|
790
789
|
info.create()
|
791
790
|
|
792
|
-
t.parentNode.
|
791
|
+
t.parentNode.classList.add(t.player.options.type)
|
793
792
|
|
794
793
|
t.player.created = true
|
795
794
|
}
|
package/toolbox/compiler.mjs
CHANGED
@@ -1,15 +1,13 @@
|
|
1
1
|
/*
|
2
2
|
ShokaX ToolBox - Compiler
|
3
|
-
compatibility: ShokaX v0.
|
3
|
+
compatibility: ShokaX v0.5.x-dev
|
4
4
|
*/
|
5
|
-
import path from "node:path";
|
6
5
|
import fs from 'fs/promises'
|
7
|
-
import child_process from 'child_process'
|
8
6
|
import { buildSync } from 'esbuild'
|
9
7
|
import { glob } from 'glob'
|
10
8
|
|
11
9
|
const CONFIG = {
|
12
|
-
|
10
|
+
|
13
11
|
}
|
14
12
|
|
15
13
|
console.log('ShokaX ToolBox - Compiler')
|
@@ -18,50 +16,24 @@ console.log('Start compiling...')
|
|
18
16
|
const entryPoints = await glob('./scripts/**/*.ts');
|
19
17
|
const jsons = await glob('./scripts/**/*.json');
|
20
18
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
for (const entry of jsons) {
|
40
|
-
await fs.unlink(entry)
|
41
|
-
}
|
42
|
-
console.log('Finished compiling.')
|
43
|
-
})
|
44
|
-
})
|
45
|
-
} else {
|
46
|
-
console.log('RUN THIS SCRIPT IN YOUR SHOKAX THEME ROOT DIRECTORY!')
|
47
|
-
console.log('Using esbuild compiler...')
|
48
|
-
buildSync({
|
49
|
-
entryPoints: entryPoints,
|
50
|
-
outdir: 'scripts',
|
51
|
-
bundle: false,
|
52
|
-
format: 'cjs',
|
53
|
-
target: ['esnext'],
|
54
|
-
platform: 'node',
|
55
|
-
loader: { '.ts': 'ts' },
|
56
|
-
})
|
57
|
-
entryPoints.forEach(async (entry) => {
|
58
|
-
await fs.unlink(entry)
|
59
|
-
})
|
60
|
-
jsons.forEach(async (entry)=>{
|
61
|
-
await fs.unlink(entry)
|
62
|
-
})
|
63
|
-
console.log('Finished compiling.')
|
64
|
-
}
|
19
|
+
console.log('RUN THIS SCRIPT IN YOUR SHOKAX THEME ROOT DIRECTORY!')
|
20
|
+
console.log('Using esbuild compiler...')
|
21
|
+
buildSync({
|
22
|
+
entryPoints: entryPoints,
|
23
|
+
outdir: 'scripts',
|
24
|
+
bundle: false,
|
25
|
+
format: 'cjs',
|
26
|
+
target: ['esnext'],
|
27
|
+
platform: 'node',
|
28
|
+
loader: { '.ts': 'ts' },
|
29
|
+
})
|
30
|
+
entryPoints.forEach(async (entry) => {
|
31
|
+
await fs.unlink(entry)
|
32
|
+
})
|
33
|
+
jsons.forEach(async (entry)=>{
|
34
|
+
await fs.unlink(entry)
|
35
|
+
})
|
36
|
+
console.log('Finished compiling.')
|
65
37
|
|
66
38
|
console.log('Done.')
|
67
39
|
|
@@ -1,41 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __defProp = Object.defineProperty;
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
-
var __export = (target, all) => {
|
7
|
-
for (var name in all)
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
-
};
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
-
for (let key of __getOwnPropNames(from))
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
-
}
|
16
|
-
return to;
|
17
|
-
};
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
-
var injects_point_exports = {};
|
20
|
-
__export(injects_point_exports, {
|
21
|
-
default: () => injects_point_default
|
22
|
-
});
|
23
|
-
module.exports = __toCommonJS(injects_point_exports);
|
24
|
-
var injects_point_default = {
|
25
|
-
views: [
|
26
|
-
"head",
|
27
|
-
"sidebar",
|
28
|
-
"rightNav",
|
29
|
-
"postMeta",
|
30
|
-
"postBodyEnd",
|
31
|
-
"footer",
|
32
|
-
"bodyEnd",
|
33
|
-
"comment",
|
34
|
-
"status"
|
35
|
-
],
|
36
|
-
styles: [
|
37
|
-
"variable",
|
38
|
-
"mixin",
|
39
|
-
"style"
|
40
|
-
]
|
41
|
-
};
|
@@ -1,105 +0,0 @@
|
|
1
|
-
var __create = Object.create;
|
2
|
-
var __defProp = Object.defineProperty;
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
7
|
-
var __export = (target, all) => {
|
8
|
-
for (var name in all)
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
10
|
-
};
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
13
|
-
for (let key of __getOwnPropNames(from))
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
16
|
-
}
|
17
|
-
return to;
|
18
|
-
};
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
25
|
-
mod
|
26
|
-
));
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
28
|
-
var injects_exports = {};
|
29
|
-
__export(injects_exports, {
|
30
|
-
default: () => injects_default
|
31
|
-
});
|
32
|
-
module.exports = __toCommonJS(injects_exports);
|
33
|
-
var import_node_fs = __toESM(require("node:fs"));
|
34
|
-
var import_node_path = __toESM(require("node:path"));
|
35
|
-
var import_injects_point = __toESM(require("./injects-point"));
|
36
|
-
/*!
|
37
|
-
inject.js in next-theme/hexo-theme-next by next-theme
|
38
|
-
under GNU AFFERO GENERAL PUBLIC LICENSE v3.0 OR LATER
|
39
|
-
https://github.com/next-theme/hexo-theme-next/blob/master/LICENSE.md
|
40
|
-
*/
|
41
|
-
const defaultExtname = ".pug";
|
42
|
-
class StylusInject {
|
43
|
-
files;
|
44
|
-
base_dir;
|
45
|
-
constructor(base_dir) {
|
46
|
-
this.base_dir = base_dir;
|
47
|
-
this.files = [];
|
48
|
-
}
|
49
|
-
push(file) {
|
50
|
-
this.files.push(import_node_path.default.resolve(this.base_dir, file));
|
51
|
-
}
|
52
|
-
}
|
53
|
-
class ViewInject {
|
54
|
-
base_dir;
|
55
|
-
raws;
|
56
|
-
constructor(base_dir) {
|
57
|
-
this.base_dir = base_dir;
|
58
|
-
this.raws = [];
|
59
|
-
}
|
60
|
-
raw(name, raw, ...args) {
|
61
|
-
if (import_node_path.default.extname(name) === "") {
|
62
|
-
name += defaultExtname;
|
63
|
-
}
|
64
|
-
this.raws.push({ name, raw, args });
|
65
|
-
}
|
66
|
-
file(name, file, ...args) {
|
67
|
-
if (import_node_path.default.extname(name) === "") {
|
68
|
-
name += import_node_path.default.extname(file);
|
69
|
-
}
|
70
|
-
this.raw(name, import_node_fs.default.readFileSync(import_node_path.default.resolve(this.base_dir, file), "utf8"), ...args);
|
71
|
-
}
|
72
|
-
}
|
73
|
-
function initInject(base_dir) {
|
74
|
-
const injects = {};
|
75
|
-
import_injects_point.default.styles.forEach((item) => {
|
76
|
-
injects[item] = new StylusInject(base_dir);
|
77
|
-
});
|
78
|
-
import_injects_point.default.views.forEach((item) => {
|
79
|
-
injects[item] = new ViewInject(base_dir);
|
80
|
-
});
|
81
|
-
return injects;
|
82
|
-
}
|
83
|
-
var injects_default = (hexo) => {
|
84
|
-
const injects = initInject(hexo.base_dir);
|
85
|
-
hexo.execFilterSync("theme_inject", injects);
|
86
|
-
hexo.theme.config.injects = {};
|
87
|
-
import_injects_point.default.styles.forEach((type) => {
|
88
|
-
hexo.theme.config.injects[type] = injects[type].files;
|
89
|
-
});
|
90
|
-
import_injects_point.default.views.forEach((type) => {
|
91
|
-
const configs = /* @__PURE__ */ Object.create(null);
|
92
|
-
hexo.theme.config.injects[type] = [];
|
93
|
-
injects[type].raws.forEach((injectObj, index) => {
|
94
|
-
const name = `inject/${type}/${injectObj.name}`;
|
95
|
-
hexo.theme.setView(name, injectObj.raw);
|
96
|
-
configs[name] = {
|
97
|
-
layout: name,
|
98
|
-
locals: injectObj.args[0],
|
99
|
-
options: injectObj.args[1],
|
100
|
-
order: injectObj.args[2] || index
|
101
|
-
};
|
102
|
-
});
|
103
|
-
hexo.theme.config.injects[type] = Object.values(configs).sort((x, y) => x.order - y.order);
|
104
|
-
});
|
105
|
-
};
|
@@ -1,28 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* 获取一个dom选择器对应的元素
|
3
|
-
* @deprecated Will be removed in the v0.5
|
4
|
-
*/
|
5
|
-
const $dom = (selector: string, element: Document = document): HTMLElement => {
|
6
|
-
// 在测试环境中这能优化0.01-0.02ms左右
|
7
|
-
if (selector[0] === '#') {
|
8
|
-
return <HTMLElement> element.getElementById(selector.substring(1))
|
9
|
-
}
|
10
|
-
return <HTMLElement> element.querySelector(selector)
|
11
|
-
}
|
12
|
-
|
13
|
-
/**
|
14
|
-
* 获取具有此选择器的所有dom节点
|
15
|
-
* @deprecated Will be removed in the v0.5
|
16
|
-
*/
|
17
|
-
$dom.all = (selector: string, element: Document = document): NodeListOf<HTMLElement> => {
|
18
|
-
return element.querySelectorAll(selector)
|
19
|
-
}
|
20
|
-
/**
|
21
|
-
* 获取具有此选择器的所有dom节点,并依次执行callback函数
|
22
|
-
* @deprecated Will be removed in the v0.5
|
23
|
-
*/
|
24
|
-
$dom.each = (selector: string, callback: (value: HTMLElement, key: number, parent: NodeListOf<Element>) => void, element?: Document): void => {
|
25
|
-
$dom.all(selector, element).forEach(callback)
|
26
|
-
}
|
27
|
-
|
28
|
-
export { $dom }
|
@@ -1,12 +0,0 @@
|
|
1
|
-
// Html5LocalStorage的一个API
|
2
|
-
export const $storage = {
|
3
|
-
set (key: string, value: string): void {
|
4
|
-
localStorage.setItem(key, value)
|
5
|
-
},
|
6
|
-
get (key: string): string {
|
7
|
-
return localStorage.getItem(key)
|
8
|
-
},
|
9
|
-
del (key: string): void {
|
10
|
-
localStorage.removeItem(key)
|
11
|
-
}
|
12
|
-
}
|