hexo-theme-next
Advanced tools
Comparing version 8.5.0 to 8.6.0
{ | ||
"name": "hexo-theme-next", | ||
"version": "8.5.0", | ||
"version": "8.6.0", | ||
"description": "Elegant and powerful theme for Hexo.", | ||
@@ -35,9 +35,9 @@ "main": "package.json", | ||
"devDependencies": { | ||
"@next-theme/eslint-config": "0.0.2", | ||
"@next-theme/eslint-config": "0.0.3", | ||
"chai": "4.3.4", | ||
"eslint": "7.27.0", | ||
"eslint": "7.29.0", | ||
"hexo": "5.4.0", | ||
"hexo-renderer-marked": "4.0.0", | ||
"js-yaml": "4.1.0", | ||
"mocha": "8.4.0", | ||
"mocha": "9.0.1", | ||
"nyc": "15.1.0", | ||
@@ -44,0 +44,0 @@ "stylint": "2.0.0" |
@@ -31,3 +31,3 @@ 'use strict'; | ||
} | ||
this.raws.push({name, raw, args}); | ||
this.raws.push({ name, raw, args }); | ||
} | ||
@@ -34,0 +34,0 @@ file(name, file, ...args) { |
@@ -13,3 +13,3 @@ /* global hexo */ | ||
injects.comment.raw('changyan', '<div class="comments" id="SOHUCS"></div>', {}, {cache: true}); | ||
injects.comment.raw('changyan', '<div class="comments" id="SOHUCS"></div>', {}, { cache: true }); | ||
@@ -16,0 +16,0 @@ injects.bodyEnd.file('changyan', path.join(hexo.theme_dir, 'layout/_third-party/comments/changyan.njk')); |
@@ -17,3 +17,3 @@ /* global hexo */ | ||
</div> | ||
`, {}, {cache: true}); | ||
`, {}, { cache: true }); | ||
@@ -20,0 +20,0 @@ injects.bodyEnd.file('disqus', path.join(hexo.theme_dir, 'layout/_third-party/comments/disqus.njk')); |
@@ -16,3 +16,3 @@ /* global hexo */ | ||
</div> | ||
`, {}, {cache: true}); | ||
`, {}, { cache: true }); | ||
@@ -19,0 +19,0 @@ injects.bodyEnd.file('disqusjs', path.join(hexo.theme_dir, 'layout/_third-party/comments/disqusjs.njk')); |
@@ -12,3 +12,3 @@ /* global hexo */ | ||
injects.comment.raw('gitalk', '<div class="comments gitalk-container"></div>', {}, {cache: true}); | ||
injects.comment.raw('gitalk', '<div class="comments gitalk-container"></div>', {}, { cache: true }); | ||
@@ -15,0 +15,0 @@ injects.bodyEnd.file('gitalk', path.join(hexo.theme_dir, 'layout/_third-party/comments/gitalk.njk')); |
@@ -12,3 +12,3 @@ /* global hexo */ | ||
injects.comment.raw('livere', '<div class="comments" id="lv-container" data-id="city" data-uid="{{ theme.livere_uid }}"></div>', {}, {cache: true}); | ||
injects.comment.raw('livere', '<div class="comments" id="lv-container" data-id="city" data-uid="{{ theme.livere_uid }}"></div>', {}, { cache: true }); | ||
@@ -15,0 +15,0 @@ injects.bodyEnd.file('livere', path.join(hexo.theme_dir, 'layout/_third-party/comments/livere.njk')); |
@@ -66,2 +66,6 @@ /* global hexo */ | ||
if (!theme.gitter.enable) { | ||
hexo.route.remove('js/third-party/chat/gitter.js'); | ||
} | ||
// Comments | ||
@@ -68,0 +72,0 @@ if (!theme.changyan.enable || !theme.changyan.appid || !theme.changyan.appkey) { |
@@ -44,6 +44,5 @@ /* global hexo */ | ||
hexo.extend.helper.register('next_data', function(name, ...data) { | ||
const { escape_html } = this; | ||
const json = data.length === 1 ? data[0] : Object.assign({}, ...data); | ||
return `<script class="next-config" data-name="${name}" type="application/json">${ | ||
escape_html(JSON.stringify(json)) | ||
JSON.stringify(json).replace(/</g, '\\u003c') | ||
}</script>`; | ||
@@ -50,0 +49,0 @@ }); |
@@ -9,10 +9,5 @@ if (!window.NexT) window.NexT = {}; | ||
const parse = (text) => { | ||
const jsonString = new DOMParser() | ||
.parseFromString(text, 'text/html').documentElement | ||
.textContent; | ||
return JSON.parse(jsonString || '{}'); | ||
}; | ||
const parse = text => JSON.parse(text || '{}'); | ||
const update = (name) => { | ||
const update = name => { | ||
const targetEle = document.querySelector(`.${className}[data-name="${name}"]`); | ||
@@ -52,3 +47,3 @@ if (!targetEle) return; | ||
// Mix, proxy changes to the override. | ||
return new Proxy({...existing, ...override}, { | ||
return new Proxy({ ...existing, ...override }, { | ||
set(target, prop, value) { | ||
@@ -55,0 +50,0 @@ target[prop] = value; |
@@ -79,2 +79,3 @@ /* global NexT, CONFIG */ | ||
NexT.utils.registerSidebarTOC(); | ||
NexT.utils.registerPostReward(); | ||
NexT.utils.wrapTableWithBox(); | ||
@@ -81,0 +82,0 @@ NexT.utils.registerVideoIframe(); |
@@ -1,10 +0,19 @@ | ||
/* global CONFIG */ | ||
/* global CONFIG, Chatra */ | ||
if (CONFIG.chatra.embed) { | ||
window.ChatraSetup = { | ||
mode : 'frame', | ||
injectTo: CONFIG.chatra.embed | ||
}; | ||
} | ||
(function() { | ||
if (CONFIG.chatra.embed) { | ||
window.ChatraSetup = { | ||
mode : 'frame', | ||
injectTo: CONFIG.chatra.embed | ||
}; | ||
} | ||
window.ChatraID = CONFIG.chatra.id; | ||
window.ChatraID = CONFIG.chatra.id; | ||
const chatButton = document.querySelector('.sidebar-button button'); | ||
if (chatButton) { | ||
chatButton.addEventListener('click', () => { | ||
Chatra('openChat', true); | ||
}); | ||
} | ||
})(); |
@@ -7,3 +7,3 @@ /* global NexT, CONFIG */ | ||
`https://changyan.sohu.com/upload/plugins/plugins.list.count.js?clientId=${CONFIG.changyan.appid}`, | ||
{ attributes: {id: 'cy_cmt_num' } } | ||
{ attributes: { id: 'cy_cmt_num' } } | ||
); | ||
@@ -10,0 +10,0 @@ } else if (CONFIG.page.comments) { |
@@ -9,3 +9,3 @@ /* global NexT, CONFIG, MathJax */ | ||
tex: { | ||
inlineMath: {'[+]': [['$', '$']]}, | ||
inlineMath: { '[+]': [['$', '$']] }, | ||
tags : CONFIG.mathjax.tags | ||
@@ -12,0 +12,0 @@ }, |
@@ -14,3 +14,3 @@ /* global CONFIG, WPac */ | ||
const newWidgets = widgets.map(widget => ({...widget})); | ||
const newWidgets = widgets.map(widget => ({ ...widget })); | ||
@@ -17,0 +17,0 @@ if (window.WPac) { |
@@ -26,3 +26,3 @@ /* global CONFIG, firebase */ | ||
const appendCountTo = (el) => { | ||
const appendCountTo = el => { | ||
return count => { | ||
@@ -29,0 +29,0 @@ el.innerText = count; |
@@ -5,3 +5,3 @@ /* global CONFIG */ | ||
(function() { | ||
const leancloudSelector = (url) => { | ||
const leancloudSelector = url => { | ||
url = encodeURI(url); | ||
@@ -11,3 +11,3 @@ return document.getElementById(url).querySelector('.leancloud-visitors-count'); | ||
const addCount = (Counter) => { | ||
const addCount = Counter => { | ||
const visitors = document.querySelector('.leancloud_visitors'); | ||
@@ -17,5 +17,5 @@ const url = decodeURI(visitors.id); | ||
Counter('get', `/classes/Counter?where=${encodeURIComponent(JSON.stringify({url}))}`) | ||
Counter('get', `/classes/Counter?where=${encodeURIComponent(JSON.stringify({ url }))}`) | ||
.then(response => response.json()) | ||
.then(({results}) => { | ||
.then(({ results }) => { | ||
if (results.length > 0) { | ||
@@ -37,3 +37,3 @@ const counter = results[0]; | ||
} else { | ||
Counter('post', '/classes/Counter', {title, url, time: 1}) | ||
Counter('post', '/classes/Counter', { title, url, time: 1 }) | ||
.then(response => response.json()) | ||
@@ -53,3 +53,3 @@ .then(() => { | ||
const showTime = (Counter) => { | ||
const showTime = Counter => { | ||
const visitors = document.querySelectorAll('.leancloud_visitors'); | ||
@@ -60,5 +60,5 @@ const entries = [...visitors].map(element => { | ||
Counter('get', `/classes/Counter?where=${encodeURIComponent(JSON.stringify({url: {'$in': entries}}))}`) | ||
Counter('get', `/classes/Counter?where=${encodeURIComponent(JSON.stringify({ url: { '$in': entries } }))}`) | ||
.then(response => response.json()) | ||
.then(({results}) => { | ||
.then(({ results }) => { | ||
for (const url of entries) { | ||
@@ -74,4 +74,4 @@ const target = results.find(item => item.url === url); | ||
const {app_id, app_key, server_url} = CONFIG.leancloud_visitors; | ||
const fetchData = (api_server) => { | ||
const { app_id, app_key, server_url } = CONFIG.leancloud_visitors; | ||
const fetchData = api_server => { | ||
const Counter = (method, url, data) => { | ||
@@ -104,3 +104,3 @@ return fetch(`${api_server}/1.1${url}`, { | ||
.then(response => response.json()) | ||
.then(({api_server}) => { | ||
.then(({ api_server }) => { | ||
fetchData(`https://${api_server}`); | ||
@@ -107,0 +107,0 @@ }); |
@@ -19,5 +19,5 @@ /* global NexT, CONFIG, mermaid */ | ||
logLevel : 3, | ||
flowchart: {curve: 'linear'}, | ||
gantt : {axisFormat: '%m/%d/%Y'}, | ||
sequence : {actorMargin: 50} | ||
flowchart: { curve: 'linear' }, | ||
gantt : { axisFormat: '%m/%d/%Y' }, | ||
sequence : { actorMargin: 50 } | ||
}, '.mermaid'); | ||
@@ -24,0 +24,0 @@ }); |
@@ -25,3 +25,3 @@ /* global NexT, CONFIG */ | ||
if (document.readyState === 'loading') { | ||
document.addEventListener('readystatechange', onPageLoaded, {once: true}); | ||
document.addEventListener('readystatechange', onPageLoaded, { once: true }); | ||
} else { | ||
@@ -286,2 +286,10 @@ onPageLoaded(); | ||
registerPostReward: function() { | ||
const button = document.querySelector('.reward-container button'); | ||
if (!button) return; | ||
button.addEventListener('click', () => { | ||
document.querySelector('.post-reward').classList.toggle('active'); | ||
}); | ||
}, | ||
activateNavByIndex: function(index) { | ||
@@ -397,3 +405,3 @@ const target = document.querySelectorAll('.post-toc li a.nav-link')[index]; | ||
} | ||
return new Promise((resolve) => { | ||
return new Promise(resolve => { | ||
const element = document.querySelector(selector); | ||
@@ -400,0 +408,0 @@ if (!CONFIG.comments.lazyload || !element) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
444169
269
3044