hexo-theme-shokax 0.5.0-dev-815e373 → 0.5.0-dev-58aa58e
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -0
- package/_images.yml +0 -7
- package/package.json +1 -1
- package/source/js/_app/components/comments.ts +0 -1
- package/source/js/_app/components/tcomments.ts +0 -1
- package/source/js/_app/globals/globalVars.ts +0 -7
- package/source/js/_app/library/loadFile.ts +1 -4
- package/source/js/_app/page/post.ts +9 -9
- package/source/js/_app/page/search.ts +2 -6
- package/source/js/_app/pjax/domInit.ts +7 -7
- package/source/js/_app/pjax/refresh.ts +0 -5
- package/source/js/_app/pjax/siteInit.ts +9 -22
- package/source/js/_app/player.ts +2 -0
- package/source/js/_app/library/scriptPjax.ts +0 -56
package/README.md
CHANGED
package/_images.yml
CHANGED
@@ -1,9 +1,2 @@
|
|
1
1
|
# 此images已失效,见https://github.com/theme-shoka-x/hexo-theme-shokaX/issues/6
|
2
|
-
- 6833939bly1giciryrr3rj20zk0m8nhk.jpg
|
3
|
-
- 6833939bly1gicis081o9j20zk0m8dmr.jpg
|
4
|
-
- 6833939bly1gicis3attqj20zk0m8k7l.jpg
|
5
|
-
- 6833939bly1giciszlczyj20zk0m816d.jpg
|
6
|
-
- 6833939bly1gicit31ffoj20zk0m8naf.jpg
|
7
|
-
- 6833939bly1gicit4jrvuj20zk0m8785.jpg
|
8
|
-
- 6833939bly1gicitcxhpij20zk0m8hdt.jpg
|
9
2
|
|
package/package.json
CHANGED
@@ -74,7 +74,6 @@ export const walineRecentComments = async function () {
|
|
74
74
|
commentTime.className = 'breadcrumb'
|
75
75
|
commentTime.innerText = `${item.nick} @ ${item.time}`
|
76
76
|
commentLink.href = root + item.href
|
77
|
-
commentLink['data-pjax-state'] = 'data-pjax-state'
|
78
77
|
commentEl.className = 'item'
|
79
78
|
|
80
79
|
commentText.appendChild(document.createElement('br'))
|
@@ -40,7 +40,6 @@ export const twikooRecentComments = async function () {
|
|
40
40
|
commentTime.className = 'breadcrumb'
|
41
41
|
commentTime.innerText = `${item.nick} @ ${item.time}`
|
42
42
|
commentLink.href = root + item.href
|
43
|
-
commentLink['data-pjax-state'] = 'data-pjax-state'
|
44
43
|
commentEl.className = 'item'
|
45
44
|
|
46
45
|
commentText.appendChild(document.createElement('br'))
|
@@ -1,5 +1,3 @@
|
|
1
|
-
import { $dom } from '../library/dom'
|
2
|
-
import Pjax from 'theme-shokax-pjax'
|
3
1
|
import initProto from '../library/proto'
|
4
2
|
|
5
3
|
export const CONFIG = shokax_CONFIG
|
@@ -29,7 +27,6 @@ export let oWinHeight = window.innerHeight
|
|
29
27
|
export let oWinWidth = window.innerWidth
|
30
28
|
export let LOCAL_HASH = 0
|
31
29
|
export let LOCAL_URL = window.location.href
|
32
|
-
export let pjax:Pjax
|
33
30
|
|
34
31
|
export function setSiteNavHeight (value:number):void {
|
35
32
|
siteNavHeight = value
|
@@ -66,10 +63,6 @@ export function setLocalUrl (value:string):void {
|
|
66
63
|
LOCAL_URL = value
|
67
64
|
}
|
68
65
|
|
69
|
-
export function setPjax (value:Pjax):void {
|
70
|
-
pjax = value
|
71
|
-
}
|
72
|
-
|
73
66
|
export function setOriginTitle (value:string):void {
|
74
67
|
originTitle = value
|
75
68
|
}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import { getScript } from './scriptPjax'
|
2
1
|
import { CONFIG } from '../globals/globalVars'
|
3
2
|
import { createChild } from './proto'
|
4
3
|
|
@@ -19,9 +18,7 @@ const assetUrl = (asset: string, type: string): string => {
|
|
19
18
|
|
20
19
|
export const vendorJs = (type: string, callback?: Function, condition?: string) => {
|
21
20
|
if (LOCAL[type]) {
|
22
|
-
|
23
|
-
window[type] = true
|
24
|
-
}, condition || window[type])
|
21
|
+
assetUrl('js', type)
|
25
22
|
}
|
26
23
|
}
|
27
24
|
|
@@ -231,15 +231,15 @@ export const postBeauty = () => {
|
|
231
231
|
element.className = ['primary', 'success', 'info', 'warning', 'danger'][Math.floor(Math.random() * 5)]
|
232
232
|
})
|
233
233
|
|
234
|
-
if (__shokax_player__) {
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
}
|
234
|
+
// if (__shokax_player__) {
|
235
|
+
// $dom.each('.md div.player', (element) => {
|
236
|
+
// mediaPlayer(element, {
|
237
|
+
// type: element.getAttribute('data-type'),
|
238
|
+
// mode: 'order',
|
239
|
+
// btns: []
|
240
|
+
// }).player.load(JSON.parse(element.getAttribute('data-src'))).fetch()
|
241
|
+
// })
|
242
|
+
// }
|
243
243
|
|
244
244
|
const angleDown = document.querySelectorAll('.show-btn .i-angle-down')
|
245
245
|
if (angleDown.length) {
|
@@ -5,7 +5,7 @@ import type { HitHighlightResult } from 'instantsearch.js/es/types/results'
|
|
5
5
|
import instantsearch from 'instantsearch.js'
|
6
6
|
import { liteClient as algoliasearch } from 'algoliasearch/lite'
|
7
7
|
|
8
|
-
export function algoliaSearch (
|
8
|
+
export function algoliaSearch () {
|
9
9
|
const search = instantsearch({
|
10
10
|
indexName: CONFIG.search.indexName,
|
11
11
|
searchClient: algoliasearch(CONFIG.search.appID, CONFIG.search.apiKey),
|
@@ -18,10 +18,6 @@ export function algoliaSearch (pjax) {
|
|
18
18
|
}
|
19
19
|
})
|
20
20
|
|
21
|
-
search.on('render', () => {
|
22
|
-
pjax.refresh(document.getElementById("search-hits"))
|
23
|
-
})
|
24
|
-
|
25
21
|
// Registering Widgets
|
26
22
|
search.addWidgets([
|
27
23
|
configure({
|
@@ -105,7 +101,7 @@ export function algoliaSearch (pjax) {
|
|
105
101
|
}
|
106
102
|
})
|
107
103
|
document.querySelector('.close-btn').addEventListener('click', onPopupClose)
|
108
|
-
window.addEventListener('pjax:success', onPopupClose)
|
104
|
+
// window.addEventListener('pjax:success', onPopupClose)
|
109
105
|
window.addEventListener('keyup', (event) => {
|
110
106
|
if (event.key === 'Escape') {
|
111
107
|
onPopupClose()
|
@@ -45,13 +45,13 @@ export default function domInit () {
|
|
45
45
|
goToComment.addEventListener('click', goToCommentHandle)
|
46
46
|
showContents.addEventListener('click', sideBarToggleHandle)
|
47
47
|
|
48
|
-
if (__shokax_player__) {
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
}
|
48
|
+
// if (__shokax_player__) {
|
49
|
+
// mediaPlayer(toolPlayer)
|
50
|
+
//
|
51
|
+
// document.querySelector('main').addEventListener('click', () => {
|
52
|
+
// toolPlayer.player.mini()
|
53
|
+
// })
|
54
|
+
// }
|
55
55
|
|
56
56
|
const createIntersectionObserver = () => {
|
57
57
|
// waves在视口外时停止动画
|
@@ -2,7 +2,6 @@ import { $dom } from '../library/dom'
|
|
2
2
|
import { cardActive } from '../page/common'
|
3
3
|
import { pageScroll, transition } from '../library/anime'
|
4
4
|
import { vendorCss, vendorJs } from '../library/loadFile'
|
5
|
-
import { pjaxScript } from '../library/scriptPjax'
|
6
5
|
import { resizeHandle } from '../globals/handles'
|
7
6
|
import {
|
8
7
|
CONFIG,
|
@@ -61,10 +60,6 @@ export const siteRefresh = async (reload) => {
|
|
61
60
|
lazyBg.observe(el)
|
62
61
|
})
|
63
62
|
|
64
|
-
if (reload !== 1) {
|
65
|
-
$dom.each('script[data-pjax]', pjaxScript)
|
66
|
-
}
|
67
|
-
|
68
63
|
setOriginTitle(document.title)
|
69
64
|
|
70
65
|
resizeHandle()
|
@@ -1,11 +1,10 @@
|
|
1
1
|
import domInit from './domInit'
|
2
|
-
import {
|
2
|
+
import { siteRefresh } from './refresh'
|
3
3
|
import { cloudflareInit } from '../components/cloudflare'
|
4
|
-
import { BODY, CONFIG,
|
4
|
+
import { BODY, CONFIG, setSiteSearch, siteSearch } from '../globals/globalVars'
|
5
5
|
import { autoDarkmode, themeColorListener } from '../globals/themeColor'
|
6
6
|
import { resizeHandle, scrollHandle, visibilityListener } from '../globals/handles'
|
7
7
|
import { pagePosition } from '../globals/tools'
|
8
|
-
import Pjax from 'theme-shokax-pjax'
|
9
8
|
import { initVue } from '../library/vue'
|
10
9
|
import { $dom } from '../library/dom'
|
11
10
|
import { createChild } from '../library/proto'
|
@@ -15,18 +14,6 @@ const siteInit = async () => {
|
|
15
14
|
initVue()
|
16
15
|
domInit()
|
17
16
|
|
18
|
-
setPjax(new Pjax({
|
19
|
-
selectors: [
|
20
|
-
'head title',
|
21
|
-
'.languages',
|
22
|
-
'.twikoo',
|
23
|
-
'.pjax',
|
24
|
-
'.leancloud-recent-comment',
|
25
|
-
'script[data-config]'
|
26
|
-
],
|
27
|
-
cacheBust: false
|
28
|
-
}))
|
29
|
-
|
30
17
|
CONFIG.quicklink.ignores = LOCAL.ignores
|
31
18
|
import('quicklink').then(({listen}) => {
|
32
19
|
listen(CONFIG.quicklink)
|
@@ -53,7 +40,7 @@ const siteInit = async () => {
|
|
53
40
|
}
|
54
41
|
|
55
42
|
import('../page/search').then(({algoliaSearch}) => {
|
56
|
-
algoliaSearch(
|
43
|
+
algoliaSearch()
|
57
44
|
})
|
58
45
|
|
59
46
|
// Handle and trigger popup window
|
@@ -83,13 +70,13 @@ const siteInit = async () => {
|
|
83
70
|
passive: true
|
84
71
|
})
|
85
72
|
|
86
|
-
window.addEventListener('pjax:send', pjaxReload, {
|
87
|
-
|
88
|
-
})
|
73
|
+
// window.addEventListener('pjax:send', pjaxReload, {
|
74
|
+
// passive: true
|
75
|
+
// })
|
89
76
|
|
90
|
-
window.addEventListener('pjax:success', siteRefresh, {
|
91
|
-
|
92
|
-
}) // 默认会传入一个event参数
|
77
|
+
// window.addEventListener('pjax:success', siteRefresh, {
|
78
|
+
// passive: true
|
79
|
+
// }) // 默认会传入一个event参数
|
93
80
|
|
94
81
|
window.addEventListener('beforeunload', () => {
|
95
82
|
pagePosition()
|
package/source/js/_app/player.ts
CHANGED
@@ -1,56 +0,0 @@
|
|
1
|
-
export const getScript = (url: string,sri: string, callback?: Function, condition?: string): void => {
|
2
|
-
// url: 脚本文件的URL地址
|
3
|
-
// callback: 当脚本加载完成时要执行的回调函数
|
4
|
-
// condition: 可选的条件参数,如果存在,则执行callback
|
5
|
-
if (condition) {
|
6
|
-
// 如果条件存在,则执行回调函数
|
7
|
-
callback()
|
8
|
-
} else {
|
9
|
-
let script = document.createElement('script')
|
10
|
-
|
11
|
-
// @ts-ignore
|
12
|
-
script.onload = function (_, isAbort: boolean) {
|
13
|
-
// _: 事件对象
|
14
|
-
// isAbort: 是否中止
|
15
|
-
// @ts-ignore
|
16
|
-
if (isAbort || !script.readyState) {
|
17
|
-
console.log('abort!')
|
18
|
-
script.onload = null
|
19
|
-
script = undefined
|
20
|
-
if (!isAbort && callback) setTimeout(callback, 0)
|
21
|
-
}
|
22
|
-
}
|
23
|
-
script.src = url
|
24
|
-
script.integrity = sri
|
25
|
-
script.crossOrigin = 'anonymous'
|
26
|
-
document.head.appendChild(script)
|
27
|
-
}
|
28
|
-
}
|
29
|
-
|
30
|
-
export const pjaxScript = (element: HTMLScriptElement) => {
|
31
|
-
const { text, parentNode, id, className, type, src, dataset } = element
|
32
|
-
const code = text || element.textContent || element.innerHTML || ''
|
33
|
-
parentNode.removeChild(element)
|
34
|
-
const script = document.createElement('script')
|
35
|
-
if (id) {
|
36
|
-
script.id = id
|
37
|
-
}
|
38
|
-
if (className) {
|
39
|
-
script.className = className
|
40
|
-
}
|
41
|
-
if (type) {
|
42
|
-
script.type = type
|
43
|
-
}
|
44
|
-
if (src) {
|
45
|
-
// Force synchronous loading of peripheral JS.
|
46
|
-
script.src = src
|
47
|
-
script.async = false
|
48
|
-
}
|
49
|
-
if (dataset.pjax !== undefined) {
|
50
|
-
script.dataset.pjax = ''
|
51
|
-
}
|
52
|
-
if (code !== '') {
|
53
|
-
script.appendChild(document.createTextNode(code))
|
54
|
-
}
|
55
|
-
parentNode.appendChild(script)
|
56
|
-
}
|