go file 完善
This commit is contained in:
parent
3d4eaa6cea
commit
489c4fb4ef
|
@ -62,6 +62,11 @@ button {
|
||||||
/* end reset & function */
|
/* end reset & function */
|
||||||
|
|
||||||
/* start common */
|
/* start common */
|
||||||
|
.ft-small {
|
||||||
|
color: #999;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
.list li {
|
.list li {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
line-height: 20px;
|
line-height: 20px;
|
||||||
|
@ -78,4 +83,9 @@ button {
|
||||||
background-color: #3875d7;
|
background-color: #3875d7;
|
||||||
color: #FFF;
|
color: #FFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.list li.selected .ft-small,
|
||||||
|
.list li:hover .ft-small {
|
||||||
|
color: #FFF;
|
||||||
|
}
|
||||||
/* end common */
|
/* end common */
|
|
@ -209,7 +209,8 @@
|
||||||
top: 1px;
|
top: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.edit-panel .tabs .ico {
|
.edit-panel .tabs .ico,
|
||||||
|
#dialogGoFilePrompt .ico {
|
||||||
background-image: url("../images/ico-file.png");
|
background-image: url("../images/ico-file.png");
|
||||||
float: left;
|
float: left;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
|
@ -335,16 +336,6 @@
|
||||||
width: 50px;
|
width: 50px;
|
||||||
padding: 0 5px;
|
padding: 0 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bottom-window-group .search .path {
|
|
||||||
color: #999;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bottom-window-group .search li.selected .path,
|
|
||||||
.bottom-window-group .search li:hover .path {
|
|
||||||
color: #FFF;
|
|
||||||
}
|
|
||||||
/* end bottom-window-group */
|
/* end bottom-window-group */
|
||||||
|
|
||||||
/* start footer */
|
/* start footer */
|
||||||
|
|
|
@ -496,7 +496,7 @@ var editors = {
|
||||||
+ contents.substring(index + key.length);
|
+ contents.substring(index + key.length);
|
||||||
|
|
||||||
searcHTML += '<li title="' + data[i].path + '">'
|
searcHTML += '<li title="' + data[i].path + '">'
|
||||||
+ contents + " <span class='path'>" + data[i].path
|
+ contents + " <span class='ft-small'>" + data[i].path
|
||||||
+ '<i class="position" data-line="'
|
+ '<i class="position" data-line="'
|
||||||
+ data[i].line + '" data-ch="' + data[i].ch + '"> (' + data[i].line + ':'
|
+ data[i].line + '" data-ch="' + data[i].ch + '"> (' + data[i].line + ':'
|
||||||
+ data[i].ch + ')</i></span></li>';
|
+ data[i].ch + ')</i></span></li>';
|
||||||
|
|
|
@ -141,6 +141,11 @@ var hotkeys = {
|
||||||
$list.scrollTop(0);
|
$list.scrollTop(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 阻止上下键改变光标位置
|
||||||
|
if (event.which === 38 || event.which === 40 || event.which === 13) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
_bindOutput: function () {
|
_bindOutput: function () {
|
||||||
|
|
|
@ -187,40 +187,7 @@ var wide = {
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#dialogNewFilePrompt").dialog("close");
|
$("#dialogNewFilePrompt").dialog("close");
|
||||||
var suffix = name.split(".")[1],
|
var iconSkin = wide.getClassBySuffix(name.split(".")[1]);
|
||||||
iconSkin = "ico-ztree-other ";
|
|
||||||
switch (suffix) {
|
|
||||||
case "html", "htm":
|
|
||||||
iconSkin = "ico-ztree-html ";
|
|
||||||
break;
|
|
||||||
case "go":
|
|
||||||
iconSkin = "ico-ztree-go ";
|
|
||||||
break;
|
|
||||||
case "css":
|
|
||||||
iconSkin = "ico-ztree-css ";
|
|
||||||
break;
|
|
||||||
case "txt":
|
|
||||||
iconSkin = "ico-ztree-text ";
|
|
||||||
break;
|
|
||||||
case "sql":
|
|
||||||
iconSkin = "ico-ztree-sql ";
|
|
||||||
break;
|
|
||||||
case "properties":
|
|
||||||
iconSkin = "ico-ztree-pro ";
|
|
||||||
break;
|
|
||||||
case "md":
|
|
||||||
iconSkin = "ico-ztree-md ";
|
|
||||||
break;
|
|
||||||
case "js", "json":
|
|
||||||
iconSkin = "ico-ztree-js ";
|
|
||||||
break;
|
|
||||||
case "xml":
|
|
||||||
iconSkin = "ico-ztree-xml ";
|
|
||||||
break;
|
|
||||||
case "jpg", "jpeg", "bmp", "gif", "png", "svg", "ico":
|
|
||||||
iconSkin = "ico-ztree-img ";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
tree.fileTree.addNodes(wide.curNode, [{
|
tree.fileTree.addNodes(wide.curNode, [{
|
||||||
"name": name,
|
"name": name,
|
||||||
|
@ -289,13 +256,26 @@ var wide = {
|
||||||
"okText": config.label.go,
|
"okText": config.label.go,
|
||||||
"cancelText": config.label.cancel,
|
"cancelText": config.label.cancel,
|
||||||
"afterInit": function () {
|
"afterInit": function () {
|
||||||
hotkeys.bindList($("#dialogGoFilePrompt > input"), $("#dialogGoFilePrompt > .list"), function ($selected) {
|
$("#dialogGoFilePrompt").on("dblclick", "li", function () {
|
||||||
var tId = tree.getTIdByPath($selected.text());
|
var tId = tree.getTIdByPath($(this).find(".ft-small").text());
|
||||||
tree.openFile(tree.fileTree.getNodeByTId(tId));
|
tree.openFile(tree.fileTree.getNodeByTId(tId));
|
||||||
$("#dialogGoFilePrompt").dialog("close");
|
$("#dialogGoFilePrompt").dialog("close");
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#dialogGoFilePrompt > input").keydown(function () {
|
$("#dialogGoFilePrompt").on("click", "li", function () {
|
||||||
|
var $list = $("#dialogGoFilePrompt > .list")
|
||||||
|
$list.find("li").removeClass("selected");
|
||||||
|
$list.data("index", $(this).data("index"));
|
||||||
|
$(this).addClass("selected");
|
||||||
|
});
|
||||||
|
|
||||||
|
hotkeys.bindList($("#dialogGoFilePrompt > input"), $("#dialogGoFilePrompt > .list"), function ($selected) {
|
||||||
|
var tId = tree.getTIdByPath($selected.find(".ft-small").text());
|
||||||
|
tree.openFile(tree.fileTree.getNodeByTId(tId));
|
||||||
|
$("#dialogGoFilePrompt").dialog("close");
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#dialogGoFilePrompt > input").bind("input", function () {
|
||||||
var name = $("#dialogGoFilePrompt > input").val();
|
var name = $("#dialogGoFilePrompt > input").val();
|
||||||
|
|
||||||
var request = newWideRequest();
|
var request = newWideRequest();
|
||||||
|
@ -317,10 +297,20 @@ var wide = {
|
||||||
|
|
||||||
var goFileHTML = '';
|
var goFileHTML = '';
|
||||||
for (var i = 0, max = data.founds.length; i < max; i++) {
|
for (var i = 0, max = data.founds.length; i < max; i++) {
|
||||||
|
var path = data.founds[i].path,
|
||||||
|
name = path.substr(path.lastIndexOf(config.pathSeparator) + 1),
|
||||||
|
icoSkin = wide.getClassBySuffix(name.split(".")[1]);
|
||||||
if (i === 0) {
|
if (i === 0) {
|
||||||
goFileHTML += '<li class="selected">' + data.founds[i].path + '</li>';
|
goFileHTML += '<li data-index="' + i + '" class="selected" title="'
|
||||||
|
+ path + '"><span class="'
|
||||||
|
+ icoSkin + 'ico"></span>'
|
||||||
|
+ name + ' <span class="ft-small">'
|
||||||
|
+ path + '</span></li>';
|
||||||
} else {
|
} else {
|
||||||
goFileHTML += '<li>' + data.founds[i].path + '</li>';
|
goFileHTML += '<li data-index="' + i + '" title="'
|
||||||
|
+ path + '"><span class="' + icoSkin + 'ico"></span>'
|
||||||
|
+ name + ' <span class="ft-small">'
|
||||||
|
+ path + '</span></li>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -335,7 +325,7 @@ var wide = {
|
||||||
$("#dialogGoFilePrompt .list").html('').data("index", 0);
|
$("#dialogGoFilePrompt .list").html('').data("index", 0);
|
||||||
},
|
},
|
||||||
"ok": function () {
|
"ok": function () {
|
||||||
var tId = tree.getTIdByPath($("#dialogGoFilePrompt .selected").text());
|
var tId = tree.getTIdByPath($("#dialogGoFilePrompt .selected .ft-small").text());
|
||||||
tree.openFile(tree.fileTree.getNodeByTId(tId));
|
tree.openFile(tree.fileTree.getNodeByTId(tId));
|
||||||
$("#dialogGoFilePrompt").dialog("close");
|
$("#dialogGoFilePrompt").dialog("close");
|
||||||
}
|
}
|
||||||
|
@ -1031,6 +1021,43 @@ var wide = {
|
||||||
},
|
},
|
||||||
openAbout: function () {
|
openAbout: function () {
|
||||||
$("#dialogAbout").dialog("open");
|
$("#dialogAbout").dialog("open");
|
||||||
|
},
|
||||||
|
getClassBySuffix: function (suffix) {
|
||||||
|
var iconSkin = "ico-ztree-other ";
|
||||||
|
switch (suffix) {
|
||||||
|
case "html", "htm":
|
||||||
|
iconSkin = "ico-ztree-html ";
|
||||||
|
break;
|
||||||
|
case "go":
|
||||||
|
iconSkin = "ico-ztree-go ";
|
||||||
|
break;
|
||||||
|
case "css":
|
||||||
|
iconSkin = "ico-ztree-css ";
|
||||||
|
break;
|
||||||
|
case "txt":
|
||||||
|
iconSkin = "ico-ztree-text ";
|
||||||
|
break;
|
||||||
|
case "sql":
|
||||||
|
iconSkin = "ico-ztree-sql ";
|
||||||
|
break;
|
||||||
|
case "properties":
|
||||||
|
iconSkin = "ico-ztree-pro ";
|
||||||
|
break;
|
||||||
|
case "md":
|
||||||
|
iconSkin = "ico-ztree-md ";
|
||||||
|
break;
|
||||||
|
case "js", "json":
|
||||||
|
iconSkin = "ico-ztree-js ";
|
||||||
|
break;
|
||||||
|
case "xml":
|
||||||
|
iconSkin = "ico-ztree-xml ";
|
||||||
|
break;
|
||||||
|
case "jpg", "jpeg", "bmp", "gif", "png", "svg", "ico":
|
||||||
|
iconSkin = "ico-ztree-img ";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return iconSkin;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue