diff --git a/scripts/filters/post.js b/scripts/filters/post.js index 23f3aab..5fb10ac 100644 --- a/scripts/filters/post.js +++ b/scripts/filters/post.js @@ -10,13 +10,13 @@ hexo.extend.filter.register('after_post_render', data => { const theme = hexo.theme.config; if (!theme.exturl && !theme.lazyload) return; if (theme.lazyload) { - data.content = data.content.replace(/(]*)src=/ig, '$1data-src='); + data.content = data.content.replace(/(]*)\ssrc=/ig, '$1 data-src='); } if (theme.exturl) { const siteHost = parse(config.url).hostname || config.url; // External URL icon const exturlIcon = theme.exturl_icon ? '' : ''; - data.content = data.content.replace(/]*href="([^"]+)"[^>]*>([^<]+)<\/a>/ig, (match, href, html) => { + data.content = data.content.replace(/]*\shref="([^"]+)"[^>]*>([^<]+)<\/a>/ig, (match, href, html) => { // Exit if the href attribute doesn't exists. if (!href) return match; diff --git a/source/js/third-party/search/algolia-search.js b/source/js/third-party/search/algolia-search.js index 2910b39..12a554c 100644 --- a/source/js/third-party/search/algolia-search.js +++ b/source/js/third-party/search/algolia-search.js @@ -42,8 +42,8 @@ document.addEventListener('DOMContentLoaded', () => { templates: { text: data => { const stats = CONFIG.i18n.hits_time - .replace(/\$\{hits}/, data.nbHits) - .replace(/\$\{time}/, data.processingTimeMS); + .replace('${hits}', data.nbHits) + .replace('${time}', data.processingTimeMS); return `${stats} Algolia`; } @@ -70,7 +70,7 @@ document.addEventListener('DOMContentLoaded', () => { }, empty: data => { return `
- ${CONFIG.i18n.empty.replace(/\$\{query}/, data.query)} + ${CONFIG.i18n.empty.replace('${query}', data.query)}
`; } }, diff --git a/source/js/third-party/search/local-search.js b/source/js/third-party/search/local-search.js index a3e5847..92a264d 100644 --- a/source/js/third-party/search/local-search.js +++ b/source/js/third-party/search/local-search.js @@ -39,7 +39,7 @@ document.addEventListener('DOMContentLoaded', () => { } return right.id - left.id; }); - const stats = CONFIG.i18n.hits.replace(/\$\{hits}/, resultItems.length); + const stats = CONFIG.i18n.hits.replace('${hits}', resultItems.length); container.classList.remove('no-result'); container.innerHTML = `
${stats}