diff --git a/themes/chameleon/layout/_partial/after-footer.ejs b/themes/chameleon/layout/_partial/after-footer.ejs index 39fc077..6085256 100644 --- a/themes/chameleon/layout/_partial/after-footer.ejs +++ b/themes/chameleon/layout/_partial/after-footer.ejs @@ -1,6 +1,6 @@ <% if (is_post()) { %> -<%- addJs({ src: '/libs/clipboard.js/2.0.4/clipboard.min.js', 'data-sri-fallback': '/js/clipboard.min.js', integrity: 'sha384-8CYhPwYlLELodlcQV713V9ZikA3DlCVaXFDpjHfP8Z36gpddf/Vrt47XmKDsCttu', crossorigin: 'anonymous', defer: true}) %> +<%- js({ src: '/libs/clipboard.js/2.0.4/clipboard.min.js', 'data-sri-fallback': '/js/clipboard.min.js', integrity: 'sha384-8CYhPwYlLELodlcQV713V9ZikA3DlCVaXFDpjHfP8Z36gpddf/Vrt47XmKDsCttu', crossorigin: 'anonymous', defer: true}) %> <% } %> -<%/* javascript of Typing theme */%> -<%- addJs('/js/chameleon.js') %> +<%/* javascript of Chameleon theme */%> +<%- js('/js/chameleon.js') %> diff --git a/themes/chameleon/layout/_partial/head.ejs b/themes/chameleon/layout/_partial/head.ejs index 5ce879c..090eddf 100644 --- a/themes/chameleon/layout/_partial/head.ejs +++ b/themes/chameleon/layout/_partial/head.ejs @@ -44,11 +44,12 @@ <%/* Fallback function for SRI */%> - <%- addJs({ src: '/js/sri.min.js', 'async': true }) %> + <%- js({ src: '/js/sri.min.js', 'async': true }) %> - <%- addCss('/css/chameleon.css') %> + <%/* CSS of Chameleon theme */%> + <%- css('/css/chameleon.css') %> <% if (theme.icons) { %> - <%- addCss({ href: '/libs/fork-awesome/1.1.7/css/fork-awesome.min.css', 'data-sri-fallback': '/forkawesome/css/fork-awesome.min.css', integrity: 'sha384-mByhW6NjnxyShh67P9+fepUvYSd7Uz/qV6e2u4kA2Fi4ZkjXxIP2mRkyK9dwK24W', crossorigin: 'anonymous' }) %> + <%- css({ href: '/libs/fork-awesome/1.1.7/css/fork-awesome.min.css', 'data-sri-fallback': '/forkawesome/css/fork-awesome.min.css', integrity: 'sha384-mByhW6NjnxyShh67P9+fepUvYSd7Uz/qV6e2u4kA2Fi4ZkjXxIP2mRkyK9dwK24W', crossorigin: 'anonymous' }) %> <% } %> diff --git a/themes/chameleon/scripts/addCss.js b/themes/chameleon/scripts/addCss.js deleted file mode 100644 index 5f200ac..0000000 --- a/themes/chameleon/scripts/addCss.js +++ /dev/null @@ -1,32 +0,0 @@ -'use strict' -/* global hexo */ - -/* -* Helper to embed css file with support of custom attributes -* https://github.com/hexojs/hexo/pull/3690 -*/ - -hexo.extend.helper.register('addCss', (...args) => { - let result = '\n' - let items = args - - if (!Array.isArray(args)) { - items = [args] - } - - items.forEach(item => { - // Old syntax - if (typeof item === 'string' || item instanceof String) { - result += `\n` - } else { - // New syntax - let tmpResult = ' { - tmpResult += ` ${attribute}="${item[attribute]}"` - }) - tmpResult += '>\n' - result += tmpResult - } - }) - return result -}) diff --git a/themes/chameleon/scripts/addJs.js b/themes/chameleon/scripts/addJs.js deleted file mode 100644 index 0851732..0000000 --- a/themes/chameleon/scripts/addJs.js +++ /dev/null @@ -1,33 +0,0 @@ -'use strict' -/* global hexo */ - -/* -* Helper to add \n` - } else { - // New syntax - let tmpResult = ' { - if (item[attribute] === true) tmpResult += ' ' + attribute - else tmpResult += ` ${attribute}="${item[attribute]}"` - }) - tmpResult += '>\n' - result += tmpResult - } - }) - return result -})