From 8248f49fcf3c3655de0f5af1f326cd27d142c58f 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 15:07:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B1=85=E7=84=B6=E5=8D=A1=E6=AD=BB=E4=BA=86?= =?UTF-8?q?=EF=BC=8C=E4=BD=BF=E7=94=A8=E5=AE=9A=E6=97=B6=E9=97=B4=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- post_example.html | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/post_example.html b/post_example.html index 708bfbc..8cbf3fd 100644 --- a/post_example.html +++ b/post_example.html @@ -147,19 +147,27 @@ function openComments(){ script.setAttribute("async",""); cm.appendChild(script); - while(utterancesLoad==0){ - utterancesFrame=document.getElementsByClassName("utterances-frame")[0]; - if(utterancesFrame!=null){ - if (utterancesFrame.attachEvent){ - utterancesFrame.attachEvent("onload", function(){utterancesLoad=1;}); - } - else { - utterancesFrame.onload = function(){utterancesLoad=1;}; - } + int=self.setInterval("iFrameLoading()",200); +} + +function iFrameLoading(){ + utterancesFrame=document.getElementsByClassName("utterances-frame")[0]; + if(utterancesFrame!=null){ + if (utterancesFrame.attachEvent){ + utterancesFrame.attachEvent("onload", function(){iFrameOK();}); + } + else { + utterancesFrame.onload = function(){iFrameOK();}; } } - cmButton.style.display="none"; - cm.style.display="block"; +} + +function iFrameOK(){ + utterancesLoad=1; + int=window.clearInterval(int); + document.getElementById("cmButton").style.display="none"; + document.getElementById("comments").style.display="block"; + console.log("utterances Load OK"); }