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”
/>
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>0&&Global.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(“http:/
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(“http:/
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(“http:/
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(“http://UpdateInfo”);
var ab = doc.selectSingleNode(“http://About”);
var ns = doc.selectSingleNode(“http://nextversion”);
var s = “”;
if(doc.error==false){
if(ab!=null){
s += ab.childNodes[0].text;
}
for(var i=0;i
//s += “
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;
}
}
//–>
progressorbar.start();
//–>
ttyp
‘s code collection v0.44,and enjoy it:)