artalk 2.8.5 → 2.8.6
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 +1 -1
- package/dist/Artalk.cjs.map +1 -1
- package/dist/Artalk.iife.js +1 -1
- 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 +281 -86
- package/dist/Artalk.mjs.map +1 -1
- package/dist/ArtalkLite.cjs +1 -1
- package/dist/ArtalkLite.cjs.map +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 +279 -85
- 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 +21 -0
- package/dist/i18n/zh-TW.cjs +1 -1
- package/dist/i18n/zh-TW.js +1 -1
- package/dist/i18n/zh-TW.mjs +21 -4
- package/dist/main.d.cts +199 -0
- package/dist/main.d.ts +199 -0
- package/package.json +2 -2
package/dist/Artalk.mjs
CHANGED
|
@@ -155,11 +155,14 @@ class HttpClient {
|
|
|
155
155
|
/* Json */
|
|
156
156
|
];
|
|
157
157
|
const responseFormat = format || requestParams.format;
|
|
158
|
-
return this.customFetch(
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
158
|
+
return this.customFetch(
|
|
159
|
+
`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`,
|
|
160
|
+
__spreadProps(__spreadValues({}, requestParams), {
|
|
161
|
+
headers: __spreadValues(__spreadValues({}, requestParams.headers || {}), type && type !== "multipart/form-data" ? { "Content-Type": type } : {}),
|
|
162
|
+
signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null,
|
|
163
|
+
body: typeof body === "undefined" || body === null ? null : payloadFormatter(body)
|
|
164
|
+
})
|
|
165
|
+
).then((response) => __async(this, null, function* () {
|
|
163
166
|
const r = response;
|
|
164
167
|
r.data = null;
|
|
165
168
|
r.error = null;
|
|
@@ -198,7 +201,9 @@ class HttpClient {
|
|
|
198
201
|
toQueryString(rawQuery) {
|
|
199
202
|
const query = rawQuery || {};
|
|
200
203
|
const keys = Object.keys(query).filter((key) => "undefined" !== typeof query[key]);
|
|
201
|
-
return keys.map(
|
|
204
|
+
return keys.map(
|
|
205
|
+
(key) => Array.isArray(query[key]) ? this.addArrayQueryParam(query, key) : this.addQueryParam(query, key)
|
|
206
|
+
).join("&");
|
|
202
207
|
}
|
|
203
208
|
addQueryParams(rawQuery) {
|
|
204
209
|
const queryString = this.toQueryString(rawQuery);
|
|
@@ -222,6 +227,133 @@ class HttpClient {
|
|
|
222
227
|
let Api$1 = class Api extends HttpClient {
|
|
223
228
|
constructor() {
|
|
224
229
|
super(...arguments);
|
|
230
|
+
__publicField(this, "auth", {
|
|
231
|
+
/**
|
|
232
|
+
* @description Login by email with verify code (Need send email verify code first) or password
|
|
233
|
+
*
|
|
234
|
+
* @tags Auth
|
|
235
|
+
* @name LoginByEmail
|
|
236
|
+
* @summary Login by email
|
|
237
|
+
* @request POST:/auth/email/login
|
|
238
|
+
* @response `200` `HandlerResponseUserLogin` OK
|
|
239
|
+
* @response `400` `(HandlerMap & {
|
|
240
|
+
msg?: string,
|
|
241
|
+
|
|
242
|
+
})` Bad Request
|
|
243
|
+
* @response `500` `(HandlerMap & {
|
|
244
|
+
msg?: string,
|
|
245
|
+
|
|
246
|
+
})` Internal Server Error
|
|
247
|
+
*/
|
|
248
|
+
loginByEmail: (data, params = {}) => this.request(__spreadValues({
|
|
249
|
+
path: `/auth/email/login`,
|
|
250
|
+
method: "POST",
|
|
251
|
+
body: data,
|
|
252
|
+
type: "application/json",
|
|
253
|
+
format: "json"
|
|
254
|
+
}, params)),
|
|
255
|
+
/**
|
|
256
|
+
* @description Register by email and verify code (if user exists, will update user, like forget password. Need send email verify code first)
|
|
257
|
+
*
|
|
258
|
+
* @tags Auth
|
|
259
|
+
* @name RegisterByEmail
|
|
260
|
+
* @summary Register by email
|
|
261
|
+
* @request POST:/auth/email/register
|
|
262
|
+
* @response `200` `HandlerResponseUserLogin` OK
|
|
263
|
+
* @response `400` `(HandlerMap & {
|
|
264
|
+
msg?: string,
|
|
265
|
+
|
|
266
|
+
})` Bad Request
|
|
267
|
+
* @response `500` `(HandlerMap & {
|
|
268
|
+
msg?: string,
|
|
269
|
+
|
|
270
|
+
})` Internal Server Error
|
|
271
|
+
*/
|
|
272
|
+
registerByEmail: (data, params = {}) => this.request(__spreadValues({
|
|
273
|
+
path: `/auth/email/register`,
|
|
274
|
+
method: "POST",
|
|
275
|
+
body: data,
|
|
276
|
+
type: "application/json",
|
|
277
|
+
format: "json"
|
|
278
|
+
}, params)),
|
|
279
|
+
/**
|
|
280
|
+
* @description Send email including verify code to user
|
|
281
|
+
*
|
|
282
|
+
* @tags Auth
|
|
283
|
+
* @name SendVerifyEmail
|
|
284
|
+
* @summary Send verify email
|
|
285
|
+
* @request POST:/auth/email/send
|
|
286
|
+
* @response `200` `(HandlerMap & {
|
|
287
|
+
msg?: string,
|
|
288
|
+
|
|
289
|
+
})` OK
|
|
290
|
+
* @response `400` `(HandlerMap & {
|
|
291
|
+
msg?: string,
|
|
292
|
+
|
|
293
|
+
})` Bad Request
|
|
294
|
+
* @response `500` `(HandlerMap & {
|
|
295
|
+
msg?: string,
|
|
296
|
+
|
|
297
|
+
})` Internal Server Error
|
|
298
|
+
*/
|
|
299
|
+
sendVerifyEmail: (data, params = {}) => this.request(__spreadValues({
|
|
300
|
+
path: `/auth/email/send`,
|
|
301
|
+
method: "POST",
|
|
302
|
+
body: data,
|
|
303
|
+
type: "application/json",
|
|
304
|
+
format: "json"
|
|
305
|
+
}, params)),
|
|
306
|
+
/**
|
|
307
|
+
* @description Get all users with same email, if there are more than one user with same email, need merge
|
|
308
|
+
*
|
|
309
|
+
* @tags Auth
|
|
310
|
+
* @name CheckDataMerge
|
|
311
|
+
* @summary Check data merge
|
|
312
|
+
* @request GET:/auth/merge
|
|
313
|
+
* @secure
|
|
314
|
+
* @response `200` `HandlerResponseAuthDataMergeCheck` OK
|
|
315
|
+
* @response `400` `(HandlerMap & {
|
|
316
|
+
msg?: string,
|
|
317
|
+
|
|
318
|
+
})` Bad Request
|
|
319
|
+
* @response `500` `(HandlerMap & {
|
|
320
|
+
msg?: string,
|
|
321
|
+
|
|
322
|
+
})` Internal Server Error
|
|
323
|
+
*/
|
|
324
|
+
checkDataMerge: (params = {}) => this.request(__spreadValues({
|
|
325
|
+
path: `/auth/merge`,
|
|
326
|
+
method: "GET",
|
|
327
|
+
secure: true,
|
|
328
|
+
format: "json"
|
|
329
|
+
}, params)),
|
|
330
|
+
/**
|
|
331
|
+
* @description This function is to solve the problem of multiple users with the same email address, should be called after user login and then check, and perform data merge.
|
|
332
|
+
*
|
|
333
|
+
* @tags Auth
|
|
334
|
+
* @name ApplyDataMerge
|
|
335
|
+
* @summary Apply data merge
|
|
336
|
+
* @request POST:/auth/merge
|
|
337
|
+
* @secure
|
|
338
|
+
* @response `200` `HandlerResponseAuthDataMergeApply` OK
|
|
339
|
+
* @response `400` `(HandlerMap & {
|
|
340
|
+
msg?: string,
|
|
341
|
+
|
|
342
|
+
})` Bad Request
|
|
343
|
+
* @response `500` `(HandlerMap & {
|
|
344
|
+
msg?: string,
|
|
345
|
+
|
|
346
|
+
})` Internal Server Error
|
|
347
|
+
*/
|
|
348
|
+
applyDataMerge: (data, params = {}) => this.request(__spreadValues({
|
|
349
|
+
path: `/auth/merge`,
|
|
350
|
+
method: "POST",
|
|
351
|
+
body: data,
|
|
352
|
+
secure: true,
|
|
353
|
+
type: "application/json",
|
|
354
|
+
format: "json"
|
|
355
|
+
}, params))
|
|
356
|
+
});
|
|
225
357
|
__publicField(this, "cache", {
|
|
226
358
|
/**
|
|
227
359
|
* @description Flush all cache on the server
|
|
@@ -482,6 +614,24 @@ let Api$1 = class Api extends HttpClient {
|
|
|
482
614
|
method: "GET",
|
|
483
615
|
format: "json"
|
|
484
616
|
}, params)),
|
|
617
|
+
/**
|
|
618
|
+
* @description Get social login providers
|
|
619
|
+
*
|
|
620
|
+
* @tags System
|
|
621
|
+
* @name GetSocialLoginProviders
|
|
622
|
+
* @summary Get Social Login Providers
|
|
623
|
+
* @request GET:/conf/auth/providers
|
|
624
|
+
* @response `200` `HandlerResponseConfAuthProviders` OK
|
|
625
|
+
* @response `404` `(HandlerMap & {
|
|
626
|
+
msg?: string,
|
|
627
|
+
|
|
628
|
+
})` Not Found
|
|
629
|
+
*/
|
|
630
|
+
getSocialLoginProviders: (params = {}) => this.request(__spreadValues({
|
|
631
|
+
path: `/conf/auth/providers`,
|
|
632
|
+
method: "GET",
|
|
633
|
+
format: "json"
|
|
634
|
+
}, params)),
|
|
485
635
|
/**
|
|
486
636
|
* @description Get Domain Info
|
|
487
637
|
*
|
|
@@ -1341,8 +1491,6 @@ function getDefaultExportFromCjs(x) {
|
|
|
1341
1491
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
1342
1492
|
if (protoProps)
|
|
1343
1493
|
_defineProperties(Constructor.prototype, protoProps);
|
|
1344
|
-
if (staticProps)
|
|
1345
|
-
_defineProperties(Constructor, staticProps);
|
|
1346
1494
|
Object.defineProperty(Constructor, "prototype", {
|
|
1347
1495
|
writable: false
|
|
1348
1496
|
});
|
|
@@ -2057,7 +2205,8 @@ class _Tokenizer {
|
|
|
2057
2205
|
blockquote(src) {
|
|
2058
2206
|
const cap = this.rules.block.blockquote.exec(src);
|
|
2059
2207
|
if (cap) {
|
|
2060
|
-
|
|
2208
|
+
let text = cap[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g, "\n $1");
|
|
2209
|
+
text = rtrim(text.replace(/^ *>[ \t]?/gm, ""), "\n");
|
|
2061
2210
|
const top = this.lexer.state.top;
|
|
2062
2211
|
this.lexer.state.top = true;
|
|
2063
2212
|
const tokens = this.lexer.blockTokens(text);
|
|
@@ -4249,7 +4398,7 @@ const insaneOptions = {
|
|
|
4249
4398
|
allowedAttributes: {
|
|
4250
4399
|
"*": ["title", "accesskey"],
|
|
4251
4400
|
a: ["href", "name", "target", "aria-label", "rel"],
|
|
4252
|
-
img: ["src", "alt", "title", "atk-emoticon", "aria-label"],
|
|
4401
|
+
img: ["src", "alt", "title", "atk-emoticon", "aria-label", "data-src", "class", "loading"],
|
|
4253
4402
|
// for code highlight
|
|
4254
4403
|
code: ["class"],
|
|
4255
4404
|
span: ["class", "style"]
|
|
@@ -4257,7 +4406,8 @@ const insaneOptions = {
|
|
|
4257
4406
|
filter: (node) => {
|
|
4258
4407
|
const allowed = [
|
|
4259
4408
|
["code", /^hljs\W+language-(.*)$/],
|
|
4260
|
-
["span", /^(hljs-.*)$/]
|
|
4409
|
+
["span", /^(hljs-.*)$/],
|
|
4410
|
+
["img", /^lazyload$/]
|
|
4261
4411
|
];
|
|
4262
4412
|
allowed.forEach(([tag2, reg]) => {
|
|
4263
4413
|
if (node.tag === tag2 && !!node.attrs.class && !reg.test(node.attrs.class)) {
|
|
@@ -4334,18 +4484,26 @@ const hanabi = /* @__PURE__ */ getDefaultExportFromCjs(hanabiExports);
|
|
|
4334
4484
|
function renderCode(code) {
|
|
4335
4485
|
return hanabi(code);
|
|
4336
4486
|
}
|
|
4337
|
-
function getRenderer() {
|
|
4487
|
+
function getRenderer(options) {
|
|
4338
4488
|
const renderer = new marked$1.Renderer();
|
|
4339
4489
|
renderer.link = markedLinkRenderer(renderer, renderer.link);
|
|
4340
4490
|
renderer.code = markedCodeRenderer();
|
|
4491
|
+
renderer.image = markedImageRenderer(renderer, renderer.image, options);
|
|
4341
4492
|
return renderer;
|
|
4342
4493
|
}
|
|
4343
4494
|
const markedLinkRenderer = (renderer, orgLinkRenderer) => (href, title, text) => {
|
|
4344
|
-
const
|
|
4495
|
+
const getLinkOrigin = (link2) => {
|
|
4496
|
+
try {
|
|
4497
|
+
return new URL(link2).origin;
|
|
4498
|
+
} catch (e) {
|
|
4499
|
+
return "";
|
|
4500
|
+
}
|
|
4501
|
+
};
|
|
4502
|
+
const isSameOriginLink = getLinkOrigin(href) === window.location.origin;
|
|
4345
4503
|
const html2 = orgLinkRenderer.call(renderer, href, title, text);
|
|
4346
4504
|
return html2.replace(
|
|
4347
4505
|
/^<a /,
|
|
4348
|
-
`<a target="_blank" ${!
|
|
4506
|
+
`<a target="_blank" ${!isSameOriginLink ? `rel="noreferrer noopener nofollow"` : ""} `
|
|
4349
4507
|
);
|
|
4350
4508
|
};
|
|
4351
4509
|
const markedCodeRenderer = () => (block2, lang) => {
|
|
@@ -4362,6 +4520,16 @@ const markedCodeRenderer = () => (block2, lang) => {
|
|
|
4362
4520
|
<code class="hljs language-${realLang}">${colorized.replace(/&/g, "&")}</code>
|
|
4363
4521
|
</pre>`;
|
|
4364
4522
|
};
|
|
4523
|
+
const markedImageRenderer = (renderer, orgImageRenderer, { imgLazyLoad }) => (href, title, text) => {
|
|
4524
|
+
const html2 = orgImageRenderer.call(renderer, href, title, text);
|
|
4525
|
+
if (!imgLazyLoad)
|
|
4526
|
+
return html2;
|
|
4527
|
+
if (imgLazyLoad === "native" || imgLazyLoad === true)
|
|
4528
|
+
return html2.replace(/^<img /, '<img class="lazyload" loading="lazy" ');
|
|
4529
|
+
if (imgLazyLoad === "data-src")
|
|
4530
|
+
return html2.replace(/^<img /, '<img class="lazyload" ').replace("src=", "data-src=");
|
|
4531
|
+
return html2;
|
|
4532
|
+
};
|
|
4365
4533
|
let instance;
|
|
4366
4534
|
let replacers = [];
|
|
4367
4535
|
const markedOptions = {
|
|
@@ -4375,16 +4543,18 @@ function getInstance() {
|
|
|
4375
4543
|
function setReplacers(arr) {
|
|
4376
4544
|
replacers = arr;
|
|
4377
4545
|
}
|
|
4378
|
-
function initMarked() {
|
|
4546
|
+
function initMarked(options) {
|
|
4379
4547
|
try {
|
|
4380
4548
|
if (!marked$1.name)
|
|
4381
4549
|
return;
|
|
4382
4550
|
} catch (e) {
|
|
4383
4551
|
return;
|
|
4384
4552
|
}
|
|
4385
|
-
marked$1.setOptions(__spreadValues({
|
|
4386
|
-
renderer: getRenderer(
|
|
4387
|
-
|
|
4553
|
+
marked$1.setOptions(__spreadValues(__spreadValues({
|
|
4554
|
+
renderer: getRenderer({
|
|
4555
|
+
imgLazyLoad: options.imgLazyLoad
|
|
4556
|
+
})
|
|
4557
|
+
}, markedOptions), options.markedOptions));
|
|
4388
4558
|
instance = marked$1;
|
|
4389
4559
|
}
|
|
4390
4560
|
function marked(src) {
|
|
@@ -4520,6 +4690,8 @@ const en = {
|
|
|
4520
4690
|
placeholder: "Leave a comment",
|
|
4521
4691
|
noComment: "No Comment",
|
|
4522
4692
|
send: "Send",
|
|
4693
|
+
signIn: "Sign in",
|
|
4694
|
+
signUp: "Sign up",
|
|
4523
4695
|
save: "Save",
|
|
4524
4696
|
nick: "Nickname",
|
|
4525
4697
|
email: "Email",
|
|
@@ -4578,7 +4750,26 @@ const en = {
|
|
|
4578
4750
|
/* Sidebar */
|
|
4579
4751
|
msgCenter: "Messages",
|
|
4580
4752
|
ctrlCenter: "Admin",
|
|
4753
|
+
/* Auth */
|
|
4754
|
+
noAccountPrompt: "Don't have an account?",
|
|
4755
|
+
haveAccountPrompt: "Already have an account?",
|
|
4756
|
+
forgetPassword: "Forget Password",
|
|
4757
|
+
resetPassword: "Reset Password",
|
|
4758
|
+
verificationCode: "Verification Code",
|
|
4759
|
+
verifySend: "Verify",
|
|
4760
|
+
verifyResend: "Resend",
|
|
4761
|
+
waitSeconds: "Wait {seconds}s",
|
|
4581
4762
|
emailVerified: "Email has been verified",
|
|
4763
|
+
password: "Password",
|
|
4764
|
+
username: "Username",
|
|
4765
|
+
nextStep: "Next Step",
|
|
4766
|
+
skipNotVerify: "Skip, do not verify",
|
|
4767
|
+
logoutConfirm: "Are you sure to logout?",
|
|
4768
|
+
accountMergeNotice: "Your email has multiple accounts with different id.",
|
|
4769
|
+
accountMergeSelectOne: "Please select one you want to merge all the data into it.",
|
|
4770
|
+
accountMergeConfirm: "All data will be merged into one account, the id is {id}.",
|
|
4771
|
+
dismiss: "Dismiss",
|
|
4772
|
+
merge: "Merge",
|
|
4582
4773
|
/* General */
|
|
4583
4774
|
frontend: "Frontend",
|
|
4584
4775
|
backend: "Backend",
|
|
@@ -4601,6 +4792,8 @@ const zhCN = {
|
|
|
4601
4792
|
placeholder: "键入内容...",
|
|
4602
4793
|
noComment: "「此时无声胜有声」",
|
|
4603
4794
|
send: "发送",
|
|
4795
|
+
signIn: "登录",
|
|
4796
|
+
signUp: "注册",
|
|
4604
4797
|
save: "保存",
|
|
4605
4798
|
nick: "昵称",
|
|
4606
4799
|
email: "邮箱",
|
|
@@ -4659,7 +4852,26 @@ const zhCN = {
|
|
|
4659
4852
|
/* Sidebar */
|
|
4660
4853
|
msgCenter: "通知中心",
|
|
4661
4854
|
ctrlCenter: "控制中心",
|
|
4855
|
+
/* Auth */
|
|
4856
|
+
noAccountPrompt: "没有账号?",
|
|
4857
|
+
haveAccountPrompt: "已有账号?",
|
|
4858
|
+
forgetPassword: "忘记密码",
|
|
4859
|
+
resetPassword: "重置密码",
|
|
4860
|
+
verificationCode: "验证码",
|
|
4861
|
+
verifySend: "发送验证码",
|
|
4862
|
+
verifyResend: "重新发送",
|
|
4863
|
+
waitSeconds: "等待 {seconds}秒",
|
|
4662
4864
|
emailVerified: "邮箱已验证",
|
|
4865
|
+
password: "密码",
|
|
4866
|
+
username: "用户名",
|
|
4867
|
+
nextStep: "下一步",
|
|
4868
|
+
skipNotVerify: "跳过,不验证",
|
|
4869
|
+
logoutConfirm: "确定要退出登录吗?",
|
|
4870
|
+
accountMergeNotice: "您的电子邮件下有多个不同 ID 的账户。",
|
|
4871
|
+
accountMergeSelectOne: "请选择将所有数据合并到其中的一个。",
|
|
4872
|
+
accountMergeConfirm: "所有数据将合并到 ID 为 {id} 的账户中。",
|
|
4873
|
+
dismiss: "忽略",
|
|
4874
|
+
merge: "合并",
|
|
4663
4875
|
/* General */
|
|
4664
4876
|
frontend: "前端",
|
|
4665
4877
|
backend: "后端",
|
|
@@ -4762,27 +4974,6 @@ function timeAgo(date, $t = (n) => n) {
|
|
|
4762
4974
|
return " - ";
|
|
4763
4975
|
}
|
|
4764
4976
|
}
|
|
4765
|
-
function onImagesLoaded($container, event) {
|
|
4766
|
-
if (!$container)
|
|
4767
|
-
return;
|
|
4768
|
-
const images = $container.getElementsByTagName("img");
|
|
4769
|
-
if (!images.length)
|
|
4770
|
-
return;
|
|
4771
|
-
let loaded = images.length;
|
|
4772
|
-
for (let i = 0; i < images.length; i++) {
|
|
4773
|
-
if (images[i].complete) {
|
|
4774
|
-
loaded--;
|
|
4775
|
-
} else {
|
|
4776
|
-
images[i].addEventListener("load", () => {
|
|
4777
|
-
loaded--;
|
|
4778
|
-
if (loaded === 0)
|
|
4779
|
-
event();
|
|
4780
|
-
});
|
|
4781
|
-
}
|
|
4782
|
-
if (loaded === 0)
|
|
4783
|
-
event();
|
|
4784
|
-
}
|
|
4785
|
-
}
|
|
4786
4977
|
function getGravatarURL(opts) {
|
|
4787
4978
|
return `${opts.mirror.replace(/\/$/, "")}/${opts.emailMD5}?${opts.params.replace(/^\?/, "")}`;
|
|
4788
4979
|
}
|
|
@@ -4982,17 +5173,12 @@ function handelCustomConf(customConf, full = false) {
|
|
|
4982
5173
|
return conf;
|
|
4983
5174
|
}
|
|
4984
5175
|
function handleConfFormServer(conf) {
|
|
4985
|
-
const DisabledKeys = [
|
|
4986
|
-
"el",
|
|
4987
|
-
"pageKey",
|
|
4988
|
-
"pageTitle",
|
|
4989
|
-
"server",
|
|
4990
|
-
"site",
|
|
4991
|
-
"darkMode"
|
|
4992
|
-
];
|
|
5176
|
+
const DisabledKeys = ["el", "pageKey", "pageTitle", "server", "site"];
|
|
4993
5177
|
Object.keys(conf).forEach((k) => {
|
|
4994
5178
|
if (DisabledKeys.includes(k))
|
|
4995
5179
|
delete conf[k];
|
|
5180
|
+
if (k === "darkMode" && conf[k] !== "auto")
|
|
5181
|
+
delete conf[k];
|
|
4996
5182
|
});
|
|
4997
5183
|
if (conf.emoticons && typeof conf.emoticons === "string") {
|
|
4998
5184
|
conf.emoticons = conf.emoticons.trim();
|
|
@@ -5300,8 +5486,6 @@ function playFadeAnim(elem, after, type = "in") {
|
|
|
5300
5486
|
const onAnimEnded = () => {
|
|
5301
5487
|
elem.classList.remove(`atk-fade-${type}`);
|
|
5302
5488
|
elem.removeEventListener("animationend", onAnimEnded);
|
|
5303
|
-
if (after)
|
|
5304
|
-
after();
|
|
5305
5489
|
};
|
|
5306
5490
|
elem.addEventListener("animationend", onAnimEnded);
|
|
5307
5491
|
}
|
|
@@ -5852,10 +6036,10 @@ class SidebarLayer extends Component {
|
|
|
5852
6036
|
} else {
|
|
5853
6037
|
const $iframe = this.$iframe;
|
|
5854
6038
|
const iFrameSrc = $iframe.src;
|
|
5855
|
-
if (this.
|
|
6039
|
+
if (this.getDarkMode() !== iFrameSrc.includes("&darkMode=1")) {
|
|
5856
6040
|
this.iframeLoad(
|
|
5857
6041
|
$iframe,
|
|
5858
|
-
this.
|
|
6042
|
+
this.getDarkMode() ? iFrameSrc.concat("&darkMode=1") : iFrameSrc.replace("&darkMode=1", "")
|
|
5859
6043
|
);
|
|
5860
6044
|
}
|
|
5861
6045
|
}
|
|
@@ -5925,12 +6109,15 @@ class SidebarLayer extends Component {
|
|
|
5925
6109
|
};
|
|
5926
6110
|
if (view)
|
|
5927
6111
|
query.view = view;
|
|
5928
|
-
if (this.
|
|
6112
|
+
if (this.getDarkMode())
|
|
5929
6113
|
query.darkMode = "1";
|
|
5930
6114
|
const urlParams = new URLSearchParams(query);
|
|
5931
6115
|
this.iframeLoad($iframe, `${baseURL}?${urlParams.toString()}`);
|
|
5932
6116
|
return $iframe;
|
|
5933
6117
|
}
|
|
6118
|
+
getDarkMode() {
|
|
6119
|
+
return this.conf.darkMode === "auto" ? window.matchMedia("(prefers-color-scheme: dark)").matches : this.conf.darkMode;
|
|
6120
|
+
}
|
|
5934
6121
|
iframeLoad($iframe, src) {
|
|
5935
6122
|
$iframe.src = src;
|
|
5936
6123
|
showLoading(this.$iframeWrap);
|
|
@@ -6265,38 +6452,42 @@ function Detect(userAgent) {
|
|
|
6265
6452
|
return dest;
|
|
6266
6453
|
}
|
|
6267
6454
|
function check(conf, rules) {
|
|
6268
|
-
rules.forEach(({ el, max
|
|
6269
|
-
|
|
6270
|
-
|
|
6271
|
-
|
|
6272
|
-
|
|
6273
|
-
|
|
6274
|
-
el,
|
|
6275
|
-
maxHeight,
|
|
6276
|
-
postBtnClick: conf.postExpandBtnClick
|
|
6277
|
-
});
|
|
6278
|
-
else
|
|
6279
|
-
applyScrollableHeightLimit({ el, maxHeight });
|
|
6280
|
-
};
|
|
6455
|
+
rules.forEach(({ el, max, imgCheck }) => {
|
|
6456
|
+
if (!el)
|
|
6457
|
+
return;
|
|
6458
|
+
if (imgCheck)
|
|
6459
|
+
el.style.maxHeight = `${max + 1}px`;
|
|
6460
|
+
let lock = false;
|
|
6281
6461
|
const _check = () => {
|
|
6282
|
-
if (
|
|
6283
|
-
|
|
6462
|
+
if (lock)
|
|
6463
|
+
return;
|
|
6464
|
+
if (getHeight(el) <= max)
|
|
6465
|
+
return;
|
|
6466
|
+
const afterExpandBtnClick = () => {
|
|
6467
|
+
var _a;
|
|
6468
|
+
lock = true;
|
|
6469
|
+
(_a = conf.afterExpandBtnClick) == null ? void 0 : _a.call(conf);
|
|
6470
|
+
};
|
|
6471
|
+
!conf.scrollable ? applyHeightLimit({ el, max, afterExpandBtnClick }) : applyScrollableHeightLimit({ el, max });
|
|
6284
6472
|
};
|
|
6285
6473
|
_check();
|
|
6286
|
-
if (
|
|
6287
|
-
|
|
6474
|
+
if (imgCheck) {
|
|
6475
|
+
el.querySelectorAll(".atk-content img").forEach((img) => {
|
|
6476
|
+
img.onload = () => _check();
|
|
6477
|
+
});
|
|
6478
|
+
}
|
|
6288
6479
|
});
|
|
6289
6480
|
}
|
|
6290
6481
|
const HEIGHT_LIMIT_CSS = "atk-height-limit";
|
|
6291
6482
|
function applyHeightLimit(obj) {
|
|
6292
6483
|
if (!obj.el)
|
|
6293
6484
|
return;
|
|
6294
|
-
if (!obj.
|
|
6485
|
+
if (!obj.max)
|
|
6295
6486
|
return;
|
|
6296
6487
|
if (obj.el.classList.contains(HEIGHT_LIMIT_CSS))
|
|
6297
6488
|
return;
|
|
6298
6489
|
obj.el.classList.add(HEIGHT_LIMIT_CSS);
|
|
6299
|
-
obj.el.style.height = `${obj.
|
|
6490
|
+
obj.el.style.height = `${obj.max}px`;
|
|
6300
6491
|
obj.el.style.overflow = "hidden";
|
|
6301
6492
|
const $expandBtn = createElement(
|
|
6302
6493
|
`<div class="atk-height-limit-btn">${t("readMore")}</span>`
|
|
@@ -6304,8 +6495,8 @@ function applyHeightLimit(obj) {
|
|
|
6304
6495
|
$expandBtn.onclick = (e) => {
|
|
6305
6496
|
e.stopPropagation();
|
|
6306
6497
|
disposeHeightLimit(obj.el);
|
|
6307
|
-
if (obj.
|
|
6308
|
-
obj.
|
|
6498
|
+
if (obj.afterExpandBtnClick)
|
|
6499
|
+
obj.afterExpandBtnClick(e);
|
|
6309
6500
|
};
|
|
6310
6501
|
obj.el.append($expandBtn);
|
|
6311
6502
|
}
|
|
@@ -6320,16 +6511,17 @@ function disposeHeightLimit($el) {
|
|
|
6320
6511
|
e.remove();
|
|
6321
6512
|
});
|
|
6322
6513
|
$el.style.height = "";
|
|
6514
|
+
$el.style.maxHeight = "";
|
|
6323
6515
|
$el.style.overflow = "";
|
|
6324
6516
|
}
|
|
6325
6517
|
const HEIGHT_LIMIT_SCROLL_CSS = "atk-height-limit-scroll";
|
|
6326
|
-
function applyScrollableHeightLimit(
|
|
6327
|
-
if (!
|
|
6518
|
+
function applyScrollableHeightLimit(opt) {
|
|
6519
|
+
if (!opt.el)
|
|
6328
6520
|
return;
|
|
6329
|
-
if (
|
|
6521
|
+
if (opt.el.classList.contains(HEIGHT_LIMIT_SCROLL_CSS))
|
|
6330
6522
|
return;
|
|
6331
|
-
|
|
6332
|
-
|
|
6523
|
+
opt.el.classList.add(HEIGHT_LIMIT_SCROLL_CSS);
|
|
6524
|
+
opt.el.style.height = `${opt.max}px`;
|
|
6333
6525
|
}
|
|
6334
6526
|
const 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-badge-wrap"></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';
|
|
6335
6527
|
function renderAvatar(r) {
|
|
@@ -6793,7 +6985,7 @@ class Render {
|
|
|
6793
6985
|
const childrenMaxH = conf.children;
|
|
6794
6986
|
check(
|
|
6795
6987
|
{
|
|
6796
|
-
|
|
6988
|
+
afterExpandBtnClick: () => {
|
|
6797
6989
|
const children = this.comment.getChildren();
|
|
6798
6990
|
if (children.length === 1)
|
|
6799
6991
|
disposeHeightLimit(children[0].getRender().$content);
|
|
@@ -6802,10 +6994,10 @@ class Render {
|
|
|
6802
6994
|
},
|
|
6803
6995
|
[
|
|
6804
6996
|
// 评论内容限高
|
|
6805
|
-
{ el: this.$content, max: contentMaxH,
|
|
6806
|
-
{ el: this.$replyTo, max: contentMaxH,
|
|
6997
|
+
{ el: this.$content, max: contentMaxH, imgCheck: true },
|
|
6998
|
+
{ el: this.$replyTo, max: contentMaxH, imgCheck: true },
|
|
6807
6999
|
// 子评论区域限高(仅嵌套模式)
|
|
6808
|
-
{ el: this.$childrenWrap, max: childrenMaxH,
|
|
7000
|
+
{ el: this.$childrenWrap, max: childrenMaxH, imgCheck: false }
|
|
6809
7001
|
]
|
|
6810
7002
|
);
|
|
6811
7003
|
}
|
|
@@ -6894,7 +7086,7 @@ class CommentActions {
|
|
|
6894
7086
|
(_b = this.comment.getRender().voteBtnDown) == null ? void 0 : _b.updateText();
|
|
6895
7087
|
}).catch((err) => {
|
|
6896
7088
|
actionBtn == null ? void 0 : actionBtn.setError(t("voteFail"));
|
|
6897
|
-
console.
|
|
7089
|
+
console.error(err);
|
|
6898
7090
|
});
|
|
6899
7091
|
}
|
|
6900
7092
|
/** 管理员 - 评论状态修改 */
|
|
@@ -7849,8 +8041,11 @@ ${opts.errMsg}`;
|
|
|
7849
8041
|
setError(opts.$err, errEl);
|
|
7850
8042
|
}
|
|
7851
8043
|
const Markdown = (ctx) => {
|
|
7852
|
-
|
|
7853
|
-
|
|
8044
|
+
ctx.watchConf(["markedReplacers", "imgLazyLoad", "markedOptions"], (conf) => {
|
|
8045
|
+
initMarked({
|
|
8046
|
+
markedOptions: ctx.getConf().markedOptions,
|
|
8047
|
+
imgLazyLoad: ctx.getConf().imgLazyLoad
|
|
8048
|
+
});
|
|
7854
8049
|
if (conf.markedReplacers)
|
|
7855
8050
|
setReplacers(conf.markedReplacers);
|
|
7856
8051
|
});
|
|
@@ -9089,7 +9284,7 @@ const GotoFocus = (ctx) => {
|
|
|
9089
9284
|
comment.focus();
|
|
9090
9285
|
}));
|
|
9091
9286
|
};
|
|
9092
|
-
const version = "2.8.
|
|
9287
|
+
const version = "2.8.6";
|
|
9093
9288
|
const Copyright = (ctx) => {
|
|
9094
9289
|
ctx.on("mounted", () => {
|
|
9095
9290
|
const list2 = ctx.get("list");
|