artalk 2.2.9 → 2.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Artalk.es.js +14 -8
- package/dist/Artalk.iife.js +1 -1
- package/dist/Artalk.js +1 -1
- package/package.json +1 -1
- package/src/artalk.ts +5 -0
- package/src/components/comment.ts +8 -5
- package/src/defaults.ts +1 -1
package/package.json
CHANGED
package/src/artalk.ts
CHANGED
|
@@ -47,6 +47,11 @@ export default class Artalk {
|
|
|
47
47
|
this.conf.pageTitle = `${document.title}`
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
// 列表显示模式
|
|
51
|
+
if (this.conf.nestMax && this.conf.nestMax <= 1) {
|
|
52
|
+
this.conf.flatMode = true
|
|
53
|
+
}
|
|
54
|
+
|
|
50
55
|
// 装载元素
|
|
51
56
|
if (!!this.conf.el && this.conf.el instanceof HTMLElement) {
|
|
52
57
|
this.$root = this.conf.el
|
|
@@ -16,6 +16,7 @@ export default class Comment extends Component {
|
|
|
16
16
|
public $main!: HTMLElement
|
|
17
17
|
public $header!: HTMLElement
|
|
18
18
|
public $headerNick!: HTMLElement
|
|
19
|
+
public $headerBadge?: HTMLElement
|
|
19
20
|
public $body!: HTMLElement
|
|
20
21
|
public $content!: HTMLElement
|
|
21
22
|
public $children!: HTMLElement|null
|
|
@@ -132,13 +133,14 @@ export default class Comment extends Component {
|
|
|
132
133
|
this.$headerNick.innerText = this.data.nick
|
|
133
134
|
}
|
|
134
135
|
|
|
135
|
-
|
|
136
|
+
this.$headerBadge = this.$el.querySelector<HTMLElement>('.atk-badge')!
|
|
136
137
|
if (this.data.badge_name) {
|
|
137
|
-
|
|
138
|
+
this.$headerBadge.innerText = this.data.badge_name
|
|
138
139
|
if (this.data.badge_color)
|
|
139
|
-
|
|
140
|
+
this.$headerBadge.style.backgroundColor = this.data.badge_color
|
|
140
141
|
} else {
|
|
141
|
-
|
|
142
|
+
this.$headerBadge.remove()
|
|
143
|
+
this.$headerBadge = undefined
|
|
142
144
|
}
|
|
143
145
|
|
|
144
146
|
if (this.data.is_pinned) {
|
|
@@ -204,7 +206,8 @@ export default class Comment extends Component {
|
|
|
204
206
|
this.$replyAt.querySelector<HTMLElement>('.atk-nick')!.innerText = `${this.replyTo.nick}`
|
|
205
207
|
this.$replyAt.onclick = () => { this.goToReplyComment() }
|
|
206
208
|
|
|
207
|
-
this.$
|
|
209
|
+
const $after = this.$headerBadge || this.$headerNick
|
|
210
|
+
$after.insertAdjacentElement('afterend', this.$replyAt)
|
|
208
211
|
}
|
|
209
212
|
|
|
210
213
|
// 回复的对象
|