diff --git a/i18n/zh_CN.json b/i18n/zh_CN.json index befd78b..6506c7d 100644 --- a/i18n/zh_CN.json +++ b/i18n/zh_CN.json @@ -35,7 +35,6 @@ "notification_3": "没有检查到 ide_stub,这将会导致 [跳转到声明]、[查找使用] 失效", "goto_line": "跳转到行", "goto": "跳转", - "input_no_empty": "输入不能为空", "tip": "提示", "confirm": "确定", "stop": "停止", @@ -46,5 +45,7 @@ "restore_side": "左侧窗口还原", "usages": "查找使用", "search_text": "查找文本", - "restore_bottom": "底部窗口还原" + "restore_bottom": "底部窗口还原", + "file_format": "文件后缀", + "keyword": "关键字" } diff --git a/static/css/dialog.css b/static/css/dialog.css index 97575de..fe44bda 100644 --- a/static/css/dialog.css +++ b/static/css/dialog.css @@ -65,11 +65,13 @@ #dialogRemoveConfirm, .dialog-prompt, +.dialog-form, #dialogAlert { padding: 10px 20px 0; overflow: hidden; } -.dialog-prompt > input { +.dialog-main input { width: 100%; + margin: 2px auto; } \ No newline at end of file diff --git a/static/js/wide.js b/static/js/wide.js index 3435455..9d02b83 100644 --- a/static/js/wide.js +++ b/static/js/wide.js @@ -5,6 +5,20 @@ var wide = { bottomWindowTab: undefined, searchTab: undefined, _initDialog: function () { + $(".dialog-prompt > input").keyup(function (event) { + var $okBtn = $(this).closest(".dialog-main").find(".dialog-footer > button:eq(0)"); + if (event.which === 13 && !$okBtn.prop("disabled")) { + $okBtn.click(); + } + + if ($.trim($(this).val()) === "") { + $okBtn.prop("disabled", true); + } else { + $okBtn.prop("disabled", false); + } + }); + + $("#dialogAlert").dialog({ "height": 26, "width": 260, @@ -64,14 +78,6 @@ var wide = { } }); - $(".dialog-prompt > input").keydown(function (event) { - $(".dialog-prompt > .tip").text(''); - - if (event.which === 13) { - $(this).closest(".dialog-main").find(".dialog-footer > button:eq(0)").click(); - } - }); - $("#dialogNewFilePrompt").dialog({ "height": 52, "width": 260, @@ -80,14 +86,11 @@ var wide = { "cancelText": config.label.cancel, "afterOpen": function () { $("#dialogNewFilePrompt > input").val('').focus(); + $("#dialogNewFilePrompt").closest(".dialog-main").find(".dialog-footer > button:eq(0)").prop("disabled", true); }, "ok": function () { var request = newWideRequest(), name = $("#dialogNewFilePrompt > input").val(); - if ($.trim(name) === "") { - $("#dialogNewFilePrompt > .tip").text(config.label.input_no_empty); - return false; - } request.path = wide.curNode.path + '\\' + name; request.fileType = "f"; @@ -156,14 +159,12 @@ var wide = { "cancelText": config.label.cancel, "afterOpen": function () { $("#dialogNewDirPrompt > input").val('').focus(); + $("#dialogNewDirPrompt").closest(".dialog-main").find(".dialog-footer > button:eq(0)").prop("disabled", true); }, "ok": function () { var name = $("#dialogNewDirPrompt > input").val(), request = newWideRequest(); - if ($.trim(name) === "") { - $("#dialogNewDirPrompt > .tip").text(config.label.input_no_empty); - return false; - } + request.path = wide.curNode.path + '\\' + name; request.fileType = "d"; @@ -197,27 +198,46 @@ var wide = { "cancelText": config.label.cancel, "afterOpen": function () { $("#dialogGoLinePrompt > input").val('').focus(); + $("#dialogGoLinePrompt").closest(".dialog-main").find(".dialog-footer > button:eq(0)").prop("disabled", true); }, "ok": function () { var line = parseInt($("#dialogGoLinePrompt > input").val()); - if ($.trim($("#dialogGoLinePrompt > input").val()) === "") { - $("#dialogGoLinePrompt > .tip").text(config.label.input_no_empty); - return false; - } $("#dialogGoLinePrompt").dialog("close"); wide.curEditor.setCursor(CodeMirror.Pos(line - 1, 0)); wide.curEditor.focus(); } }); + $("#dialogSearchForm > input:eq(0)").keyup(function (event) { + var $okBtn = $(this).closest(".dialog-main").find(".dialog-footer > button:eq(0)"); + if (event.which === 13 && !$okBtn.prop("disabled")) { + $okBtn.click(); + } + + if ($.trim($(this).val()) === "") { + $okBtn.prop("disabled", true); + } else { + $okBtn.prop("disabled", false); + } + }); + + $("#dialogSearchForm > input:eq(1)").keyup(function (event) { + var $okBtn = $(this).closest(".dialog-main").find(".dialog-footer > button:eq(0)"); + if (event.which === 13 && !$okBtn.prop("disabled")) { + $okBtn.click(); + } + }); + $("#dialogSearchForm").dialog({ - "height": 52, + "height": 62, "width": 260, "title": config.label.search, "okText": config.label.search, "cancelText": config.label.cancel, "afterOpen": function () { $("#dialogSearchForm > input:eq(0)").val('').focus(); + $("#dialogSearchForm > input:eq(1)").val(''); + $("#dialogSearchForm").closest(".dialog-main").find(".dialog-footer > button:eq(0)").prop("disabled", true); }, "ok": function () { var request = newWideRequest(); @@ -234,7 +254,7 @@ var wide = { if (!data.succ) { return; } - + $("#dialogSearchForm").dialog("close"); editors.appendSearch(data.founds, 'founds', request.text); } diff --git a/view/index.html b/view/index.html index e7c9b87..cf76690 100644 --- a/view/index.html +++ b/view/index.html @@ -189,17 +189,17 @@
- +
- +
- +
-
- - +
+ +