From da10a8e395cda67fa59baa31eff92d5c0e3afc16 Mon Sep 17 00:00:00 2001 From: Van Date: Fri, 14 Nov 2014 15:03:30 +0800 Subject: [PATCH] go file --- static/css/dialog.css | 15 +++++++++++++++ static/css/side.css | 1 + static/js/editors.js | 3 --- static/js/hotkeys.js | 20 +++++++++++++++++--- static/js/wide.js | 9 +++++++-- views/index.html | 1 + 6 files changed, 41 insertions(+), 8 deletions(-) diff --git a/static/css/dialog.css b/static/css/dialog.css index b19d57d..6c1b8ba 100644 --- a/static/css/dialog.css +++ b/static/css/dialog.css @@ -96,4 +96,19 @@ .dialog-main input { width: 100%; margin: 2px auto; +} + +#dialogGoFilePrompt > ul { + height: 260px; + overflow: auto; + margin-top: 5px; +} + +#dialogGoFilePrompt li { + +} + +#dialogGoFilePrompt li.selected, +#dialogGoFilePrompt li:hover { + } \ No newline at end of file diff --git a/static/css/side.css b/static/css/side.css index 17e84eb..b2e8e62 100644 --- a/static/css/side.css +++ b/static/css/side.css @@ -45,6 +45,7 @@ border-width: 0; color: #fff; height: 18px; + opacity: 1; } .ztree li a:hover { diff --git a/static/js/editors.js b/static/js/editors.js index 972960d..53c1ae1 100644 --- a/static/js/editors.js +++ b/static/js/editors.js @@ -761,9 +761,6 @@ var editors = { cm.setSelection(CodeMirror.Pos(from.line + 1, from.ch), CodeMirror.Pos(to.line + 1, to.ch)); - }, - "Shift-Alt-O": function () { - $("#dialogGoFilePrompt").dialog("open"); } } }); diff --git a/static/js/hotkeys.js b/static/js/hotkeys.js index a774e71..c5ac915 100644 --- a/static/js/hotkeys.js +++ b/static/js/hotkeys.js @@ -12,7 +12,7 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ + */ var hotkeys = { defaultKeyMap: { @@ -79,6 +79,13 @@ var hotkeys = { shiftKey: false, which: 81 }, + // Shift+Alt+O 跳转到文件 + goFile: { + ctrlKey: false, + altKey: true, + shiftKey: true, + which: 79 + }, // F6 构建并运行 buildRun: { ctrlKey: false, @@ -267,7 +274,7 @@ var hotkeys = { return; } - + if (event.ctrlKey === hotKeys.goSearch.ctrlKey && event.which === hotKeys.goSearch.which) { // Ctrl+5 焦点切换到搜索窗口 bottomGroup.tabs.setCurrent("search"); @@ -361,7 +368,14 @@ var hotkeys = { return; } - }); + + if (event.ctrlKey === hotKeys.goFile.ctrlKey + && event.altKey === hotKeys.goFile.altKey + && event.shiftKey === hotKeys.goFile.shiftKey + && event.which === hotKeys.goFile.which) { // Shift+Alt+O 跳转到文件 + $("#dialogGoFilePrompt").dialog("open"); + } + }); }, init: function () { this._bindFileTree(); diff --git a/static/js/wide.js b/static/js/wide.js index 50199f8..22eedbb 100644 --- a/static/js/wide.js +++ b/static/js/wide.js @@ -308,8 +308,13 @@ var wide = { if (!data.succ) { return; } - - console.log(data); + + var goFileHTML = ''; + for (var i = 0, max = data.founds.length; i < max; i++) { + goFileHTML += '
  • ' + data.founds[i].path + '
  • '; + } + + $("#dialogGoFilePrompt > ul").html(goFileHTML); } }); } diff --git a/views/index.html b/views/index.html index a3eab6b..d78b3e4 100644 --- a/views/index.html +++ b/views/index.html @@ -246,6 +246,7 @@
    +