JS代码格式化和语法着色V2

2019-06-03 18:16:39王旭

        left=(document.body.clientWidth-divWaiting.offsetWidth)/2;
        top=(document.body.clientHeight-divWaiting.offsetHeight)/2;
    }
    spnProcess.innerHTML="0.00%  ( 0 / 0 )";
    divWaiting.onstop=onstop;
    cmdStop.focus();
    return(false);
}

function hideWait(){
    glbBusy=false;
    document.body.style.cursor="";
    divWaiting.style.display="none";
    try{clearTimeout(glbTimer);}catch(e){}
    try{divWaiting.onstop();}catch(e){}
    return(false);
}

function stopExec(){ hideWait(); }

function startRecalcLine(){
    var re="", re2="";
    if(glbBusy)return;
    glbBusy=true;

    for(var i=0;i<parseInt(divJSOutput.scrollHeight/14+200);i++){
        re+="<p>"+(i+1)+"</p>";
        re2+="<p> </p>";
    }

    divJSOutputLineNo.innerHTML=re;
    divJSOutputPlus.innerHTML=re2;
    divJSOutputPlus.buttons=new Array();

    glbP=0;

    showWait();
    recalcLine();
    return(false);

}


function recalcLine(){
    var objs, j;

    objs=document.getElementsByTagName("div");
    for(var i=glbP;i<objs.length&&(i-glbP<30);i++){
        if(objs[i].className=="indent"){
            j=parseInt(objs[i].offsetTop/14)-1;
            divJSOutputPlus.childNodes[j].className="colsp";
            divJSOutputPlus.childNodes[j].innerHTML="-";
            divJSOutputPlus.childNodes[j].linkedDIV=objs[i];
            divJSOutputPlus.childNodes[j].startIndex=j+1;
            divJSOutputPlus.childNodes[j].endIndex=j+Math.round(objs[i].offsetHeight/14);
            if(objs[i].innerHTML!="")divJSOutputPlus.childNodes[j].endIndex++;
            divJSOutputPlus.childNodes[j].switchDIV=divJSOutputPlus.childNodes[j].onclick=switchDIV;