artalk 2.2.4 → 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
@@ -66,6 +66,7 @@ class Context {
66
66
  __publicField(this, "user");
67
67
  __publicField(this, "eventList", []);
68
68
  __publicField(this, "markedInstance");
69
+ __publicField(this, "markedReplacers", []);
69
70
  this.cid = +new Date();
70
71
  this.$root = rootEl;
71
72
  this.conf = conf;
@@ -2656,10 +2657,10 @@ function versionCompare(a, b) {
2656
2657
  }
2657
2658
  function initMarked(ctx) {
2658
2659
  const renderer = new marked$1.Renderer();
2659
- const linkRenderer = renderer.link;
2660
+ const orgLinkRenderer = renderer.link;
2660
2661
  renderer.link = (href, title, text) => {
2661
2662
  const localLink = href == null ? void 0 : href.startsWith(`${window.location.protocol}//${window.location.hostname}`);
2662
- const html = linkRenderer.call(renderer, href, title, text);
2663
+ const html = orgLinkRenderer.call(renderer, href, title, text);
2663
2664
  return html.replace(/^<a /, `<a target="_blank" ${!localLink ? `rel="noreferrer noopener nofollow"` : ""} `);
2664
2665
  };
2665
2666
  renderer.code = (block2, lang) => {
@@ -2691,7 +2692,7 @@ function initMarked(ctx) {
2691
2692
  ctx.markedInstance = nMarked;
2692
2693
  }
2693
2694
  function marked(ctx, src) {
2694
- return insane_1(ctx.markedInstance.parse(src), {
2695
+ let dest = insane_1(ctx.markedInstance.parse(src), {
2695
2696
  allowedClasses: {},
2696
2697
  allowedSchemes: ["http", "https", "mailto"],
2697
2698
  allowedTags: [
@@ -2742,7 +2743,7 @@ function marked(ctx, src) {
2742
2743
  ],
2743
2744
  allowedAttributes: {
2744
2745
  "*": ["title", "accesskey"],
2745
- a: ["href", "name", "target", "aria-label"],
2746
+ a: ["href", "name", "target", "aria-label", "rel"],
2746
2747
  img: ["src", "alt", "title", "atk-emoticon", "aria-label"],
2747
2748
  code: ["class"],
2748
2749
  span: ["class", "style"]
@@ -2763,14 +2764,19 @@ function marked(ctx, src) {
2763
2764
  return true;
2764
2765
  }
2765
2766
  });
2767
+ ctx.markedReplacers.forEach((replacer) => {
2768
+ if (typeof replacer === "function")
2769
+ dest = replacer(dest);
2770
+ });
2771
+ return dest;
2766
2772
  }
2767
2773
  function getCorrectUserAgent() {
2768
2774
  return __async(this, null, function* () {
2769
2775
  const uaRaw = navigator.userAgent;
2770
- const uaData = navigator.userAgentData;
2771
- if (!uaData || !uaData.getHighEntropyValues) {
2776
+ if (!navigator.userAgentData || !navigator.userAgentData.getHighEntropyValues) {
2772
2777
  return uaRaw;
2773
2778
  }
2779
+ const uaData = navigator.userAgentData;
2774
2780
  let uaGot = null;
2775
2781
  try {
2776
2782
  uaGot = yield uaData.getHighEntropyValues(["platformVersion"]);
@@ -2778,12 +2784,16 @@ function getCorrectUserAgent() {
2778
2784
  console.error(err);
2779
2785
  return uaRaw;
2780
2786
  }
2781
- if (uaData.platform !== "Windows") {
2782
- return uaRaw;
2783
- }
2784
2787
  const majorPlatformVersion = Number(uaGot.platformVersion.split(".")[0]);
2785
- if (majorPlatformVersion >= 13) {
2786
- 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
+ }
2787
2797
  }
2788
2798
  return uaRaw;
2789
2799
  });
@@ -3660,16 +3670,28 @@ class EmoticonsPlug extends EditorPlug {
3660
3670
  __publicField(this, "emoticons", []);
3661
3671
  __publicField(this, "$grpWrap");
3662
3672
  __publicField(this, "$grpSwitcher");
3673
+ __publicField(this, "loadingTask", null);
3674
+ __publicField(this, "isListLoaded", false);
3675
+ __publicField(this, "isImgLoaded", false);
3663
3676
  this.editor = editor2;
3664
3677
  this.$el = createElement(`<div class="atk-editor-plug-emoticons"></div>`);
3665
- this.init();
3666
3678
  }
3667
- init() {
3679
+ loadEmoticonsData() {
3668
3680
  return __async(this, null, function* () {
3669
- showLoading(this.$el);
3670
- this.emoticons = yield this.handleData(this.ctx.conf.emoticons);
3671
- hideLoading(this.$el);
3672
- 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;
3673
3695
  });
3674
3696
  }
3675
3697
  handleData(data) {
@@ -3718,7 +3740,6 @@ class EmoticonsPlug extends EditorPlug {
3718
3740
  }
3719
3741
  });
3720
3742
  data = data.filter((item) => typeof item === "object" && !Array.isArray(item) && !!item && !!item.name);
3721
- console.log(data);
3722
3743
  this.solveNullKey(data);
3723
3744
  this.solveSameKey(data);
3724
3745
  return data;
@@ -3849,9 +3870,16 @@ class EmoticonsPlug extends EditorPlug {
3849
3870
  changeListHeight() {
3850
3871
  }
3851
3872
  onShow() {
3852
- setTimeout(() => {
3853
- this.changeListHeight();
3854
- }, 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
+ }))();
3855
3883
  }
3856
3884
  onHide() {
3857
3885
  this.$el.parentElement.style.height = "";
@@ -4055,6 +4083,13 @@ class Editor extends Component {
4055
4083
  this.LOADABLE_PLUG_LIST.forEach((PlugObj) => {
4056
4084
  const btnElem = createElement(`<span class="atk-plug-btn" data-plug-name="${PlugObj.Name}">${PlugObj.BtnHTML}</span>`);
4057
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
+ }
4058
4093
  btnElem.addEventListener("click", () => {
4059
4094
  let plug = this.plugList[PlugObj.Name];
4060
4095
  if (!plug) {
@@ -4209,7 +4244,9 @@ class Editor extends Component {
4209
4244
  if (!!this.plugList && !!this.plugList.preview) {
4210
4245
  this.plugList.preview.updateContent();
4211
4246
  }
4212
- this.adjustTextareaHeight();
4247
+ window.setTimeout(() => {
4248
+ this.adjustTextareaHeight();
4249
+ }, 80);
4213
4250
  }
4214
4251
  clearEditor() {
4215
4252
  this.setContent("");
@@ -4348,252 +4385,201 @@ class Editor extends Component {
4348
4385
  if (this.replyComment !== null)
4349
4386
  this.cancelReply();
4350
4387
  }
4388
+ initRemoteEmoticons() {
4389
+ }
4351
4390
  }
4352
4391
  var list = "";
4353
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';
4354
4393
  var comment = "";
4355
- var win = window || {};
4356
- var nav = navigator || {};
4394
+ const win = window || {};
4395
+ const nav = navigator || {};
4357
4396
  function Detect(userAgent) {
4358
- var u = userAgent || nav.userAgent;
4359
- var _this = this;
4360
- var match = {
4361
- Trident: u.indexOf("Trident") > -1 || u.indexOf("NET CLR") > -1,
4362
- Presto: u.indexOf("Presto") > -1,
4363
- WebKit: u.indexOf("AppleWebKit") > -1,
4364
- Gecko: u.indexOf("Gecko/") > -1,
4365
- Safari: u.indexOf("Safari") > -1,
4366
- Chrome: u.indexOf("Chrome") > -1 || u.indexOf("CriOS") > -1,
4367
- IE: u.indexOf("MSIE") > -1 || u.indexOf("Trident") > -1,
4368
- Edge: u.indexOf("Edge") > -1,
4369
- Firefox: u.indexOf("Firefox") > -1 || u.indexOf("FxiOS") > -1,
4370
- "Firefox Focus": u.indexOf("Focus") > -1,
4371
- Chromium: u.indexOf("Chromium") > -1,
4372
- Opera: u.indexOf("Opera") > -1 || u.indexOf("OPR") > -1,
4373
- Vivaldi: u.indexOf("Vivaldi") > -1,
4374
- Yandex: u.indexOf("YaBrowser") > -1,
4375
- Kindle: u.indexOf("Kindle") > -1 || u.indexOf("Silk/") > -1,
4376
- 360: u.indexOf("360EE") > -1 || u.indexOf("360SE") > -1,
4377
- UC: u.indexOf("UC") > -1 || u.indexOf(" UBrowser") > -1,
4378
- QQBrowser: u.indexOf("QQBrowser") > -1,
4379
- QQ: u.indexOf("QQ/") > -1,
4380
- Baidu: u.indexOf("Baidu") > -1 || u.indexOf("BIDUBrowser") > -1,
4381
- Maxthon: u.indexOf("Maxthon") > -1,
4382
- Sogou: u.indexOf("MetaSr") > -1 || u.indexOf("Sogou") > -1,
4383
- LBBROWSER: u.indexOf("LBBROWSER") > -1,
4384
- "2345Explorer": u.indexOf("2345Explorer") > -1,
4385
- TheWorld: u.indexOf("TheWorld") > -1,
4386
- XiaoMi: u.indexOf("MiuiBrowser") > -1,
4387
- Quark: u.indexOf("Quark") > -1,
4388
- Qiyu: u.indexOf("Qiyu") > -1,
4389
- Wechat: u.indexOf("MicroMessenger") > -1,
4390
- Taobao: u.indexOf("AliApp(TB") > -1,
4391
- Alipay: u.indexOf("AliApp(AP") > -1,
4392
- Weibo: u.indexOf("Weibo") > -1,
4393
- Douban: u.indexOf("com.douban.frodo") > -1,
4394
- Suning: u.indexOf("SNEBUY-APP") > -1,
4395
- iQiYi: u.indexOf("IqiyiApp") > -1,
4396
- Windows: u.indexOf("Windows") > -1,
4397
- Linux: u.indexOf("Linux") > -1 || u.indexOf("X11") > -1,
4398
- "Mac OS": u.indexOf("Macintosh") > -1,
4399
- Android: u.indexOf("Android") > -1 || u.indexOf("Adr") > -1,
4400
- Ubuntu: u.indexOf("Ubuntu") > -1,
4401
- FreeBSD: u.indexOf("FreeBSD") > -1,
4402
- Debian: u.indexOf("Debian") > -1,
4403
- "Windows Phone": u.indexOf("IEMobile") > -1 || u.indexOf("Windows Phone") > -1,
4404
- BlackBerry: u.indexOf("BlackBerry") > -1 || u.indexOf("RIM") > -1,
4405
- MeeGo: u.indexOf("MeeGo") > -1,
4406
- Symbian: u.indexOf("Symbian") > -1,
4407
- iOS: u.indexOf("like Mac OS X") > -1,
4408
- "Chrome OS": u.indexOf("CrOS") > -1,
4409
- WebOS: u.indexOf("hpwOS") > -1,
4410
- Mobile: u.indexOf("Mobi") > -1 || u.indexOf("iPh") > -1 || u.indexOf("480") > -1,
4411
- 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: ""
4412
4406
  };
4413
- if (match.Mobile) {
4414
- match.Mobile = !(u.indexOf("iPad") > -1);
4415
- } else if (win.showModalDialog && win.chrome) {
4416
- match["360"] = true;
4417
- }
4418
- var hash = {
4419
- engine: ["WebKit", "Trident", "Gecko", "Presto"],
4420
- 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"],
4421
- os: ["Windows", "Linux", "Mac OS", "Android", "Ubuntu", "FreeBSD", "Debian", "iOS", "Windows Phone", "BlackBerry", "MeeGo", "Symbian", "Chrome OS", "WebOS"],
4422
- 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")
4445
+ };
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")
4423
4461
  };
4424
- _this.device = "PC";
4425
- _this.language = function() {
4426
- var g = nav.browserLanguage || nav.language;
4427
- var arr = g.split("-");
4428
- if (arr[1]) {
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])
4429
4480
  arr[1] = arr[1].toUpperCase();
4430
- }
4431
4481
  return arr.join("_");
4432
- }();
4433
- for (var s in hash) {
4434
- for (var i = 0; i < hash[s].length; i++) {
4435
- var value = hash[s][i];
4436
- if (match[value]) {
4437
- _this[s] = value;
4438
- }
4439
- }
4440
- }
4441
- var osVersion = {
4442
- Windows: function() {
4443
- var v = u.replace(/^.*Windows NT ([\d.]+);.*$/, "$1");
4444
- var hash2 = {
4445
- 6.4: "10",
4446
- 6.3: "8.1",
4447
- 6.2: "8",
4448
- 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",
4449
4503
  "6.0": "Vista",
4450
- 5.2: "XP",
4451
- 5.1: "XP",
4504
+ "5.2": "XP",
4505
+ "5.1": "XP",
4452
4506
  "5.0": "2000",
4453
4507
  "10.0": "10",
4454
4508
  "11.0": "11"
4455
4509
  };
4456
- return hash2[v] || v;
4457
- },
4458
- Android: function() {
4459
- return u.replace(/^.*Android ([\d.]+);.*$/, "$1");
4460
- },
4461
- iOS: function() {
4462
- return u.replace(/^.*OS ([\d_]+) like.*$/, "$1").replace(/_/g, ".");
4463
- },
4464
- Debian: function() {
4465
- return u.replace(/^.*Debian\/([\d.]+).*$/, "$1");
4510
+ return wvHash[v] || v;
4466
4511
  },
4467
- "Windows Phone": function() {
4468
- return u.replace(/^.*Windows Phone( OS)? ([\d.]+);.*$/, "$2");
4469
- },
4470
- "Mac OS": function() {
4471
- return u.replace(/^.*Mac OS X ([\d_]+).*$/, "$1").replace(/_/g, ".");
4472
- },
4473
- WebOS: function() {
4474
- return u.replace(/^.*hpwOS\/([\d.]+);.*$/, "$1");
4475
- }
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")
4476
4518
  };
4477
- _this.osVersion = "";
4478
- if (osVersion[_this.os]) {
4479
- _this.osVersion = osVersion[_this.os]();
4480
- if (_this.osVersion === u) {
4481
- _this.osVersion = "";
4482
- }
4483
- }
4484
- var version = {
4485
- Safari: function() {
4486
- return u.replace(/^.*Version\/([\d.]+).*$/, "$1");
4487
- },
4488
- Chrome: function() {
4489
- return u.replace(/^.*Chrome\/([\d.]+).*$/, "$1").replace(/^.*CriOS\/([\d.]+).*$/, "$1");
4490
- },
4491
- IE: function() {
4492
- return u.replace(/^.*MSIE ([\d.]+).*$/, "$1").replace(/^.*rv:([\d.]+).*$/, "$1");
4493
- },
4494
- Edge: function() {
4495
- return u.replace(/^.*Edge\/([\d.]+).*$/, "$1");
4496
- },
4497
- Firefox: function() {
4498
- return u.replace(/^.*Firefox\/([\d.]+).*$/, "$1").replace(/^.*FxiOS\/([\d.]+).*$/, "$1");
4499
- },
4500
- "Firefox Focus": function() {
4501
- return u.replace(/^.*Focus\/([\d.]+).*$/, "$1");
4502
- },
4503
- Chromium: function() {
4504
- return u.replace(/^.*Chromium\/([\d.]+).*$/, "$1");
4505
- },
4506
- Opera: function() {
4507
- return u.replace(/^.*Opera\/([\d.]+).*$/, "$1").replace(/^.*OPR\/([\d.]+).*$/, "$1");
4508
- },
4509
- Vivaldi: function() {
4510
- return u.replace(/^.*Vivaldi\/([\d.]+).*$/, "$1");
4511
- },
4512
- Yandex: function() {
4513
- return u.replace(/^.*YaBrowser\/([\d.]+).*$/, "$1");
4514
- },
4515
- Kindle: function() {
4516
- return u.replace(/^.*Version\/([\d.]+).*$/, "$1");
4517
- },
4518
- Maxthon: function() {
4519
- return u.replace(/^.*Maxthon\/([\d.]+).*$/, "$1");
4520
- },
4521
- QQBrowser: function() {
4522
- return u.replace(/^.*QQBrowser\/([\d.]+).*$/, "$1");
4523
- },
4524
- QQ: function() {
4525
- return u.replace(/^.*QQ\/([\d.]+).*$/, "$1");
4526
- },
4527
- Baidu: function() {
4528
- return u.replace(/^.*BIDUBrowser[\s/]([\d.]+).*$/, "$1");
4529
- },
4530
- UC: function() {
4531
- return u.replace(/^.*UC?Browser\/([\d.]+).*$/, "$1");
4532
- },
4533
- Sogou: function() {
4534
- return u.replace(/^.*SE ([\d.X]+).*$/, "$1").replace(/^.*SogouMobileBrowser\/([\d.]+).*$/, "$1");
4535
- },
4536
- "2345Explorer": function() {
4537
- return u.replace(/^.*2345Explorer\/([\d.]+).*$/, "$1");
4538
- },
4539
- TheWorld: function() {
4540
- return u.replace(/^.*TheWorld ([\d.]+).*$/, "$1");
4541
- },
4542
- XiaoMi: function() {
4543
- return u.replace(/^.*MiuiBrowser\/([\d.]+).*$/, "$1");
4544
- },
4545
- Quark: function() {
4546
- return u.replace(/^.*Quark\/([\d.]+).*$/, "$1");
4547
- },
4548
- Qiyu: function() {
4549
- return u.replace(/^.*Qiyu\/([\d.]+).*$/, "$1");
4550
- },
4551
- Wechat: function() {
4552
- return u.replace(/^.*MicroMessenger\/([\d.]+).*$/, "$1");
4553
- },
4554
- Taobao: function() {
4555
- return u.replace(/^.*AliApp\(TB\/([\d.]+).*$/, "$1");
4556
- },
4557
- Alipay: function() {
4558
- return u.replace(/^.*AliApp\(AP\/([\d.]+).*$/, "$1");
4559
- },
4560
- Weibo: function() {
4561
- return u.replace(/^.*weibo__([\d.]+).*$/, "$1");
4562
- },
4563
- Douban: function() {
4564
- return u.replace(/^.*com.douban.frodo\/([\d.]+).*$/, "$1");
4565
- },
4566
- Suning: function() {
4567
- return u.replace(/^.*SNEBUY-APP([\d.]+).*$/, "$1");
4568
- },
4569
- iQiYi: function() {
4570
- return u.replace(/^.*IqiyiVersion\/([\d.]+).*$/, "$1");
4571
- }
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")
4572
4556
  };
4573
- _this.version = "";
4574
- if (version[_this.browser]) {
4575
- _this.version = version[_this.browser]();
4576
- if (_this.version === u) {
4577
- _this.version = "";
4578
- }
4579
- }
4580
- if (_this.version.indexOf(".")) {
4581
- _this.version = _this.version.substring(0, _this.version.indexOf("."));
4582
- }
4583
- if (_this.browser === "Edge") {
4584
- _this.engine = "EdgeHTML";
4585
- } else if (_this.browser === "Chrome" && parseInt(_this.version) > 27) {
4586
- _this.engine = "Blink";
4587
- } else if (_this.browser === "Opera" && parseInt(_this.version) > 12) {
4588
- _this.engine = "Blink";
4589
- } else if (_this.browser === "Yandex") {
4590
- _this.engine = "Blink";
4591
- } else if (_this.browser === void 0) {
4592
- _this.browser = "Unknow App";
4593
- }
4594
- }
4595
- function detectFactory(u) {
4596
- 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;
4597
4583
  }
4598
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';
4599
4585
  class ActionBtn {
@@ -5019,11 +5005,11 @@ class Comment extends Component {
5019
5005
  return timeAgo(new Date(this.data.date));
5020
5006
  }
5021
5007
  getUserUaBrowser() {
5022
- const info = detectFactory(this.data.ua);
5008
+ const info = Detect(this.data.ua);
5023
5009
  return `${info.browser} ${info.version}`;
5024
5010
  }
5025
5011
  getUserUaOS() {
5026
- const info = detectFactory(this.data.ua);
5012
+ const info = Detect(this.data.ua);
5027
5013
  return `${info.os} ${info.osVersion}`;
5028
5014
  }
5029
5015
  playFadeInAnim() {
@@ -5448,7 +5434,7 @@ class ListLite extends Component {
5448
5434
  }
5449
5435
  this.data = data;
5450
5436
  const feMinVersion = ((_a = data.api_version) == null ? void 0 : _a.fe_min_version) || "0.0.0";
5451
- if (this.ctx.conf.versionCheck && this.versionCheck("\u524D\u7AEF", feMinVersion, "2.2.4"))
5437
+ if (this.ctx.conf.versionCheck && this.versionCheck("\u524D\u7AEF", feMinVersion, "2.2.5"))
5452
5438
  return;
5453
5439
  if (this.ctx.conf.versionCheck && this.versionCheck("\u540E\u7AEF", backendMinVersion, (_b = data.api_version) == null ? void 0 : _b.version))
5454
5440
  return;
@@ -5780,7 +5766,7 @@ class List extends ListLite {
5780
5766
  if (this.ctx.conf.listSort) {
5781
5767
  this.initDropdown();
5782
5768
  }
5783
- this.$el.querySelector(".atk-copyright").innerHTML = `Powered By <a href="https://artalk.js.org" target="_blank" title="Artalk v${"2.2.4"}">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>`;
5784
5770
  this.ctx.on("list-reload", () => this.fetchComments(0));
5785
5771
  this.ctx.on("list-refresh-ui", () => this.refreshUI());
5786
5772
  this.ctx.on("list-import", (data) => this.importComments(data));