utterance / utterances

:crystal_ball: A lightweight comments widget built on GitHub issues
https://utteranc.es
MIT License
8.66k stars 567 forks source link

Add a load button to comments #657

Open Meekdai opened 9 months ago

Meekdai commented 9 months ago

Hello, I want to add a button to the comment and load utterances after the user clicks.
I use setInterval to check the utterances height, when height!="" is means utterances Loading completed. Demo

int=self.setInterval("iFrameLoading()",200);

function iFrameLoading(){
    var utterances=document.getElementsByClassName('utterances');
    if(utterances.length==1){
        if(utterances[0].style.height!=""){
            int=window.clearInterval(int);
            console.log("utterances Load OK");
        }
    }
}

Is there a better way to achieve this functionality?