Skip to content

Commit

Permalink
Update blog files
Browse files Browse the repository at this point in the history
  • Loading branch information
windshadow233 committed May 6, 2024
1 parent 076f069 commit 5bd69f3
Show file tree
Hide file tree
Showing 8 changed files with 355 additions and 9 deletions.
1 change: 1 addition & 0 deletions _config.butterfly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1080,6 +1080,7 @@ inject:
}
</script>
- <link rel="stylesheet" href="/css/custom.css">
- <script src="/js/githubcalendar.js"></script>
# - <script src="xxxx"></script>

# CDN
Expand Down
1 change: 0 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,4 +176,3 @@ encrypt:
message: 请输入密码~
abstract: 输入密码查看加密内容~
wrong_pass_message: 抱歉, 这个密码似乎不太对, 请再试试.

6 changes: 0 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"hexo-generator-search": "^2.4.3",
"hexo-generator-sitemap": "^3.0.1",
"hexo-generator-tag": "^2.0.0",
"hexo-history-calendar": "^1.0.3",
"hexo-renderer-kramed": "^0.1.4",
"hexo-renderer-pug": "^3.0.0",
"hexo-renderer-stylus": "^3.0.1",
Expand Down
73 changes: 73 additions & 0 deletions scripts/history-calendar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
function priority_history_calendar(){
var priority = 0
if(hexo.config.history_calendar.priority){
priority = hexo.config.history_calendar.priority
}
else{
priority = 0
}
return priority
}

function common_injector(name, item_comfig, temple_html_text, js_text, css_text) {
if (item_comfig.enable) {
if (temple_html_text !== '') {
var layout_name;
var layout_type;
var layout_index = 0;
if (item_comfig.layout_id) {
layout_name = item_comfig.layout_id;
layout_type = 'id';
} else {
layout_name = item_comfig.layout.name;
layout_type = item_comfig.layout.type;
layout_index = item_comfig.layout.index;
}
var get_layout
if (layout_type === 'class') {
get_layout = `document.getElementsByClassName('${layout_name}')[${layout_index}]`
} else if (layout_type === 'id') {
get_layout = `document.getElementById('${layout_name}')`
} else {
get_layout = `document.getElementById('${layout_name}')`
}
var user_info_js = `<script data-pjax>function ${name}_injector_config(){
var parent_div_git = ${get_layout};
var item_html = '${temple_html_text}';
var exists = document.querySelectorAll('.card-history');
exists.forEach(item => {document.querySelector('#aside-content').removeChild(item);})
// console.log('已挂载${name}')
// parent_div_git.innerHTML=item_html+parent_div_git.innerHTML // 无报错,但不影响使用(支持pjax跳转)
parent_div_git.insertAdjacentHTML("beforebegin",item_html) // 有报错,但不影响使用(支持pjax跳转)
}if( ${get_layout} && (location.pathname ==='${item_comfig.enable_page}'|| '${item_comfig.enable_page}' ==='all')){
${name}_injector_config()
} </script>`
}
hexo.extend.injector.register('body_end', user_info_js, "default");
if (js_text !== '') {
hexo.extend.injector.register('body_end', js_text, "default");
}
if (css_text !== '') {
hexo.extend.injector.register('head_end', css_text, "default");
}
}
}

hexo.extend.filter.register('after_generate',function() {
if(hexo.config.history_calendar.enable){
var history_calendar = hexo.config.history_calendar;
if(hexo.config.swiper && hexo.config.swiper.enable){
var css_text =`<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Zfour/Butterfly-card-history/baiduhistory/css/main.css">`;
var js_text =`<script data-pjax src="https://cdn.jsdelivr.net/gh/Zfour/Butterfly-card-history/baiduhistory/js/main.js"></script>`

}else{
var css_text =`<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper/swiper-bundle.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Zfour/Butterfly-card-history/baiduhistory/css/main.css">`;
var js_text =`<script src="https://cdn.jsdelivr.net/npm/swiper/swiper-bundle.min.js"></script><script data-pjax src="https://cdn.jsdelivr.net/gh/Zfour/Butterfly-card-history/baiduhistory/js/main.js"></script>`

}
common_injector('history_calendar', history_calendar,history_calendar.temple_html,js_text,css_text)
}


},priority_history_calendar())
2 changes: 1 addition & 1 deletion source/css/pace_progress_bar.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
right: 0;
height: 8px;
border-radius: 8px;
width: 4rem;
width: 12rem;
background: #eaecf2;
border: 1px #e3e8f7;
overflow: hidden;
Expand Down
Loading

0 comments on commit 5bd69f3

Please sign in to comment.