fix: fixed footer theme info display error

This commit is contained in:
XPoet 2021-01-07 17:04:53 +08:00
parent 182868292a
commit a8c0054e69
2 changed files with 3 additions and 10 deletions

View File

@ -23,7 +23,7 @@
</div> </div>
<% } %> <% } %>
<div class="theme-info info-item"> <div class="theme-info info-item">
<%- __('powered_by', '<a target="_blank" href="https://hexo.io">Hexo</a>') %> | <%- __('theme') %> <a class="theme-version" target="_blank"></a> <%- __('powered_by', '<a target="_blank" href="https://hexo.io">Hexo</a>') %> | <%- __('theme') %> <a class="theme-version" target="_blank" href="https://github.com/XPoet/hexo-theme-keep">Keep v<%= theme.version %></a>
</div> </div>
</div> </div>
</footer> </footer>

View File

@ -1,21 +1,14 @@
window.addEventListener('DOMContentLoaded', () => { window.addEventListener('DOMContentLoaded', () => {
KEEP.themeInfo = { KEEP.themeInfo = {
theme: `Keep v${KEEP.theme_config.version}`,
author: 'XPoet', author: 'XPoet',
name: 'Keep',
version: KEEP.theme_config.version,
repository: 'https://github.com/XPoet/hexo-theme-keep' repository: 'https://github.com/XPoet/hexo-theme-keep'
} }
// print theme base info // print theme base info
KEEP.printThemeInfo = () => { KEEP.printThemeInfo = () => {
const themeInfo = `${KEEP.themeInfo.name} v${KEEP.themeInfo.version}`; console.log(`\n %c ${KEEP.themeInfo.theme} %c ${KEEP.themeInfo.repository} \n`, `color: #fadfa3; background: #333; padding: 5px 0;`, `background: #fadfa3; padding: 5px 0;`);
console.log(`\n %c ${themeInfo} %c ${KEEP.themeInfo.repository} \n`, `color: #fadfa3; background: #333; padding: 5px 0;`, `background: #fadfa3; padding: 5px 0;`);
const footThemeInfoDom = document.querySelector('.footer .info-container .theme-info a.theme-version');
if (footThemeInfoDom) {
footThemeInfoDom.setAttribute('href', KEEP.themeInfo.repository);
footThemeInfoDom.innerHTML = themeInfo;
}
} }
KEEP.refresh = () => { KEEP.refresh = () => {