给评论按钮添加Loading动画
This commit is contained in:
parent
2d86241d39
commit
a98cf47a63
@ -47,7 +47,7 @@ h1 {display:flex;}
|
|||||||
</h1>
|
</h1>
|
||||||
<div id="postBody"></div>
|
<div id="postBody"></div>
|
||||||
|
|
||||||
<button class="btn btn-block" type="button" onclick="openComments()" id="cmButton">Comments </button>
|
<button class="btn btn-block" type="button" onclick="openComments()" id="cmButton"> </button>
|
||||||
<div class="comments" style="display:none;" id="comments"></div>
|
<div class="comments" style="display:none;" id="comments"></div>
|
||||||
|
|
||||||
<div class="footer">Copyright © <span id="year"></span> <a id="footerblogTitle" href=""></a> <p><span id="filingNum"></span><span id="runday"></span>Powered by <a href="https://github.com/Meekdai/Gmeek" target="_blank">Gmeek</a></p></div>
|
<div class="footer">Copyright © <span id="year"></span> <a id="footerblogTitle" href=""></a> <p><span id="filingNum"></span><span id="runday"></span>Powered by <a href="https://github.com/Meekdai/Gmeek" target="_blank">Gmeek</a></p></div>
|
||||||
@ -59,8 +59,8 @@ h1 {display:flex;}
|
|||||||
|
|
||||||
var blogBase=%s
|
var blogBase=%s
|
||||||
|
|
||||||
var i18nEN=["switch theme","Run "," days","Home"];
|
var i18nEN=["switch theme","Run "," days","Home","Comments","Loading"];
|
||||||
var i18nCN=["切换主题","网站运行","天","首页"];
|
var i18nCN=["切换主题","网站运行","天","首页","评论","加载中"];
|
||||||
if(blogBase["i18n"]=="CN"){var i18n=i18nCN;}
|
if(blogBase["i18n"]=="CN"){var i18n=i18nCN;}
|
||||||
else{var i18n=i18nEN;}
|
else{var i18n=i18nEN;}
|
||||||
|
|
||||||
@ -78,6 +78,7 @@ document.getElementById("postTitle").innerHTML=blogBase["postTitle"];
|
|||||||
document.getElementById("postBody").innerHTML=blogBase["postBody"];
|
document.getElementById("postBody").innerHTML=blogBase["postBody"];
|
||||||
document.getElementById("changeTheme").setAttribute("title",i18n[0]);
|
document.getElementById("changeTheme").setAttribute("title",i18n[0]);
|
||||||
document.getElementById("buttonHome").setAttribute("title",i18n[3]);
|
document.getElementById("buttonHome").setAttribute("title",i18n[3]);
|
||||||
|
document.getElementById("cmButton").innerHTML=i18n[4];
|
||||||
|
|
||||||
if(blogBase["faviconUrl"]!=""){
|
if(blogBase["faviconUrl"]!=""){
|
||||||
link=document.createElement("link");
|
link=document.createElement("link");
|
||||||
@ -131,6 +132,11 @@ if(blogBase["commentNum"]>0){
|
|||||||
function openComments(){
|
function openComments(){
|
||||||
cm=document.getElementById("comments");
|
cm=document.getElementById("comments");
|
||||||
cmButton=document.getElementById("cmButton");
|
cmButton=document.getElementById("cmButton");
|
||||||
|
cmButton.innerHTML=i18n[5];
|
||||||
|
span=document.createElement("span");
|
||||||
|
span.setAttribute("class","AnimatedEllipsis");
|
||||||
|
cmButton.appendChild(span);
|
||||||
|
|
||||||
script=document.createElement("script");
|
script=document.createElement("script");
|
||||||
script.setAttribute("src","https://utteranc.es/client.js");
|
script.setAttribute("src","https://utteranc.es/client.js");
|
||||||
script.setAttribute("repo",blogBase["repoName"]);
|
script.setAttribute("repo",blogBase["repoName"]);
|
||||||
@ -141,9 +147,17 @@ function openComments(){
|
|||||||
script.setAttribute("async","");
|
script.setAttribute("async","");
|
||||||
cm.appendChild(script);
|
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";
|
cmButton.style.display="none";
|
||||||
cm.style.display="block";
|
cm.style.display="block";
|
||||||
utterancesLoad=1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user