Skip to content

Commit

Permalink
删除一些无用代码,优化整体结构
Browse files Browse the repository at this point in the history
  • Loading branch information
wenjing-xin committed Jul 9, 2024
1 parent 94e1217 commit 4d13acc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
11 changes: 2 additions & 9 deletions src/main/java/xin/wenjing/halo/artalk/ArtalkComment.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,8 @@ private String normalTemplateResolve(String siteTitle, String artalkUrl, String
final Properties properties = new Properties();
properties.setProperty("siteTitle", siteTitle);
properties.setProperty("artalkUrl", artalkUrl);

if(darkModeAttribute.equals("auto")){
// 根据设备切换
properties.setProperty("dataTheme", "prefers-color-scheme");
properties.setProperty("dataThemeName", "dark");
}else{
properties.setProperty("dataTheme", darkModeAttribute.split("=")[0]);
properties.setProperty("dataThemeName", darkModeAttribute.split("=")[1]);
}
properties.setProperty("dataTheme", darkModeAttribute.split("=")[0]);
properties.setProperty("dataThemeName", darkModeAttribute.split("=")[1]);

// 同时兼容使用pjax的主题和未使用pjax的主题
final var artalkTmpl = """
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/extensions/settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,5 @@ spec:
if: $get(enableLightDark).value == attribute
name: darkModeAttribute
label: 选择器名称(严格按照说明的示例格式填写)
help: 填入CSS选择器会在对应选择器生效时启用夜间模式,例如hao主题的明暗切换选择器为:data-theme=dark;joe3主题的明暗切换选择器为data-mode=dark,设置 'auto' 会根据设备暗黑模式自适应
value: "auto"
help: 填入CSS选择器会在对应选择器生效时启用夜间模式,例如hao主题的明暗切换选择器为:data-theme=dark;joe3主题的明暗切换选择器为data-mode=dark,可以在控制台的html或body元素上查看该属性
value: "data-theme=dark"
2 changes: 1 addition & 1 deletion src/main/resources/templates/new_comment.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no" />
<title>最新评论</title>
<link rel="stylesheet" href="/plugins/plugin-artalk/assets/static/new_comment.css" />
<link rel="stylesheet" href="/plugins/plugin-artalk/assets/static/new_comment.css?v=1.3.0" />
</head>

<body>
Expand Down

0 comments on commit 4d13acc

Please sign in to comment.