This commit is contained in:
Van 2014-09-03 17:49:03 +08:00
parent 515fcd85e1
commit 1daadb6e12
1 changed files with 62 additions and 51 deletions

View File

@ -1,5 +1,5 @@
var tree = {
fileTree: {},
fileTree: undefined,
newFile: function() {
$("#dirRMenu ul").hide();
var name = prompt("Name", "");
@ -96,14 +96,32 @@ var tree = {
wide.curNode = treeNode;
if ("f" === treeNode.type) { // 如果右击了文件
$("#fileRMenu ul").show();
fileRMenu.css({"top": event.clientY - 10 + "px", "left": event.clientX + "px", "display": "block"});
fileRMenu.css({
"top": event.clientY - 10 + "px",
"left": event.clientX + "px",
"display": "block"
});
} else { // 右击了目录
$("#dirRMenu ul").show();
dirRMenu.css({"top": event.clientY - 10 + "px", "left": event.clientX + "px", "display": "block"});
dirRMenu.css({
"top": event.clientY - 10 + "px",
"left": event.clientX + "px",
"display": "block"
});
}
}
},
onClick: function(event, treeId, treeNode, clickFlag) {
tree._onClick(treeNode);
}
}
};
tree.fileTree = $.fn.zTree.init($("#files"), setting, data.root.children);
}
}
});
},
_onClick: function(treeNode) {
if (wide.curNode) {
var id = wide.curNode.tId;
if (id === treeNode.tId) {
@ -153,11 +171,4 @@ var tree = {
});
}
}
}
};
tree.fileTree = $.fn.zTree.init($("#files"), setting, data.root.children);
}
}
});
}
};