perf: modified printThemeInfo()
This commit is contained in:
parent
3abec3cb33
commit
5b925fd5d1
|
@ -7,6 +7,17 @@ window.addEventListener('DOMContentLoaded', () => {
|
||||||
repository: 'https://github.com/XPoet/hexo-theme-keep'
|
repository: 'https://github.com/XPoet/hexo-theme-keep'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// print theme base info
|
||||||
|
KEEP.printThemeInfo = () => {
|
||||||
|
const themeInfo = `${KEEP.themeInfo.name} v${KEEP.themeInfo.version}`;
|
||||||
|
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 = () => {
|
||||||
KEEP.initUtils();
|
KEEP.initUtils();
|
||||||
KEEP.initHeaderShrink();
|
KEEP.initHeaderShrink();
|
||||||
|
@ -26,5 +37,6 @@ window.addEventListener('DOMContentLoaded', () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
KEEP.printThemeInfo();
|
||||||
KEEP.refresh();
|
KEEP.refresh();
|
||||||
});
|
});
|
||||||
|
|
|
@ -15,17 +15,6 @@ KEEP.initUtils = () => {
|
||||||
prevScrollValue: 0,
|
prevScrollValue: 0,
|
||||||
defaultFontSize: 0,
|
defaultFontSize: 0,
|
||||||
|
|
||||||
// print theme base info
|
|
||||||
printThemeInfo() {
|
|
||||||
const themeInfo = `${KEEP.themeInfo.name} v${KEEP.themeInfo.version}`;
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// Scroll Style Handle
|
// Scroll Style Handle
|
||||||
styleHandleWhenScroll() {
|
styleHandleWhenScroll() {
|
||||||
const scrollTop = document.body.scrollTop || document.documentElement.scrollTop;
|
const scrollTop = document.body.scrollTop || document.documentElement.scrollTop;
|
||||||
|
@ -282,9 +271,6 @@ KEEP.initUtils = () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// print theme info
|
|
||||||
KEEP.utils.printThemeInfo();
|
|
||||||
|
|
||||||
// init scroll
|
// init scroll
|
||||||
KEEP.utils.registerWindowScroll();
|
KEEP.utils.registerWindowScroll();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue