Use strict mode & update comments

This commit is contained in:
Mimi 2020-07-28 00:03:21 +08:00
parent 1f26b10d27
commit d871eedbb6
4 changed files with 8 additions and 5 deletions

View File

@ -1,8 +1,10 @@
'use strict';
const fs = require('fs');
const path = require('path');
function resolve(package) {
return path.dirname(require.resolve(`${package}/package.json`));
function resolve(name) {
return path.dirname(require.resolve(`${name}/package.json`));
}
function highlightTheme(name) {

View File

@ -2,6 +2,7 @@
'use strict';
// https://developers.google.com/fonts/docs/getting_started
hexo.extend.helper.register('next_font', function() {
const config = this.theme.font;
@ -18,7 +19,7 @@ hexo.extend.helper.register('next_font', function() {
}
});
fontFamilies = fontFamilies.map(name => name.trim() + fontStyles);
fontFamilies = fontFamilies.map(name => name.trim().replace(/\s/g, '+') + fontStyles);
fontFamilies = [...new Set(fontFamilies)].join('|');
// Merge extra parameters to the final processed font string

View File

@ -1,5 +1,5 @@
/**
* video.js | https://theme-next.js.org/docs/tag-plugins/video
* video.js | https://theme-next.js.org/docs/tag-plugins/
*/
/* global hexo */

View File

@ -219,7 +219,7 @@ document.addEventListener('DOMContentLoaded', () => {
url : element.querySelector('url').textContent
};
}) : JSON.parse(res);
// Only match articles with not empty titles
// Only match articles with non-empty titles
datas = datas.filter(data => data.title).map(data => {
data.title = data.title.trim();
data.content = data.content ? data.content.trim().replace(/<[^>]+>/g, '') : '';