From 692f1fda5a35f7868a237e53e41ce704e1bb05e5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=B1=B1=E5=90=B9=E8=89=B2=E5=BE=A1=E5=AE=88?=
<85992002+KazariEX@users.noreply.github.com>
Date: Sun, 16 Jun 2024 22:30:38 +0800
Subject: [PATCH] fix: load script synchronously (#482)
* fix: constant path
* fix: load script synchronously
---
layout/_partial/comments/artalk/script.ejs | 5 +----
layout/_partial/comments/twikoo/script.ejs | 7 ++-----
layout/_partial/comments/waline/script.ejs | 6 +-----
layout/_partial/scripts.ejs | 2 +-
4 files changed, 5 insertions(+), 15 deletions(-)
diff --git a/layout/_partial/comments/artalk/script.ejs b/layout/_partial/comments/artalk/script.ejs
index 74e70fc..f5fb5f8 100644
--- a/layout/_partial/comments/artalk/script.ejs
+++ b/layout/_partial/comments/artalk/script.ejs
@@ -6,10 +6,7 @@
if (!el) return;
utils.css('<%- theme.comments.artalk.css %>');
utils.js('<%- theme.comments.artalk.js %>', {defer: true}).then(function () {
- const path = el.getAttribute('comment_id');
- if (!path) {
- path = decodeURI(window.location.pathname);
- }
+ const path = el.getAttribute('comment_id') ?? decodeURI(window.location.pathname);
const artalk = Artalk.init({
el: '#artalk_container',
pageKey: path,
diff --git a/layout/_partial/comments/twikoo/script.ejs b/layout/_partial/comments/twikoo/script.ejs
index ed52fb0..e1a2846 100644
--- a/layout/_partial/comments/twikoo/script.ejs
+++ b/layout/_partial/comments/twikoo/script.ejs
@@ -1,14 +1,11 @@
+
<%- partial('scripts/theme') %>