From a98cf47a63d3b2fae1bf8ad5186e65e3cce678d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=86=E7=93=9C=E4=BA=91?= Date: Mon, 31 Jul 2023 14:12:23 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=99=E8=AF=84=E8=AE=BA=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0Loading=E5=8A=A8=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- post_example.html | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/post_example.html b/post_example.html index 7455e26..7af480c 100644 --- a/post_example.html +++ b/post_example.html @@ -47,7 +47,7 @@ h1 {display:flex;}
- + @@ -59,8 +59,8 @@ h1 {display:flex;} var blogBase=%s -var i18nEN=["switch theme","Run "," days","Home"]; -var i18nCN=["切换主题","网站运行","天","首页"]; +var i18nEN=["switch theme","Run "," days","Home","Comments","Loading"]; +var i18nCN=["切换主题","网站运行","天","首页","评论","加载中"]; if(blogBase["i18n"]=="CN"){var i18n=i18nCN;} else{var i18n=i18nEN;} @@ -78,6 +78,7 @@ document.getElementById("postTitle").innerHTML=blogBase["postTitle"]; document.getElementById("postBody").innerHTML=blogBase["postBody"]; document.getElementById("changeTheme").setAttribute("title",i18n[0]); document.getElementById("buttonHome").setAttribute("title",i18n[3]); +document.getElementById("cmButton").innerHTML=i18n[4]; if(blogBase["faviconUrl"]!=""){ link=document.createElement("link"); @@ -131,6 +132,11 @@ if(blogBase["commentNum"]>0){ function openComments(){ cm=document.getElementById("comments"); cmButton=document.getElementById("cmButton"); + cmButton.innerHTML=i18n[5]; + span=document.createElement("span"); + span.setAttribute("class","AnimatedEllipsis"); + cmButton.appendChild(span); + script=document.createElement("script"); script.setAttribute("src","https://utteranc.es/client.js"); script.setAttribute("repo",blogBase["repoName"]); @@ -141,9 +147,17 @@ function openComments(){ script.setAttribute("async",""); cm.appendChild(script); + while(utterancesLoad==0){ + utterancesFrame=document.getElementsByClassName("utterances-frame")[0]; + if (utterancesFrame.attachEvent){ + utterancesFrame.attachEvent("onload", function(){utterancesLoad=1;}); + } + else { + utterancesFrame.onload = function(){utterancesLoad=1;}; + } + } cmButton.style.display="none"; cm.style.display="block"; - utterancesLoad=1; }