artalk 2.8.3 → 2.8.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.cjs +2 -2
- package/dist/Artalk.cjs.map +1 -1
- package/dist/Artalk.css +1 -1
- package/dist/Artalk.iife.js +2 -2
- package/dist/Artalk.iife.js.map +1 -1
- package/dist/Artalk.js +1 -1
- package/dist/Artalk.js.map +1 -1
- package/dist/Artalk.mjs +258 -156
- package/dist/Artalk.mjs.map +1 -1
- package/dist/ArtalkLite.cjs +1 -1
- package/dist/ArtalkLite.cjs.map +1 -1
- package/dist/ArtalkLite.css +1 -1
- package/dist/ArtalkLite.iife.js +1 -1
- package/dist/ArtalkLite.iife.js.map +1 -1
- package/dist/ArtalkLite.js +1 -1
- package/dist/ArtalkLite.js.map +1 -1
- package/dist/ArtalkLite.mjs +254 -152
- package/dist/ArtalkLite.mjs.map +1 -1
- package/dist/i18n/jp.cjs +1 -1
- package/dist/i18n/jp.js +1 -1
- package/dist/i18n/jp.mjs +85 -81
- package/dist/i18n/zh-TW.cjs +1 -1
- package/dist/i18n/zh-TW.js +1 -1
- package/dist/i18n/zh-TW.mjs +1 -1
- package/dist/main.d.cts +12 -12
- package/dist/main.d.ts +12 -12
- package/package.json +49 -30
package/dist/ArtalkLite.mjs
CHANGED
|
@@ -1706,7 +1706,7 @@ function getDefaultExportFromCjs(x) {
|
|
|
1706
1706
|
const Fetch$1 = (opts, input, init2) => __async(void 0, null, function* () {
|
|
1707
1707
|
const apiToken = opts.getApiToken && opts.getApiToken();
|
|
1708
1708
|
const headers = new Headers(__spreadValues({
|
|
1709
|
-
|
|
1709
|
+
Authorization: apiToken ? `Bearer ${apiToken}` : ""
|
|
1710
1710
|
}, init2 == null ? void 0 : init2.headers));
|
|
1711
1711
|
if (!headers.get("Authorization"))
|
|
1712
1712
|
headers.delete("Authorization");
|
|
@@ -2322,7 +2322,10 @@ function getRenderer() {
|
|
|
2322
2322
|
const markedLinkRenderer = (renderer, orgLinkRenderer) => (href, title, text) => {
|
|
2323
2323
|
const localLink = href == null ? void 0 : href.startsWith(`${window.location.protocol}//${window.location.hostname}`);
|
|
2324
2324
|
const html = orgLinkRenderer.call(renderer, href, title, text);
|
|
2325
|
-
return html.replace(
|
|
2325
|
+
return html.replace(
|
|
2326
|
+
/^<a /,
|
|
2327
|
+
`<a target="_blank" ${!localLink ? `rel="noreferrer noopener nofollow"` : ""} `
|
|
2328
|
+
);
|
|
2326
2329
|
};
|
|
2327
2330
|
const markedCodeRenderer = () => (block, lang) => {
|
|
2328
2331
|
const realLang = !lang ? "plaintext" : lang;
|
|
@@ -2377,7 +2380,13 @@ function marked(src) {
|
|
|
2377
2380
|
return dest;
|
|
2378
2381
|
}
|
|
2379
2382
|
function simpleMarked(src) {
|
|
2380
|
-
return src.replace(
|
|
2383
|
+
return src.replace(
|
|
2384
|
+
/```\s*([^]+?.*?[^]+?[^]+?)```/g,
|
|
2385
|
+
(_, code) => `<pre><code>${renderCode(code)}</code></pre>`
|
|
2386
|
+
).replace(/!\[(.*?)\]\((.*?)\)/g, (_, alt, imgSrc) => `<img src="${imgSrc}" alt="${alt}" />`).replace(
|
|
2387
|
+
/\[(.*?)\]\((.*?)\)/g,
|
|
2388
|
+
(_, text, link) => `<a href="${link}" target="_blank">${text}</a>`
|
|
2389
|
+
).replace(/\n/g, "<br>");
|
|
2381
2390
|
}
|
|
2382
2391
|
function mergeDeep(...objects) {
|
|
2383
2392
|
const isObject = (obj) => obj && typeof obj === "object" && obj.constructor === Object;
|
|
@@ -2560,7 +2569,7 @@ const en = {
|
|
|
2560
2569
|
deleteFail: "Delete Failed",
|
|
2561
2570
|
reqGot: "Request got",
|
|
2562
2571
|
reqAborted: "Request timed out or terminated unexpectedly",
|
|
2563
|
-
updateMsg: "Please update Artalk {name} to get the
|
|
2572
|
+
updateMsg: "Please update Artalk {name} to get the best experience!",
|
|
2564
2573
|
currentVersion: "Current Version",
|
|
2565
2574
|
ignore: "Ignore",
|
|
2566
2575
|
open: "Open",
|
|
@@ -2641,7 +2650,7 @@ const zhCN = {
|
|
|
2641
2650
|
deleteFail: "删除失败",
|
|
2642
2651
|
reqGot: "请求响应",
|
|
2643
2652
|
reqAborted: "请求超时或意外终止",
|
|
2644
|
-
updateMsg: "请更新 Artalk {name}
|
|
2653
|
+
updateMsg: "请更新 Artalk {name} 以获得更好的体验!",
|
|
2645
2654
|
currentVersion: "当前版本",
|
|
2646
2655
|
ignore: "忽略",
|
|
2647
2656
|
open: "打开",
|
|
@@ -2795,7 +2804,10 @@ function getCorrectUserAgent() {
|
|
|
2795
2804
|
}
|
|
2796
2805
|
if (uaData.platform === "macOS") {
|
|
2797
2806
|
if (majorPlatformVersion >= 11) {
|
|
2798
|
-
return uaRaw.replace(
|
|
2807
|
+
return uaRaw.replace(
|
|
2808
|
+
/(Mac OS X \d+_\d+_\d+|Mac OS X)/,
|
|
2809
|
+
`Mac OS X ${uaGot.platformVersion.replace(/\./g, "_")}`
|
|
2810
|
+
);
|
|
2799
2811
|
}
|
|
2800
2812
|
}
|
|
2801
2813
|
return uaRaw;
|
|
@@ -2817,7 +2829,7 @@ function getURLBasedOn(baseURL, path) {
|
|
|
2817
2829
|
return `${baseURL.replace(/\/$/, "")}/${path.replace(/^\//, "")}`;
|
|
2818
2830
|
}
|
|
2819
2831
|
const internal = {
|
|
2820
|
-
|
|
2832
|
+
en,
|
|
2821
2833
|
"en-US": en,
|
|
2822
2834
|
"zh-CN": zhCN
|
|
2823
2835
|
};
|
|
@@ -2855,7 +2867,10 @@ class EventManager {
|
|
|
2855
2867
|
* Add an event listener for a specific event name
|
|
2856
2868
|
*/
|
|
2857
2869
|
on(name, handler, opts = {}) {
|
|
2858
|
-
this.events.push(__spreadValues({
|
|
2870
|
+
this.events.push(__spreadValues({
|
|
2871
|
+
name,
|
|
2872
|
+
handler
|
|
2873
|
+
}, opts));
|
|
2859
2874
|
}
|
|
2860
2875
|
/**
|
|
2861
2876
|
* Remove an event listener for a specific event name and handler
|
|
@@ -3333,7 +3348,9 @@ function imgBody(checker) {
|
|
|
3333
3348
|
}
|
|
3334
3349
|
function iframeBody(checker) {
|
|
3335
3350
|
const $iframeWrap = createElement(`<div class="atk-checker-iframe-wrap"></div>`);
|
|
3336
|
-
const $iframe = createElement(
|
|
3351
|
+
const $iframe = createElement(
|
|
3352
|
+
`<iframe class="atk-fade-in" referrerpolicy="strict-origin-when-cross-origin"></iframe>`
|
|
3353
|
+
);
|
|
3337
3354
|
$iframe.style.display = "none";
|
|
3338
3355
|
showLoading($iframeWrap, { transparentBg: true });
|
|
3339
3356
|
$iframe.src = checker.getOpts().getCaptchaIframeURL();
|
|
@@ -3342,7 +3359,9 @@ function iframeBody(checker) {
|
|
|
3342
3359
|
hideLoading($iframeWrap);
|
|
3343
3360
|
};
|
|
3344
3361
|
$iframeWrap.append($iframe);
|
|
3345
|
-
const $closeBtn = createElement(
|
|
3362
|
+
const $closeBtn = createElement(
|
|
3363
|
+
`<div class="atk-close-btn"><i class="atk-icon atk-icon-close"></i></div>`
|
|
3364
|
+
);
|
|
3346
3365
|
$iframeWrap.append($closeBtn);
|
|
3347
3366
|
checker.hideInteractInput();
|
|
3348
3367
|
let stop = false;
|
|
@@ -3554,7 +3573,7 @@ class Component {
|
|
|
3554
3573
|
return this.$el;
|
|
3555
3574
|
}
|
|
3556
3575
|
}
|
|
3557
|
-
const EditorHTML = '<div class="atk-main-editor">\n <div class="atk-header">\n <input name="nick" class="atk-nick" type="text" required="required"
|
|
3576
|
+
const EditorHTML = '<div class="atk-main-editor">\n <div class="atk-header">\n <input name="nick" class="atk-nick" type="text" required="required" />\n <input name="email" class="atk-email" type="email" required="required" />\n <input name="link" class="atk-link" type="url" />\n </div>\n <div class="atk-textarea-wrap">\n <textarea class="atk-textarea"></textarea>\n </div>\n <div class="atk-plug-panel-wrap" style="display: none"></div>\n <div class="atk-bottom">\n <div class="atk-item atk-bottom-left">\n <span class="atk-state-wrap"></span>\n <span class="atk-plug-btn-wrap"></span>\n </div>\n <div class="atk-item">\n <button type="button" class="atk-send-btn"></button>\n </div>\n </div>\n <div class="atk-notify-wrap"></div>\n</div>\n';
|
|
3558
3577
|
const Sel = {
|
|
3559
3578
|
$header: ".atk-header",
|
|
3560
3579
|
$nick: '.atk-header [name="nick"]',
|
|
@@ -3728,7 +3747,9 @@ class Editor extends Component {
|
|
|
3728
3747
|
const sStart = this.ui.$textarea.selectionStart;
|
|
3729
3748
|
const sEnd = this.ui.$textarea.selectionEnd;
|
|
3730
3749
|
const sT = this.ui.$textarea.scrollTop;
|
|
3731
|
-
this.setContent(
|
|
3750
|
+
this.setContent(
|
|
3751
|
+
this.ui.$textarea.value.substring(0, sStart) + val + this.ui.$textarea.value.substring(sEnd, this.ui.$textarea.value.length)
|
|
3752
|
+
);
|
|
3732
3753
|
this.ui.$textarea.focus();
|
|
3733
3754
|
this.ui.$textarea.selectionStart = sStart + val.length;
|
|
3734
3755
|
this.ui.$textarea.selectionEnd = sStart + val.length;
|
|
@@ -3772,7 +3793,7 @@ class Editor extends Component {
|
|
|
3772
3793
|
}
|
|
3773
3794
|
}
|
|
3774
3795
|
}
|
|
3775
|
-
const SidebarHTML = '<div class="atk-sidebar-layer">\n <div class="atk-sidebar-inner">\n <div class="atk-sidebar-header">\n <div class="atk-sidebar-close"
|
|
3796
|
+
const SidebarHTML = '<div class="atk-sidebar-layer">\n <div class="atk-sidebar-inner">\n <div class="atk-sidebar-header">\n <div class="atk-sidebar-close">\n <i class="atk-icon atk-icon-close-slim"></i>\n </div>\n </div>\n <div class="atk-sidebar-iframe-wrap"></div>\n </div>\n</div>\n';
|
|
3776
3797
|
class SidebarLayer extends Component {
|
|
3777
3798
|
constructor(ctx) {
|
|
3778
3799
|
super(ctx);
|
|
@@ -3811,7 +3832,10 @@ class SidebarLayer extends Component {
|
|
|
3811
3832
|
const $iframe = this.$iframe;
|
|
3812
3833
|
const iFrameSrc = $iframe.src;
|
|
3813
3834
|
if (this.conf.darkMode !== iFrameSrc.includes("darkMode=1")) {
|
|
3814
|
-
this.iframeLoad(
|
|
3835
|
+
this.iframeLoad(
|
|
3836
|
+
$iframe,
|
|
3837
|
+
this.conf.darkMode ? iFrameSrc.concat("&darkMode=1") : iFrameSrc.replace("&darkMode=1", "")
|
|
3838
|
+
);
|
|
3815
3839
|
}
|
|
3816
3840
|
}
|
|
3817
3841
|
this.authCheck({
|
|
@@ -3865,7 +3889,9 @@ class SidebarLayer extends Component {
|
|
|
3865
3889
|
});
|
|
3866
3890
|
}
|
|
3867
3891
|
createIframe(view) {
|
|
3868
|
-
const $iframe = createElement(
|
|
3892
|
+
const $iframe = createElement(
|
|
3893
|
+
'<iframe referrerpolicy="strict-origin-when-cross-origin"></iframe>'
|
|
3894
|
+
);
|
|
3869
3895
|
const baseURL = getURLBasedOnApi({
|
|
3870
3896
|
base: this.ctx.conf.server,
|
|
3871
3897
|
path: "/sidebar/"
|
|
@@ -3892,7 +3918,7 @@ class SidebarLayer extends Component {
|
|
|
3892
3918
|
};
|
|
3893
3919
|
}
|
|
3894
3920
|
}
|
|
3895
|
-
const ListHTML = '<div class="atk-list">\n <div class="atk-list-header">\n <div class="atk-comment-count">\n <div class="atk-text"></div>\n </div>\n <div class="atk-right-action">\n <span data-action="admin-close-comment" class="atk-hide" atk-only-admin-show></span>\n <span data-action="open-sidebar" class="atk-hide atk-on">\n <span class="atk-unread-badge" style="display: none
|
|
3921
|
+
const ListHTML = '<div class="atk-list">\n <div class="atk-list-header">\n <div class="atk-comment-count">\n <div class="atk-text"></div>\n </div>\n <div class="atk-right-action">\n <span data-action="admin-close-comment" class="atk-hide" atk-only-admin-show></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"></div>\n </span>\n </div>\n </div>\n <div class="atk-list-body">\n <div class="atk-list-comments-wrap"></div>\n </div>\n <div class="atk-list-footer">\n <div class="atk-copyright"></div>\n </div>\n</div>\n';
|
|
3896
3922
|
function makeNestCommentNodeList(srcData, sortBy = "DATE_DESC", nestMax = 2) {
|
|
3897
3923
|
const nodeList = [];
|
|
3898
3924
|
const roots = srcData.filter((o) => o.rid === 0);
|
|
@@ -3954,8 +3980,9 @@ const createNestStrategy = (opts) => ({
|
|
|
3954
3980
|
rootC.getRender().playFadeAnim();
|
|
3955
3981
|
const loadChildren = (parentC, parentNode) => {
|
|
3956
3982
|
parentNode.children.forEach((node) => {
|
|
3983
|
+
const replyD = comments.find((c) => c.id === node.comment.rid);
|
|
3957
3984
|
const childD = node.comment;
|
|
3958
|
-
const childC = opts.createCommentNode(childD,
|
|
3985
|
+
const childC = opts.createCommentNode(childD, replyD);
|
|
3959
3986
|
parentC.putChild(childC);
|
|
3960
3987
|
loadChildren(childC, node);
|
|
3961
3988
|
});
|
|
@@ -4217,16 +4244,16 @@ function Detect(userAgent) {
|
|
|
4217
4244
|
return dest;
|
|
4218
4245
|
}
|
|
4219
4246
|
function check(conf, rules) {
|
|
4220
|
-
rules.forEach(({
|
|
4221
|
-
el,
|
|
4222
|
-
max: maxHeight,
|
|
4223
|
-
imgContains
|
|
4224
|
-
}) => {
|
|
4247
|
+
rules.forEach(({ el, max: maxHeight, imgContains }) => {
|
|
4225
4248
|
const _apply = () => {
|
|
4226
4249
|
if (!el)
|
|
4227
4250
|
return;
|
|
4228
4251
|
if (!conf.scrollable)
|
|
4229
|
-
applyHeightLimit({
|
|
4252
|
+
applyHeightLimit({
|
|
4253
|
+
el,
|
|
4254
|
+
maxHeight,
|
|
4255
|
+
postBtnClick: conf.postExpandBtnClick
|
|
4256
|
+
});
|
|
4230
4257
|
else
|
|
4231
4258
|
applyScrollableHeightLimit({ el, maxHeight });
|
|
4232
4259
|
};
|
|
@@ -4250,7 +4277,9 @@ function applyHeightLimit(obj) {
|
|
|
4250
4277
|
obj.el.classList.add(HEIGHT_LIMIT_CSS);
|
|
4251
4278
|
obj.el.style.height = `${obj.maxHeight}px`;
|
|
4252
4279
|
obj.el.style.overflow = "hidden";
|
|
4253
|
-
const $expandBtn = createElement(
|
|
4280
|
+
const $expandBtn = createElement(
|
|
4281
|
+
`<div class="atk-height-limit-btn">${t("readMore")}</span>`
|
|
4282
|
+
);
|
|
4254
4283
|
$expandBtn.onclick = (e) => {
|
|
4255
4284
|
e.stopPropagation();
|
|
4256
4285
|
disposeHeightLimit(obj.el);
|
|
@@ -4288,7 +4317,9 @@ function renderAvatar(r) {
|
|
|
4288
4317
|
const avatarURLBuilder = r.opts.avatarURLBuilder;
|
|
4289
4318
|
$avatarImg.src = avatarURLBuilder ? avatarURLBuilder(r.data) : r.comment.getGravatarURL();
|
|
4290
4319
|
if (r.data.link) {
|
|
4291
|
-
const $avatarA = createElement(
|
|
4320
|
+
const $avatarA = createElement(
|
|
4321
|
+
'<a target="_blank" rel="noreferrer noopener nofollow"></a>'
|
|
4322
|
+
);
|
|
4292
4323
|
$avatarA.href = isValidURL(r.data.link) ? r.data.link : `https://${r.data.link}`;
|
|
4293
4324
|
$avatarA.append($avatarImg);
|
|
4294
4325
|
$avatar.append($avatarA);
|
|
@@ -4309,7 +4340,9 @@ function renderHeader(r) {
|
|
|
4309
4340
|
function renderNick(r) {
|
|
4310
4341
|
r.$headerNick = r.$el.querySelector(".atk-nick");
|
|
4311
4342
|
if (r.data.link) {
|
|
4312
|
-
const $nickA = createElement(
|
|
4343
|
+
const $nickA = createElement(
|
|
4344
|
+
'<a target="_blank" rel="noreferrer noopener nofollow"></a>'
|
|
4345
|
+
);
|
|
4313
4346
|
$nickA.innerText = r.data.nick;
|
|
4314
4347
|
$nickA.href = isValidURL(r.data.link) ? r.data.link : `https://${r.data.link}`;
|
|
4315
4348
|
r.$headerNick.append($nickA);
|
|
@@ -4328,7 +4361,9 @@ function renderVerifyBadge(ctx) {
|
|
|
4328
4361
|
$badge.style.backgroundColor = badgeColor || "";
|
|
4329
4362
|
ctx.$headerBadgeWrap.append($badge);
|
|
4330
4363
|
} else if (ctx.data.is_verified) {
|
|
4331
|
-
const $verifiedBadge = createElement(
|
|
4364
|
+
const $verifiedBadge = createElement(
|
|
4365
|
+
`<span class="atk-verified-icon" title="${t("emailVerified")}"></span>`
|
|
4366
|
+
);
|
|
4332
4367
|
ctx.$headerBadgeWrap.append($verifiedBadge);
|
|
4333
4368
|
}
|
|
4334
4369
|
if (ctx.data.is_pinned) {
|
|
@@ -4402,7 +4437,9 @@ function renderReplyAt(r) {
|
|
|
4402
4437
|
return;
|
|
4403
4438
|
if (!r.opts.replyTo)
|
|
4404
4439
|
return;
|
|
4405
|
-
r.$replyAt = createElement(
|
|
4440
|
+
r.$replyAt = createElement(
|
|
4441
|
+
`<span class="atk-item atk-reply-at"><span class="atk-arrow"></span><span class="atk-nick"></span></span>`
|
|
4442
|
+
);
|
|
4406
4443
|
r.$replyAt.querySelector(".atk-nick").innerText = `${r.opts.replyTo.nick}`;
|
|
4407
4444
|
r.$replyAt.onclick = () => {
|
|
4408
4445
|
r.comment.getActions().goToReplyComment();
|
|
@@ -4593,7 +4630,9 @@ function renderVote(r) {
|
|
|
4593
4630
|
r.comment.getActions().vote("up");
|
|
4594
4631
|
});
|
|
4595
4632
|
if (r.opts.voteDown) {
|
|
4596
|
-
r.voteBtnDown = new ActionBtn(() => `${t("voteDown")} (${r.data.vote_down || 0})`).appendTo(
|
|
4633
|
+
r.voteBtnDown = new ActionBtn(() => `${t("voteDown")} (${r.data.vote_down || 0})`).appendTo(
|
|
4634
|
+
r.$actions
|
|
4635
|
+
);
|
|
4597
4636
|
r.voteBtnDown.setClick(() => {
|
|
4598
4637
|
r.comment.getActions().vote("down");
|
|
4599
4638
|
});
|
|
@@ -4731,20 +4770,23 @@ class Render {
|
|
|
4731
4770
|
return;
|
|
4732
4771
|
const contentMaxH = conf.content;
|
|
4733
4772
|
const childrenMaxH = conf.children;
|
|
4734
|
-
check(
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4773
|
+
check(
|
|
4774
|
+
{
|
|
4775
|
+
postExpandBtnClick: () => {
|
|
4776
|
+
const children = this.comment.getChildren();
|
|
4777
|
+
if (children.length === 1)
|
|
4778
|
+
disposeHeightLimit(children[0].getRender().$content);
|
|
4779
|
+
},
|
|
4780
|
+
scrollable: conf.scrollable
|
|
4739
4781
|
},
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4782
|
+
[
|
|
4783
|
+
// 评论内容限高
|
|
4784
|
+
{ el: this.$content, max: contentMaxH, imgContains: true },
|
|
4785
|
+
{ el: this.$replyTo, max: contentMaxH, imgContains: true },
|
|
4786
|
+
// 子评论区域限高(仅嵌套模式)
|
|
4787
|
+
{ el: this.$childrenWrap, max: childrenMaxH, imgContains: false }
|
|
4788
|
+
]
|
|
4789
|
+
);
|
|
4748
4790
|
}
|
|
4749
4791
|
/** 子评论区域移除限高 */
|
|
4750
4792
|
heightLimitRemoveForChildren() {
|
|
@@ -5463,7 +5505,9 @@ class List extends Component {
|
|
|
5463
5505
|
}
|
|
5464
5506
|
});
|
|
5465
5507
|
this.ctx.on("comment-inserted", (comment) => {
|
|
5466
|
-
|
|
5508
|
+
var _a;
|
|
5509
|
+
const replyComment = comment.rid ? (_a = this.commentNodes.find((c) => c.getID() === comment.rid)) == null ? void 0 : _a.getData() : void 0;
|
|
5510
|
+
this.getListLayout().insert(comment, replyComment);
|
|
5467
5511
|
});
|
|
5468
5512
|
this.ctx.on("comment-deleted", (comment) => {
|
|
5469
5513
|
const node = this.commentNodes.find((c) => c.getID() === comment.id);
|
|
@@ -5494,7 +5538,10 @@ function getScrollbarHelper() {
|
|
|
5494
5538
|
},
|
|
5495
5539
|
lock() {
|
|
5496
5540
|
document.body.style.overflow = "hidden";
|
|
5497
|
-
const barPaddingRight = parseInt(
|
|
5541
|
+
const barPaddingRight = parseInt(
|
|
5542
|
+
window.getComputedStyle(document.body, null).getPropertyValue("padding-right"),
|
|
5543
|
+
10
|
|
5544
|
+
);
|
|
5498
5545
|
document.body.style.paddingRight = `${getScrollBarWidth() + barPaddingRight || 0}px`;
|
|
5499
5546
|
}
|
|
5500
5547
|
};
|
|
@@ -5705,13 +5752,7 @@ const services = {
|
|
|
5705
5752
|
}
|
|
5706
5753
|
};
|
|
5707
5754
|
const PvCountWidget = (ctx) => {
|
|
5708
|
-
ctx.watchConf([
|
|
5709
|
-
"site",
|
|
5710
|
-
"pageKey",
|
|
5711
|
-
"pageTitle",
|
|
5712
|
-
"countEl",
|
|
5713
|
-
"pvEl"
|
|
5714
|
-
], (conf) => {
|
|
5755
|
+
ctx.watchConf(["site", "pageKey", "pageTitle", "countEl", "pvEl"], (conf) => {
|
|
5715
5756
|
initCountWidget({
|
|
5716
5757
|
getApi: () => ctx.getApi(),
|
|
5717
5758
|
siteName: conf.site,
|
|
@@ -5778,7 +5819,9 @@ ${opts.errMsg}`;
|
|
|
5778
5819
|
errEl.appendChild($retryBtn);
|
|
5779
5820
|
}
|
|
5780
5821
|
if (opts.onOpenSidebar) {
|
|
5781
|
-
const $openSidebar = createElement(
|
|
5822
|
+
const $openSidebar = createElement(
|
|
5823
|
+
`<span atk-only-admin-show> | <span style="cursor:pointer;">${t("openName", { name: t("ctrlCenter") })}</span></span>`
|
|
5824
|
+
);
|
|
5782
5825
|
errEl.appendChild($openSidebar);
|
|
5783
5826
|
$openSidebar.onclick = () => opts.onOpenSidebar && opts.onOpenSidebar();
|
|
5784
5827
|
}
|
|
@@ -6121,7 +6164,9 @@ class Closable extends EditorPlug {
|
|
|
6121
6164
|
}
|
|
6122
6165
|
close() {
|
|
6123
6166
|
if (!this.kit.useUI().$textareaWrap.querySelector(".atk-comment-closed"))
|
|
6124
|
-
this.kit.useUI().$textareaWrap.prepend(
|
|
6167
|
+
this.kit.useUI().$textareaWrap.prepend(
|
|
6168
|
+
createElement(`<div class="atk-comment-closed">${t("onlyAdminCanReply")}</div>`)
|
|
6169
|
+
);
|
|
6125
6170
|
if (!this.kit.useUser().getData().isAdmin) {
|
|
6126
6171
|
this.kit.useUI().$textarea.style.display = "none";
|
|
6127
6172
|
this.kit.useEvents().trigger("panel-close");
|
|
@@ -6145,8 +6190,14 @@ class HeaderEvent extends EditorPlug {
|
|
|
6145
6190
|
};
|
|
6146
6191
|
this.kit.useMounted(() => {
|
|
6147
6192
|
Object.entries(this.$inputs).forEach(([key, $input]) => {
|
|
6148
|
-
$input.addEventListener(
|
|
6149
|
-
|
|
6193
|
+
$input.addEventListener(
|
|
6194
|
+
"input",
|
|
6195
|
+
inputEventFns[key] = trigger("header-input", $input, key)
|
|
6196
|
+
);
|
|
6197
|
+
$input.addEventListener(
|
|
6198
|
+
"change",
|
|
6199
|
+
changeEventFns[key] = trigger("header-change", $input, key)
|
|
6200
|
+
);
|
|
6150
6201
|
});
|
|
6151
6202
|
});
|
|
6152
6203
|
this.kit.useUnmounted(() => {
|
|
@@ -6196,9 +6247,12 @@ class HeaderUser extends EditorPlug {
|
|
|
6196
6247
|
const api = this.kit.useApi();
|
|
6197
6248
|
const CANCEL_TOKEN = "getUserCancelToken";
|
|
6198
6249
|
this.query.abortFn = () => api.abortRequest(CANCEL_TOKEN);
|
|
6199
|
-
api.user.getUser(
|
|
6200
|
-
|
|
6201
|
-
|
|
6250
|
+
api.user.getUser(
|
|
6251
|
+
__spreadValues({}, api.getUserFields()),
|
|
6252
|
+
{
|
|
6253
|
+
cancelToken: CANCEL_TOKEN
|
|
6254
|
+
}
|
|
6255
|
+
).then((res) => this.onUserInfoFetched(res.data)).catch((err) => {
|
|
6202
6256
|
}).finally(() => {
|
|
6203
6257
|
this.query.abortFn = null;
|
|
6204
6258
|
});
|
|
@@ -6259,7 +6313,9 @@ class Emoticons extends EditorPlug {
|
|
|
6259
6313
|
__publicField(this, "isImgLoaded", false);
|
|
6260
6314
|
this.kit.useMounted(() => {
|
|
6261
6315
|
this.usePanel(`<div class="atk-editor-plug-emoticons"></div>`);
|
|
6262
|
-
this.useBtn(
|
|
6316
|
+
this.useBtn(
|
|
6317
|
+
`<i aria-label="${t("emoticon")}"><svg fill="currentColor" aria-hidden="true" height="14" viewBox="0 0 14 14" width="14"><path d="m4.26829 5.29294c0-.94317.45893-1.7074 1.02439-1.7074.56547 0 1.02439.76423 1.02439 1.7074s-.45892 1.7074-1.02439 1.7074c-.56546 0-1.02439-.76423-1.02439-1.7074zm4.43903 1.7074c.56546 0 1.02439-.76423 1.02439-1.7074s-.45893-1.7074-1.02439-1.7074c-.56547 0-1.02439.76423-1.02439 1.7074s.45892 1.7074 1.02439 1.7074zm-1.70732 2.73184c-1.51883 0-2.06312-1.52095-2.08361-1.58173l-1.29551.43231c.03414.10244.868 2.51604 3.3798 2.51604 2.51181 0 3.34502-2.41291 3.37982-2.51604l-1.29484-.43573c-.02254.06488-.56683 1.58583-2.08498 1.58583zm7-2.73252c0 3.86004-3.1401 7.00034-7 7.00034s-7-3.1396-7-6.99966c0-3.86009 3.1401-7.00034 7-7.00034s7 3.14025 7 7.00034zm-1.3659 0c0-3.10679-2.5275-5.63442-5.6341-5.63442-3.10663 0-5.63415 2.52832-5.63415 5.6351 0 3.10676 2.52752 5.63446 5.63415 5.63446 3.1066 0 5.6341-2.5277 5.6341-5.63446z"/></svg></i>`
|
|
6318
|
+
);
|
|
6263
6319
|
});
|
|
6264
6320
|
this.kit.useUnmounted(() => {
|
|
6265
6321
|
});
|
|
@@ -6319,19 +6375,21 @@ class Emoticons extends EditorPlug {
|
|
|
6319
6375
|
data.push(grp);
|
|
6320
6376
|
};
|
|
6321
6377
|
const remoteLoad = (d) => __async(this, null, function* () {
|
|
6322
|
-
yield Promise.all(
|
|
6323
|
-
|
|
6324
|
-
|
|
6325
|
-
|
|
6326
|
-
|
|
6327
|
-
|
|
6328
|
-
|
|
6329
|
-
|
|
6330
|
-
|
|
6331
|
-
|
|
6332
|
-
|
|
6333
|
-
|
|
6334
|
-
|
|
6378
|
+
yield Promise.all(
|
|
6379
|
+
d.map((grp, index) => __async(this, null, function* () {
|
|
6380
|
+
if (typeof grp === "object" && !Array.isArray(grp)) {
|
|
6381
|
+
pushGrp(grp);
|
|
6382
|
+
} else if (Array.isArray(grp)) {
|
|
6383
|
+
yield remoteLoad(grp);
|
|
6384
|
+
} else if (typeof grp === "string") {
|
|
6385
|
+
const grpData = yield this.remoteLoad(grp);
|
|
6386
|
+
if (Array.isArray(grpData))
|
|
6387
|
+
yield remoteLoad(grpData);
|
|
6388
|
+
else if (typeof grpData === "object")
|
|
6389
|
+
pushGrp(grpData);
|
|
6390
|
+
}
|
|
6391
|
+
}))
|
|
6392
|
+
);
|
|
6335
6393
|
});
|
|
6336
6394
|
yield remoteLoad(data);
|
|
6337
6395
|
data.forEach((item) => {
|
|
@@ -6346,7 +6404,9 @@ class Emoticons extends EditorPlug {
|
|
|
6346
6404
|
});
|
|
6347
6405
|
}
|
|
6348
6406
|
});
|
|
6349
|
-
data = data.filter(
|
|
6407
|
+
data = data.filter(
|
|
6408
|
+
(item) => typeof item === "object" && !Array.isArray(item) && !!item && !!item.name
|
|
6409
|
+
);
|
|
6350
6410
|
this.solveNullKey(data);
|
|
6351
6411
|
this.solveSameKey(data);
|
|
6352
6412
|
return data;
|
|
@@ -6414,7 +6474,10 @@ class Emoticons extends EditorPlug {
|
|
|
6414
6474
|
if (find && find.length > 1)
|
|
6415
6475
|
item.icon = find[1];
|
|
6416
6476
|
}
|
|
6417
|
-
nGrp.items.push({
|
|
6477
|
+
nGrp.items.push({
|
|
6478
|
+
key: item.text || `${grpName} ${index + 1}`,
|
|
6479
|
+
val: item.icon
|
|
6480
|
+
});
|
|
6418
6481
|
});
|
|
6419
6482
|
dest.push(nGrp);
|
|
6420
6483
|
});
|
|
@@ -6510,7 +6573,9 @@ class Upload extends EditorPlug {
|
|
|
6510
6573
|
this.$imgUploadInput.type = "file";
|
|
6511
6574
|
this.$imgUploadInput.style.display = "none";
|
|
6512
6575
|
this.$imgUploadInput.accept = AllowImgExts.map((o) => `.${o}`).join(",");
|
|
6513
|
-
const $btn = this.useBtn(
|
|
6576
|
+
const $btn = this.useBtn(
|
|
6577
|
+
`<i aria-label="${t("uploadImage")}"><svg fill="currentColor" aria-hidden="true" height="14" viewBox="0 0 14 14" width="14"><path d="m0 1.94444c0-1.074107.870333-1.94444 1.94444-1.94444h10.11116c1.0741 0 1.9444.870333 1.9444 1.94444v10.11116c0 1.0741-.8703 1.9444-1.9444 1.9444h-10.11116c-1.074107 0-1.94444-.8703-1.94444-1.9444zm1.94444-.38888c-.21466 0-.38888.17422-.38888.38888v7.06689l2.33333-2.33333 2.33333 2.33333 3.88888-3.88889 2.3333 2.33334v-5.51134c0-.21466-.1742-.38888-.3888-.38888zm10.49996 8.09977-2.3333-2.33333-3.88888 3.8889-2.33333-2.33334-2.33333 2.33334v.8447c0 .2146.17422.3888.38888.3888h10.11116c.2146 0 .3888-.1742.3888-.3888zm-7.1944-6.54422c-.75133 0-1.36111.60978-1.36111 1.36111 0 .75134.60978 1.36111 1.36111 1.36111s1.36111-.60977 1.36111-1.36111c0-.75133-.60978-1.36111-1.36111-1.36111z"/></svg></i>`
|
|
6578
|
+
);
|
|
6514
6579
|
$btn.after(this.$imgUploadInput);
|
|
6515
6580
|
$btn.onclick = () => {
|
|
6516
6581
|
const $input = this.$imgUploadInput;
|
|
@@ -6571,7 +6636,7 @@ class Upload extends EditorPlug {
|
|
|
6571
6636
|
uploadImg(file) {
|
|
6572
6637
|
return __async(this, null, function* () {
|
|
6573
6638
|
const fileExt = /[^.]+$/.exec(file.name);
|
|
6574
|
-
if (!fileExt || !AllowImgExts.includes(fileExt[0]))
|
|
6639
|
+
if (!fileExt || !AllowImgExts.includes(String(fileExt[0]).toLowerCase()))
|
|
6575
6640
|
return;
|
|
6576
6641
|
if (!this.kit.useUser().checkHasBasicUserInfo()) {
|
|
6577
6642
|
this.kit.useEditor().showNotify(t("uploadLoginMsg"), "w");
|
|
@@ -6601,7 +6666,9 @@ class Upload extends EditorPlug {
|
|
|
6601
6666
|
base: this.kit.useConf().server,
|
|
6602
6667
|
path: imgURL
|
|
6603
6668
|
});
|
|
6604
|
-
this.kit.useEditor().setContent(
|
|
6669
|
+
this.kit.useEditor().setContent(
|
|
6670
|
+
this.kit.useUI().$textarea.value.replace(uploadPlaceholderTxt, `${insertPrefix}`)
|
|
6671
|
+
);
|
|
6605
6672
|
} else {
|
|
6606
6673
|
this.kit.useEditor().setContent(this.kit.useUI().$textarea.value.replace(uploadPlaceholderTxt, ""));
|
|
6607
6674
|
}
|
|
@@ -6614,7 +6681,9 @@ class Preview extends EditorPlug {
|
|
|
6614
6681
|
__publicField(this, "isPlugPanelShow", false);
|
|
6615
6682
|
this.kit.useMounted(() => {
|
|
6616
6683
|
this.usePanel(`<div class="atk-editor-plug-preview"></div>`);
|
|
6617
|
-
this.useBtn(
|
|
6684
|
+
this.useBtn(
|
|
6685
|
+
`<i aria-label="${t("preview")}"><svg fill="currentColor" aria-hidden="true" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M14.85 3H1.15C.52 3 0 3.52 0 4.15v7.69C0 12.48.52 13 1.15 13h13.69c.64 0 1.15-.52 1.15-1.15v-7.7C16 3.52 15.48 3 14.85 3zM9 11H7V8L5.5 9.92 4 8v3H2V5h2l1.5 2L7 5h2v6zm2.99.5L9.5 8H11V5h2v3h1.5l-2.51 3.5z"></path></svg></i>`
|
|
6686
|
+
);
|
|
6618
6687
|
});
|
|
6619
6688
|
this.kit.useUnmounted(() => {
|
|
6620
6689
|
});
|
|
@@ -6720,23 +6789,20 @@ class PlugManager {
|
|
|
6720
6789
|
__publicField(this, "events", new EventManager());
|
|
6721
6790
|
this.editor = editor;
|
|
6722
6791
|
let confLoaded = false;
|
|
6723
|
-
this.editor.ctx.watchConf(
|
|
6724
|
-
"imgUpload",
|
|
6725
|
-
|
|
6726
|
-
|
|
6727
|
-
|
|
6728
|
-
|
|
6729
|
-
|
|
6730
|
-
|
|
6731
|
-
|
|
6732
|
-
|
|
6733
|
-
|
|
6734
|
-
this.
|
|
6735
|
-
}
|
|
6736
|
-
|
|
6737
|
-
confLoaded = true;
|
|
6738
|
-
this.loadPluginUI();
|
|
6739
|
-
});
|
|
6792
|
+
this.editor.ctx.watchConf(
|
|
6793
|
+
["imgUpload", "emoticons", "preview", "editorTravel", "locale"],
|
|
6794
|
+
(conf) => {
|
|
6795
|
+
confLoaded && this.getEvents().trigger("unmounted");
|
|
6796
|
+
this.clear();
|
|
6797
|
+
getEnabledPlugs(conf).forEach((Plug) => {
|
|
6798
|
+
const kit = new PlugKit(this);
|
|
6799
|
+
this.plugs.push(new Plug(kit));
|
|
6800
|
+
});
|
|
6801
|
+
this.getEvents().trigger("mounted");
|
|
6802
|
+
confLoaded = true;
|
|
6803
|
+
this.loadPluginUI();
|
|
6804
|
+
}
|
|
6805
|
+
);
|
|
6740
6806
|
this.events.on("panel-close", () => this.closePlugPanel());
|
|
6741
6807
|
}
|
|
6742
6808
|
getPlugs() {
|
|
@@ -6875,7 +6941,9 @@ const Unread = (ctx) => {
|
|
|
6875
6941
|
const notifyKey = getQueryParam("atk_notify_key");
|
|
6876
6942
|
if (notifyKey) {
|
|
6877
6943
|
ctx.getApi().notifies.markNotifyRead(commentID, notifyKey).then(() => {
|
|
6878
|
-
ctx.getData().updateNotifies(
|
|
6944
|
+
ctx.getData().updateNotifies(
|
|
6945
|
+
ctx.getData().getNotifies().filter((o) => o.comment_id !== commentID)
|
|
6946
|
+
);
|
|
6879
6947
|
});
|
|
6880
6948
|
}
|
|
6881
6949
|
});
|
|
@@ -6887,7 +6955,11 @@ const Count = (ctx) => {
|
|
|
6887
6955
|
const $count = list.$el.querySelector(".atk-comment-count .atk-text");
|
|
6888
6956
|
if (!$count)
|
|
6889
6957
|
return;
|
|
6890
|
-
const text = htmlEncode(
|
|
6958
|
+
const text = htmlEncode(
|
|
6959
|
+
t("counter", {
|
|
6960
|
+
count: `${Number((_b = (_a = ctx.getData().getListLastFetch()) == null ? void 0 : _a.data) == null ? void 0 : _b.count) || 0}`
|
|
6961
|
+
})
|
|
6962
|
+
);
|
|
6891
6963
|
$count.innerHTML = text.replace(/(\d+)/, '<span class="atk-comment-count-num">$1</span>');
|
|
6892
6964
|
};
|
|
6893
6965
|
ctx.on("list-loaded", () => {
|
|
@@ -6996,7 +7068,7 @@ const GotoFocus = (ctx) => {
|
|
|
6996
7068
|
comment.focus();
|
|
6997
7069
|
}));
|
|
6998
7070
|
};
|
|
6999
|
-
const version = "2.8.
|
|
7071
|
+
const version = "2.8.5";
|
|
7000
7072
|
const Copyright = (ctx) => {
|
|
7001
7073
|
ctx.on("mounted", () => {
|
|
7002
7074
|
const list = ctx.get("list");
|
|
@@ -7031,26 +7103,38 @@ const Dropdown = (ctx) => {
|
|
|
7031
7103
|
renderDropdown({
|
|
7032
7104
|
$dropdownWrap: $dropdownOn,
|
|
7033
7105
|
dropdownList: [
|
|
7034
|
-
[
|
|
7035
|
-
|
|
7036
|
-
|
|
7037
|
-
|
|
7038
|
-
|
|
7039
|
-
|
|
7040
|
-
|
|
7041
|
-
|
|
7042
|
-
|
|
7043
|
-
|
|
7044
|
-
|
|
7045
|
-
|
|
7046
|
-
|
|
7047
|
-
|
|
7048
|
-
|
|
7049
|
-
|
|
7050
|
-
|
|
7051
|
-
|
|
7052
|
-
|
|
7053
|
-
|
|
7106
|
+
[
|
|
7107
|
+
t("sortLatest"),
|
|
7108
|
+
() => {
|
|
7109
|
+
reloadUseParamsEditor((p) => {
|
|
7110
|
+
p.sort_by = "date_desc";
|
|
7111
|
+
});
|
|
7112
|
+
}
|
|
7113
|
+
],
|
|
7114
|
+
[
|
|
7115
|
+
t("sortBest"),
|
|
7116
|
+
() => {
|
|
7117
|
+
reloadUseParamsEditor((p) => {
|
|
7118
|
+
p.sort_by = "vote";
|
|
7119
|
+
});
|
|
7120
|
+
}
|
|
7121
|
+
],
|
|
7122
|
+
[
|
|
7123
|
+
t("sortOldest"),
|
|
7124
|
+
() => {
|
|
7125
|
+
reloadUseParamsEditor((p) => {
|
|
7126
|
+
p.sort_by = "date_asc";
|
|
7127
|
+
});
|
|
7128
|
+
}
|
|
7129
|
+
],
|
|
7130
|
+
[
|
|
7131
|
+
t("sortAuthor"),
|
|
7132
|
+
() => {
|
|
7133
|
+
reloadUseParamsEditor((p) => {
|
|
7134
|
+
p.view_only_admin = true;
|
|
7135
|
+
});
|
|
7136
|
+
}
|
|
7137
|
+
]
|
|
7054
7138
|
]
|
|
7055
7139
|
});
|
|
7056
7140
|
};
|
|
@@ -7199,18 +7283,21 @@ const ReachBottom = (ctx) => {
|
|
|
7199
7283
|
let observer = null;
|
|
7200
7284
|
const setupObserver = ($target) => {
|
|
7201
7285
|
const scrollEvtAt = ctx.conf.scrollRelativeTo && ctx.conf.scrollRelativeTo() || null;
|
|
7202
|
-
observer = new IntersectionObserver(
|
|
7203
|
-
|
|
7204
|
-
|
|
7205
|
-
|
|
7286
|
+
observer = new IntersectionObserver(
|
|
7287
|
+
([entries]) => {
|
|
7288
|
+
if (entries.isIntersecting) {
|
|
7289
|
+
clearObserver();
|
|
7290
|
+
ctx.trigger("list-reach-bottom");
|
|
7291
|
+
}
|
|
7292
|
+
},
|
|
7293
|
+
{
|
|
7294
|
+
threshold: 0.9,
|
|
7295
|
+
// when the target is 90% visible
|
|
7296
|
+
// @see https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver/root
|
|
7297
|
+
// If the root is null, then the bounds of the actual document viewport are used.
|
|
7298
|
+
root: scrollEvtAt
|
|
7206
7299
|
}
|
|
7207
|
-
|
|
7208
|
-
threshold: 0.9,
|
|
7209
|
-
// when the target is 90% visible
|
|
7210
|
-
// @see https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver/root
|
|
7211
|
-
// If the root is null, then the bounds of the actual document viewport are used.
|
|
7212
|
-
root: scrollEvtAt
|
|
7213
|
-
});
|
|
7300
|
+
);
|
|
7214
7301
|
observer.observe($target);
|
|
7215
7302
|
};
|
|
7216
7303
|
const clearObserver = () => {
|
|
@@ -7294,22 +7381,26 @@ function versionCheck(list, feVer, beVer) {
|
|
|
7294
7381
|
if (sameVer)
|
|
7295
7382
|
return;
|
|
7296
7383
|
const errEl = createElement(
|
|
7297
|
-
`<div
|
|
7384
|
+
`<div class="atk-version-check-notice">${t("updateMsg", {
|
|
7385
|
+
name: comp < 0 ? t("frontend") : t("backend")
|
|
7386
|
+
})} <span class="atk-info">${t("currentVersion")}: ${t("frontend")} ${feVer} / ${t("backend")} ${beVer}</span></div>`
|
|
7298
7387
|
);
|
|
7299
|
-
const ignoreBtn = createElement(`<span
|
|
7388
|
+
const ignoreBtn = createElement(`<span class="atk-ignore-btn">${t("ignore")}</span>`);
|
|
7300
7389
|
ignoreBtn.onclick = () => {
|
|
7301
|
-
|
|
7390
|
+
errEl.remove();
|
|
7302
7391
|
IgnoreVersionCheck = true;
|
|
7303
|
-
list.ctx.fetch({ offset: 0 });
|
|
7304
7392
|
};
|
|
7305
7393
|
errEl.append(ignoreBtn);
|
|
7306
|
-
|
|
7394
|
+
list.$el.parentElement.prepend(errEl);
|
|
7307
7395
|
}
|
|
7308
7396
|
const AdminOnlyElem = (ctx) => {
|
|
7309
7397
|
const scanApply = () => {
|
|
7310
|
-
applyAdminOnlyEls(
|
|
7311
|
-
|
|
7312
|
-
|
|
7398
|
+
applyAdminOnlyEls(
|
|
7399
|
+
ctx.get("user").getData().isAdmin,
|
|
7400
|
+
getAdminOnlyEls({
|
|
7401
|
+
$root: ctx.$root
|
|
7402
|
+
})
|
|
7403
|
+
);
|
|
7313
7404
|
};
|
|
7314
7405
|
ctx.on("list-loaded", () => {
|
|
7315
7406
|
scanApply();
|
|
@@ -7406,7 +7497,9 @@ function load(ctx) {
|
|
|
7406
7497
|
};
|
|
7407
7498
|
if (ctx.conf.useBackendConf) {
|
|
7408
7499
|
if (!data.frontend_conf)
|
|
7409
|
-
throw new Error(
|
|
7500
|
+
throw new Error(
|
|
7501
|
+
"The remote backend does not respond to the frontend conf, but `useBackendConf` conf is enabled"
|
|
7502
|
+
);
|
|
7410
7503
|
conf = __spreadValues(__spreadValues({}, conf), handleConfFormServer(data.frontend_conf));
|
|
7411
7504
|
}
|
|
7412
7505
|
ctx.conf.remoteConfModifier && ctx.conf.remoteConfModifier(conf);
|
|
@@ -7431,17 +7524,19 @@ function loadNetworkPlugins(scripts, apiBase) {
|
|
|
7431
7524
|
scripts.forEach((url) => {
|
|
7432
7525
|
if (!/^(http|https):\/\//.test(url))
|
|
7433
7526
|
url = `${apiBase.replace(/\/$/, "")}/${url.replace(/^\//, "")}`;
|
|
7434
|
-
tasks.push(
|
|
7435
|
-
|
|
7436
|
-
|
|
7437
|
-
|
|
7438
|
-
|
|
7439
|
-
|
|
7440
|
-
|
|
7441
|
-
|
|
7442
|
-
|
|
7443
|
-
|
|
7444
|
-
|
|
7527
|
+
tasks.push(
|
|
7528
|
+
new Promise((resolve, reject) => {
|
|
7529
|
+
if (document.querySelector(`script[src="${url}"]`)) {
|
|
7530
|
+
resolve();
|
|
7531
|
+
return;
|
|
7532
|
+
}
|
|
7533
|
+
const script = document.createElement("script");
|
|
7534
|
+
script.src = url;
|
|
7535
|
+
document.head.appendChild(script);
|
|
7536
|
+
script.onload = () => resolve();
|
|
7537
|
+
script.onerror = (err) => reject(err);
|
|
7538
|
+
})
|
|
7539
|
+
);
|
|
7445
7540
|
});
|
|
7446
7541
|
yield Promise.all(tasks);
|
|
7447
7542
|
return Object.values(window.ArtalkPlugins || {});
|
|
@@ -7451,7 +7546,10 @@ function onLoadErr(ctx, err) {
|
|
|
7451
7546
|
var _a;
|
|
7452
7547
|
let sidebarOpenView = "";
|
|
7453
7548
|
if ((_a = err.data) == null ? void 0 : _a.err_no_site) {
|
|
7454
|
-
const viewLoadParam = {
|
|
7549
|
+
const viewLoadParam = {
|
|
7550
|
+
create_name: ctx.conf.site,
|
|
7551
|
+
create_urls: `${window.location.protocol}//${window.location.host}`
|
|
7552
|
+
};
|
|
7455
7553
|
sidebarOpenView = `sites|${JSON.stringify(viewLoadParam)}`;
|
|
7456
7554
|
}
|
|
7457
7555
|
showErrorDialog({
|
|
@@ -7474,7 +7572,9 @@ class Artalk {
|
|
|
7474
7572
|
const obj = initService(this.ctx);
|
|
7475
7573
|
obj && this.ctx.inject(name, obj);
|
|
7476
7574
|
});
|
|
7477
|
-
|
|
7575
|
+
{
|
|
7576
|
+
load(this.ctx);
|
|
7577
|
+
}
|
|
7478
7578
|
}
|
|
7479
7579
|
/** Get the config of Artalk */
|
|
7480
7580
|
getConf() {
|
|
@@ -7496,7 +7596,9 @@ class Artalk {
|
|
|
7496
7596
|
/** Destroy instance of Artalk */
|
|
7497
7597
|
destroy() {
|
|
7498
7598
|
this.ctx.trigger("unmounted");
|
|
7499
|
-
this.ctx.$root.
|
|
7599
|
+
while (this.ctx.$root.firstChild) {
|
|
7600
|
+
this.ctx.$root.removeChild(this.ctx.$root.firstChild);
|
|
7601
|
+
}
|
|
7500
7602
|
}
|
|
7501
7603
|
/** Add an event listener */
|
|
7502
7604
|
on(name, handler) {
|