Compare commits

...
5 Commits
Author SHA1 Message Date
qwqcode 6f1f48c18f v2.2.11
Signed-off-by: qwqcode <qwqcode@gmail.com>
2022-05-01 17:13:10 +08:00
qwqcode 91a0406d44 feat(conf): Add nestSort option
Signed-off-by: qwqcode <qwqcode@gmail.com>
2022-05-01 17:12:55 +08:00
qwqcode e58ae853cf v2.2.10
Signed-off-by: qwqcode <qwqcode@gmail.com>
2022-05-01 17:01:33 +08:00
qwqcode 7d679359d3 fix(at): Show AT after user badge 2022-05-01 17:00:41 +08:00
qwqcode 0b645e66e5 chore(defaults): Modify nestMax=2 as default.
Signed-off-by: qwqcode <qwqcode@gmail.com>
2022-05-01 16:47:43 +08:00
6 changed files with 25 additions and 9 deletions

No files matched your search

+1 -1
View File
@@ -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",
+5
View File
@@ -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
+8 -5
View File
@@ -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)
}
// 回复的对象
+4 -1
View File
@@ -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 => {
+4 -2
View File
@@ -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
View File
@@ -77,6 +77,9 @@ export default interface ArtalkConfig {
/** 嵌套模式 · 最大层数 */
nestMax?: number
/** 嵌套模式 · 排序方式 */
nestSort?: 'DATE_ASC'|'DATE_DESC'
/** 显示 UA 徽标 */
uaBadge?: boolean