加载中...
card-newest-comments .aside-list') $dom.innerHTML= result window.lazyLoadInstance && window.lazyLoadInstance.update() window.pjax && window.pjax.refresh($dom) } const getComment = () => { const serverURL = 'https://b9Xc8bot.api.lncldglobal.com' var settings = { "method": "GET", "headers": { "X-LC-Id": 'b9Xc8botwAAeh4drWtmvVMOn-MdYXbMMI', "X-LC-Key": 'PYcn0BFYdI8RXz3S4itWbjfG', "Content-Type": "application/json" }, } fetch(`${serverURL}/1.1/classes/Comment?limit=6&order=-createdAt`,settings) .then(response => response.json()) .then(data => { const valineArray = data.results.map(function (e) { return { 'avatar': getIcon(e.QQAvatar, e.mail), 'content': changeContent(e.comment), 'nick': e.nick, 'url': e.url + '#' + e.objectId, 'date': e.updatedAt, } }) saveToLocal.set('valine-newest-comments', JSON.stringify(valineArray), 10/(60*24)) generateHtml(valineArray) }).catch(e => { const $dom = document.querySelector('#card-newest-comments .aside-list') $dom.innerHTML= "无法获取评论,请确认相关配置是否正确" }) } const newestCommentInit = () => { if (document.querySelector('#card-newest-comments .aside-list')) { const data = saveToLocal.get('valine-newest-comments') if (data) { generateHtml(JSON.parse(data)) } else { getComment() } } } newestCommentInit() document.addEventListener('pjax:complete', newestCommentInit) })
f', '#30021f']; var git_user ="desirefire"; var parent_div_git = document.getElementById("recent-posts"); var git_div_html = '
'; if(parent_div_git){ // parent_div_git.innerHTML=git_div_html+parent_div_git.innerHTML // 无报错,但不影响使用(支持pjax跳转) parent_div_git.insertAdjacentHTML("afterbegin",git_div_html) // 有报错,但不影响使用(支持pjax跳转) }; GithubCalendar(git_githubapiurl,git_color,git_user) } if(document.getElementById("recent-posts")){ GithubCalendarConfig() }