mirror of https://github.com/halo-dev/halo
👽 Anatole主题优化
parent
249a78d6d8
commit
3237c5a301
|
@ -48,7 +48,6 @@ public class StartupConfig implements ApplicationListener<ContextRefreshedEvent>
|
||||||
* 加载主题设置
|
* 加载主题设置
|
||||||
*/
|
*/
|
||||||
private void loadActiveTheme(){
|
private void loadActiveTheme(){
|
||||||
try {
|
|
||||||
String themeValue = optionsService.findOneOption("theme");
|
String themeValue = optionsService.findOneOption("theme");
|
||||||
if(StringUtils.isNotEmpty("themeValue") && !StringUtils.equals(themeValue,null)){
|
if(StringUtils.isNotEmpty("themeValue") && !StringUtils.equals(themeValue,null)){
|
||||||
BaseController.THEME = themeValue;
|
BaseController.THEME = themeValue;
|
||||||
|
@ -56,51 +55,36 @@ public class StartupConfig implements ApplicationListener<ContextRefreshedEvent>
|
||||||
//以防万一
|
//以防万一
|
||||||
BaseController.THEME = "anatole";
|
BaseController.THEME = "anatole";
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
|
||||||
log.error("加载主题设置失败:{0}",e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加载设置选项
|
* 加载设置选项
|
||||||
*/
|
*/
|
||||||
private void loadOptions(){
|
private void loadOptions(){
|
||||||
try{
|
|
||||||
Map<String,String> options = optionsService.findAllOptions();
|
Map<String,String> options = optionsService.findAllOptions();
|
||||||
if(options!=null&&!options.isEmpty()){
|
if(options!=null&&!options.isEmpty()){
|
||||||
HaloConst.OPTIONS = options;
|
HaloConst.OPTIONS = options;
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
|
||||||
log.error("加载设置选项失败:{0}",e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加载所有文件
|
* 加载所有文件
|
||||||
*/
|
*/
|
||||||
private void loadFiles(){
|
private void loadFiles(){
|
||||||
try {
|
|
||||||
List<Attachment> attachments = attachmentService.findAllAttachments();
|
List<Attachment> attachments = attachmentService.findAllAttachments();
|
||||||
if(null!=attachments){
|
if(null!=attachments){
|
||||||
HaloConst.ATTACHMENTS = attachments;
|
HaloConst.ATTACHMENTS = attachments;
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
|
||||||
log.error("加载所有文件失败:{0}",e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加载所有主题
|
* 加载所有主题
|
||||||
*/
|
*/
|
||||||
private void loadThemes(){
|
private void loadThemes(){
|
||||||
try{
|
|
||||||
HaloConst.THEMES.clear();
|
HaloConst.THEMES.clear();
|
||||||
List<Theme> themes = HaloUtils.getThemes();
|
List<Theme> themes = HaloUtils.getThemes();
|
||||||
if(null!=themes){
|
if(null!=themes){
|
||||||
HaloConst.THEMES = themes;
|
HaloConst.THEMES = themes;
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
|
||||||
log.error("加载主题失败:{0}",e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
||||||
<meta name="format-detection" content="telephone=no" />
|
<meta name="format-detection" content="telephone=no" />
|
||||||
<meta name="renderer" content="webkit">
|
<meta name="renderer" content="webkit">
|
||||||
|
<meta name="theme-color" content="${options.anatole_style_google_color?default('#fff')}">
|
||||||
<meta name="author" content="${user.userDisplayName?if_exists}" />
|
<meta name="author" content="${user.userDisplayName?if_exists}" />
|
||||||
<meta name="keywords" content="${keywords?default("Anatole")}"/>
|
<meta name="keywords" content="${keywords?default("Anatole")}"/>
|
||||||
<meta name="description" content="${description?default("Anatole")}" />
|
<meta name="description" content="${description?default("Anatole")}" />
|
||||||
|
|
|
@ -171,6 +171,12 @@
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="anatoleStyleGoogleColor" class="col-sm-4 control-label">浏览器沉浸颜色:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input type="text" class="form-control" id="anatoleStyleGoogleColor" name="anatole_style_google_color" value="${options.anatole_style_google_color?default("#fff")}" >
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="box-footer">
|
<div class="box-footer">
|
||||||
<button type="button" class="btn btn-primary btn-sm pull-right" onclick="saveThemeOptions('anatoleStyleOptions')">保存设置</button>
|
<button type="button" class="btn btn-primary btn-sm pull-right" onclick="saveThemeOptions('anatoleStyleOptions')">保存设置</button>
|
||||||
|
|
Loading…
Reference in New Issue