Skip to content

Commit

Permalink
添加后台首页选择功能
Browse files Browse the repository at this point in the history
  • Loading branch information
Arronlong committed Mar 28, 2021
1 parent 0123f81 commit c168866
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
2. 扩展md编辑器配置,可以自行根据需要修改配置。目前可配置支持html标签解析(默认关闭),更多设置参考[editormd官网](https://pandao.github.io/editor.md/)
3. 后台新建页和编辑页,自动设置时间和默认图片(使用JustNews主题时必须设置,否则样式大变),默认图片为:![](https://cdn.jsdelivr.net/gh/Arronlong/cdn@master/cfblog/cfblog-plus.png)
4. 添加文章置顶设置功能
5. 添加后台首页选择功能


一些功能还在规划中:
Expand Down
8 changes: 7 additions & 1 deletion index_plus.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ const OPT = { //网站配置

//主题路径
"theme_github_path":"https://cdn.jsdelivr.net/gh/Arronlong/cfblog-plus@master/themes/",
"top_flag":'<topflag>[置顶]</topflag>',
"top_flag":'<topflag>[置顶]</topflag>',//置顶标志
"admin_home_idx": 1, //后台首页tab索引设置:1-我的文章,2-新建,3-设置,4-发布
"editor_page_scripts": `
//置顶设置
let top_setting=\`
Expand Down Expand Up @@ -655,6 +656,11 @@ async function handle_admin(request){
html = theme_html.replaceHtmlPara("categoryJson",JSON.stringify(categoryJson))
.replaceHtmlPara("menuJson",JSON.stringify(menuJson))
.replaceHtmlPara("linkJson",JSON.stringify(linkJson))

//添加后台首页配置
if(OPT.admin_home_idx && OPT.admin_home_idx>=1 && OPT.admin_home_idx<=4){
html = html.replace("$('#myTab li:eq(0) 1').tab('show')","$('#myTab a:eq("+OPT.admin_home_idx+")').tab('show')")
}
}

//发布
Expand Down

0 comments on commit c168866

Please sign in to comment.