Skip to content

Commit

Permalink
Site updated: 2023-08-24 09:06:43
Browse files Browse the repository at this point in the history
  • Loading branch information
yihan12 committed Aug 24, 2023
1 parent ad9d885 commit ac3d104
Show file tree
Hide file tree
Showing 105 changed files with 24,746 additions and 0 deletions.

Large diffs are not rendered by default.

174 changes: 174 additions & 0 deletions 2022/03/10/Echarts/echarts--上下左右的距离(grid)/index.html

Large diffs are not rendered by default.

178 changes: 178 additions & 0 deletions 2022/03/10/Echarts/echarts--基准线markLine/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

168 changes: 168 additions & 0 deletions 2022/03/10/Echarts/echarts折线--无数据时连线与否/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

168 changes: 168 additions & 0 deletions 2022/03/10/Echarts/echarts设置从原点开始/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

189 changes: 189 additions & 0 deletions 2023/08/13/js去除中括号/index.html

Large diffs are not rendered by default.

200 changes: 200 additions & 0 deletions 2023/08/13/浏览器/ 【浏览器】之同源策略/index.html

Large diffs are not rendered by default.

583 changes: 583 additions & 0 deletions 2023/08/17/JavaScript/JavaScript面试/JavaScript面试/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

180 changes: 180 additions & 0 deletions 2023/08/23/leetcode/String/LeetCode 006:N 字形变换/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

182 changes: 182 additions & 0 deletions about/index.html

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions archives/2022/03/index.html

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions archives/2022/07/index.html

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions archives/2022/index.html

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions archives/2022/page/2/index.html

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions archives/2023/08/index.html

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions archives/2023/index.html

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions archives/index.html

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions archives/page/2/index.html

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions archives/page/3/index.html

Large diffs are not rendered by default.

653 changes: 653 additions & 0 deletions atom.xml

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions categories/Bug/index.html

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions categories/Bug/兼容性/img/index.html

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions categories/Bug/兼容性/index.html

Large diffs are not rendered by default.

174 changes: 174 additions & 0 deletions categories/index.html

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions categories/前端/Echarts/borderRadius/index.html

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions categories/前端/Echarts/boundaryGap/index.html

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions categories/前端/Echarts/connectNulls/index.html

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions categories/前端/Echarts/grid/index.html

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions categories/前端/Echarts/index.html

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions categories/前端/Echarts/itemStyle/index.html

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions categories/前端/Echarts/legend/index.html

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions categories/前端/Echarts/markLine/index.html

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions categories/前端/Echarts/symbol/index.html

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions categories/前端/Echarts/symbolSize/index.html

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions categories/前端/Echarts/xAxis/index.html

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions categories/前端/JavaScript/ES6/index.html

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions categories/前端/JavaScript/ES6/变量/index.html

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions categories/前端/JavaScript/ES6/解构/index.html

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions categories/前端/JavaScript/JavaScript深入理解/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions categories/前端/JavaScript/JavaScript深入理解/节流/index.html

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions categories/前端/JavaScript/JavaScript深入理解/防抖/index.html

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions categories/前端/JavaScript/JavaScript面试/index.html

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions categories/前端/JavaScript/index.html

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions categories/前端/JavaScript/lodash源码分析/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions categories/前端/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions categories/前端/leetcode/005最长回文子串/index.html

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions categories/前端/leetcode/006N-字形变换/index.html

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions categories/前端/leetcode/030串联所有单词的子串/index.html

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions categories/前端/leetcode/index.html

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions categories/前端/page/2/index.html

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions categories/前端/page/3/index.html

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions categories/前端/正则/index.html

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions categories/前端/浏览器/index.html

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions categories/前端/浏览器/同源策略/index.html

Large diffs are not rendered by default.

5,669 changes: 5,669 additions & 0 deletions css/index.css

Large diffs are not rendered by default.

File renamed without changes.
174 changes: 174 additions & 0 deletions friends/index.html

Large diffs are not rendered by default.

Binary file added images/avatar.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/avatar1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/bg.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/favicon.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/favicon1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/404.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/friend_404.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
264 changes: 264 additions & 0 deletions index.html

Large diffs are not rendered by default.

827 changes: 827 additions & 0 deletions js/main.js

Large diffs are not rendered by default.

177 changes: 177 additions & 0 deletions js/search/algolia.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
window.addEventListener('load', () => {
const $searchMask = document.getElementById('search-mask')
const $searchDialog = document.querySelector('#algolia-search .search-dialog')

const openSearch = () => {
const bodyStyle = document.body.style
bodyStyle.width = '100%'
bodyStyle.overflow = 'hidden'
btf.animateIn($searchMask, 'to_show 0.5s')
btf.animateIn($searchDialog, 'titleScale 0.5s')
setTimeout(() => { document.querySelector('#algolia-search .ais-SearchBox-input').focus() }, 100)

// shortcut: ESC
document.addEventListener('keydown', function f (event) {
if (event.code === 'Escape') {
closeSearch()
document.removeEventListener('keydown', f)
}
})

fixSafariHeight()
window.addEventListener('resize', fixSafariHeight)
}

const closeSearch = () => {
const bodyStyle = document.body.style
bodyStyle.width = ''
bodyStyle.overflow = ''
btf.animateOut($searchDialog, 'search_close .5s')
btf.animateOut($searchMask, 'to_hide 0.5s')
window.removeEventListener('resize', fixSafariHeight)
}

// fix safari
const fixSafariHeight = () => {
if (window.innerWidth < 768) {
$searchDialog.style.setProperty('--search-height', window.innerHeight + 'px')
}
}

const searchClickFn = () => {
document.querySelector('#search-button > .search').addEventListener('click', openSearch)
}

const searchFnOnce = () => {
$searchMask.addEventListener('click', closeSearch)
document.querySelector('#algolia-search .search-close-button').addEventListener('click', closeSearch)
}

const cutContent = content => {
if (content === '') return ''

const firstOccur = content.indexOf('<mark>')

let start = firstOccur - 30
let end = firstOccur + 120
let pre = ''
let post = ''

if (start <= 0) {
start = 0
end = 140
} else {
pre = '...'
}

if (end > content.length) {
end = content.length
} else {
post = '...'
}

const matchContent = pre + content.substring(start, end) + post
return matchContent
}

const algolia = GLOBAL_CONFIG.algolia
const isAlgoliaValid = algolia.appId && algolia.apiKey && algolia.indexName
if (!isAlgoliaValid) {
return console.error('Algolia setting is invalid!')
}

const search = instantsearch({
indexName: algolia.indexName,
/* global algoliasearch */
searchClient: algoliasearch(algolia.appId, algolia.apiKey),
searchFunction (helper) {
helper.state.query && helper.search()
}
})

const configure = instantsearch.widgets.configure({
hitsPerPage: 5
})

const searchBox = instantsearch.widgets.searchBox({
container: '#algolia-search-input',
showReset: false,
showSubmit: false,
placeholder: GLOBAL_CONFIG.algolia.languages.input_placeholder,
showLoadingIndicator: true
})

const hits = instantsearch.widgets.hits({
container: '#algolia-hits',
templates: {
item (data) {
const link = data.permalink ? data.permalink : (GLOBAL_CONFIG.root + data.path)
const result = data._highlightResult
const content = result.contentStripTruncate
? cutContent(result.contentStripTruncate.value)
: result.contentStrip
? cutContent(result.contentStrip.value)
: result.content
? cutContent(result.content.value)
: ''
return `
<a href="${link}" class="algolia-hit-item-link">
<span class="algolia-hits-item-title">${result.title.value || 'no-title'}</span>
<p class="algolia-hit-item-content">${content}</p>
</a>`
},
empty: function (data) {
return (
'<div id="algolia-hits-empty">' +
GLOBAL_CONFIG.algolia.languages.hits_empty.replace(/\$\{query}/, data.query) +
'</div>'
)
}
}
})

const stats = instantsearch.widgets.stats({
container: '#algolia-info > .algolia-stats',
templates: {
text: function (data) {
const stats = GLOBAL_CONFIG.algolia.languages.hits_stats
.replace(/\$\{hits}/, data.nbHits)
.replace(/\$\{time}/, data.processingTimeMS)
return (
`<hr>${stats}`
)
}
}
})

const powerBy = instantsearch.widgets.poweredBy({
container: '#algolia-info > .algolia-poweredBy'
})

const pagination = instantsearch.widgets.pagination({
container: '#algolia-pagination',
totalPages: 5,
templates: {
first: '<i class="fas fa-angle-double-left"></i>',
last: '<i class="fas fa-angle-double-right"></i>',
previous: '<i class="fas fa-angle-left"></i>',
next: '<i class="fas fa-angle-right"></i>'
}
})

search.addWidgets([configure, searchBox, hits, stats, powerBy, pagination]) // add the widgets to the instantsearch instance

search.start()

searchClickFn()
searchFnOnce()

window.addEventListener('pjax:complete', () => {
!btf.isHidden($searchMask) && closeSearch()
searchClickFn()
})

window.pjax && search.on('render', () => {
window.pjax.refresh(document.getElementById('algolia-hits'))
})
})
Loading

0 comments on commit ac3d104

Please sign in to comment.