Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vvusu/vvusu.github.io
vvusu.github.io
https://github.com/vvusu/vvusu.github.io
Last synced: about 1 month ago
JSON representation
vvusu.github.io
- Host: GitHub
- URL: https://github.com/vvusu/vvusu.github.io
- Owner: vvusu
- Created: 2023-10-24T12:51:20.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-25T03:46:17.000Z (about 1 year ago)
- Last Synced: 2023-10-26T03:28:01.931Z (about 1 year ago)
- Language: HTML
- Size: 1.3 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.html
Awesome Lists containing this project
README
VVUSU | VVUSU
(adsbygoogle = window.adsbygoogle || []).push({
google_ad_client: 'ca-pub-7021409880699000',
enable_page_level_ads: 'true'
});const GLOBAL_CONFIG = {
root: '/',
algolia: undefined,
localSearch: {"path":"/search.xml","preload":false,"top_n_per_article":1,"unescape":false,"languages":{"hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found"}},
translate: {"defaultEncoding":1,"translateDelay":0,"msgToTraditionalChinese":"็น","msgToSimplifiedChinese":"็ฐก"},
noticeOutdate: undefined,
highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
copy: {
success: 'Copy successfully',
error: 'Copy error',
noSupport: 'The browser does not support'
},
relativeDate: {
homepage: true,
post: true
},
runtime: 'days',
dateSuffix: {
just: 'Just',
min: 'minutes ago',
hour: 'hours ago',
day: 'days ago',
month: 'months ago'
},
copyright: {"limitCount":50,"languages":{"author":"Author: vvusu","link":"Link: ","source":"Source: VVUSU","info":"Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source."}},
lightbox: 'fancybox',
Snackbar: undefined,
source: {
justifiedGallery: {
js: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.js',
css: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.css'
}
},
isPhotoFigcaption: false,
islazyload: false,
isAnchor: false,
percent: {
toc: true,
rightside: true,
},
autoDarkmode: false
}var GLOBAL_CONFIG_SITE = {
title: 'VVUSU',
isPost: false,
isHome: false,
isHighlightShrink: false,
isToc: false,
postUpdate: '2023-09-14 18:02:31'
}
#nav {
opacity: 1
}
.justified-gallery img {
opacity: 1
}#recent-posts time,
#post-meta time {
display: inline !important
}
(win=>{
win.saveToLocal = {
set: function setWithExpiry(key, value, ttl) {
if (ttl === 0) return
const now = new Date()
const expiryDay = ttl * 86400000
const item = {
value: value,
expiry: now.getTime() + expiryDay,
}
localStorage.setItem(key, JSON.stringify(item))
},get: function getWithExpiry(key) {
const itemStr = localStorage.getItem(key)if (!itemStr) {
return undefined
}
const item = JSON.parse(itemStr)
const now = new Date()if (now.getTime() > item.expiry) {
localStorage.removeItem(key)
return undefined
}
return item.value
}
}
win.getScript = url => new Promise((resolve, reject) => {
const script = document.createElement('script')
script.src = url
script.async = true
script.onerror = reject
script.onload = script.onreadystatechange = function() {
const loadState = this.readyState
if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
script.onload = script.onreadystatechange = null
resolve()
}
document.head.appendChild(script)
})
win.getCSS = (url,id = false) => new Promise((resolve, reject) => {
const link = document.createElement('link')
link.rel = 'stylesheet'
link.href = url
if (id) link.id = id
link.onerror = reject
link.onload = link.onreadystatechange = function() {
const loadState = this.readyState
if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
link.onload = link.onreadystatechange = null
resolve()
}
document.head.appendChild(link)
})
win.activateDarkMode = function () {
document.documentElement.setAttribute('data-theme', 'dark')
if (document.querySelector('meta[name="theme-color"]') !== null) {
document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
}
}
win.activateLightMode = function () {
document.documentElement.setAttribute('data-theme', 'light')
if (document.querySelector('meta[name="theme-color"]') !== null) {
document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
}
}
const t = saveToLocal.get('theme')
if (t === 'dark') activateDarkMode()
else if (t === 'light') activateLightMode()
const asideStatus = saveToLocal.get('aside-status')
if (asideStatus !== undefined) {
if (asideStatus === 'hide') {
document.documentElement.classList.add('hide-aside')
} else {
document.documentElement.classList.remove('hide-aside')
}
}
const detectApple = () => {
if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
document.documentElement.classList.add('apple')
}
}
detectApple()
})(window)
(() => {
const $mermaid = document.querySelectorAll('#article-container .mermaid-wrap')
if ($mermaid.length === 0) return
const runMermaid = () => {
window.loadMermaid = true
const theme = document.documentElement.getAttribute('data-theme') === 'dark' ? 'dark' : 'default'Array.from($mermaid).forEach((item, index) => {
const mermaidSrc = item.firstElementChild
const mermaidThemeConfig = '%%{init:{ \'theme\':\'' + theme + '\'}}%%\n'
const mermaidID = 'mermaid-' + index
const mermaidDefinition = mermaidThemeConfig + mermaidSrc.textContentconst renderFn = mermaid.render(mermaidID, mermaidDefinition)
const renderV10 = () => {
renderFn.then(({svg}) => {
mermaidSrc.insertAdjacentHTML('afterend', svg)
})
}const renderV9 = svg => {
mermaidSrc.insertAdjacentHTML('afterend', svg)
}typeof renderFn === 'string' ? renderV9(renderFn) : renderV10()
})
}const loadMermaid = () => {
window.loadMermaid ? runMermaid() : getScript('https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js').then(runMermaid)
}btf.addModeChange('mermaid', runMermaid)
window.pjax ? loadMermaid() : document.addEventListener('DOMContentLoaded', loadMermaid)
})()function loadDisqus () {
const disqus_config = function () {
this.page.url = 'http://blog.vvusu.com/README.html'
this.page.identifier = '/README.html'
this.page.title = ''
}const disqusReset = () => {
DISQUS.reset({
reload: true,
config: disqus_config
})
}btf.addModeChange('disqus', disqusReset)
if (window.DISQUS) disqusReset()
else {
(function() {
var d = document, s = d.createElement('script');
s.src = 'https://blog-vvusu-com.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
}
}if ('Disqus' === 'Disqus' || !true) {
if (true) btf.loadComment(document.getElementById('disqus_thread'), loadDisqus)
else loadDisqus()
} else {
function loadOtherComment () {
loadDisqus()
}
}
window.addEventListener('load', () => {
const changeContent = (content) => {
if (content === '') return contentcontent = content.replace(/<img.*?src="(.*?)"?[^\>]+>/ig, '[image]') // replace image link
content = content.replace(/<a[^>]+?href=["']?([^"']+)["']?[^>]*>([^<]+)<\/a>/gi, '[link]') // replace url
content = content.replace(/<code>.*?<\/code>/gi, '[code]') // replace code
content = content.replace(/<[^>]+>/g,"") // remove html tagif (content.length > 150) {
content = content.substring(0,150) + '...'
}
return content
}const getComment = () => {
fetch('https://disqus.com/api/3.0/forums/listPosts.json?forum=blog-vvusu-com&related=thread&limit=6&api_key=')
.then(response => response.json())
.then(data => {
const disqusArray = data.response.map(item => {
return {
'avatar': item.author.avatar.cache,
'content': changeContent(item.message),
'nick': item.author.name,
'url': item.url,
'date': item.createdAt
}
})saveToLocal.set('disqus-newest-comments', JSON.stringify(disqusArray), 10/(60*24))
generateHtml(disqusArray)
}).catch(e => {
const $dom = document.querySelector('#card-newest-comments .aside-list')
$dom.textContent= "Unable to get the data, please make sure the settings are correct."
})
}const generateHtml = array => {
let result = ''if (array.length) {
for (let i = 0; i < array.length; i++) {
result += '<div class=\'aside-list-item\'>'if (true) {
const name = 'src'
result += `<a href='${array[i].url}' class='thumbnail'><img ${name}='${array[i].avatar}' alt='${array[i].nick}'></a>`
}
result += `<div class='content'>
<a class='comment' href='${array[i].url}' title='${array[i].content}'>${array[i].content}</a>
<div class='name'><span>${array[i].nick}</span><time> / ${btf.diffDate(array[i].date, true)}</time></div>
</div></div>`
}
} else {
result += 'No Comment'
}let $dom = document.querySelector('#card-newest-comments .aside-list')
$dom.innerHTML= result
window.lazyLoadInstance && window.lazyLoadInstance.update()
window.pjax && window.pjax.refresh($dom)
}const newestCommentInit = () => {
if (document.querySelector('#card-newest-comments .aside-list')) {
const data = saveToLocal.get('disqus-newest-comments')
if (data) {
generateHtml(JSON.parse(data))
} else {
getComment()
}
}
}newestCommentInit()
document.addEventListener('pjax:complete', newestCommentInit)
})
Search
Loading the Database
Comment