From 43b4cd8d982fbc0320a523db78545f42533afc1a Mon Sep 17 00:00:00 2001 From: Van Date: Fri, 5 Dec 2014 17:59:42 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8F=9C=E5=8D=95=E5=8A=9F=E8=83=BD=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/js/editors.js | 2 +- static/js/hotkeys.js | 80 ++++++++++++++++++++++++++------------------ static/js/tree.js | 2 +- static/js/wide.js | 2 +- views/index.html | 31 ++++++++--------- 5 files changed, 66 insertions(+), 51 deletions(-) diff --git a/static/js/editors.js b/static/js/editors.js index 7f561c1..4b569d8 100644 --- a/static/js/editors.js +++ b/static/js/editors.js @@ -78,7 +78,7 @@ var editors = { init: function () { $("#dialogCloseEditor").dialog({ "modal": true, - "height": 66, + "height": 90, "width": 260, "title": config.label.tip, "hideFooter": true, diff --git a/static/js/hotkeys.js b/static/js/hotkeys.js index 83d32fe..1fe2c5c 100644 --- a/static/js/hotkeys.js +++ b/static/js/hotkeys.js @@ -21,35 +21,71 @@ var hotkeys = { ctrlKey: true, altKey: false, shiftKey: false, - which: 48 + which: 48, + fun: function () { + if (wide.curEditor) { + wide.curEditor.focus(); + } + } }, // Ctrl-1 焦点切换到文件树 goFileTree: { ctrlKey: true, altKey: false, shiftKey: false, - which: 49 + which: 49, + fun: function () { + // 有些元素需设置 tabindex 为 -1 时才可以 focus + if ($(".footer .ico-restore:eq(0)").css("display") === "inline") { + // 当文件树最小化时 + $(".side").css({ + "left": "0" + }); + + if ($(".footer .ico-restore:eq(1)").css("display") === "inline") { + // 当底部最小化时 + $(".bottom-window-group").css("top", "100%").hide(); + } + } + + $("#files").focus(); + } }, // Ctrl-4 焦点切换到输出窗口 goOutput: { ctrlKey: true, altKey: false, shiftKey: false, - which: 52 + which: 52, + fun: function () { + bottomGroup.tabs.setCurrent("output"); + windows.flowBottom(); + $(".bottom-window-group .output").focus(); + } }, // Ctrl-5 焦点切换到搜索窗口 goSearch: { ctrlKey: true, altKey: false, shiftKey: false, - which: 53 + which: 53, + fun: function () { + bottomGroup.tabs.setCurrent("search"); + windows.flowBottom(); + $(".bottom-window-group .search").focus(); + } }, // Ctrl-6 焦点切换到通知窗口 goNotification: { ctrlKey: true, altKey: false, shiftKey: false, - which: 54 + which: 54, + fun: function () { + bottomGroup.tabs.setCurrent("notification"); + windows.flowBottom(); + $(".bottom-window-group .notification").focus(); + } }, // Ctrl-C 清空窗口内容 clearWindow: { @@ -311,9 +347,7 @@ var hotkeys = { $(document).keydown(function (event) { if (event.ctrlKey === hotKeys.goEditor.ctrlKey && event.which === hotKeys.goEditor.which) { // Ctrl-0 焦点切换到当前编辑器 - if (wide.curEditor) { - wide.curEditor.focus(); - } + hotKeys.goEditor.fun(); event.preventDefault(); return; @@ -321,20 +355,7 @@ var hotkeys = { if (event.ctrlKey === hotKeys.goFileTree.ctrlKey && event.which === hotKeys.goFileTree.which) { // Ctrl-1 焦点切换到文件树 - // 有些元素需设置 tabindex 为 -1 时才可以 focus - if ($(".footer .ico-restore:eq(0)").css("display") === "inline") { - // 当文件树最小化时 - $(".side").css({ - "left": "0" - }); - - if ($(".footer .ico-restore:eq(1)").css("display") === "inline") { - // 当底部最小化时 - $(".bottom-window-group").css("top", "100%").hide(); - } - } - - $("#files").focus(); + hotKeys.goFileTree.fun(); event.preventDefault(); return; @@ -342,10 +363,7 @@ var hotkeys = { if (event.ctrlKey === hotKeys.goOutput.ctrlKey && event.which === hotKeys.goOutput.which) { // Ctrl-4 焦点切换到输出窗口 - bottomGroup.tabs.setCurrent("output"); - - windows.flowBottom(); - $(".bottom-window-group .output").focus(); + hotKeys.goOutput.fun(); event.preventDefault(); return; @@ -353,19 +371,15 @@ var hotkeys = { if (event.ctrlKey === hotKeys.goSearch.ctrlKey && event.which === hotKeys.goSearch.which) { // Ctrl-5 焦点切换到搜索窗口 - bottomGroup.tabs.setCurrent("search"); - windows.flowBottom(); - $(".bottom-window-group .search").focus(); + hotKeys.goSearch.fun(); event.preventDefault(); return; } if (event.ctrlKey === hotKeys.goNotification.ctrlKey - && event.which === hotKeys.goNotification.which) { // Ctrl-6 焦点切换到通知窗口 - bottomGroup.tabs.setCurrent("notification"); - windows.flowBottom(); - $(".bottom-window-group .notification").focus(); + && event.which === hotKeys.goNotification.which) { // Ctrl-6 焦点切换到通知窗口 + hotKeys.goNotification.fun(); event.preventDefault(); return; diff --git a/static/js/tree.js b/static/js/tree.js index ab4feb6..775ed11 100644 --- a/static/js/tree.js +++ b/static/js/tree.js @@ -370,7 +370,7 @@ var tree = { $("#dialogSearchForm").dialog({ "modal": true, - "height": 62, + "height": 80, "width": 260, "title": config.label.search, "okText": config.label.search, diff --git a/static/js/wide.js b/static/js/wide.js index aef5061..1ff2309 100644 --- a/static/js/wide.js +++ b/static/js/wide.js @@ -193,7 +193,7 @@ var wide = { $("#dialogGoFilePrompt").dialog({ "modal": true, - "height": 300, + "height": 320, "width": 660, "title": config.label.goto_file, "okText": config.label.go, diff --git a/views/index.html b/views/index.html index 462f057..f413f79 100644 --- a/views/index.html +++ b/views/index.html @@ -38,7 +38,7 @@