主页 > 知识库 > code collection v0.44 hta

code collection v0.44 hta

热门标签:美图手机 智能手机 检查注册表项 服务器配置 铁路电话系统 网站文章发布 呼叫中心市场需求 银行业务
复制代码 代码如下:

!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
html>
head>
title>code collection v0.44/title>
meta http-equiv="Content-Type" content="text/html; charset=GB2312">
HTA:APPLICATION 
    ID="ttyp's code collection v0.44" 
    APPLICATIONNAME="ttyp's code collection v0.44" 
    VERSION="0.1" 
    SCROLL="no" 
    INNERBORDER="no" 
    CONTEXTMENU="yes" 
    CAPTION="yes" 
    ICON="skin//cc.ico" 
    SHOWINTASKBAR="yes" 
    SINGLEINSTANCE="yes" 
    SYSMENU="yes" 
    WINDOWSTATE="normal"
    NAVIGABLE="yes"
    />
script language="JavaScript" src="js/xml.js">/script>
script language="JavaScript" src="js/xmlhttp.js">/script>
SCRIPT language=JavaScript src="js/skin.js">/script>
SCRIPT language=JavaScript src="js/progressorbar.js">/script>
script language="JavaScript" src="js/xtree.js">/script>
script language="JavaScript" src="js/dom.js">/script>
script language="JavaScript" src="js/config.js">/script>
script language="JavaScript" src="js/global.js">/script>
script language="JavaScript" src="js/highlight.js">/script>
script language="VbScript" src="js/ts.vbs">/script>
script language="JavaScript" src="js/autoupdate.js">/script>
SCRIPT language=JavaScript src="js/dmenu.js">/script>
SCRIPT language=JavaScript src="js/output.js">/script>
SCRIPT language=JavaScript src="js/splitbar.js">/script>
SCRIPT language=JavaScript src="js/search.js">/script>
SCRIPT language=JavaScript src="js/toolbar.js">/script>
SCRIPT language=JavaScript src="js/inputfile.js">/script>
SCRIPT language=JavaScript src="js/createlink.js">/script>
SCRIPT language=JavaScript src="js/password.js">/script>
SCRIPT language=JavaScript src="js/chm.js">/script>


SCRIPT LANGUAGE="JavaScript">

var _designMode=0;
var g_prompt;
var g_window;
var doc;

!--
function init()
{    

    //定义全局变量
    g_prompt    = new CLASS_PROMPT();
    g_window    = new CLASS_WINDOW();


    var doc        = new CLASS_XML("xml/data.xml")

    //用于直接加载时获得根接点
    var rootXml    = doc.root();
    var root    = getRootNode(rootXml);

    //dom.js
    loadChild(root,rootXml);

    doc.dispose();

    root.setup(document.getElementById("divTree"));    

    bt_newitem.onclick = function(){
        if(Global.selectedNode!=null){
            writeDate(document.frames.fraGeneral,"");
            changeModel(0);

            var o = new Node("新接点","javascript:writeCode()","fraGeneral");
            if(Global.selectedNode.childNodes.length>0Global.selectedNode.load==false){
                Global.selectedNode.expand();
                Global.selectedNode.load = false;
            }else{
                Global.selectedNode.load = true;
            }
            Global.selectedNode.add(o);

            o.select();
            o.edit();

            var o_xml    = new CLASS_XML("xml/data.xml");

            var n = o_xml.selectSingleNode("//*[@id=" + o.parent.key + "]");

            var q = o_xml.createElement("item");
                q.setAttribute("name","新接点");
                q.setAttribute("id",o.key);

            n.appendChild(q);

            //保存菜单文件
            o_xml.save();
            o_xml.dispose();

        }else{
            g_prompt.show("请选择要添加的接点栏目");
        }        
    }

    bt_delete.onclick = function(){
        var _o = Global.selectedNode;
        if(_o){
            if(_o.childNodes.length==0){            
                var o_xml    = new CLASS_XML("xml/data.xml");
                var    m        = o_xml.selectSingleNode("//*[@id=" + _o.key + "]");

                if(m!=nullm.nodeName=="item"){
                    if(confirm("是否真的删除接点[" + _o.text + "]?")){
                        m.parentNode.removeChild(m);

                        o_xml.save();


                        //删除数据文件
                        deleteContent(_o.key);

                        _o.remove();
                    }
                }else{
                    g_prompt.show("根接点不能删除!");
                }

                o_xml.dispose();
            }else{
                g_prompt.show("有子接点不能删除",true);
            }
        }else{
            g_prompt.show("请选择要删除的接点");
        }
    }

    bt_save.onclick = function(){        
        var _o = Global.selectedNode;
        if(_o){        
            //获取文本
            var s = "";
            var t = _o.text;

            switch(_designMode){
                case 0:
                    s = document.frames.fraGeneral.document.documentElement.outerHTML;
                break;
                case 1:
                    s = document.getElementById("editBox").innerText;                    
                break;
                case 2:
                    s = document.frames.fraPreview.document.documentElement.outerHTML;
                default:
                break;
            }

            //保存文本(dom.js)
            if(saveContent(_o.key,t,s)){
                g_prompt.show("[" + _o.text + "]保存成功!");
            }else{
                g_prompt.show("[" + _o.text + "]保存失败!");
            }
        }else{
            g_prompt.show("请选择要保存的接点");
        }
    }

    bt_update.onclick = function(){
        var    auto = new CLASS_AUTOUPDATE("CLASS_AUTOUPDATE",g_window);
            auto.update();

    }

    /*
     *    树接点编辑事件
     */
    Node.prototype.onAfterEdit = function(e,oldText,newText){
        if(oldText!=newText){
            var _o    = Global.selectedNode;
                _o.setText(this.text);

            var o_xml = new CLASS_XML("xml/data.xml");

            var m    = o_xml.selectSingleNode("//*[@id=" + _o.key + "]");
            if(m!=null){
                m.setAttribute("name",this.text);
                m.setAttribute("password",this.password);
                //保存菜单文件
                o_xml.save();

                var data = new CLASS_XML("xml\\" + _o.key + ".xml");
                if(data.error == false){
                    var    title = data.selectSingleNode("//title");

                    if(title!=null){
                        title.setAttribute("value",this.text);
                    }
                    data.save();
                }
                data.dispose();                
            }else{
                document.title = "Error:没有找到接点" + _o.key;
            }

            o_xml.dispose();

            this.select();
        }

    }

    /*
     *    接点拖动事件
     */
    Node.prototype.onDrag = function(from,to){
        var _f = from.path+"";
        var _t = to.path+"";
        if(_f.length_t.length_t.substring(0,_f.length)==_f){
            g_prompt.show("不能移动到子接点");
            return;
        }

        //处理树
        to.moveToChild(from);

        /*
         *开始移动接点
         */        
        var o_xml = new CLASS_XML("xml/data.xml");

        //处理XML
        var o_f = o_xml.selectSingleNode("//*[@id=" + from.key + "]");
        var o_t = o_xml.selectSingleNode("//*[@id=" + to.key + "]");

        o_t.appendChild(o_f);

        o_xml.save();
        o_xml.dispose();

    }


    Node.prototype.onExpand = function(n){
        var o = this;    

        if(!this.load){

            if(this.locked){

                var r = window.showModalDialog("js/password.htm",this.key,"dialogHeight:80px;dialogWidth:250px;");            

                if(typeof(r)=="undefined"||r==0){                    
                    return false;
                }else{            
                    o.locked = false;
                }

                
            }

            this.open    = 1;
            this.load    = true;

            var o_xml    = new CLASS_XML("xml/data.xml");
            var m        = o_xml.selectSingleNode("//*[@id=" + o.key + "]");

            var    f    = o.getFirstChild();            
                f.remove();

            //dom.js
            loadChild(o,m);

            o_xml.dispose();
        } 
        return true;
    }


    document.frames.fraGeneral.document.designMode = "on";

    //创建右键菜单
    var g_rightmenu = new CLASS_RIGHTMENU(document.getElementById("test"),document.getElementById("divTree"),"xml/rightmenu.xml");

    //创建分割条
    var g_splitbar    = new CLASS_SPLITBAR_HORIZON(document.getElementById("divSplit"),document.getElementById("divTree"),document.getElementById("divList"));

    var    auto    = new CLASS_AUTOUPDATE("CLASS_AUTOUPDATE",g_window);
        auto.check();

        CLASS_TOOLBAR.prototype.highlight = doHighlight;
    var g_toolbar    =  new CLASS_TOOLBAR(document.getElementById("cbHead"),document.frames.fraGeneral,g_window);
        g_toolbar.path = skinPath;


    //全局键盘事件
    document.onkeydown = function(e){
        var code,o;

        //兼容nsie事件
        if(!e) e = window.event;

        //兼容nsie按键
        code = e.which ? e.which : e.keyCode;        

        switch(code){
            case 83:
            case 115:                //ctrl+s
                if(e.ctrlKey){
                    document.getElementById("bt_save").click();
                }
                break;
            case 110:                //ctrl+n
            case 78:
                if(e.ctrlKey){
                    document.getElementById("bt_newitem").click();
                }
                break;
            case 46:                //delete
                if(e.shiftKey){
                    document.getElementById("bt_delete").click();
                }
                break;
            case 81:    //ctrl+q
            case 113:
                if(e.ctrlKey)
                {
                    changeModel(0,true);
                }
                break;
            case 87:    //ctrl+w
            case 119:
                if(e.ctrlKey)
                {
                    changeModel(1,true);
                }
                break;
            case 69:    //ctrl+e,ctrl+b
            case 101:
            case 66:
            case 98:
                if(e.ctrlKey)
                {
                    changeModel(2,true);
                }
                break;
            default:break;
        }
    }

    //开始画面
    about();

}

/*
 *    数据导入导出
 */
function odata(flag){

    var _o    = Global.selectedNode;
    if(_o){
        if(flag){                
            outData(_o);
        }else{
            inData(_o);
        }
    }else{
        g_prompt.show("请选择要操作的接点");
    }
}

/*
 *    重命名接点
 */
function editNode(){
    var _o    = Global.selectedNode;
    if(_o){
        _o.edit();
    }
}

/*
 *    转到连接
 */
function go(url){
    changeModel(2,false);
    document.getElementById("fraPreview").src = url;
}

/*
 *    写正文
 */
function writeCode(id){    

    //获得接点的文本(dom.js)
    var sid;
    if(typeof(id)=="undefined"){
        sid = Global.selectedNode.key;
        if(Global.selectedNode.locked){
            var r = window.showModalDialog("js/password.htm",Global.selectedNode.key,"dialogHeight:80px;dialogWidth:250px;");            
            if(typeof(r)=="undefined"||r==0){                
                Global.selectedNode.unselect();
                return false;
            }else{
                Global.selectedNode.locked = false;    
            }
        }
    }else{
        sid = id;
        //判断id是否是锁定的
    }

    var s= readContent(sid);

    changeModel(2,false);

    writeDate(document.frames.fraPreview,s);
    writeDate(document.frames.fraGeneral,s);
    document.getElementById("editBox").innerText = s;

}

/*
 *    关于
 */
function about(){    
    var doc    = new CLASS_XML("xml\\autoupdate.xml");
    var info= doc.selectNodes("//UpdateInfo");
    var ab    = doc.selectSingleNode("//About");
    var ns    = doc.selectSingleNode("//nextversion");

    var s    = "";
    if(doc.error==false){
        if(ab!=null){
            s += ab.childNodes[0].text;
        }

        for(var i=0;iinfo.length;i++){
            //s += "xmp>" + info[i].childNodes[0].text + "/xmp>br>";
            s += info[i].childNodes[0].text + "";
        }
        if(ns!=null){
            s += ns.childNodes[0].text;
        }        
    }else{
        s    = "读配置文件失败!";
    }
    doc.dispose();

    //切换浏览模式
    changeModel(2,false);

    //写正文
    writeDate(document.frames.fraPreview,s);
    writeDate(document.frames.fraGeneral,s);
    document.getElementById("editBox").innerText = s;
}

/*
 *    写框价数据
 */
function writeDate(fra,data){
    fra.document.close();
    fra.document.write(data);
    fra.document.close();
}


/*
 *    切换浏览模式
 */
function changeModel(n,flag){
    var _dm=parseInt(n);

    document.getElementById("Img_modelBtn").style.pixelTop=_dm*(-15);

    var d = document.getElementById("editBox");
    var g = document.getElementById("fraGeneral");
    var p = document.getElementById("fraPreview");

    var gd= document.frames.fraGeneral.document;
    var pd= document.frames.fraPreview.document;

    var c = document.getElementById("cbHead");

    switch(_dm){
        case 0:    //普通
            d.style.display = "none";
            g.style.display = "";
            p.style.display = "none";
            c.style.display = "";

            if(flag==true){
                writeDate(document.frames.fraGeneral,d.innerText);
            }

        break;
        case 1:    //HTML
            d.style.display = "";
            g.style.display = "none";
            p.style.display = "none";
            c.style.display = "none";

            if(flag==true){
                d.innerText = gd.documentElement.outerHTML;
            }

        break;
        case 2:    //浏览
            d.style.display = "none";
            g.style.display = "none";
            p.style.display = "";
            c.style.display = "none";

            if(flag==true){
                if(_designMode==0){
                    writeDate(document.frames.fraPreview,gd.documentElement.outerHTML);
                    d.innerText = gd.documentElement.outerHTML;
                }
                if(_designMode==1){
                    writeDate(document.frames.fraGeneral,d.innerText);
                    writeDate(document.frames.fraPreview,d.innerText);
                }
            }

        break;
    }

    _designMode = _dm;
}

function editTab(){
    sel    =event.srcElement.document.selection.createRange();
    switch (event.keyCode){
        case 8:
            break
        case 9:
            sel.text = "\t\t\t\t";
             event.returnValue = false;
            break;
        case 13 :
            break;
        default:
            break;
    }
}
//-->
/SCRIPT>
/head>

body marginleft=0 marginright=0 onload="init()" oncontextmenu="if(event.srcElement.tagName!='TEXTAREA'event.srcElement.tagName!='INPUT'event.srcElement.contentEditable!='true'){return false;}">
SCRIPT LANGUAGE="JavaScript">
!--
    progressorbar.start();
//-->
/SCRIPT>
DIV id=test style="diaplay:none;position:absolute;">/DIV>
div id="logoBar" noWrap oncontextmenu ="return false;" onselectstart="return false;">b>Welcome to a href='mailto:ttyp@21cn.com'>font color='#ffffff'>ttyp/font>/a>/b>'s code collection v0.44,and enjoy it:)/div>
div id="toolBar" noWrap oncontextmenu ="return false;" onselectstart="return false;">
    a href="#" class="bt_off" id="bt_newitem" hideFocus="true">div>/div>NewItem/a>a href="#" class="bt_off" id="bt_delete" hideFocus="true" style="border-right-width:0px">div>/div>Delete/a>a href="#" class="bt_off" id="bt_save" hideFocus="true" style="border-right-width:1px">div>/div>Save/a>
    span id="settingBar">
        a href="#" class="setting" id="bt_update" hideFocus="true" style="border-right:0px">Update/a>
    /span>
/div>
/div>
div id="divTree" xmlSrc="xml/data.xml">/div>
div id="divList" onfocus="this.blur();">
    div id=cbHead style="display:none;">/div>
    div id="divContent">
        iframe id="fraGeneral" name="fraGeneral" style="display:none;" frameborder=0 width="100%" height="100%" marginwidth=0 marginheight=0 >/iframe>
        iframe id="fraPreview" name="fraPreview" style="display:none;" frameborder=0 width="100%" height="100%" marginwidth=0 marginheight=0 >/iframe>
        div id="editBox" name="editBox" style="width:100%;height:100%;" marginheight="1" marginwidth="1" contenteditable="true" onselectstart="event.cancelBubble=true;" designMode="off" oncontextmenu="return true;" onkeydown="editTab()">/div>
    /div>
    SPAN STYLE="position:absolute;width:123;height:15;clip: rect(0 123 15 0)" onfocus="this.blur();">
    IMG ID="Img_modelBtn" style="border:0" SRC="skin/default/img/editmode.gif" STYLE="position:absolute;top:0;left:0" usemap="#MBtnMap">
    /SPAN>
/div>
div id="divSplit">/div>
map name="MBtnMap">
area shape="rect" coords="0, 0, 40, 44"   alt="普通设计模式"    onclick="changeModel(0,true)">
area shape="rect" coords="41, 0, 81, 44"  alt="HTML原码模式"    onclick="changeModel(1,true)">
area shape="rect" coords="82, 0, 122, 44" alt="预览模式"        onclick="changeModel(2,true)">
/map>
/body>
/html>
SCRIPT language=JavaScript src="js/plugin.js">/script>

标签:红河 沈阳 乐山 沧州 新疆 上海 河南 长治

巨人网络通讯声明:本文标题《code collection v0.44 hta》,本文关键词  ;如发现本文内容存在版权问题,烦请提供相关信息告之我们,我们将及时沟通与处理。本站内容系统采集于网络,涉及言论、版权与本站无关。
  • 相关文章
  • 收缩
    • 微信客服
    • 微信二维码
    • 电话咨询

    • 400-1100-266