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 CHANGED
@@ -104,7 +104,7 @@ const defaults$3 = {
104
104
  listSort: true,
105
105
  pvEl: "#ArtalkPV",
106
106
  flatMode: "auto",
107
- nestMax: 3,
107
+ nestMax: 2,
108
108
  gravatar: {
109
109
  default: "mp",
110
110
  mirror: "https://sdn.geekzu.org/avatar/"
@@ -4759,6 +4759,7 @@ class Comment extends Component {
4759
4759
  __publicField(this, "$main");
4760
4760
  __publicField(this, "$header");
4761
4761
  __publicField(this, "$headerNick");
4762
+ __publicField(this, "$headerBadge");
4762
4763
  __publicField(this, "$body");
4763
4764
  __publicField(this, "$content");
4764
4765
  __publicField(this, "$children");
@@ -4852,13 +4853,14 @@ class Comment extends Component {
4852
4853
  } else {
4853
4854
  this.$headerNick.innerText = this.data.nick;
4854
4855
  }
4855
- const $badge = this.$el.querySelector(".atk-badge");
4856
+ this.$headerBadge = this.$el.querySelector(".atk-badge");
4856
4857
  if (this.data.badge_name) {
4857
- $badge.innerText = this.data.badge_name;
4858
+ this.$headerBadge.innerText = this.data.badge_name;
4858
4859
  if (this.data.badge_color)
4859
- $badge.style.backgroundColor = this.data.badge_color;
4860
+ this.$headerBadge.style.backgroundColor = this.data.badge_color;
4860
4861
  } else {
4861
- $badge.remove();
4862
+ this.$headerBadge.remove();
4863
+ this.$headerBadge = void 0;
4862
4864
  }
4863
4865
  if (this.data.is_pinned) {
4864
4866
  const $pinnedBadge = createElement(`<span class="atk-item atk-pinned-badge">\u7F6E\u9876</span>`);
@@ -4917,7 +4919,8 @@ class Comment extends Component {
4917
4919
  this.$replyAt.onclick = () => {
4918
4920
  this.goToReplyComment();
4919
4921
  };
4920
- this.$headerNick.insertAdjacentElement("afterend", this.$replyAt);
4922
+ const $after = this.$headerBadge || this.$headerNick;
4923
+ $after.insertAdjacentElement("afterend", this.$replyAt);
4921
4924
  }
4922
4925
  renderReplyTo() {
4923
4926
  if (!this.flatMode)
@@ -5580,7 +5583,7 @@ class ListLite extends Component {
5580
5583
  }
5581
5584
  this.data = data;
5582
5585
  const feMinVersion = ((_a = data.api_version) == null ? void 0 : _a.fe_min_version) || "0.0.0";
5583
- if (this.ctx.conf.versionCheck && this.versionCheck("\u524D\u7AEF", feMinVersion, "2.2.9"))
5586
+ if (this.ctx.conf.versionCheck && this.versionCheck("\u524D\u7AEF", feMinVersion, "2.2.10"))
5584
5587
  return;
5585
5588
  if (this.ctx.conf.versionCheck && this.versionCheck("\u540E\u7AEF", backendMinVersion, (_b = data.api_version) == null ? void 0 : _b.version))
5586
5589
  return;
@@ -5887,7 +5890,7 @@ class List extends ListLite {
5887
5890
  if (this.ctx.conf.listSort) {
5888
5891
  this.initDropdown();
5889
5892
  }
5890
- this.$el.querySelector(".atk-copyright").innerHTML = `Powered By <a href="https://artalk.js.org" target="_blank" title="Artalk v${"2.2.9"}">Artalk</a>`;
5893
+ this.$el.querySelector(".atk-copyright").innerHTML = `Powered By <a href="https://artalk.js.org" target="_blank" title="Artalk v${"2.2.10"}">Artalk</a>`;
5891
5894
  this.ctx.on("list-reload", () => this.fetchComments(0));
5892
5895
  this.ctx.on("list-refresh-ui", () => this.refreshUI());
5893
5896
  this.ctx.on("list-import", (data) => this.importComments(data));
@@ -6212,6 +6215,9 @@ const _Artalk = class {
6212
6215
  if (!this.conf.pageTitle) {
6213
6216
  this.conf.pageTitle = `${document.title}`;
6214
6217
  }
6218
+ if (this.conf.nestMax && this.conf.nestMax <= 1) {
6219
+ this.conf.flatMode = true;
6220
+ }
6215
6221
  if (!!this.conf.el && this.conf.el instanceof HTMLElement) {
6216
6222
  this.$root = this.conf.el;
6217
6223
  } else {