Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6f1f48c18f | ||
|
|
91a0406d44 | ||
|
|
e58ae853cf | ||
|
|
7d679359d3 | ||
|
|
0b645e66e5 |
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "artalk",
|
||||
"version": "2.2.9",
|
||||
"version": "2.2.11",
|
||||
"backendMinVersion": "2.1.4",
|
||||
"license": "LGPL-3.0",
|
||||
"description": "A Selfhosted Comment System",
|
||||
|
||||
@@ -47,6 +47,11 @@ export default class Artalk {
|
||||
this.conf.pageTitle = `${document.title}`
|
||||
}
|
||||
|
||||
// 列表显示模式
|
||||
if (this.conf.nestMax && this.conf.nestMax <= 1) {
|
||||
this.conf.flatMode = true
|
||||
}
|
||||
|
||||
// 装载元素
|
||||
if (!!this.conf.el && this.conf.el instanceof HTMLElement) {
|
||||
this.$root = this.conf.el
|
||||
|
||||
@@ -16,6 +16,7 @@ export default class Comment extends Component {
|
||||
public $main!: HTMLElement
|
||||
public $header!: HTMLElement
|
||||
public $headerNick!: HTMLElement
|
||||
public $headerBadge?: HTMLElement
|
||||
public $body!: HTMLElement
|
||||
public $content!: HTMLElement
|
||||
public $children!: HTMLElement|null
|
||||
@@ -132,13 +133,14 @@ export default class Comment extends Component {
|
||||
this.$headerNick.innerText = this.data.nick
|
||||
}
|
||||
|
||||
const $badge = this.$el.querySelector<HTMLElement>('.atk-badge')!
|
||||
this.$headerBadge = this.$el.querySelector<HTMLElement>('.atk-badge')!
|
||||
if (this.data.badge_name) {
|
||||
$badge.innerText = this.data.badge_name
|
||||
this.$headerBadge.innerText = this.data.badge_name
|
||||
if (this.data.badge_color)
|
||||
$badge.style.backgroundColor = this.data.badge_color
|
||||
this.$headerBadge.style.backgroundColor = this.data.badge_color
|
||||
} else {
|
||||
$badge.remove()
|
||||
this.$headerBadge.remove()
|
||||
this.$headerBadge = undefined
|
||||
}
|
||||
|
||||
if (this.data.is_pinned) {
|
||||
@@ -204,7 +206,8 @@ export default class Comment extends Component {
|
||||
this.$replyAt.querySelector<HTMLElement>('.atk-nick')!.innerText = `${this.replyTo.nick}`
|
||||
this.$replyAt.onclick = () => { this.goToReplyComment() }
|
||||
|
||||
this.$headerNick.insertAdjacentElement('afterend', this.$replyAt)
|
||||
const $after = this.$headerBadge || this.$headerNick
|
||||
$after.insertAdjacentElement('afterend', this.$replyAt)
|
||||
}
|
||||
|
||||
// 回复的对象
|
||||
|
||||
@@ -25,7 +25,7 @@ export default class ListLite extends Component {
|
||||
public flatMode = false
|
||||
|
||||
/** 嵌套模式 */
|
||||
public nestSortBy: ListNest.SortByType = 'DATE_DESC'
|
||||
public nestSortBy!: ListNest.SortByType
|
||||
|
||||
/** 分页 */
|
||||
public pageMode: 'pagination'|'read-more' = 'pagination'
|
||||
@@ -58,6 +58,9 @@ export default class ListLite extends Component {
|
||||
// 评论为空时显示字符
|
||||
if (ctx.conf.noComment) this.noCommentText = ctx.conf.noComment
|
||||
|
||||
// 嵌套排序方式
|
||||
this.nestSortBy = this.ctx.conf.nestSort || 'DATE_ASC'
|
||||
|
||||
// 评论时间自动更新
|
||||
window.setInterval(() => {
|
||||
this.$el.querySelectorAll<HTMLElement>('[data-atk-comment-date]').forEach(el => {
|
||||
|
||||
@@ -12,6 +12,10 @@ const defaults: ArtalkConfig = {
|
||||
darkMode: false,
|
||||
editorTravel: true,
|
||||
|
||||
flatMode: 'auto',
|
||||
nestMax: 2,
|
||||
nestSort: 'DATE_ASC',
|
||||
|
||||
emoticons: "https://cdn.jsdelivr.net/gh/ArtalkJS/Emoticons/grps/default.json",
|
||||
|
||||
vote: true,
|
||||
@@ -19,8 +23,6 @@ const defaults: ArtalkConfig = {
|
||||
uaBadge: true,
|
||||
listSort: true,
|
||||
pvEl: '#ArtalkPV',
|
||||
flatMode: 'auto',
|
||||
nestMax: 3,
|
||||
|
||||
gravatar: {
|
||||
default: 'mp',
|
||||
|
||||
+3
@@ -77,6 +77,9 @@ export default interface ArtalkConfig {
|
||||
/** 嵌套模式 · 最大层数 */
|
||||
nestMax?: number
|
||||
|
||||
/** 嵌套模式 · 排序方式 */
|
||||
nestSort?: 'DATE_ASC'|'DATE_DESC'
|
||||
|
||||
/** 显示 UA 徽标 */
|
||||
uaBadge?: boolean
|
||||
|
||||
|
||||
Reference in new issue
Block a user