artalk 2.2.2 → 2.2.5

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
@@ -1,6 +1,4 @@
1
1
  var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
2
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
3
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
4
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
@@ -16,7 +14,6 @@ var __spreadValues = (a, b) => {
16
14
  }
17
15
  return a;
18
16
  };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
17
  var __publicField = (obj, key, value) => {
21
18
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
22
19
  return value;
@@ -69,6 +66,7 @@ class Context {
69
66
  __publicField(this, "user");
70
67
  __publicField(this, "eventList", []);
71
68
  __publicField(this, "markedInstance");
69
+ __publicField(this, "markedReplacers", []);
72
70
  this.cid = +new Date();
73
71
  this.$root = rootEl;
74
72
  this.conf = conf;
@@ -2659,42 +2657,126 @@ function versionCompare(a, b) {
2659
2657
  }
2660
2658
  function initMarked(ctx) {
2661
2659
  const renderer = new marked$1.Renderer();
2662
- const linkRenderer = renderer.link;
2660
+ const orgLinkRenderer = renderer.link;
2663
2661
  renderer.link = (href, title, text) => {
2664
2662
  const localLink = href == null ? void 0 : href.startsWith(`${window.location.protocol}//${window.location.hostname}`);
2665
- const html = linkRenderer.call(renderer, href, title, text);
2663
+ const html = orgLinkRenderer.call(renderer, href, title, text);
2666
2664
  return html.replace(/^<a /, `<a target="_blank" ${!localLink ? `rel="noreferrer noopener nofollow"` : ""} `);
2667
2665
  };
2666
+ renderer.code = (block2, lang) => {
2667
+ const realLang = !lang ? "plaintext" : lang;
2668
+ let colorized = block2;
2669
+ if (window.hljs) {
2670
+ if (realLang && window.hljs.getLanguage(realLang)) {
2671
+ colorized = window.hljs.highlight(realLang, block2).value;
2672
+ }
2673
+ } else {
2674
+ colorized = hanabi(block2);
2675
+ }
2676
+ return `<pre rel="${realLang}">
2677
+ <code class="hljs language-${realLang}">${colorized.replace(/&amp;/g, "&")}</code>
2678
+ </pre>`;
2679
+ };
2668
2680
  const nMarked = marked$1;
2669
2681
  marked$1.setOptions({
2670
2682
  renderer,
2671
- highlight: (code) => hanabi(code),
2672
2683
  pedantic: false,
2673
2684
  gfm: true,
2674
2685
  breaks: true,
2675
2686
  smartLists: true,
2676
2687
  smartypants: true,
2677
2688
  xhtml: false,
2678
- sanitize: true,
2679
- sanitizer: (html) => insane_1(html, __spreadProps(__spreadValues({}, insane_1.defaults), {
2680
- allowedAttributes: __spreadProps(__spreadValues({}, insane_1.defaults.allowedAttributes), {
2681
- img: ["src", "atk-emoticon"]
2682
- })
2683
- })),
2689
+ sanitize: false,
2684
2690
  silent: true
2685
2691
  });
2686
2692
  ctx.markedInstance = nMarked;
2687
2693
  }
2688
2694
  function marked(ctx, src) {
2689
- return ctx.markedInstance.parse(src);
2695
+ let dest = insane_1(ctx.markedInstance.parse(src), {
2696
+ allowedClasses: {},
2697
+ allowedSchemes: ["http", "https", "mailto"],
2698
+ allowedTags: [
2699
+ "a",
2700
+ "abbr",
2701
+ "article",
2702
+ "b",
2703
+ "blockquote",
2704
+ "br",
2705
+ "caption",
2706
+ "code",
2707
+ "del",
2708
+ "details",
2709
+ "div",
2710
+ "em",
2711
+ "h1",
2712
+ "h2",
2713
+ "h3",
2714
+ "h4",
2715
+ "h5",
2716
+ "h6",
2717
+ "hr",
2718
+ "i",
2719
+ "img",
2720
+ "ins",
2721
+ "kbd",
2722
+ "li",
2723
+ "main",
2724
+ "mark",
2725
+ "ol",
2726
+ "p",
2727
+ "pre",
2728
+ "section",
2729
+ "span",
2730
+ "strike",
2731
+ "strong",
2732
+ "sub",
2733
+ "summary",
2734
+ "sup",
2735
+ "table",
2736
+ "tbody",
2737
+ "td",
2738
+ "th",
2739
+ "thead",
2740
+ "tr",
2741
+ "u",
2742
+ "ul"
2743
+ ],
2744
+ allowedAttributes: {
2745
+ "*": ["title", "accesskey"],
2746
+ a: ["href", "name", "target", "aria-label", "rel"],
2747
+ img: ["src", "alt", "title", "atk-emoticon", "aria-label"],
2748
+ code: ["class"],
2749
+ span: ["class", "style"]
2750
+ },
2751
+ filter: (node) => {
2752
+ const allowed = [
2753
+ ["code", /^hljs\W+language-(.*)$/],
2754
+ ["span", /^(hljs-.*)$/]
2755
+ ];
2756
+ allowed.forEach(([tag, reg]) => {
2757
+ if (node.tag === tag && !!node.attrs.class && !reg.test(node.attrs.class)) {
2758
+ delete node.attrs.class;
2759
+ }
2760
+ });
2761
+ if (node.tag === "span" && !!node.attrs.style && !/^color:(\W+)?#[0-9a-f]{3,6};?$/i.test(node.attrs.style)) {
2762
+ delete node.attrs.style;
2763
+ }
2764
+ return true;
2765
+ }
2766
+ });
2767
+ ctx.markedReplacers.forEach((replacer) => {
2768
+ if (typeof replacer === "function")
2769
+ dest = replacer(dest);
2770
+ });
2771
+ return dest;
2690
2772
  }
2691
2773
  function getCorrectUserAgent() {
2692
2774
  return __async(this, null, function* () {
2693
2775
  const uaRaw = navigator.userAgent;
2694
- const uaData = navigator.userAgentData;
2695
- if (!uaData || !uaData.getHighEntropyValues) {
2776
+ if (!navigator.userAgentData || !navigator.userAgentData.getHighEntropyValues) {
2696
2777
  return uaRaw;
2697
2778
  }
2779
+ const uaData = navigator.userAgentData;
2698
2780
  let uaGot = null;
2699
2781
  try {
2700
2782
  uaGot = yield uaData.getHighEntropyValues(["platformVersion"]);
@@ -2702,12 +2784,16 @@ function getCorrectUserAgent() {
2702
2784
  console.error(err);
2703
2785
  return uaRaw;
2704
2786
  }
2705
- if (uaData.platform !== "Windows") {
2706
- return uaRaw;
2707
- }
2708
2787
  const majorPlatformVersion = Number(uaGot.platformVersion.split(".")[0]);
2709
- if (majorPlatformVersion >= 13) {
2710
- return uaRaw.replace(/Windows\W+NT\W+10.0/, "Windows NT 11.0");
2788
+ if (uaData.platform === "Windows") {
2789
+ if (majorPlatformVersion >= 13) {
2790
+ return uaRaw.replace(/Windows NT 10.0/, "Windows NT 11.0");
2791
+ }
2792
+ }
2793
+ if (uaData.platform === "macOS") {
2794
+ if (majorPlatformVersion >= 11) {
2795
+ return uaRaw.replace(/(Mac OS X \d+_\d+_\d+|Mac OS X)/, `Mac OS X ${uaGot.platformVersion.replace(/\./g, "_")}`);
2796
+ }
2711
2797
  }
2712
2798
  return uaRaw;
2713
2799
  });
@@ -2863,8 +2949,6 @@ const _Layer = class extends Component {
2863
2949
  __publicField(this, "$wrap");
2864
2950
  __publicField(this, "$mask");
2865
2951
  __publicField(this, "maskClickHideEnable", true);
2866
- __publicField(this, "bodyStyleOrgOverflow", "");
2867
- __publicField(this, "bodyStyleOrgPaddingRight", "");
2868
2952
  __publicField(this, "afterHide");
2869
2953
  this.name = name;
2870
2954
  const { $wrap, $mask } = GetLayerWrap(ctx);
@@ -2909,9 +2993,9 @@ const _Layer = class extends Component {
2909
2993
  this.afterHide();
2910
2994
  this.$wrap.classList.add("atk-fade-out");
2911
2995
  this.$el.style.display = "none";
2996
+ this.pageBodyScrollBarShow();
2912
2997
  this.newActionTimer(() => {
2913
2998
  this.$wrap.style.display = "none";
2914
- this.pageBodyScrollBarShow();
2915
2999
  this.checkCleanLayer();
2916
3000
  }, 450);
2917
3001
  this.newActionTimer(() => {
@@ -2923,15 +3007,13 @@ const _Layer = class extends Component {
2923
3007
  this.maskClickHideEnable = enable;
2924
3008
  }
2925
3009
  pageBodyScrollBarHide() {
2926
- this.bodyStyleOrgOverflow = document.body.style.overflow;
2927
- this.bodyStyleOrgPaddingRight = document.body.style.paddingRight;
2928
3010
  document.body.style.overflow = "hidden";
2929
3011
  const bpr = parseInt(window.getComputedStyle(document.body, null).getPropertyValue("padding-right"), 10);
2930
3012
  document.body.style.paddingRight = `${getScrollBarWidth() + bpr || 0}px`;
2931
3013
  }
2932
3014
  pageBodyScrollBarShow() {
2933
- document.body.style.overflow = this.bodyStyleOrgOverflow;
2934
- document.body.style.paddingRight = this.bodyStyleOrgPaddingRight;
3015
+ document.body.style.overflow = _Layer.BodyOrgOverflow;
3016
+ document.body.style.paddingRight = _Layer.BodyOrgPaddingRight;
2935
3017
  }
2936
3018
  newActionTimer(func, delay) {
2937
3019
  const act = () => {
@@ -2948,7 +3030,6 @@ const _Layer = class extends Component {
2948
3030
  });
2949
3031
  }
2950
3032
  disposeNow() {
2951
- document.body.style.overflow = "";
2952
3033
  this.$el.remove();
2953
3034
  this.pageBodyScrollBarShow();
2954
3035
  this.checkCleanLayer();
@@ -2965,6 +3046,8 @@ const _Layer = class extends Component {
2965
3046
  }
2966
3047
  };
2967
3048
  let Layer = _Layer;
3049
+ __publicField(Layer, "BodyOrgOverflow");
3050
+ __publicField(Layer, "BodyOrgPaddingRight");
2968
3051
  __publicField(Layer, "actionTimers", []);
2969
3052
  function GetLayerWrap(ctx) {
2970
3053
  let $wrap = document.querySelector(`.atk-layer-wrap#ctx-${ctx.cid}`);
@@ -3200,8 +3283,11 @@ class Api {
3200
3283
  }
3201
3284
  loginStatus() {
3202
3285
  return __async(this, null, function* () {
3203
- const data = yield POST(this.ctx, `${this.baseURL}/login-status`);
3204
- return data || { is_login: false };
3286
+ const data = yield POST(this.ctx, `${this.baseURL}/login-status`, {
3287
+ name: this.ctx.user.data.nick,
3288
+ email: this.ctx.user.data.email
3289
+ });
3290
+ return data || { is_login: false, is_admin: false };
3205
3291
  });
3206
3292
  }
3207
3293
  pageGet(siteName, offset, limit) {
@@ -3235,13 +3321,17 @@ class Api {
3235
3321
  };
3236
3322
  return POST(this.ctx, `${this.baseURL}/admin/page-del`, params);
3237
3323
  }
3238
- pageFetch(id) {
3324
+ pageFetch(id, siteName, getStatus) {
3239
3325
  return __async(this, null, function* () {
3240
- const params = {
3241
- id
3242
- };
3326
+ const params = {};
3327
+ if (id)
3328
+ params.id = id;
3329
+ if (siteName)
3330
+ params.site_name = siteName;
3331
+ if (getStatus)
3332
+ params.get_status = getStatus;
3243
3333
  const d = yield POST(this.ctx, `${this.baseURL}/admin/page-fetch`, params);
3244
- return d.page;
3334
+ return d;
3245
3335
  });
3246
3336
  }
3247
3337
  siteGet() {
@@ -3370,7 +3460,7 @@ const CaptchaChecker = {
3370
3460
  const $iframe = createElement(`<iframe class="atk-fade-in"></iframe>`);
3371
3461
  $iframe.style.display = "none";
3372
3462
  showLoading($iframeWrap, { transparentBg: true });
3373
- $iframe.src = `${that.ctx.conf.server}/captcha/get`;
3463
+ $iframe.src = `${that.ctx.conf.server}/captcha/get?t=${+new Date()}`;
3374
3464
  $iframe.onload = () => {
3375
3465
  $iframe.style.display = "";
3376
3466
  hideLoading($iframeWrap);
@@ -3580,16 +3670,28 @@ class EmoticonsPlug extends EditorPlug {
3580
3670
  __publicField(this, "emoticons", []);
3581
3671
  __publicField(this, "$grpWrap");
3582
3672
  __publicField(this, "$grpSwitcher");
3673
+ __publicField(this, "loadingTask", null);
3674
+ __publicField(this, "isListLoaded", false);
3675
+ __publicField(this, "isImgLoaded", false);
3583
3676
  this.editor = editor2;
3584
3677
  this.$el = createElement(`<div class="atk-editor-plug-emoticons"></div>`);
3585
- this.init();
3586
3678
  }
3587
- init() {
3679
+ loadEmoticonsData() {
3588
3680
  return __async(this, null, function* () {
3589
- showLoading(this.$el);
3590
- this.emoticons = yield this.handleData(this.ctx.conf.emoticons);
3591
- hideLoading(this.$el);
3592
- this.initEmoticonsList();
3681
+ if (this.isListLoaded)
3682
+ return;
3683
+ if (this.loadingTask !== null) {
3684
+ yield this.loadingTask;
3685
+ return;
3686
+ }
3687
+ this.loadingTask = (() => __async(this, null, function* () {
3688
+ showLoading(this.$el);
3689
+ this.emoticons = yield this.handleData(this.ctx.conf.emoticons);
3690
+ hideLoading(this.$el);
3691
+ this.loadingTask = null;
3692
+ this.isListLoaded = true;
3693
+ }))();
3694
+ yield this.loadingTask;
3593
3695
  });
3594
3696
  }
3595
3697
  handleData(data) {
@@ -3638,7 +3740,6 @@ class EmoticonsPlug extends EditorPlug {
3638
3740
  }
3639
3741
  });
3640
3742
  data = data.filter((item) => typeof item === "object" && !Array.isArray(item) && !!item && !!item.name);
3641
- console.log(data);
3642
3743
  this.solveNullKey(data);
3643
3744
  this.solveSameKey(data);
3644
3745
  return data;
@@ -3769,9 +3870,16 @@ class EmoticonsPlug extends EditorPlug {
3769
3870
  changeListHeight() {
3770
3871
  }
3771
3872
  onShow() {
3772
- setTimeout(() => {
3773
- this.changeListHeight();
3774
- }, 30);
3873
+ (() => __async(this, null, function* () {
3874
+ yield this.loadEmoticonsData();
3875
+ if (!this.isImgLoaded) {
3876
+ this.initEmoticonsList();
3877
+ this.isImgLoaded = true;
3878
+ }
3879
+ setTimeout(() => {
3880
+ this.changeListHeight();
3881
+ }, 30);
3882
+ }))();
3775
3883
  }
3776
3884
  onHide() {
3777
3885
  this.$el.parentElement.style.height = "";
@@ -3839,6 +3947,7 @@ class Editor extends Component {
3839
3947
  __publicField(this, "$bottom");
3840
3948
  __publicField(this, "$plugBtnWrap");
3841
3949
  __publicField(this, "$imgUploadBtn");
3950
+ __publicField(this, "$imgUploadInput");
3842
3951
  __publicField(this, "$submitBtn");
3843
3952
  __publicField(this, "$notifyWrap");
3844
3953
  __publicField(this, "replyComment", null);
@@ -3974,6 +4083,13 @@ class Editor extends Component {
3974
4083
  this.LOADABLE_PLUG_LIST.forEach((PlugObj) => {
3975
4084
  const btnElem = createElement(`<span class="atk-plug-btn" data-plug-name="${PlugObj.Name}">${PlugObj.BtnHTML}</span>`);
3976
4085
  this.$plugBtnWrap.appendChild(btnElem);
4086
+ if (PlugObj.Name === "emoticons") {
4087
+ const emoPlug = new PlugObj(this);
4088
+ this.plugList[PlugObj.Name] = emoPlug;
4089
+ window.setTimeout(() => {
4090
+ emoPlug.loadEmoticonsData();
4091
+ }, 1e3);
4092
+ }
3977
4093
  btnElem.addEventListener("click", () => {
3978
4094
  let plug = this.plugList[PlugObj.Name];
3979
4095
  if (!plug) {
@@ -4018,10 +4134,13 @@ class Editor extends Component {
4018
4134
  initImgUpload() {
4019
4135
  this.$imgUploadBtn = createElement(`<span class="atk-plug-btn">\u56FE\u7247</span>`);
4020
4136
  this.$plugBtnWrap.querySelector('[data-plug-name="preview"]').before(this.$imgUploadBtn);
4137
+ this.$imgUploadInput = document.createElement("input");
4138
+ this.$imgUploadInput.type = "file";
4139
+ this.$imgUploadInput.style.display = "none";
4140
+ this.$imgUploadInput.accept = this.allowImgExts.map((o) => `.${o}`).join(",");
4141
+ this.$imgUploadBtn.after(this.$imgUploadInput);
4021
4142
  this.$imgUploadBtn.onclick = () => {
4022
- const $input = document.createElement("input");
4023
- $input.type = "file";
4024
- $input.accept = this.allowImgExts.map((o) => `.${o}`).join(",");
4143
+ const $input = this.$imgUploadInput;
4025
4144
  $input.onchange = () => {
4026
4145
  (() => __async(this, null, function* () {
4027
4146
  if (!$input.files || $input.files.length === 0)
@@ -4125,7 +4244,9 @@ class Editor extends Component {
4125
4244
  if (!!this.plugList && !!this.plugList.preview) {
4126
4245
  this.plugList.preview.updateContent();
4127
4246
  }
4128
- this.adjustTextareaHeight();
4247
+ window.setTimeout(() => {
4248
+ this.adjustTextareaHeight();
4249
+ }, 80);
4129
4250
  }
4130
4251
  clearEditor() {
4131
4252
  this.setContent("");
@@ -4210,7 +4331,7 @@ class Editor extends Component {
4210
4331
  site_name: this.replyComment === null ? this.ctx.conf.site : this.replyComment.site_name
4211
4332
  });
4212
4333
  if (this.replyComment !== null && this.replyComment.page_key !== this.ctx.conf.pageKey) {
4213
- window.open(`${this.replyComment.page_key}#atk-comment-${nComment.id}`);
4334
+ window.open(`${this.replyComment.page_url}#atk-comment-${nComment.id}`);
4214
4335
  }
4215
4336
  this.ctx.trigger("list-insert", nComment);
4216
4337
  this.clearEditor();
@@ -4264,252 +4385,201 @@ class Editor extends Component {
4264
4385
  if (this.replyComment !== null)
4265
4386
  this.cancelReply();
4266
4387
  }
4388
+ initRemoteEmoticons() {
4389
+ }
4267
4390
  }
4268
4391
  var list = "";
4269
4392
  var ListHTML = '<div class="atk-list">\n <div class="atk-list-header">\n <div class="atk-comment-count">\n <div class="atk-text">\n <span class="atk-comment-count-num">0</span>\n \u6761\u8BC4\u8BBA\n </div>\n </div>\n <div class="atk-right-action">\n <span data-action="admin-close-comment" class="atk-hide" atk-only-admin-show>\u5173\u95ED\u8BC4\u8BBA</span>\n <span data-action="open-sidebar" class="atk-hide atk-on">\n <span class="atk-unread-badge" style="display: none;"></span>\n <div class="atk-text">\u901A\u77E5\u4E2D\u5FC3</div>\n </span>\n </div>\n </div>\n <div class="atk-list-body"></div>\n <div class="atk-list-footer">\n <div class="atk-copyright"></div>\n </div>\n</div>\n';
4270
4393
  var comment = "";
4271
- var win = window || {};
4272
- var nav = navigator || {};
4394
+ const win = window || {};
4395
+ const nav = navigator || {};
4273
4396
  function Detect(userAgent) {
4274
- var u = userAgent || nav.userAgent;
4275
- var _this = this;
4276
- var match = {
4277
- Trident: u.indexOf("Trident") > -1 || u.indexOf("NET CLR") > -1,
4278
- Presto: u.indexOf("Presto") > -1,
4279
- WebKit: u.indexOf("AppleWebKit") > -1,
4280
- Gecko: u.indexOf("Gecko/") > -1,
4281
- Safari: u.indexOf("Safari") > -1,
4282
- Chrome: u.indexOf("Chrome") > -1 || u.indexOf("CriOS") > -1,
4283
- IE: u.indexOf("MSIE") > -1 || u.indexOf("Trident") > -1,
4284
- Edge: u.indexOf("Edge") > -1,
4285
- Firefox: u.indexOf("Firefox") > -1 || u.indexOf("FxiOS") > -1,
4286
- "Firefox Focus": u.indexOf("Focus") > -1,
4287
- Chromium: u.indexOf("Chromium") > -1,
4288
- Opera: u.indexOf("Opera") > -1 || u.indexOf("OPR") > -1,
4289
- Vivaldi: u.indexOf("Vivaldi") > -1,
4290
- Yandex: u.indexOf("YaBrowser") > -1,
4291
- Kindle: u.indexOf("Kindle") > -1 || u.indexOf("Silk/") > -1,
4292
- 360: u.indexOf("360EE") > -1 || u.indexOf("360SE") > -1,
4293
- UC: u.indexOf("UC") > -1 || u.indexOf(" UBrowser") > -1,
4294
- QQBrowser: u.indexOf("QQBrowser") > -1,
4295
- QQ: u.indexOf("QQ/") > -1,
4296
- Baidu: u.indexOf("Baidu") > -1 || u.indexOf("BIDUBrowser") > -1,
4297
- Maxthon: u.indexOf("Maxthon") > -1,
4298
- Sogou: u.indexOf("MetaSr") > -1 || u.indexOf("Sogou") > -1,
4299
- LBBROWSER: u.indexOf("LBBROWSER") > -1,
4300
- "2345Explorer": u.indexOf("2345Explorer") > -1,
4301
- TheWorld: u.indexOf("TheWorld") > -1,
4302
- XiaoMi: u.indexOf("MiuiBrowser") > -1,
4303
- Quark: u.indexOf("Quark") > -1,
4304
- Qiyu: u.indexOf("Qiyu") > -1,
4305
- Wechat: u.indexOf("MicroMessenger") > -1,
4306
- Taobao: u.indexOf("AliApp(TB") > -1,
4307
- Alipay: u.indexOf("AliApp(AP") > -1,
4308
- Weibo: u.indexOf("Weibo") > -1,
4309
- Douban: u.indexOf("com.douban.frodo") > -1,
4310
- Suning: u.indexOf("SNEBUY-APP") > -1,
4311
- iQiYi: u.indexOf("IqiyiApp") > -1,
4312
- Windows: u.indexOf("Windows") > -1,
4313
- Linux: u.indexOf("Linux") > -1 || u.indexOf("X11") > -1,
4314
- "Mac OS": u.indexOf("Macintosh") > -1,
4315
- Android: u.indexOf("Android") > -1 || u.indexOf("Adr") > -1,
4316
- Ubuntu: u.indexOf("Ubuntu") > -1,
4317
- FreeBSD: u.indexOf("FreeBSD") > -1,
4318
- Debian: u.indexOf("Debian") > -1,
4319
- "Windows Phone": u.indexOf("IEMobile") > -1 || u.indexOf("Windows Phone") > -1,
4320
- BlackBerry: u.indexOf("BlackBerry") > -1 || u.indexOf("RIM") > -1,
4321
- MeeGo: u.indexOf("MeeGo") > -1,
4322
- Symbian: u.indexOf("Symbian") > -1,
4323
- iOS: u.indexOf("like Mac OS X") > -1,
4324
- "Chrome OS": u.indexOf("CrOS") > -1,
4325
- WebOS: u.indexOf("hpwOS") > -1,
4326
- Mobile: u.indexOf("Mobi") > -1 || u.indexOf("iPh") > -1 || u.indexOf("480") > -1,
4327
- Tablet: u.indexOf("Tablet") > -1 || u.indexOf("Pad") > -1 || u.indexOf("Nexus 7") > -1
4397
+ const u = String(userAgent || nav.userAgent);
4398
+ const dest = {
4399
+ os: "",
4400
+ osVersion: "",
4401
+ engine: "",
4402
+ browser: "",
4403
+ device: "",
4404
+ language: "",
4405
+ version: ""
4328
4406
  };
4329
- if (match.Mobile) {
4330
- match.Mobile = !(u.indexOf("iPad") > -1);
4331
- } else if (win.showModalDialog && win.chrome) {
4332
- match["360"] = true;
4333
- }
4334
- var hash = {
4335
- engine: ["WebKit", "Trident", "Gecko", "Presto"],
4336
- browser: ["Safari", "Chrome", "Edge", "IE", "Firefox", "Firefox Focus", "Chromium", "Opera", "Vivaldi", "Yandex", "Kindle", "360", "UC", "QQBrowser", "QQ", "Baidu", "Maxthon", "Sogou", "LBBROWSER", "2345Explorer", "TheWorld", "XiaoMi", "Quark", "Qiyu", "Wechat", "Taobao", "Alipay", "Weibo", "Douban", "Suning", "iQiYi"],
4337
- os: ["Windows", "Linux", "Mac OS", "Android", "Ubuntu", "FreeBSD", "Debian", "iOS", "Windows Phone", "BlackBerry", "MeeGo", "Symbian", "Chrome OS", "WebOS"],
4338
- device: ["Mobile", "Tablet"]
4407
+ const engineMatch = {
4408
+ Trident: u.includes("Trident") || u.includes("NET CLR"),
4409
+ Presto: u.includes("Presto"),
4410
+ WebKit: u.includes("AppleWebKit"),
4411
+ Gecko: u.includes("Gecko/")
4412
+ };
4413
+ const browserMatch = {
4414
+ Safari: u.includes("Safari"),
4415
+ Chrome: u.includes("Chrome") || u.includes("CriOS"),
4416
+ IE: u.includes("MSIE") || u.includes("Trident"),
4417
+ Edge: u.includes("Edge") || u.includes("Edg"),
4418
+ Firefox: u.includes("Firefox") || u.includes("FxiOS"),
4419
+ "Firefox Focus": u.includes("Focus"),
4420
+ Chromium: u.includes("Chromium"),
4421
+ Opera: u.includes("Opera") || u.includes("OPR"),
4422
+ Vivaldi: u.includes("Vivaldi"),
4423
+ Yandex: u.includes("YaBrowser"),
4424
+ Kindle: u.includes("Kindle") || u.includes("Silk/"),
4425
+ 360: u.includes("360EE") || u.includes("360SE"),
4426
+ UC: u.includes("UC") || u.includes(" UBrowser"),
4427
+ QQBrowser: u.includes("QQBrowser"),
4428
+ QQ: u.includes("QQ/"),
4429
+ Baidu: u.includes("Baidu") || u.includes("BIDUBrowser"),
4430
+ Maxthon: u.includes("Maxthon"),
4431
+ Sogou: u.includes("MetaSr") || u.includes("Sogou"),
4432
+ LBBROWSER: u.includes("LBBROWSER"),
4433
+ "2345Explorer": u.includes("2345Explorer"),
4434
+ TheWorld: u.includes("TheWorld"),
4435
+ MIUI: u.includes("MiuiBrowser"),
4436
+ Quark: u.includes("Quark"),
4437
+ Qiyu: u.includes("Qiyu"),
4438
+ Wechat: u.includes("MicroMessenger"),
4439
+ Taobao: u.includes("AliApp(TB"),
4440
+ Alipay: u.includes("AliApp(AP"),
4441
+ Weibo: u.includes("Weibo"),
4442
+ Douban: u.includes("com.douban.frodo"),
4443
+ Suning: u.includes("SNEBUY-APP"),
4444
+ iQiYi: u.includes("IqiyiApp")
4339
4445
  };
4340
- _this.device = "PC";
4341
- _this.language = function() {
4342
- var g = nav.browserLanguage || nav.language;
4343
- var arr = g.split("-");
4344
- if (arr[1]) {
4446
+ const osMatch = {
4447
+ Windows: u.includes("Windows"),
4448
+ Linux: u.includes("Linux") || u.includes("X11"),
4449
+ "macOS": u.includes("Macintosh"),
4450
+ Android: u.includes("Android") || u.includes("Adr"),
4451
+ Ubuntu: u.includes("Ubuntu"),
4452
+ FreeBSD: u.includes("FreeBSD"),
4453
+ Debian: u.includes("Debian"),
4454
+ "Windows Phone": u.includes("IEMobile") || u.includes("Windows Phone"),
4455
+ BlackBerry: u.includes("BlackBerry") || u.includes("RIM"),
4456
+ MeeGo: u.includes("MeeGo"),
4457
+ Symbian: u.includes("Symbian"),
4458
+ iOS: u.includes("like Mac OS X"),
4459
+ "Chrome OS": u.includes("CrOS"),
4460
+ WebOS: u.includes("hpwOS")
4461
+ };
4462
+ const deviceMatch = {
4463
+ Mobile: u.includes("Mobi") || u.includes("iPh") || u.includes("480"),
4464
+ Tablet: u.includes("Tablet") || u.includes("Pad") || u.includes("Nexus 7")
4465
+ };
4466
+ if (deviceMatch.Mobile) {
4467
+ deviceMatch.Mobile = !u.includes("iPad");
4468
+ } else if (browserMatch.Chrome && u.includes("Edg")) {
4469
+ browserMatch.Chrome = false;
4470
+ browserMatch.Edge = true;
4471
+ } else if (win.showModalDialog && win.chrome) {
4472
+ browserMatch.Chrome = false;
4473
+ browserMatch["360"] = true;
4474
+ }
4475
+ dest.device = "PC";
4476
+ dest.language = (() => {
4477
+ const g = nav.browserLanguage || nav.language;
4478
+ const arr = g.split("-");
4479
+ if (arr[1])
4345
4480
  arr[1] = arr[1].toUpperCase();
4346
- }
4347
4481
  return arr.join("_");
4348
- }();
4349
- for (var s in hash) {
4350
- for (var i = 0; i < hash[s].length; i++) {
4351
- var value = hash[s][i];
4352
- if (match[value]) {
4353
- _this[s] = value;
4354
- }
4355
- }
4356
- }
4357
- var osVersion = {
4358
- Windows: function() {
4359
- var v = u.replace(/^.*Windows NT ([\d.]+);.*$/, "$1");
4360
- var hash2 = {
4361
- 6.4: "10",
4362
- 6.3: "8.1",
4363
- 6.2: "8",
4364
- 6.1: "7",
4482
+ })();
4483
+ const hash = {
4484
+ engine: engineMatch,
4485
+ browser: browserMatch,
4486
+ os: osMatch,
4487
+ device: deviceMatch
4488
+ };
4489
+ Object.entries(hash).forEach(([type, match]) => {
4490
+ Object.entries(match).forEach(([name, result]) => {
4491
+ if (result === true)
4492
+ dest[type] = name;
4493
+ });
4494
+ });
4495
+ const osVersion = {
4496
+ Windows: () => {
4497
+ const v = u.replace(/^.*Windows NT ([\d.]+);.*$/, "$1");
4498
+ const wvHash = {
4499
+ "6.4": "10",
4500
+ "6.3": "8.1",
4501
+ "6.2": "8",
4502
+ "6.1": "7",
4365
4503
  "6.0": "Vista",
4366
- 5.2: "XP",
4367
- 5.1: "XP",
4504
+ "5.2": "XP",
4505
+ "5.1": "XP",
4368
4506
  "5.0": "2000",
4369
4507
  "10.0": "10",
4370
4508
  "11.0": "11"
4371
4509
  };
4372
- return hash2[v] || v;
4510
+ return wvHash[v] || v;
4373
4511
  },
4374
- Android: function() {
4375
- return u.replace(/^.*Android ([\d.]+);.*$/, "$1");
4376
- },
4377
- iOS: function() {
4378
- return u.replace(/^.*OS ([\d_]+) like.*$/, "$1").replace(/_/g, ".");
4379
- },
4380
- Debian: function() {
4381
- return u.replace(/^.*Debian\/([\d.]+).*$/, "$1");
4382
- },
4383
- "Windows Phone": function() {
4384
- return u.replace(/^.*Windows Phone( OS)? ([\d.]+);.*$/, "$2");
4385
- },
4386
- "Mac OS": function() {
4387
- return u.replace(/^.*Mac OS X ([\d_]+).*$/, "$1").replace(/_/g, ".");
4388
- },
4389
- WebOS: function() {
4390
- return u.replace(/^.*hpwOS\/([\d.]+);.*$/, "$1");
4391
- }
4512
+ Android: () => u.replace(/^.*Android ([\d.]+);.*$/, "$1"),
4513
+ iOS: () => u.replace(/^.*OS ([\d_]+) like.*$/, "$1").replace(/_/g, "."),
4514
+ Debian: () => u.replace(/^.*Debian\/([\d.]+).*$/, "$1"),
4515
+ "Windows Phone": () => u.replace(/^.*Windows Phone( OS)? ([\d.]+);.*$/, "$2"),
4516
+ "macOS": () => u.replace(/^.*Mac OS X ([\d_]+).*$/, "$1").replace(/_/g, "."),
4517
+ WebOS: () => u.replace(/^.*hpwOS\/([\d.]+);.*$/, "$1")
4392
4518
  };
4393
- _this.osVersion = "";
4394
- if (osVersion[_this.os]) {
4395
- _this.osVersion = osVersion[_this.os]();
4396
- if (_this.osVersion === u) {
4397
- _this.osVersion = "";
4398
- }
4399
- }
4400
- var version = {
4401
- Safari: function() {
4402
- return u.replace(/^.*Version\/([\d.]+).*$/, "$1");
4403
- },
4404
- Chrome: function() {
4405
- return u.replace(/^.*Chrome\/([\d.]+).*$/, "$1").replace(/^.*CriOS\/([\d.]+).*$/, "$1");
4406
- },
4407
- IE: function() {
4408
- return u.replace(/^.*MSIE ([\d.]+).*$/, "$1").replace(/^.*rv:([\d.]+).*$/, "$1");
4409
- },
4410
- Edge: function() {
4411
- return u.replace(/^.*Edge\/([\d.]+).*$/, "$1");
4412
- },
4413
- Firefox: function() {
4414
- return u.replace(/^.*Firefox\/([\d.]+).*$/, "$1").replace(/^.*FxiOS\/([\d.]+).*$/, "$1");
4415
- },
4416
- "Firefox Focus": function() {
4417
- return u.replace(/^.*Focus\/([\d.]+).*$/, "$1");
4418
- },
4419
- Chromium: function() {
4420
- return u.replace(/^.*Chromium\/([\d.]+).*$/, "$1");
4421
- },
4422
- Opera: function() {
4423
- return u.replace(/^.*Opera\/([\d.]+).*$/, "$1").replace(/^.*OPR\/([\d.]+).*$/, "$1");
4424
- },
4425
- Vivaldi: function() {
4426
- return u.replace(/^.*Vivaldi\/([\d.]+).*$/, "$1");
4427
- },
4428
- Yandex: function() {
4429
- return u.replace(/^.*YaBrowser\/([\d.]+).*$/, "$1");
4430
- },
4431
- Kindle: function() {
4432
- return u.replace(/^.*Version\/([\d.]+).*$/, "$1");
4433
- },
4434
- Maxthon: function() {
4435
- return u.replace(/^.*Maxthon\/([\d.]+).*$/, "$1");
4436
- },
4437
- QQBrowser: function() {
4438
- return u.replace(/^.*QQBrowser\/([\d.]+).*$/, "$1");
4439
- },
4440
- QQ: function() {
4441
- return u.replace(/^.*QQ\/([\d.]+).*$/, "$1");
4442
- },
4443
- Baidu: function() {
4444
- return u.replace(/^.*BIDUBrowser[\s/]([\d.]+).*$/, "$1");
4445
- },
4446
- UC: function() {
4447
- return u.replace(/^.*UC?Browser\/([\d.]+).*$/, "$1");
4448
- },
4449
- Sogou: function() {
4450
- return u.replace(/^.*SE ([\d.X]+).*$/, "$1").replace(/^.*SogouMobileBrowser\/([\d.]+).*$/, "$1");
4451
- },
4452
- "2345Explorer": function() {
4453
- return u.replace(/^.*2345Explorer\/([\d.]+).*$/, "$1");
4454
- },
4455
- TheWorld: function() {
4456
- return u.replace(/^.*TheWorld ([\d.]+).*$/, "$1");
4457
- },
4458
- XiaoMi: function() {
4459
- return u.replace(/^.*MiuiBrowser\/([\d.]+).*$/, "$1");
4460
- },
4461
- Quark: function() {
4462
- return u.replace(/^.*Quark\/([\d.]+).*$/, "$1");
4463
- },
4464
- Qiyu: function() {
4465
- return u.replace(/^.*Qiyu\/([\d.]+).*$/, "$1");
4466
- },
4467
- Wechat: function() {
4468
- return u.replace(/^.*MicroMessenger\/([\d.]+).*$/, "$1");
4469
- },
4470
- Taobao: function() {
4471
- return u.replace(/^.*AliApp\(TB\/([\d.]+).*$/, "$1");
4472
- },
4473
- Alipay: function() {
4474
- return u.replace(/^.*AliApp\(AP\/([\d.]+).*$/, "$1");
4475
- },
4476
- Weibo: function() {
4477
- return u.replace(/^.*weibo__([\d.]+).*$/, "$1");
4478
- },
4479
- Douban: function() {
4480
- return u.replace(/^.*com.douban.frodo\/([\d.]+).*$/, "$1");
4481
- },
4482
- Suning: function() {
4483
- return u.replace(/^.*SNEBUY-APP([\d.]+).*$/, "$1");
4484
- },
4485
- iQiYi: function() {
4486
- return u.replace(/^.*IqiyiVersion\/([\d.]+).*$/, "$1");
4487
- }
4519
+ dest.osVersion = "";
4520
+ if (osVersion[dest.os]) {
4521
+ dest.osVersion = osVersion[dest.os]();
4522
+ if (dest.osVersion === u) {
4523
+ dest.osVersion = "";
4524
+ }
4525
+ }
4526
+ const version = {
4527
+ Safari: () => u.replace(/^.*Version\/([\d.]+).*$/, "$1"),
4528
+ Chrome: () => u.replace(/^.*Chrome\/([\d.]+).*$/, "$1").replace(/^.*CriOS\/([\d.]+).*$/, "$1"),
4529
+ IE: () => u.replace(/^.*MSIE ([\d.]+).*$/, "$1").replace(/^.*rv:([\d.]+).*$/, "$1"),
4530
+ Edge: () => u.replace(/^.*(Edge|Edg|Edg[A-Z]{1})\/([\d.]+).*$/, "$2"),
4531
+ Firefox: () => u.replace(/^.*Firefox\/([\d.]+).*$/, "$1").replace(/^.*FxiOS\/([\d.]+).*$/, "$1"),
4532
+ "Firefox Focus": () => u.replace(/^.*Focus\/([\d.]+).*$/, "$1"),
4533
+ Chromium: () => u.replace(/^.*Chromium\/([\d.]+).*$/, "$1"),
4534
+ Opera: () => u.replace(/^.*Opera\/([\d.]+).*$/, "$1").replace(/^.*OPR\/([\d.]+).*$/, "$1"),
4535
+ Vivaldi: () => u.replace(/^.*Vivaldi\/([\d.]+).*$/, "$1"),
4536
+ Yandex: () => u.replace(/^.*YaBrowser\/([\d.]+).*$/, "$1"),
4537
+ Kindle: () => u.replace(/^.*Version\/([\d.]+).*$/, "$1"),
4538
+ Maxthon: () => u.replace(/^.*Maxthon\/([\d.]+).*$/, "$1"),
4539
+ QQBrowser: () => u.replace(/^.*QQBrowser\/([\d.]+).*$/, "$1"),
4540
+ QQ: () => u.replace(/^.*QQ\/([\d.]+).*$/, "$1"),
4541
+ Baidu: () => u.replace(/^.*BIDUBrowser[\s/]([\d.]+).*$/, "$1"),
4542
+ UC: () => u.replace(/^.*UC?Browser\/([\d.]+).*$/, "$1"),
4543
+ Sogou: () => u.replace(/^.*SE ([\d.X]+).*$/, "$1").replace(/^.*SogouMobileBrowser\/([\d.]+).*$/, "$1"),
4544
+ "2345Explorer": () => u.replace(/^.*2345Explorer\/([\d.]+).*$/, "$1"),
4545
+ TheWorld: () => u.replace(/^.*TheWorld ([\d.]+).*$/, "$1"),
4546
+ MIUI: () => u.replace(/^.*MiuiBrowser\/([\d.]+).*$/, "$1"),
4547
+ Quark: () => u.replace(/^.*Quark\/([\d.]+).*$/, "$1"),
4548
+ Qiyu: () => u.replace(/^.*Qiyu\/([\d.]+).*$/, "$1"),
4549
+ Wechat: () => u.replace(/^.*MicroMessenger\/([\d.]+).*$/, "$1"),
4550
+ Taobao: () => u.replace(/^.*AliApp\(TB\/([\d.]+).*$/, "$1"),
4551
+ Alipay: () => u.replace(/^.*AliApp\(AP\/([\d.]+).*$/, "$1"),
4552
+ Weibo: () => u.replace(/^.*weibo__([\d.]+).*$/, "$1"),
4553
+ Douban: () => u.replace(/^.*com.douban.frodo\/([\d.]+).*$/, "$1"),
4554
+ Suning: () => u.replace(/^.*SNEBUY-APP([\d.]+).*$/, "$1"),
4555
+ iQiYi: () => u.replace(/^.*IqiyiVersion\/([\d.]+).*$/, "$1")
4488
4556
  };
4489
- _this.version = "";
4490
- if (version[_this.browser]) {
4491
- _this.version = version[_this.browser]();
4492
- if (_this.version === u) {
4493
- _this.version = "";
4494
- }
4495
- }
4496
- if (_this.version.indexOf(".")) {
4497
- _this.version = _this.version.substring(0, _this.version.indexOf("."));
4498
- }
4499
- if (_this.browser === "Edge") {
4500
- _this.engine = "EdgeHTML";
4501
- } else if (_this.browser === "Chrome" && parseInt(_this.version) > 27) {
4502
- _this.engine = "Blink";
4503
- } else if (_this.browser === "Opera" && parseInt(_this.version) > 12) {
4504
- _this.engine = "Blink";
4505
- } else if (_this.browser === "Yandex") {
4506
- _this.engine = "Blink";
4507
- } else if (_this.browser === void 0) {
4508
- _this.browser = "Unknow App";
4509
- }
4510
- }
4511
- function detectFactory(u) {
4512
- return new Detect(u);
4557
+ dest.version = "";
4558
+ if (version[dest.browser]) {
4559
+ dest.version = version[dest.browser]();
4560
+ if (dest.version === u) {
4561
+ dest.version = "";
4562
+ }
4563
+ }
4564
+ if (dest.version.indexOf(".")) {
4565
+ dest.version = dest.version.substring(0, dest.version.indexOf("."));
4566
+ }
4567
+ if (dest.os === "iOS" && u.includes("iPad")) {
4568
+ dest.os = "iPadOS";
4569
+ } else if (dest.browser === "Edge" && !u.includes("Edg")) {
4570
+ dest.engine = "EdgeHTML";
4571
+ } else if (dest.browser === "MIUI") {
4572
+ dest.os = "Android";
4573
+ } else if (dest.browser === "Chrome" && Number(dest.version) > 27) {
4574
+ dest.engine = "Blink";
4575
+ } else if (dest.browser === "Opera" && Number(dest.version) > 12) {
4576
+ dest.engine = "Blink";
4577
+ } else if (dest.browser === "Yandex") {
4578
+ dest.engine = "Blink";
4579
+ } else if (dest.browser === void 0) {
4580
+ dest.browser = "Unknow App";
4581
+ }
4582
+ return dest;
4513
4583
  }
4514
4584
  var CommentHTML = '<div class="atk-comment-wrap">\n <div class="atk-comment">\n <div class="atk-avatar"></div>\n <div class="atk-main">\n <div class="atk-header">\n <span class="atk-item atk-nick"></span>\n <span class="atk-item atk-badge"></span>\n <span class="atk-item atk-date"></span>\n </div>\n <div class="atk-body">\n <div class="atk-content"></div>\n </div>\n <div class="atk-footer">\n <div class="atk-actions"></div>\n </div>\n </div>\n </div>\n</div>\n';
4515
4585
  class ActionBtn {
@@ -4935,11 +5005,11 @@ class Comment extends Component {
4935
5005
  return timeAgo(new Date(this.data.date));
4936
5006
  }
4937
5007
  getUserUaBrowser() {
4938
- const info = detectFactory(this.data.ua);
5008
+ const info = Detect(this.data.ua);
4939
5009
  return `${info.browser} ${info.version}`;
4940
5010
  }
4941
5011
  getUserUaOS() {
4942
- const info = detectFactory(this.data.ua);
5012
+ const info = Detect(this.data.ua);
4943
5013
  return `${info.os} ${info.osVersion}`;
4944
5014
  }
4945
5015
  playFadeInAnim() {
@@ -5276,7 +5346,7 @@ class ReadMoreBtn {
5276
5346
  this.hide();
5277
5347
  }
5278
5348
  }
5279
- const backendMinVersion = "2.1.1";
5349
+ const backendMinVersion = "2.1.2";
5280
5350
  class ListLite extends Component {
5281
5351
  constructor(ctx) {
5282
5352
  super(ctx);
@@ -5341,7 +5411,7 @@ class ListLite extends Component {
5341
5411
  try {
5342
5412
  listData = yield new Api(this.ctx).get(offset, this.pageSize, this.flatMode, this.paramsEditor);
5343
5413
  } catch (e) {
5344
- this.onError(e.msg || String(e), offset);
5414
+ this.onError(e.msg || String(e), offset, e.data);
5345
5415
  throw e;
5346
5416
  } finally {
5347
5417
  hideLoading$1();
@@ -5364,7 +5434,7 @@ class ListLite extends Component {
5364
5434
  }
5365
5435
  this.data = data;
5366
5436
  const feMinVersion = ((_a = data.api_version) == null ? void 0 : _a.fe_min_version) || "0.0.0";
5367
- if (this.ctx.conf.versionCheck && this.versionCheck("\u524D\u7AEF", feMinVersion, "2.2.2"))
5437
+ if (this.ctx.conf.versionCheck && this.versionCheck("\u524D\u7AEF", feMinVersion, "2.2.5"))
5368
5438
  return;
5369
5439
  if (this.ctx.conf.versionCheck && this.versionCheck("\u540E\u7AEF", backendMinVersion, (_b = data.api_version) == null ? void 0 : _b.version))
5370
5440
  return;
@@ -5445,7 +5515,7 @@ class ListLite extends Component {
5445
5515
  this.$el.append(this.pagination.$el);
5446
5516
  }
5447
5517
  }
5448
- onError(msg, offset) {
5518
+ onError(msg, offset, errData) {
5449
5519
  var _a;
5450
5520
  msg = String(msg);
5451
5521
  console.error(msg);
@@ -5458,10 +5528,20 @@ class ListLite extends Component {
5458
5528
  $retryBtn.onclick = () => this.fetchComments(0);
5459
5529
  $err.appendChild($retryBtn);
5460
5530
  const adminBtn = createElement('<span atk-only-admin-show> | <span style="cursor:pointer;">\u6253\u5F00\u63A7\u5236\u53F0</span></span>');
5461
- adminBtn.onclick = () => this.ctx.trigger("sidebar-show");
5531
+ $err.appendChild(adminBtn);
5462
5532
  if (!this.ctx.user.data.isAdmin)
5463
5533
  adminBtn.classList.add("atk-hide");
5464
- $err.appendChild(adminBtn);
5534
+ let sidebarView = "";
5535
+ if (errData == null ? void 0 : errData.err_no_site) {
5536
+ const viewLoadParam = {
5537
+ create_name: this.ctx.conf.site,
5538
+ create_urls: `${window.location.protocol}//${window.location.host}`
5539
+ };
5540
+ sidebarView = `sites|${JSON.stringify(viewLoadParam)}`;
5541
+ }
5542
+ adminBtn.onclick = () => this.ctx.trigger("sidebar-show", {
5543
+ view: sidebarView
5544
+ });
5465
5545
  setError(this.$el, $err);
5466
5546
  }
5467
5547
  refreshUI() {
@@ -5686,7 +5766,7 @@ class List extends ListLite {
5686
5766
  if (this.ctx.conf.listSort) {
5687
5767
  this.initDropdown();
5688
5768
  }
5689
- this.$el.querySelector(".atk-copyright").innerHTML = `Powered By <a href="https://artalk.js.org" target="_blank" title="Artalk v${"2.2.2"}">Artalk</a>`;
5769
+ this.$el.querySelector(".atk-copyright").innerHTML = `Powered By <a href="https://artalk.js.org" target="_blank" title="Artalk v${"2.2.5"}">Artalk</a>`;
5690
5770
  this.ctx.on("list-reload", () => this.fetchComments(0));
5691
5771
  this.ctx.on("list-refresh-ui", () => this.refreshUI());
5692
5772
  this.ctx.on("list-import", (data) => this.importComments(data));
@@ -5870,13 +5950,13 @@ class SidebarLayer extends Component {
5870
5950
  this.$closeBtn.onclick = () => {
5871
5951
  this.hide();
5872
5952
  };
5873
- this.ctx.on("sidebar-show", () => this.show());
5953
+ this.ctx.on("sidebar-show", (conf) => this.show(conf || {}));
5874
5954
  this.ctx.on("sidebar-hide", () => this.hide());
5875
5955
  this.ctx.on("user-changed", () => {
5876
5956
  this.firstShow = true;
5877
5957
  });
5878
5958
  }
5879
- show() {
5959
+ show(conf) {
5880
5960
  return __async(this, null, function* () {
5881
5961
  this.$el.style.transform = "";
5882
5962
  if (this.layer == null) {
@@ -5891,41 +5971,48 @@ class SidebarLayer extends Component {
5891
5971
  setTimeout(() => {
5892
5972
  this.$el.style.transform = "translate(0, 0)";
5893
5973
  }, 20);
5894
- if (this.firstShow) {
5895
- if (this.ctx.user.data.isAdmin) {
5896
- const resp = yield new Api(this.ctx).loginStatus();
5897
- if (!resp.is_login) {
5898
- yield new Promise((resolve, reject) => {
5899
- this.ctx.trigger("checker-admin", {
5900
- onSuccess: () => {
5901
- resolve(null);
5902
- setTimeout(() => {
5903
- this.show();
5904
- }, 500);
5905
- },
5906
- onCancel: () => {
5907
- var _a;
5908
- (_a = this.layer) == null ? void 0 : _a.hide();
5909
- }
5910
- });
5911
- });
5912
- }
5974
+ (() => __async(this, null, function* () {
5975
+ var _a;
5976
+ const resp = yield new Api(this.ctx).loginStatus();
5977
+ if (resp.is_admin && !resp.is_login) {
5978
+ (_a = this.layer) == null ? void 0 : _a.hide();
5979
+ this.firstShow = true;
5980
+ this.ctx.trigger("checker-admin", {
5981
+ onSuccess: () => {
5982
+ setTimeout(() => {
5983
+ this.show(conf);
5984
+ }, 500);
5985
+ },
5986
+ onCancel: () => {
5987
+ }
5988
+ });
5913
5989
  }
5990
+ }))();
5991
+ this.ctx.trigger("unread-update", { notifies: [] });
5992
+ if (this.firstShow) {
5914
5993
  this.$iframeWrap.innerHTML = "";
5915
5994
  this.$iframe = createElement("<iframe></iframe>");
5916
5995
  const baseURL = getURLBasedOnApi(this.ctx, "sidebar/");
5917
- const userData = encodeURIComponent(JSON.stringify(this.ctx.user.data));
5918
- const location = window.location;
5919
- this.iframeLoad(`${baseURL}?pageKey=${encodeURIComponent(this.conf.pageKey)}&site=${encodeURIComponent(this.conf.site || "")}&user=${userData}&time=${+new Date()}&referer=${encodeURIComponent(`${location.protocol}//${location.host}${location.pathname}`)}${this.conf.darkMode ? `&darkMode=1` : ``}`);
5996
+ const query = {
5997
+ pageKey: this.conf.pageKey,
5998
+ site: this.conf.site || "",
5999
+ user: JSON.stringify(this.ctx.user.data),
6000
+ time: +new Date()
6001
+ };
6002
+ if (conf.view)
6003
+ query.view = conf.view;
6004
+ if (this.conf.darkMode)
6005
+ query.darkMode = "1";
6006
+ const urlParams = new URLSearchParams(query);
6007
+ this.iframeLoad(`${baseURL}?${urlParams.toString()}`);
5920
6008
  this.$iframeWrap.append(this.$iframe);
5921
6009
  this.firstShow = false;
5922
6010
  } else {
5923
- if (this.conf.darkMode && !this.$iframe.src.match(/darkMode=1$/)) {
6011
+ const isIframeSrcDarkMode = this.$iframe.src.includes("darkMode=1");
6012
+ if (this.conf.darkMode && !isIframeSrcDarkMode)
5924
6013
  this.iframeLoad(`${this.$iframe.src}&darkMode=1`);
5925
- }
5926
- if (!this.conf.darkMode && this.$iframe.src.match(/darkMode=1$/)) {
5927
- this.iframeLoad(this.$iframe.src.replace(/&darkMode=1$/, ""));
5928
- }
6014
+ if (!this.conf.darkMode && isIframeSrcDarkMode)
6015
+ this.iframeLoad(this.$iframe.src.replace("&darkMode=1", ""));
5929
6016
  }
5930
6017
  });
5931
6018
  }
@@ -5994,6 +6081,7 @@ const _Artalk = class {
5994
6081
  this.ctx = new Context(this.$root, this.conf);
5995
6082
  this.$root.classList.add("artalk");
5996
6083
  this.$root.innerHTML = "";
6084
+ this.initLayer();
5997
6085
  this.initDarkMode();
5998
6086
  this.checkerLauncher = new CheckerLauncher(this.ctx);
5999
6087
  initMarked(this.ctx);
@@ -6040,6 +6128,10 @@ const _Artalk = class {
6040
6128
  reload() {
6041
6129
  this.list.fetchComments(0);
6042
6130
  }
6131
+ initLayer() {
6132
+ Layer.BodyOrgOverflow = document.body.style.overflow;
6133
+ Layer.BodyOrgPaddingRight = document.body.style.paddingRight;
6134
+ }
6043
6135
  initDarkMode() {
6044
6136
  const darkModeClassName = "atk-dark-mode";
6045
6137
  if (this.conf.darkMode) {
@@ -6063,12 +6155,12 @@ const _Artalk = class {
6063
6155
  }
6064
6156
  initPV() {
6065
6157
  return __async(this, null, function* () {
6066
- if (!this.conf.pvEl || !document.querySelector(this.conf.pvEl))
6067
- return;
6068
- const $pv = document.querySelector(this.conf.pvEl);
6069
6158
  const pvNum = yield new Api(this.ctx).pv();
6070
6159
  if (Number.isNaN(Number(pvNum)))
6071
6160
  return;
6161
+ if (!this.conf.pvEl || !document.querySelector(this.conf.pvEl))
6162
+ return;
6163
+ const $pv = document.querySelector(this.conf.pvEl);
6072
6164
  $pv.innerText = String(pvNum);
6073
6165
  });
6074
6166
  }