弹窗按钮改为不给非空提示了,没有内容,确认按钮直接 disabled

This commit is contained in:
Van 2014-10-13 11:43:22 +08:00
parent cc173af277
commit 68eb5a1bc3
4 changed files with 54 additions and 32 deletions

View File

@ -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": "关键字"
}

View File

@ -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;
}

View File

@ -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();

View File

@ -189,17 +189,17 @@
</div>
<div id="dialogAlert" class="fn-none"></div>
<div id="dialogNewFilePrompt" class="dialog-prompt fn-none">
<input/><span class="tip"></span>
<input/>
</div>
<div id="dialogNewDirPrompt" class="dialog-prompt fn-none">
<input/><span class="tip"></span>
<input/>
</div>
<div id="dialogGoLinePrompt" class="dialog-prompt fn-none">
<input/><span class="tip"></span>
<input/>
</div>
<div id="dialogSearchForm" class="dialog-prompt fn-none">
<input/>
<input/>
<div id="dialogSearchForm" class="dialog-form fn-none">
<input placeholder="{{.i18n.keyword}}" />
<input placeholder="{{.i18n.file_format}}" />
</div>
<script>
var config = {
@ -209,7 +209,6 @@
"max_editor": "{{.i18n.max_editor}}",
"delete": "{{.i18n.delete}}",
"cancel": "{{.i18n.cancel}}",
"input_no_empty": "{{.i18n.input_no_empty}}",
"goto_line": "{{.i18n.goto_line}}",
"goto": "{{.i18n.goto}}",
"create": "{{.i18n.create}}",