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

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

    }

    txtJSInput.focus();

    return(false);
}

function showJSExport(){
    if(glbBusy)return;
    hideJSInput();
    with(divJSExport.style){
        display="block";
        left=(document.body.clientWidth-divJSExport.offsetWidth)/2;
        top=(document.body.clientHeight-divJSExport.offsetHeight)/2;
    }
    divJSExportContent.style.display="none";
    selJSExport.style.display="block";

    selJSExport.focus();
    return(false);
}

function hideJSInput(){
    divJSInput.style.display="none";
}

function hideJSExport(){
    divJSExport.style.display="none";
}

function execJSInput(){
    hideJSInput();

    divJSOutput.innerHTML="";
    divJSOutputLineNo.innerHTML="";
    divJSOutputPlus.innerHTML="";

    glbStr=txtJSInput.innerText; // not support FF    
    glbP=0;
    glbFuntionNames=new Array();
    curRe=glbRe=document.createElement("div");

    divJSOutput.appendChild(glbRe);
    glbRe.className="codeRoot";

    while(selJSExport.options.length>0)selJSExport.options[0]=null;

    showWait(startRecalcLine);
    core_analysis();
}

function execJSExport(){
    var fns=new Array(), fcs=new Array(), str;

    for(var i=0; i<selJSExport.options.length; i++){
        if(selJSExport.options[i].selected){
            fns.push(selJSExport.options[i].value);
            str=selJSExport.options[i].obj.outerHTML;
            try{
                str+=selJSExport.options[i].obj.nextSibling.outerHTML;
                str+=selJSExport.options[i].obj.nextSibling.nextSibling.outerHTML;
            }catch(e){}
            fcs.push(str);