diff --git a/static/css/base.css b/static/css/base.css
index 8ac7f00..0dc9b7c 100644
--- a/static/css/base.css
+++ b/static/css/base.css
@@ -60,3 +60,22 @@ button {
display: none;
}
/* end reset & function */
+
+/* start common */
+.list li {
+ cursor: pointer;
+ line-height: 20px;
+ padding: 0 3px;
+ word-wrap: normal;
+ word-break: normal;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+.list li.selected,
+.list li:hover{
+ background-color: #3875d7;
+ color: #FFF;
+}
+/* end common */
\ No newline at end of file
diff --git a/static/css/dialog.css b/static/css/dialog.css
index 6c1b8ba..258810e 100644
--- a/static/css/dialog.css
+++ b/static/css/dialog.css
@@ -99,16 +99,10 @@
}
#dialogGoFilePrompt > ul {
+ position: relative;
height: 260px;
overflow: auto;
margin-top: 5px;
-}
-
-#dialogGoFilePrompt li {
-
-}
-
-#dialogGoFilePrompt li.selected,
-#dialogGoFilePrompt li:hover {
-
+ background-color: #FFF;
+ border: 1px solid #9B9B9B;
}
\ No newline at end of file
diff --git a/static/css/wide.css b/static/css/wide.css
index ed4d3c9..354be75 100644
--- a/static/css/wide.css
+++ b/static/css/wide.css
@@ -336,28 +336,13 @@
padding: 0 5px;
}
-.bottom-window-group .search li {
- cursor: pointer;
- line-height: 20px;
- padding: 0 3px;
- word-wrap: normal;
- word-break: normal;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
-}
-
-.bottom-window-group .search li.selected {
- background-color: #3875d7;
- color: #FFF;
-}
-
.bottom-window-group .search .path {
color: #999;
font-size: 12px;
}
-.bottom-window-group .search li.selected .path {
+.bottom-window-group .search li.selected .path,
+.bottom-window-group .search li:hover .path {
color: #FFF;
}
/* end bottom-window-group */
diff --git a/static/js/editors.js b/static/js/editors.js
index 53c1ae1..5f57f0d 100644
--- a/static/js/editors.js
+++ b/static/js/editors.js
@@ -486,7 +486,7 @@ var editors = {
};
},
appendSearch: function (data, type, key) {
- var searcHTML = '
';
+ var searcHTML = '';
for (var i = 0, ii = data.length; i < ii; i++) {
var contents = data[i].contents[0],
diff --git a/static/js/hotkeys.js b/static/js/hotkeys.js
index c5ac915..9f03413 100644
--- a/static/js/hotkeys.js
+++ b/static/js/hotkeys.js
@@ -94,6 +94,55 @@ var hotkeys = {
which: 117
}
},
+ bindList: function ($source, $list, enterFun) {
+ $list.data("index", 0);
+ $source.keydown(function (event) {
+ var index = $list.data("index"),
+ count = $list.find("li").length;
+
+ if (count === 0) {
+ return true;
+ }
+
+ if (event.which === 38) { // up
+ index--;
+ if (index < 0) {
+ index = count - 1;
+ }
+ }
+
+ if (event.which === 40) { // down
+ index++;
+ if (index > count - 1) {
+ index = 0;
+ }
+ }
+
+ var $selected = $list.find("li:eq(" + index + ")");
+
+ if (event.which === 13) { // enter
+ enterFun($selected);
+ }
+
+ $list.find("li").removeClass("selected");
+ $list.data("index", index);
+ $selected.addClass("selected");
+
+ if (index === 0) {
+ $list.scrollTop(0);
+ } else {
+ if ($selected[0].offsetTop + $list.scrollTop() > $list.height()) {
+ if (event.which === 40) {
+ $list.scrollTop($list.scrollTop() + $selected.height());
+ } else {
+ $list.scrollTop($selected[0].offsetTop);
+ }
+ } else {
+ $list.scrollTop(0);
+ }
+ }
+ });
+ },
_bindOutput: function () {
$(".bottom-window-group .output").keydown(function (event) {
event.preventDefault();
diff --git a/static/js/wide.js b/static/js/wide.js
index 22eedbb..95e9dc1 100644
--- a/static/js/wide.js
+++ b/static/js/wide.js
@@ -288,35 +288,53 @@ var wide = {
"title": config.label.goto_file,
"okText": config.label.go,
"cancelText": config.label.cancel,
+ "afterInit": function () {
+ hotkeys.bindList($("#dialogGoFilePrompt > input"), $("#dialogGoFilePrompt > .list"), function ($selected) {
+ var tId = tree.getTIdByPath($selected.text());
+ tree.openFile(tree.fileTree.getNodeByTId(tId));
+ $("#dialogGoFilePrompt").dialog("close");
+ });
+
+ $("#dialogGoFilePrompt > input").keydown(function () {
+ var name = $("#dialogGoFilePrompt > input").val();
+
+ var request = newWideRequest();
+ request.path = wide.curNode.path;
+ request.name = '*' + name + '*';
+
+ $.ajax({
+ type: 'POST',
+ url: '/file/find/name',
+ data: JSON.stringify(request),
+ dataType: "json",
+ success: function (data) {
+ if (!data.succ) {
+ return;
+ }
+
+ var goFileHTML = '';
+ for (var i = 0, max = data.founds.length; i < max; i++) {
+ if (i === 0) {
+ goFileHTML += '- ' + data.founds[i].path + '
';
+ } else {
+ goFileHTML += '- ' + data.founds[i].path + '
';
+ }
+ }
+
+ $("#dialogGoFilePrompt > ul").html(goFileHTML);
+ }
+ });
+ });
+ },
"afterOpen": function () {
$("#dialogGoFilePrompt > input").val('').focus();
$("#dialogGoFilePrompt").closest(".dialog-main").find(".dialog-footer > button:eq(0)").prop("disabled", true);
+ $("#dialogGoFilePrompt .list").html('').data("index", 0);
},
"ok": function () {
- var name = $("#dialogGoFilePrompt > input").val();
-
- var request = newWideRequest();
- request.path = wide.curNode.path;
- request.name = '*' + name + '*';
-
- $.ajax({
- type: 'POST',
- url: '/file/find/name',
- data: JSON.stringify(request),
- dataType: "json",
- success: function (data) {
- if (!data.succ) {
- return;
- }
-
- var goFileHTML = '';
- for (var i = 0, max = data.founds.length; i < max; i++) {
- goFileHTML += '- ' + data.founds[i].path + '
';
- }
-
- $("#dialogGoFilePrompt > ul").html(goFileHTML);
- }
- });
+ var tId = tree.getTIdByPath($("#dialogGoFilePrompt .selected").text());
+ tree.openFile(tree.fileTree.getNodeByTId(tId));
+ $("#dialogGoFilePrompt").dialog("close");
}
});
diff --git a/static/user/admin/style.css b/static/user/admin/style.css
index 8d762ad..8e30ddd 100644
--- a/static/user/admin/style.css
+++ b/static/user/admin/style.css
@@ -9,6 +9,6 @@ button {
.CodeMirror,
.CodeMirror-hints {
font-family: Consolas, 'Courier New', monospace;
- font-size: 13px;
- line-height: 17px;
+ font-size: inherit;
+ line-height: ;
}
\ No newline at end of file
diff --git a/views/index.html b/views/index.html
index d78b3e4..673ecc6 100644
--- a/views/index.html
+++ b/views/index.html
@@ -246,7 +246,7 @@