q78kgblog 1.0.0
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/.github/workflows/HexoSeoAutoPush.yml +36 -0
- package/404.html +933 -0
- package/BingSiteAuth.xml +4 -0
- package/CNAME +1 -0
- package/about/index.html +1096 -0
- package/archives/2022/06/index.html +942 -0
- package/archives/2022/index.html +942 -0
- package/archives/2023/02/index.html +942 -0
- package/archives/2023/04/index.html +942 -0
- package/archives/2023/05/index.html +942 -0
- package/archives/2023/08/index.html +942 -0
- package/archives/2023/09/index.html +942 -0
- package/archives/2023/index.html +942 -0
- package/archives/2024/01/index.html +942 -0
- package/archives/2024/02/index.html +942 -0
- package/archives/2024/index.html +942 -0
- package/archives/index.html +942 -0
- package/assets/css/APlayer.min.css +3 -0
- package/assets/douban-loading.gif +0 -0
- package/assets/js/APlayer.min.js +2 -0
- package/assets/js/Meting.min.js +1 -0
- package/atom.xml +311 -0
- package/baidusitemap.xml +43 -0
- package/bangumis/index.html +1247 -0
- package/bigpie/index.html +714 -0
- package/bing.json +1 -0
- package/categories/Hello-World/index.html +954 -0
- package/categories/Hexo/index.html +954 -0
- package/categories/index.html +710 -0
- package/categories//345/271/264/347/273/210/346/200/273/347/273/223/index.html +954 -0
- package/categories//346/201/260/351/245/255/index.html +954 -0
- package/categories//347/264/240/346/235/220/index.html +954 -0
- package/categories//351/227/262/350/201/212/346/235/202/350/260/210/index.html +954 -0
- package/content.json +1 -0
- package/css/404page.css +65 -0
- package/css/ariasakablog.css +5632 -0
- package/css/commentBarrage.css +111 -0
- package/css/danmaku.css +89 -0
- package/css/essay.css +306 -0
- package/css/iconfont.css +55 -0
- package/css/iconfont.ttf +0 -0
- package/css/iconfont.woff +0 -0
- package/css/iconfont.woff2 +0 -0
- package/css/index.css +7006 -0
- package/css/people.css +18 -0
- package/css/stylessimple.css +40 -0
- package/css/swiper.min.css +701 -0
- package/css/swiperstyle.css +567 -0
- package/css/var.css +0 -0
- package/essay/index.html +701 -0
- package/favicon.ico +0 -0
- package/fcircle/index.html +733 -0
- package/fontawesome/index.html +716 -0
- package/google.txt +10 -0
- package/googlebe706248808ee393.html +1 -0
- package/img/144.png +0 -0
- package/img/16.png +0 -0
- package/img/1666416625095-iPhone X.png +0 -0
- package/img/1666416702650-Macbook Pro 2016 (1).png +0 -0
- package/img/1666416764216-Nexus 9.png +0 -0
- package/img/180.png +0 -0
- package/img/192.png +0 -0
- package/img/20200904222157.png +0 -0
- package/img/20200924153652.png +0 -0
- package/img/256.png +0 -0
- package/img/36.png +0 -0
- package/img/48.png +0 -0
- package/img/512.png +0 -0
- package/img/72.png +0 -0
- package/img/72645310.jpg +0 -0
- package/img/8DSTSS20990281646044689944.PNG +0 -0
- package/img/96.png +0 -0
- package/img/O35HOG22090681654187900371.jpg +0 -0
- package/img/a.webp +0 -0
- package/img/ad.png +0 -0
- package/img/apple-touch-icon.png +0 -0
- package/img/avatar.jpg +0 -0
- package/img/buYgVO22990681624844309044.jpg +0 -0
- package/img/comment.png +0 -0
- package/img/favicon.ico +0 -0
- package/img/favicon.jpg +0 -0
- package/img/friend_404.gif +0 -0
- package/img/mqaizf23990681654186719414.jpeg +0 -0
- package/img/nyancat.gif +0 -0
- package/img/siteshot.png +0 -0
- package/img/uTools_1666416859497-iMac.png +0 -0
- package/img-col/index.html +802 -0
- package/index.html +1056 -0
- package/js/aplayersave.js +268 -0
- package/js/baiduhistory.js +76 -0
- package/js/bbtalk.js +11354 -0
- package/js/bbtalklunbo.js +78 -0
- package/js/browser.js +35 -0
- package/js/calendar.js +380 -0
- package/js/cate.js +22 -0
- package/js/commentBarrage.js +240 -0
- package/js/commentsCount.js +43 -0
- package/js/copy.js +23 -0
- package/js/countup.js +209 -0
- package/js/cursor.js +82 -0
- package/js/danmaku.js +106 -0
- package/js/day.js +199 -0
- package/js/dianzan.js +249 -0
- package/js/dis.js +255 -0
- package/js/dist/baiduhistory.dev.js +102 -0
- package/js/dist/bbtalk.dev.js +12876 -0
- package/js/dist/bbtalklunbo.dev.js +45 -0
- package/js/dist/calendar.dev.js +395 -0
- package/js/dist/fixbugpjax.dev.js +8 -0
- package/js/dist/gongnong.dev.js +565 -0
- package/js/dist/heimu.dev.js +19 -0
- package/js/dist/links.dev.js +13 -0
- package/js/dist/main.dev.js +845 -0
- package/js/dist/resizeTop.dev.js +50 -0
- package/js/dist/seo.dev.js +33 -0
- package/js/dist/twikoo.all.min.dev.js +1 -0
- package/js/fixbugpjax.js +7 -0
- package/js/fixed_card_widget.js +46 -0
- package/js/fps.js +58 -0
- package/js/gitalker.js +11 -0
- package/js/gsap.min.js +11 -0
- package/js/heimu.js +16 -0
- package/js/hide.show.js +17 -0
- package/js/jike.js +121 -0
- package/js/jikewater.js +60 -0
- package/js/languages.js +511 -0
- package/js/latest.js +49 -0
- package/js/local-search.js +476 -0
- package/js/lunar.js +1071 -0
- package/js/lyxTalk.js +12 -0
- package/js/main.js +783 -0
- package/js/nav.js +30 -0
- package/js/noie.js +3 -0
- package/js/owo.js +52 -0
- package/js/people.js +175 -0
- package/js/pikaday.js +109 -0
- package/js/random.js +1 -0
- package/js/randomFriend.js +95 -0
- package/js/resizeTop.js +43 -0
- package/js/rightmenu.js +335 -0
- package/js/sakura.js +164 -0
- package/js/search/algolia.js +155 -0
- package/js/search/local-search.js +188 -0
- package/js/settings.js +353 -0
- package/js/sitetime.js +25 -0
- package/js/smooth-scrolling.js +546 -0
- package/js/sw-toolbox.js +16 -0
- package/js/swiperinit.js +23 -0
- package/js/tw_cn.js +100 -0
- package/js/twikoo.all.min.js +2 -0
- package/js/utils.js +278 -0
- package/js/welcome.js +107 -0
- package/js/welcomeconsole.js +23 -0
- package/links/index.html +842 -0
- package/live2d-widget/LICENSE +674 -0
- package/live2d-widget/README.md +188 -0
- package/live2d-widget/assets/screenshot-1.png +0 -0
- package/live2d-widget/assets/screenshot-2.png +0 -0
- package/live2d-widget/assets/screenshot-3.png +0 -0
- package/live2d-widget/autoload.js +63 -0
- package/live2d-widget/demo/demo.html +34 -0
- package/live2d-widget/demo/login.html +271 -0
- package/live2d-widget/live2d.min.js +1 -0
- package/live2d-widget/package.json +31 -0
- package/live2d-widget/rollup.config.js +38 -0
- package/live2d-widget/src/index.js +178 -0
- package/live2d-widget/src/message.js +22 -0
- package/live2d-widget/src/model.js +75 -0
- package/live2d-widget/src/tools.js +78 -0
- package/live2d-widget/src/utils.js +5 -0
- package/live2d-widget/src/waifu-tips.js +3 -0
- package/live2d-widget/waifu-tips.js +5 -0
- package/live2d-widget/waifu-tips.json +255 -0
- package/live2d-widget/waifu.css +310 -0
- package/manifest.json +1 -0
- package/noie.html +69 -0
- package/othersite/index.html +779 -0
- package/owo.json +1 -0
- package/package.json +1 -0
- package/people.html +24 -0
- package/posts/164ef646/index.html +1027 -0
- package/posts/228c2ef8/index.html +1014 -0
- package/posts/4a17b156/index.html +1010 -0
- package/posts/6f3c565b/index.html +1013 -0
- package/posts/7da7c3f6/index.html +1070 -0
- package/posts/a9a6c1fb/index.html +1041 -0
- package/posts/c262e439/index.html +1002 -0
- package/posts/c81531cf/index.html +1080 -0
- package/posts/da2093a1/index.html +1022 -0
- package/posts/e54f7476/index.html +1052 -0
- package/projects.html +424 -0
- package/random.html +32 -0
- package/robots.txt +17 -0
- package/search.xml +309 -0
- package/sitemap.txt +62 -0
- package/sitemap.xml +488 -0
- package/sw.js +190 -0
- package/swReg.js +29 -0
- package/tags/AI/index.html +955 -0
- package/tags/Butterfly/index.html +955 -0
- package/tags/Cloudflare/index.html +955 -0
- package/tags/DiffSinger/index.html +955 -0
- package/tags/Hexo/index.html +955 -0
- package/tags/Next/index.html +955 -0
- package/tags/RAID/index.html +955 -0
- package/tags/VPS/index.html +955 -0
- package/tags/Vercel/index.html +955 -0
- package/tags/Workers/index.html +955 -0
- package/tags/hello-world/index.html +955 -0
- package/tags/index.html +710 -0
- package/tags//344/270/273/351/242/230/index.html +955 -0
- package/tags//344/272/221/346/234/215/345/212/241/345/231/250/index.html +955 -0
- package/tags//344/276/277/345/256/234/index.html +955 -0
- package/tags//345/206/231/344/275/234/index.html +955 -0
- package/tags//345/245/263/346/200/247/346/204/217/350/257/206/index.html +955 -0
- package/tags//345/255/246/344/271/240/index.html +955 -0
- package/tags//345/256/266/351/207/214/344/272/221/index.html +955 -0
- package/tags//345/271/264/347/273/210/346/200/273/347/273/223/index.html +955 -0
- package/tags//346/200/247/344/273/267/346/257/224/index.html +955 -0
- package/tags//346/212/230/350/205/276/index.html +955 -0
- package/tags//346/217/220/344/276/233/345/225/206/index.html +955 -0
- package/tags//346/227/245/345/270/270/index.html +955 -0
- package/tags//346/234/215/345/212/241/345/231/250/index.html +955 -0
- package/tags//346/265/252/346/275/256/index.html +955 -0
- package/tags//347/256/200/347/210/261/index.html +955 -0
- package/tags//350/207/252/345/212/250/346/240/207/346/263/250/index.html +955 -0
- package/tags//350/256/272/346/226/207/index.html +955 -0
- package/tags//350/260/267/346/255/214/347/277/273/350/257/221/index.html +955 -0
- package/tags//350/264/237/350/275/275/345/235/207/350/241/241/index.html +955 -0
- package/tags//351/207/221/345/217/245/index.html +955 -0
- package/tags//351/255/224/346/224/271/index.html +955 -0
@@ -0,0 +1,155 @@
|
|
1
|
+
window.addEventListener('load', () => {
|
2
|
+
const openSearch = () => {
|
3
|
+
const bodyStyle = document.body.style
|
4
|
+
bodyStyle.width = '100%'
|
5
|
+
bodyStyle.overflow = 'hidden'
|
6
|
+
btf.animateIn(document.getElementById('search-mask'), 'to_show 0.5s')
|
7
|
+
btf.animateIn(document.querySelector('#algolia-search .search-dialog'), 'titleScale 0.5s')
|
8
|
+
setTimeout(() => { document.querySelector('#algolia-search .ais-SearchBox-input').focus() }, 100)
|
9
|
+
|
10
|
+
// shortcut: ESC
|
11
|
+
document.addEventListener('keydown', function f (event) {
|
12
|
+
if (event.code === 'Escape') {
|
13
|
+
closeSearch()
|
14
|
+
document.removeEventListener('keydown', f)
|
15
|
+
}
|
16
|
+
})
|
17
|
+
}
|
18
|
+
|
19
|
+
const closeSearch = () => {
|
20
|
+
const bodyStyle = document.body.style
|
21
|
+
bodyStyle.width = ''
|
22
|
+
bodyStyle.overflow = ''
|
23
|
+
btf.animateOut(document.querySelector('#algolia-search .search-dialog'), 'search_close .5s')
|
24
|
+
btf.animateOut(document.getElementById('search-mask'), 'to_hide 0.5s')
|
25
|
+
}
|
26
|
+
|
27
|
+
const searchClickFn = () => {
|
28
|
+
document.querySelector('#search-button > .search').addEventListener('click', openSearch)
|
29
|
+
}
|
30
|
+
|
31
|
+
const searchClickFnOnce = () => {
|
32
|
+
document.getElementById('search-mask').addEventListener('click', closeSearch)
|
33
|
+
document.querySelector('#algolia-search .search-close-button').addEventListener('click', closeSearch)
|
34
|
+
}
|
35
|
+
|
36
|
+
const cutContent = content => {
|
37
|
+
if (content === '') return ''
|
38
|
+
|
39
|
+
const firstOccur = content.indexOf('<mark>')
|
40
|
+
|
41
|
+
let start = firstOccur - 30
|
42
|
+
let end = firstOccur + 120
|
43
|
+
let pre = ''
|
44
|
+
let post = ''
|
45
|
+
|
46
|
+
if (start <= 0) {
|
47
|
+
start = 0
|
48
|
+
end = 140
|
49
|
+
} else {
|
50
|
+
pre = '...'
|
51
|
+
}
|
52
|
+
|
53
|
+
if (end > content.length) {
|
54
|
+
end = content.length
|
55
|
+
} else {
|
56
|
+
post = '...'
|
57
|
+
}
|
58
|
+
|
59
|
+
let matchContent = pre + content.substring(start, end) + post
|
60
|
+
return matchContent
|
61
|
+
}
|
62
|
+
|
63
|
+
const algolia = GLOBAL_CONFIG.algolia
|
64
|
+
const isAlgoliaValid = algolia.appId && algolia.apiKey && algolia.indexName
|
65
|
+
if (!isAlgoliaValid) {
|
66
|
+
return console.error('Algolia setting is invalid!')
|
67
|
+
}
|
68
|
+
|
69
|
+
const search = instantsearch({
|
70
|
+
indexName: algolia.indexName,
|
71
|
+
searchClient: algoliasearch(algolia.appId, algolia.apiKey),
|
72
|
+
searchFunction(helper) {
|
73
|
+
helper.state.query && helper.search()
|
74
|
+
},
|
75
|
+
})
|
76
|
+
|
77
|
+
const configure = instantsearch.widgets.configure({
|
78
|
+
hitsPerPage: 5
|
79
|
+
})
|
80
|
+
|
81
|
+
const searchBox = instantsearch.widgets.searchBox({
|
82
|
+
container: '#algolia-search-input',
|
83
|
+
showReset: false,
|
84
|
+
showSubmit: false,
|
85
|
+
placeholder: GLOBAL_CONFIG.algolia.languages.input_placeholder,
|
86
|
+
showLoadingIndicator: true
|
87
|
+
})
|
88
|
+
|
89
|
+
const hits = instantsearch.widgets.hits({
|
90
|
+
container: '#algolia-hits',
|
91
|
+
templates: {
|
92
|
+
item(data) {
|
93
|
+
const link = data.permalink ? data.permalink : (GLOBAL_CONFIG.root + data.path)
|
94
|
+
return `
|
95
|
+
<a href="${link}" class="algolia-hit-item-link">
|
96
|
+
${data._highlightResult.title.value || 'no-title'}
|
97
|
+
</a>
|
98
|
+
<p class="algolia-hit-item-content">${cutContent(data._highlightResult.contentStripTruncate.value)}</p>`
|
99
|
+
},
|
100
|
+
empty: function (data) {
|
101
|
+
return (
|
102
|
+
'<div id="algolia-hits-empty">' +
|
103
|
+
GLOBAL_CONFIG.algolia.languages.hits_empty.replace(/\$\{query}/, data.query) +
|
104
|
+
'</div>'
|
105
|
+
)
|
106
|
+
}
|
107
|
+
}
|
108
|
+
})
|
109
|
+
|
110
|
+
const stats = instantsearch.widgets.stats({
|
111
|
+
container: '#algolia-info > .algolia-stats',
|
112
|
+
templates: {
|
113
|
+
text: function (data) {
|
114
|
+
const stats = GLOBAL_CONFIG.algolia.languages.hits_stats
|
115
|
+
.replace(/\$\{hits}/, data.nbHits)
|
116
|
+
.replace(/\$\{time}/, data.processingTimeMS)
|
117
|
+
return (
|
118
|
+
`<hr>${stats}`
|
119
|
+
)
|
120
|
+
}
|
121
|
+
}
|
122
|
+
})
|
123
|
+
|
124
|
+
const powerBy = instantsearch.widgets.poweredBy({
|
125
|
+
container: '#algolia-info > .algolia-poweredBy',
|
126
|
+
})
|
127
|
+
|
128
|
+
const pagination = instantsearch.widgets.pagination({
|
129
|
+
container: '#algolia-pagination',
|
130
|
+
totalPages: 5,
|
131
|
+
templates: {
|
132
|
+
first: '<i class="fas fa-angle-double-left"></i>',
|
133
|
+
last: '<i class="fas fa-angle-double-right"></i>',
|
134
|
+
previous: '<i class="fas fa-angle-left"></i>',
|
135
|
+
next: '<i class="fas fa-angle-right"></i>'
|
136
|
+
}
|
137
|
+
})
|
138
|
+
|
139
|
+
|
140
|
+
search.addWidgets([configure,searchBox,hits,stats,powerBy,pagination]) // add the widgets to the instantsearch instance
|
141
|
+
|
142
|
+
search.start()
|
143
|
+
|
144
|
+
searchClickFn()
|
145
|
+
searchClickFnOnce()
|
146
|
+
|
147
|
+
window.addEventListener('pjax:complete', () => {
|
148
|
+
getComputedStyle(document.querySelector('#algolia-search .search-dialog')).display === 'block' && closeSearch()
|
149
|
+
searchClickFn()
|
150
|
+
})
|
151
|
+
|
152
|
+
window.pjax && search.on('render', () => {
|
153
|
+
window.pjax.refresh(document.getElementById('algolia-hits'))
|
154
|
+
})
|
155
|
+
})
|
@@ -0,0 +1,188 @@
|
|
1
|
+
window.addEventListener('load', () => {
|
2
|
+
let loadFlag = false
|
3
|
+
let dataObj = []
|
4
|
+
const $searchMask = document.getElementById('search-mask')
|
5
|
+
|
6
|
+
const openSearch = () => {
|
7
|
+
const bodyStyle = document.body.style
|
8
|
+
bodyStyle.width = '100%'
|
9
|
+
bodyStyle.overflow = 'hidden'
|
10
|
+
btf.animateIn($searchMask, 'to_show 0.5s')
|
11
|
+
btf.animateIn(document.querySelector('#local-search .search-dialog'), 'titleScale 0.5s')
|
12
|
+
setTimeout(() => { document.querySelector('#local-search-input input').focus() }, 100)
|
13
|
+
if (!loadFlag) {
|
14
|
+
search()
|
15
|
+
loadFlag = true
|
16
|
+
}
|
17
|
+
// shortcut: ESC
|
18
|
+
document.addEventListener('keydown', function f (event) {
|
19
|
+
if (event.code === 'Escape') {
|
20
|
+
closeSearch()
|
21
|
+
document.removeEventListener('keydown', f)
|
22
|
+
}
|
23
|
+
})
|
24
|
+
}
|
25
|
+
|
26
|
+
const closeSearch = () => {
|
27
|
+
const bodyStyle = document.body.style
|
28
|
+
bodyStyle.width = ''
|
29
|
+
bodyStyle.overflow = ''
|
30
|
+
btf.animateOut(document.querySelector('#local-search .search-dialog'), 'search_close .5s')
|
31
|
+
btf.animateOut($searchMask, 'to_hide 0.5s')
|
32
|
+
}
|
33
|
+
|
34
|
+
const searchClickFn = () => {
|
35
|
+
document.querySelector('#search-button > .search').addEventListener('click', openSearch)
|
36
|
+
}
|
37
|
+
|
38
|
+
const searchClickFnOnce = () => {
|
39
|
+
document.querySelector('#local-search .search-close-button').addEventListener('click', closeSearch)
|
40
|
+
$searchMask.addEventListener('click', closeSearch)
|
41
|
+
if (GLOBAL_CONFIG.localSearch.preload) dataObj = fetchData(GLOBAL_CONFIG.localSearch.path)
|
42
|
+
}
|
43
|
+
|
44
|
+
// check url is json or not
|
45
|
+
const isJson = url => {
|
46
|
+
const reg = /\.json$/
|
47
|
+
return reg.test(url)
|
48
|
+
}
|
49
|
+
|
50
|
+
const fetchData = async (path) => {
|
51
|
+
let data = []
|
52
|
+
const response = await fetch(path)
|
53
|
+
if (isJson(path)) {
|
54
|
+
data = await response.json()
|
55
|
+
} else {
|
56
|
+
const res = await response.text()
|
57
|
+
const t = await new window.DOMParser().parseFromString(res, 'text/xml')
|
58
|
+
const a = await t
|
59
|
+
data = [...a.querySelectorAll('entry')].map(item =>{
|
60
|
+
return {
|
61
|
+
title: item.querySelector('title').textContent,
|
62
|
+
content: item.querySelector('content') && item.querySelector('content').textContent,
|
63
|
+
url: item.querySelector('url').textContent
|
64
|
+
}
|
65
|
+
})
|
66
|
+
}
|
67
|
+
if (response.ok) {
|
68
|
+
const $loadDataItem = document.getElementById('loading-database')
|
69
|
+
$loadDataItem.nextElementSibling.style.display = 'block'
|
70
|
+
$loadDataItem.remove()
|
71
|
+
}
|
72
|
+
return data
|
73
|
+
}
|
74
|
+
|
75
|
+
const search = () => {
|
76
|
+
if (!GLOBAL_CONFIG.localSearch.preload) {
|
77
|
+
dataObj = fetchData(GLOBAL_CONFIG.localSearch.path)
|
78
|
+
}
|
79
|
+
|
80
|
+
const $input = document.querySelector('#local-search-input input')
|
81
|
+
const $resultContent = document.getElementById('local-search-results')
|
82
|
+
const $loadingStatus = document.getElementById('loading-status')
|
83
|
+
|
84
|
+
$input.addEventListener('input', function () {
|
85
|
+
const keywords = this.value.trim().toLowerCase().split(/[\s]+/)
|
86
|
+
if (keywords[0] !== '') $loadingStatus.innerHTML = '<i class="fas fa-spinner fa-pulse"></i>'
|
87
|
+
|
88
|
+
$resultContent.innerHTML = ''
|
89
|
+
let str = '<div class="search-result-list">'
|
90
|
+
if (keywords.length <= 0) return
|
91
|
+
let count = 0
|
92
|
+
// perform local searching
|
93
|
+
dataObj.then(data => {
|
94
|
+
data.forEach(data => {
|
95
|
+
let isMatch = true
|
96
|
+
let dataTitle = data.title ? data.title.trim().toLowerCase() : ''
|
97
|
+
const dataContent = data.content ? data.content.trim().replace(/<[^>]+>/g, '').toLowerCase() : ''
|
98
|
+
const dataUrl = data.url.startsWith('/') ? data.url : GLOBAL_CONFIG.root + data.url
|
99
|
+
let indexTitle = -1
|
100
|
+
let indexContent = -1
|
101
|
+
let firstOccur = -1
|
102
|
+
// only match articles with not empty titles and contents
|
103
|
+
if (dataTitle !== '' || dataContent !== '') {
|
104
|
+
keywords.forEach((keyword, i) => {
|
105
|
+
indexTitle = dataTitle.indexOf(keyword)
|
106
|
+
indexContent = dataContent.indexOf(keyword)
|
107
|
+
if (indexTitle < 0 && indexContent < 0) {
|
108
|
+
isMatch = false
|
109
|
+
} else {
|
110
|
+
if (indexContent < 0) {
|
111
|
+
indexContent = 0
|
112
|
+
}
|
113
|
+
if (i === 0) {
|
114
|
+
firstOccur = indexContent
|
115
|
+
}
|
116
|
+
}
|
117
|
+
})
|
118
|
+
} else {
|
119
|
+
isMatch = false
|
120
|
+
}
|
121
|
+
|
122
|
+
// show search results
|
123
|
+
if (isMatch) {
|
124
|
+
if (firstOccur >= 0) {
|
125
|
+
// cut out 130 characters
|
126
|
+
// let start = firstOccur - 30 < 0 ? 0 : firstOccur - 30
|
127
|
+
// let end = firstOccur + 50 > dataContent.length ? dataContent.length : firstOccur + 50
|
128
|
+
let start = firstOccur - 30
|
129
|
+
let end = firstOccur + 100
|
130
|
+
let pre = ''
|
131
|
+
let post = ''
|
132
|
+
|
133
|
+
if (start < 0) {
|
134
|
+
start = 0
|
135
|
+
}
|
136
|
+
|
137
|
+
if (start === 0) {
|
138
|
+
end = 100
|
139
|
+
} else {
|
140
|
+
pre = '...'
|
141
|
+
}
|
142
|
+
|
143
|
+
if (end > dataContent.length) {
|
144
|
+
end = dataContent.length
|
145
|
+
} else {
|
146
|
+
post = '...'
|
147
|
+
}
|
148
|
+
|
149
|
+
let matchContent = dataContent.substring(start, end)
|
150
|
+
|
151
|
+
// highlight all keywords
|
152
|
+
keywords.forEach(keyword => {
|
153
|
+
const regS = new RegExp(keyword, 'gi')
|
154
|
+
matchContent = matchContent.replace(regS, '<span class="search-keyword">' + keyword + '</span>')
|
155
|
+
dataTitle = dataTitle.replace(regS, '<span class="search-keyword">' + keyword + '</span>')
|
156
|
+
})
|
157
|
+
|
158
|
+
str += '<div class="local-search__hit-item"><a href="' + dataUrl + '" class="search-result-title">' + dataTitle + '</a>'
|
159
|
+
count += 1
|
160
|
+
|
161
|
+
if (dataContent !== '') {
|
162
|
+
str += '<p class="search-result">' + pre + matchContent + post + '</p>'
|
163
|
+
}
|
164
|
+
}
|
165
|
+
str += '</div>'
|
166
|
+
}
|
167
|
+
})
|
168
|
+
if (count === 0) {
|
169
|
+
str += '<div id="local-search__hits-empty">' + GLOBAL_CONFIG.localSearch.languages.hits_empty.replace(/\$\{query}/, this.value.trim()) +
|
170
|
+
'</div>'
|
171
|
+
}
|
172
|
+
str += '</div>'
|
173
|
+
$resultContent.innerHTML = str
|
174
|
+
if (keywords[0] !== '') $loadingStatus.innerHTML = ''
|
175
|
+
window.pjax && window.pjax.refresh($resultContent)
|
176
|
+
})
|
177
|
+
})
|
178
|
+
}
|
179
|
+
|
180
|
+
searchClickFn()
|
181
|
+
searchClickFnOnce()
|
182
|
+
|
183
|
+
// pjax
|
184
|
+
window.addEventListener('pjax:complete', () => {
|
185
|
+
!btf.isHidden($searchMask) && closeSearch()
|
186
|
+
searchClickFn()
|
187
|
+
})
|
188
|
+
})
|
package/js/settings.js
ADDED
@@ -0,0 +1,353 @@
|
|
1
|
+
document.addEventListener('pjax:complete', tosetting);
|
2
|
+
document.addEventListener('DOMContentLoaded', tosetting);
|
3
|
+
function tosetting(){
|
4
|
+
$("#settingWindow").hide();
|
5
|
+
if(localStorage.getItem("blur")=="false"){
|
6
|
+
blur=0;
|
7
|
+
}else{
|
8
|
+
blur=1;
|
9
|
+
|
10
|
+
}
|
11
|
+
if(localStorage.getItem("yjjs")=="true"){
|
12
|
+
yjjs=1;
|
13
|
+
}else{
|
14
|
+
yjjs=0;
|
15
|
+
|
16
|
+
}
|
17
|
+
if(localStorage.getItem("fpson")==undefined){
|
18
|
+
localStorage.setItem("fpson","1");
|
19
|
+
}
|
20
|
+
if(!blur){
|
21
|
+
document.getElementById("settingStyle").innerText=`
|
22
|
+
*,*:not(.card-info)::before,*::after{
|
23
|
+
-webkit-backdrop-filter: none!important;
|
24
|
+
backdrop-filter: none!important;
|
25
|
+
-webkit-filter: none!important;
|
26
|
+
filter: none!important;
|
27
|
+
}`}
|
28
|
+
else{
|
29
|
+
document.getElementById("settingStyle").innerText=''
|
30
|
+
}
|
31
|
+
setBlur=function(){
|
32
|
+
blur=!blur;
|
33
|
+
localStorage.setItem("blur",blur);
|
34
|
+
if(!blur){
|
35
|
+
document.getElementById("settingStyle").innerText=`
|
36
|
+
*{
|
37
|
+
-webkit-backdrop-filter: none!important;
|
38
|
+
backdrop-filter: none!important;
|
39
|
+
-webkit-filter: none!important;
|
40
|
+
filter: none!important;
|
41
|
+
}`}
|
42
|
+
else{
|
43
|
+
document.getElementById("settingStyle").innerText=''
|
44
|
+
}
|
45
|
+
}
|
46
|
+
// if(yjjs){
|
47
|
+
// document.getElementById("yjjs").innerText=`
|
48
|
+
// *:not(#web_bg){
|
49
|
+
// transform:translateZ(0);
|
50
|
+
// backface-visibility: hidden
|
51
|
+
// }`}
|
52
|
+
// else{
|
53
|
+
// document.getElementById("yjjs").innerText=``
|
54
|
+
// }
|
55
|
+
yjjs1=function(){
|
56
|
+
yjjs=!yjjs;
|
57
|
+
localStorage.setItem("yjjs",yjjs)
|
58
|
+
// if(yjjs){
|
59
|
+
// document.getElementById("yjjs").innerText=`
|
60
|
+
// *:not(#web_bg){
|
61
|
+
// transform:translateZ(0);
|
62
|
+
// backface-visibility: hidden
|
63
|
+
// }`}
|
64
|
+
// else{
|
65
|
+
// document.getElementById("yjjs").innerText=``
|
66
|
+
// }
|
67
|
+
}
|
68
|
+
if(localStorage.getItem("blogTheme")=="acrylic"){
|
69
|
+
document.getElementById("css").href="";
|
70
|
+
}
|
71
|
+
switchTheme=function(){
|
72
|
+
if(document.getElementById("css").href==window.location.protocol+"//"+window.location.host+"/css/stylessimple.css"){
|
73
|
+
document.getElementById("css").href=""
|
74
|
+
localStorage.setItem("blogTheme","acrylic");
|
75
|
+
}else{
|
76
|
+
document.getElementById("css").href="/css/stylessimple.css"
|
77
|
+
localStorage.setItem("blogTheme","simple");
|
78
|
+
}
|
79
|
+
}
|
80
|
+
setColor=function(c){
|
81
|
+
document.getElementById("themeColor").innerText=`:root{--lyx-theme:var(--lyx-${c})!important}`;
|
82
|
+
localStorage.setItem("themeColor",c);
|
83
|
+
|
84
|
+
}
|
85
|
+
setFont=function(n){
|
86
|
+
localStorage.setItem("font",n);
|
87
|
+
if(n=="main"){
|
88
|
+
var s=document.querySelectorAll("body,.wv-lt-location>a[data-v-4b9dcab4],.wv-lt-location>span[data-v-4b9dcab4],.wv-n-h-now-tmp>span[data-v-5f4c0628],.wv-n-h-now-txt>span[data-v-5f4c0628],.wv-n-h-now-rain>a[data-v-5f4c0628], .wv-n-h-now-rain>span[data-v-5f4c0628],.wv-f-forecast-date>a[data-v-66693262],.wv-f-a,.wv-lt-location>a[data-v-4b9dcab4],.wv-lt-location>span[data-v-4b9dcab4],.wv-n-h-now-tmp>span[data-v-5f4c0628],.wv-n-h-now-txt>span[data-v-5f4c0628],.wv-n-h-now-rain>a[data-v-5f4c0628], .wv-n-h-now-rain>span[data-v-5f4c0628],.wv-f-forecast-date>a[data-v-66693262],.wv-f-a,.aplayer")
|
89
|
+
for(var i = 0; i <s.length; i++) {
|
90
|
+
s[i].style.fontFamily="-apple-system, IBM Plex Mono ,monospace,'微软雅黑', sans-serif"
|
91
|
+
}
|
92
|
+
}
|
93
|
+
else if(n=="HYPailou"){
|
94
|
+
var s=document.querySelectorAll("body,.wv-lt-location>a[data-v-4b9dcab4],.wv-lt-location>span[data-v-4b9dcab4],.wv-n-h-now-tmp>span[data-v-5f4c0628],.wv-n-h-now-txt>span[data-v-5f4c0628],.wv-n-h-now-rain>a[data-v-5f4c0628], .wv-n-h-now-rain>span[data-v-5f4c0628],.wv-f-forecast-date>a[data-v-66693262],.wv-f-a,.wv-lt-location>a[data-v-4b9dcab4],.wv-lt-location>span[data-v-4b9dcab4],.wv-n-h-now-tmp>span[data-v-5f4c0628],.wv-n-h-now-txt>span[data-v-5f4c0628],.wv-n-h-now-rain>a[data-v-5f4c0628], .wv-n-h-now-rain>span[data-v-5f4c0628],.wv-f-forecast-date>a[data-v-66693262],.wv-f-a,.aplayer")
|
95
|
+
for(var i = 0; i <s.length; i++) {
|
96
|
+
s[i].style.fontFamily="Fredoka,HYPailou,KyoukashoProL,-apple-system, IBM Plex Mono ,monospace,'微软雅黑', sans-serif"
|
97
|
+
}
|
98
|
+
}
|
99
|
+
else{
|
100
|
+
var s=document.querySelectorAll("body,.wv-lt-location>a[data-v-4b9dcab4],.wv-lt-location>span[data-v-4b9dcab4],.wv-n-h-now-tmp>span[data-v-5f4c0628],.wv-n-h-now-txt>span[data-v-5f4c0628],.wv-n-h-now-rain>a[data-v-5f4c0628], .wv-n-h-now-rain>span[data-v-5f4c0628],.wv-f-forecast-date>a[data-v-66693262],.wv-f-a,.wv-lt-location>a[data-v-4b9dcab4],.wv-lt-location>span[data-v-4b9dcab4],.wv-n-h-now-tmp>span[data-v-5f4c0628],.wv-n-h-now-txt>span[data-v-5f4c0628],.wv-n-h-now-rain>a[data-v-5f4c0628], .wv-n-h-now-rain>span[data-v-5f4c0628],.wv-f-forecast-date>a[data-v-66693262],.wv-f-a,.aplayer")
|
101
|
+
for(var i = 0; i <s.length; i++) {
|
102
|
+
s[i].style.fontFamily="var(--global-font),KyoukashoProL,-apple-system, IBM Plex Mono ,monosapce,\"微软雅黑\", sans-serif"
|
103
|
+
}
|
104
|
+
document.body.style.fontFamily="var(--global-font),KyoukashoProL,-apple-system, IBM Plex Mono ,monosapce,'微软雅黑', sans-serif"
|
105
|
+
document.documentElement.style.setProperty('--global-font', n)
|
106
|
+
}
|
107
|
+
}
|
108
|
+
if(localStorage.getItem("themeColor")==undefined){
|
109
|
+
localStorage.setItem("themeColor","pink");
|
110
|
+
}
|
111
|
+
|
112
|
+
setColor(localStorage.getItem("themeColor"));
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
if(localStorage.getItem("hideRightside")==undefined){
|
117
|
+
localStorage.setItem("hideRightside","0");
|
118
|
+
}
|
119
|
+
|
120
|
+
if(localStorage.getItem("hideRightside")=="1"){
|
121
|
+
$("#rightside").toggle()
|
122
|
+
}
|
123
|
+
toggleRightside=function(){
|
124
|
+
$("#rightside").toggle();
|
125
|
+
localStorage.setItem("hideRightside",Math.abs(Number(localStorage.getItem("hideRightside"))-1))
|
126
|
+
}
|
127
|
+
if(localStorage.getItem("font")==undefined){
|
128
|
+
localStorage.setItem("font","HYTMR")
|
129
|
+
}
|
130
|
+
setFont(localStorage.getItem("font"))
|
131
|
+
// 存数据
|
132
|
+
// name:命名 data:数据
|
133
|
+
saveData=function(name, data) {
|
134
|
+
localStorage.setItem(name, JSON.stringify({ 'time': Date.now(), 'data': data }))
|
135
|
+
}
|
136
|
+
|
137
|
+
// 取数据
|
138
|
+
// name:命名 time:过期时长,单位分钟,如传入30,即加载数据时如果超出30分钟返回0,否则返回数据
|
139
|
+
loadData=function(name, time) {
|
140
|
+
let d = JSON.parse(localStorage.getItem(name));
|
141
|
+
// 过期或有错误返回 0 否则返回数据
|
142
|
+
if (d) {
|
143
|
+
let t = Date.now() - d.time
|
144
|
+
if (t < (time * 60 * 1000) && t > -1) return d.data;
|
145
|
+
}
|
146
|
+
return 0;
|
147
|
+
}
|
148
|
+
// 切换背景函数
|
149
|
+
// 此处的flag是为了每次读取时都重新存储一次,导致过期时间不稳定
|
150
|
+
// 如果flag为0则存储,即设置背景. 为1则不存储,即每次加载自动读取背景.
|
151
|
+
changeBg=function(s, flag) {
|
152
|
+
let bg = document.getElementById('web_bg')
|
153
|
+
if (s.charAt(0) == '#') {
|
154
|
+
bg.style.backgroundColor = s
|
155
|
+
bg.style.backgroundImage = 'none'
|
156
|
+
} else bg.style.backgroundImage = s
|
157
|
+
if (!flag) { saveData('blogbg', s) }
|
158
|
+
}
|
159
|
+
// 上面两个函数如果你有其他需要存取数据的功能,也可以直接使用
|
160
|
+
|
161
|
+
// 读取背景
|
162
|
+
try {
|
163
|
+
let data = loadData('blogbg', 1440)
|
164
|
+
if (data) changeBg(data, 1)
|
165
|
+
else localStorage.removeItem('blogbg');
|
166
|
+
} catch (error) { localStorage.removeItem('blogbg'); }
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
fpssw=function(){
|
171
|
+
if(localStorage.getItem("fpson")=="1"){
|
172
|
+
localStorage.setItem("fpson","0");
|
173
|
+
}else{
|
174
|
+
localStorage.setItem("fpson","1");
|
175
|
+
}
|
176
|
+
}
|
177
|
+
$(".asetting").hide();
|
178
|
+
$('#backer').hide();
|
179
|
+
$("#"+localStorage.getItem("themeColor")).attr("checked", true);
|
180
|
+
if(localStorage.getItem("blur")=="false"){
|
181
|
+
document.getElementById("blur").checked=true;
|
182
|
+
}
|
183
|
+
if(localStorage.getItem("yjjs")=="true"){
|
184
|
+
document.getElementById("yjjs").checked=true;
|
185
|
+
}
|
186
|
+
if(localStorage.getItem("fpson")=="1"){
|
187
|
+
document.getElementById("fpson").checked=true;
|
188
|
+
}
|
189
|
+
|
190
|
+
|
191
|
+
if(localStorage.getItem("sakurahide")=="false"){
|
192
|
+
document.getElementById("hideSakura").checked=true;
|
193
|
+
isSakura=1;
|
194
|
+
}
|
195
|
+
else if(localStorage.getItem("sakurahide")==null){
|
196
|
+
localStorage.setItem("sakurahide","false");
|
197
|
+
document.getElementById("hideSakura").checked=true;
|
198
|
+
isSakura=1;
|
199
|
+
}
|
200
|
+
else{
|
201
|
+
setTimeout(
|
202
|
+
stopp,1000);
|
203
|
+
isSakura=0;
|
204
|
+
}
|
205
|
+
if(localStorage.getItem("aplayerhide")=="false"){
|
206
|
+
document.getElementById("hideAplayer").checked=true;
|
207
|
+
}
|
208
|
+
else if(localStorage.getItem("aplayerhide")==null){
|
209
|
+
localStorage.setItem("aplayerhide","false");
|
210
|
+
document.getElementById("hideAplayer").checked=true;
|
211
|
+
}
|
212
|
+
else{
|
213
|
+
doStuff=function() {
|
214
|
+
flag=0;
|
215
|
+
try{
|
216
|
+
ap=aplayers[0];
|
217
|
+
ap.list;
|
218
|
+
flag=1;
|
219
|
+
}catch{
|
220
|
+
setTimeout(doStuff, 50);
|
221
|
+
return;
|
222
|
+
}
|
223
|
+
if(flag){
|
224
|
+
$(".aplayer-fixed").hide()
|
225
|
+
}
|
226
|
+
}
|
227
|
+
doStuff();
|
228
|
+
|
229
|
+
}
|
230
|
+
|
231
|
+
document.getElementsByClassName("reSettings")[0].onclick=function(){
|
232
|
+
localStorage.clear()
|
233
|
+
window.location.reload()
|
234
|
+
}
|
235
|
+
|
236
|
+
toggleWinbox=function(){
|
237
|
+
$("#settingWindow").fadeToggle();
|
238
|
+
if(document.getElementById("settingWindow").style.display!="none"){
|
239
|
+
document.getElementById("settingWindow").style.display="flex";
|
240
|
+
}
|
241
|
+
}
|
242
|
+
fullScreen=function() {
|
243
|
+
if (document.fullscreenElement) document.exitFullscreen()
|
244
|
+
else document.documentElement.requestFullscreen();
|
245
|
+
}
|
246
|
+
toggleAside=function(){
|
247
|
+
const $htmlDom = document.documentElement.classList
|
248
|
+
$htmlDom.contains('hide-aside')
|
249
|
+
? saveToLocal.set('aside-status', 'show', 2)
|
250
|
+
: saveToLocal.set('aside-status', 'hide', 2)
|
251
|
+
$htmlDom.toggle('hide-aside')
|
252
|
+
}
|
253
|
+
toggleAplayer=function(){
|
254
|
+
$(".aplayer-fixed").toggle()
|
255
|
+
if(localStorage.getItem("aplayerhide")=="true"){
|
256
|
+
localStorage.setItem("aplayerhide",false);
|
257
|
+
}
|
258
|
+
else{
|
259
|
+
localStorage.setItem("aplayerhide",true);
|
260
|
+
}
|
261
|
+
}
|
262
|
+
// position = $(window).scrollTop();
|
263
|
+
// $(window).scroll(function () {
|
264
|
+
|
265
|
+
// scroll = $(window).scrollTop();
|
266
|
+
|
267
|
+
// if (scroll > position) {
|
268
|
+
// document.getElementsByTagName("header")[0].style.transform="translateY(58px)";
|
269
|
+
// } else {
|
270
|
+
|
271
|
+
|
272
|
+
// document.getElementsByTagName("header")[0].style.transform="";
|
273
|
+
|
274
|
+
// }
|
275
|
+
|
276
|
+
// position = scroll;
|
277
|
+
// });
|
278
|
+
toggleSakuras=function(){
|
279
|
+
isSakura=!isSakura;
|
280
|
+
stopp(isSakura);
|
281
|
+
if(localStorage.getItem("sakurahide")=="true"){
|
282
|
+
localStorage.setItem("sakurahide",false);
|
283
|
+
}
|
284
|
+
else{
|
285
|
+
localStorage.setItem("sakurahide",true);
|
286
|
+
}
|
287
|
+
}
|
288
|
+
switchAside=function(){
|
289
|
+
if(left){
|
290
|
+
document.getElementById("aside-content").classList.add("right");
|
291
|
+
document.querySelector(".layout > div:first-child").classList.add("left");
|
292
|
+
localStorage.setItem("leftAside","false");
|
293
|
+
}
|
294
|
+
else{
|
295
|
+
document.getElementById("aside-content").className="aside-content";
|
296
|
+
document.querySelector(".layout > div:first-child").className="";
|
297
|
+
try{
|
298
|
+
document.querySelector("#recent-posts").className="recent-posts";
|
299
|
+
}catch(err){}localStorage.setItem("leftAside","true");}
|
300
|
+
left=!left;
|
301
|
+
}
|
302
|
+
left=1;
|
303
|
+
if(localStorage.getItem("leftAside")=="true"||localStorage.getItem("leftAside")==null){
|
304
|
+
|
305
|
+
}else{
|
306
|
+
switchAside();
|
307
|
+
}
|
308
|
+
if(localStorage.getItem("autoTheme")=="true"){
|
309
|
+
document.getElementById("autoTheme").checked=true;
|
310
|
+
$("#con-mode,.rightMenu-item:has(.fa-moon)").hide();
|
311
|
+
var time=new Date();
|
312
|
+
if(time.getHours()<=7||time.getHours()>=19){
|
313
|
+
activateDarkMode()
|
314
|
+
localStorage.removeItem("theme");
|
315
|
+
}
|
316
|
+
else{
|
317
|
+
activateLightMode()
|
318
|
+
localStorage.removeItem("theme");
|
319
|
+
}
|
320
|
+
}
|
321
|
+
if(location.href.indexOf('posts')!=-1){
|
322
|
+
var xhr = new XMLHttpRequest();
|
323
|
+
var url = document.querySelector('#page-header').style.backgroundImage.split('url("')[1].split('")')[0];
|
324
|
+
xhr.open("GET","https://apis.yisous.xyz/api/imageColor?imgurl="+url, true);
|
325
|
+
xhr.send();
|
326
|
+
xhr.onreadystatechange = function () {
|
327
|
+
if (xhr.readyState===4) {
|
328
|
+
if(xhr.status===200) {
|
329
|
+
document.getElementById("themeColor").innerText=`:root{--lyx-theme:${xhr.responseText}!important}`;
|
330
|
+
}
|
331
|
+
}
|
332
|
+
}
|
333
|
+
}
|
334
|
+
toggleAutoTheme=()=>{
|
335
|
+
if(localStorage.getItem("autoTheme")=="true"){
|
336
|
+
localStorage.setItem("autoTheme","false");
|
337
|
+
$("#con-mode,.rightMenu-item:has(.fa-moon)").show();
|
338
|
+
}
|
339
|
+
else{
|
340
|
+
localStorage.setItem("autoTheme","true");
|
341
|
+
var time=new Date();
|
342
|
+
if(time.getHours()<=7||time.getHours()>=19){
|
343
|
+
activateDarkMode()
|
344
|
+
localStorage.removeItem("theme");
|
345
|
+
}
|
346
|
+
else{
|
347
|
+
activateLightMode()
|
348
|
+
localStorage.removeItem("theme");
|
349
|
+
}
|
350
|
+
$("#con-mode,.rightMenu-item:has(.fa-moon)").hide();
|
351
|
+
}
|
352
|
+
}
|
353
|
+
}
|