|
|
|
@ -165,11 +165,22 @@ $(".resourcesList").mousedown(function(e) {
|
|
|
|
|
//将当前元素赋给 上一个对象 保存起来。
|
|
|
|
|
last_line = line;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
//元素包含关系计算
|
|
|
|
|
var contains = function(root, el) {
|
|
|
|
|
if (root.compareDocumentPosition)
|
|
|
|
|
return root === el || !!(root.compareDocumentPosition(el) & 16);
|
|
|
|
|
if (root.contains && el.nodeType === 1){
|
|
|
|
|
return root.contains(el) && root !== el;
|
|
|
|
|
}
|
|
|
|
|
while ((el = el.parentNode))
|
|
|
|
|
if (el === root) return true;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
$(document.body).click(function(e) {
|
|
|
|
|
//在列表上的任何单击事件都要恢复原来的样子
|
|
|
|
|
//隐藏右键菜单
|
|
|
|
|
e.preventDefault()
|
|
|
|
|
//e.preventDefault();
|
|
|
|
|
$("#contextMenu").hide();
|
|
|
|
|
document.oncontextmenu = function() {return true;}
|
|
|
|
|
//如果当前行为空,那么要将当前行的拿到
|
|
|
|
@ -181,9 +192,13 @@ $(document.body).click(function(e) {
|
|
|
|
|
if(line.get(0).tagName === 'LI'){
|
|
|
|
|
line = line.parent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//如果当前对象在表格里,将当前行改变为白色,这里主要是防止点击页面的其他链接的时候,那个链接背景色变白了
|
|
|
|
|
if( contains($(".resourcesList").get(0),line.get(0))){
|
|
|
|
|
line.children().css("background-color", 'white');
|
|
|
|
|
}
|
|
|
|
|
//将当前行改变为白色
|
|
|
|
|
line.children().css("background-color", 'white');
|
|
|
|
|
|
|
|
|
|
//当前行恢复编辑状态到链接状态
|
|
|
|
|
if(ele && ele.nodeName != 'INPUT') {
|
|
|
|
|
restore();
|
|
|
|
|