This commit is contained in:
Van 2014-09-24 11:35:03 +08:00
parent 790a3116e5
commit 6730017aec
8 changed files with 68 additions and 57 deletions

View File

@ -34,5 +34,7 @@
"notification_3": "没有检查到 ide_stub这将会导致 [跳转到声明]、[查找使用] 失效", "notification_3": "没有检查到 ide_stub这将会导致 [跳转到声明]、[查找使用] 失效",
"goto_line": "跳转到行", "goto_line": "跳转到行",
"goto": "跳转", "goto": "跳转",
"input_no_empty": "输入不能为空" "input_no_empty": "输入不能为空",
"tip": "提示",
"confirm": "确定"
} }

View File

@ -74,6 +74,19 @@ ul {
.icon-buildrun:before { .icon-buildrun:before {
content: "\e607"; content: "\e607";
} }
.ico-close {
color: #666;
}
.ico-close:hover {
color: #333;
}
.ico-close:before {
content: "\e60a";
cursor: pointer;
}
/* end reset & function */ /* end reset & function */
/* start frame */ /* start frame */
@ -133,20 +146,6 @@ ul {
.tabs > div.current { .tabs > div.current {
background-color: #F7F7F7; background-color: #F7F7F7;
} }
.tabs .ico-close {
color: #666;
}
.tabs .ico-close:hover {
color: #333;
}
.tabs .ico-close:before {
content: "\e60a";
cursor: pointer;
}
/* end tabs */ /* end tabs */
/* start framework */ /* start framework */

View File

@ -43,16 +43,9 @@
} }
.dialog-close-icon { .dialog-close-icon {
background-position: -15px 0;
cursor: pointer;
float: right; float: right;
height: 18px; margin: 3px;
margin: 5px 3px 0 0; text-decoration: none;
width: 18px;
}
.dialog-close-icon:hover {
background-position: -15px -18px;
} }
.dialog-main { .dialog-main {
@ -71,7 +64,8 @@
} }
#dialogRemoveConfirm, #dialogRemoveConfirm,
.dialog-prompt { .dialog-prompt,
#dialogAlert {
padding: 10px 20px 0; padding: 10px 20px 0;
overflow: hidden; overflow: hidden;
} }

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
(function($) { (function ($) {
$.fn.extend({ $.fn.extend({
dialog: { dialog: {
version: "0.0.1.7", version: "0.0.1.7",
@ -24,7 +24,7 @@
var dpuuid = new Date().getTime(); var dpuuid = new Date().getTime();
var PROP_NAME = 'dialog'; var PROP_NAME = 'dialog';
var Dialog = function() { var Dialog = function () {
this._defaults = { this._defaults = {
"styleClass": { "styleClass": {
"background": "dialog-background", "background": "dialog-background",
@ -41,7 +41,7 @@
}; };
$.extend(Dialog.prototype, { $.extend(Dialog.prototype, {
_attach: function(target, settings) { _attach: function (target, settings) {
if (!target.id) { if (!target.id) {
this.uuid++; this.uuid++;
target.id = 'dp' + this.uuid; target.id = 'dp' + this.uuid;
@ -53,21 +53,21 @@
this._init(target); this._init(target);
}, },
/* Create a new instance object. */ /* Create a new instance object. */
_newInst: function(target) { _newInst: function (target) {
// escape jQuery meta chars // escape jQuery meta chars
var id = target[0].id.replace(/([^A-Za-z0-9_])/g, '\\\\$1'); var id = target[0].id.replace(/([^A-Za-z0-9_])/g, '\\\\$1');
return { return {
id: id id: id
}; };
}, },
_getInst: function(target) { _getInst: function (target) {
try { try {
return $.data(target, PROP_NAME); return $.data(target, PROP_NAME);
} catch (err) { } catch (err) {
throw 'Missing instance data for this dialog'; throw 'Missing instance data for this dialog';
} }
}, },
_destroyDialog: function(target) { _destroyDialog: function (target) {
var inst = $.dialog._getInst(target); var inst = $.dialog._getInst(target);
var id = inst.id; var id = inst.id;
$.removeData(target, PROP_NAME); $.removeData(target, PROP_NAME);
@ -79,7 +79,7 @@
$("." + styleClass.background).remove(); $("." + styleClass.background).remove();
$("#" + id + "Dialog").remove(); $("#" + id + "Dialog").remove();
}, },
_init: function(target) { _init: function (target) {
var inst = this._getInst(target); var inst = this._getInst(target);
var id = inst.id, var id = inst.id,
settings = inst.settings; settings = inst.settings;
@ -99,13 +99,16 @@
headerHTML = "<div class='" headerHTML = "<div class='"
+ styleClass.headerBg + "'><div class='" + styleClass.headerBg + "'><div class='"
+ styleClass.title + "'>" + styleClass.title + "'>"
+ settings.title + "</div><a href='javascript:void(0);' class='" + settings.title + "</div><a href='javascript:void(0);' class='ico-close font-ico "
+ styleClass.closeIcon + "'></a></div>"; + styleClass.closeIcon + "'></a></div>";
// Sets footerHTML. // Sets footerHTML.
if (!settings.hideFooter) { if (!settings.hideFooter) {
footerHTML = "<button>" + settings.okText + if (!settings.hiddenOk) {
"</button><button>" footerHTML = "<button>" + settings.okText +
"</button>";
}
footerHTML += "<button>"
+ settings.cancelText + "</button>"; + settings.cancelText + "</button>";
} }
@ -147,16 +150,16 @@
}); });
// Bind event. // Bind event.
$("#" + id + "Dialog ." + styleClass.closeIcon).bind("click", function() { $("#" + id + "Dialog ." + styleClass.closeIcon).bind("click", function () {
$.dialog._close(id, settings); $.dialog._close(id, settings);
}); });
var $buttons = $("#" + id + "Dialog ." + styleClass.footer + " button"); var $buttons = $("#" + id + "Dialog ." + styleClass.footer + " button");
$($buttons.get(1)).bind("click", function() { $($buttons.get(1)).bind("click", function () {
$.dialog._close(id, settings); $.dialog._close(id, settings);
}); });
$($buttons.get(0)).bind("click", function() { $($buttons.get(0)).bind("click", function () {
if (settings.ok === undefined || settings.ok()) { if (settings.ok === undefined || settings.ok()) {
$.dialog._close(id, settings); $.dialog._close(id, settings);
} }
@ -165,14 +168,14 @@
this._bindMove(id, styleClass.headerBg, dialogH, dialogW); this._bindMove(id, styleClass.headerBg, dialogH, dialogW);
// esc exit // esc exit
$(window).keyup(function(event) { $(window).keyup(function (event) {
if (event.keyCode === 27) { if (event.keyCode === 27) {
$.dialog._close(id, settings); $.dialog._close(id, settings);
} }
}); });
}, },
_bindMove: function(id, className) { _bindMove: function (id, className) {
$("#" + id + "Dialog ." + className).mousedown(function(event) { $("#" + id + "Dialog ." + className).mousedown(function (event) {
var _document = document; var _document = document;
if (!event) { if (!event) {
event = window.event; event = window.event;
@ -190,7 +193,7 @@
window.captureEvents(Event.MOUSEMOVE | Event.MOUSEUP); window.captureEvents(Event.MOUSEMOVE | Event.MOUSEUP);
} }
_document.onmousemove = function(event) { _document.onmousemove = function (event) {
if (!event) { if (!event) {
event = window.event; event = window.event;
} }
@ -212,7 +215,7 @@
dialog.style.top = positionY + "px"; dialog.style.top = positionY + "px";
}; };
_document.onmouseup = function() { _document.onmouseup = function () {
if (this.releaseCapture) { if (this.releaseCapture) {
this.releaseCapture(); this.releaseCapture();
} else if (window.captureEvents) { } else if (window.captureEvents) {
@ -226,7 +229,7 @@
} }
}); });
}, },
_close: function(id, settings) { _close: function (id, settings) {
if ($("#" + id + "Dialog").css("display") === "none") { if ($("#" + id + "Dialog").css("display") === "none") {
return; return;
} }
@ -238,13 +241,13 @@
} }
} }
}, },
_closeDialog: function(target) { _closeDialog: function (target) {
var inst = this._getInst(target); var inst = this._getInst(target);
var id = inst.id, var id = inst.id,
settings = inst.settings; settings = inst.settings;
$.dialog._close(id, settings); $.dialog._close(id, settings);
}, },
_openDialog: function(target) { _openDialog: function (target, msg) {
var inst = this._getInst(target); var inst = this._getInst(target);
var id = inst.id, var id = inst.id,
settings = inst.settings; settings = inst.settings;
@ -257,12 +260,12 @@
} }
$("#" + id + "Dialog .dialog-footer button:eq(0)").focus(); $("#" + id + "Dialog .dialog-footer button:eq(0)").focus();
if (typeof settings.afterOpen === "function") { if (typeof settings.afterOpen === "function") {
settings.afterOpen(); settings.afterOpen(msg);
} }
}, },
_updateDialog: function(target, data) { _updateDialog: function (target, data) {
var inst = this._getInst(target); var inst = this._getInst(target);
var id = inst.id, var id = inst.id,
settings = inst.settings; settings = inst.settings;
@ -273,7 +276,7 @@
$dialog.css({ $dialog.css({
"top": data.position.top, "top": data.position.top,
"left": data.position.left "left": data.position.left
}) });
} }
if (data.width) { if (data.width) {
@ -307,7 +310,7 @@
} }
}, },
_getDefaults: function(defaults, settings, key) { _getDefaults: function (defaults, settings, key) {
if (key === "styleClass") { if (key === "styleClass") {
if (settings.theme === "default" || settings.theme === undefined) { if (settings.theme === "default" || settings.theme === undefined) {
return defaults.styleClass; return defaults.styleClass;
@ -331,14 +334,14 @@
} }
}); });
$.fn.dialog = function(options) { $.fn.dialog = function (options) {
var otherArgs = Array.prototype.slice.call(arguments); var otherArgs = Array.prototype.slice.call(arguments);
if (typeof options === 'string') { if (typeof options === 'string') {
otherArgs.shift(); otherArgs.shift();
return $.dialog['_' + options + 'Dialog'].apply($.dialog, [this[0]].concat(otherArgs)); return $.dialog['_' + options + 'Dialog'].apply($.dialog, [this[0]].concat(otherArgs));
} }
return this.each(function() { return this.each(function () {
$.dialog._attach(this, options); $.dialog._attach(this, options);
}); });
}; };

View File

@ -123,7 +123,7 @@ var editors = {
}; };
CodeMirror.commands.gotoLine = function (cm) { CodeMirror.commands.gotoLine = function (cm) {
$("#dialogGoLinePrompt").dialog("open"); $("#dialogGoLinePrompt").dialog("open");
}; };
CodeMirror.commands.doNothing = function (cm) { CodeMirror.commands.doNothing = function (cm) {
@ -161,7 +161,7 @@ var editors = {
dataType: "json", dataType: "json",
success: function (data) { success: function (data) {
if (!data.succ) { if (!data.succ) {
alert(data.msg); $("#dialogAlert").dialog("open", data.msg);
return false; return false;
} }

View File

@ -161,7 +161,7 @@ var tree = {
dataType: "json", dataType: "json",
success: function (data) { success: function (data) {
if (!data.succ) { if (!data.succ) {
alert(data.msg); $("#dialogAlert").dialog("open", data.msg);
return false; return false;
} }

View File

@ -67,6 +67,17 @@ var wide = {
curEditor: undefined, curEditor: undefined,
bottomWindowTab: undefined, bottomWindowTab: undefined,
_initDialog: function() { _initDialog: function() {
$("#dialogAlert").dialog({
"height": 26,
"width": 260,
"title": config.label.tip,
"hiddenOk": true,
"cancelText": config.label.confirm,
"afterOpen": function(msg) {
$("#dialogAlert").html(msg);
}
});
$("#dialogRemoveConfirm").dialog({ $("#dialogRemoveConfirm").dialog({
"height": 26, "height": 26,
"width": 260, "width": 260,
@ -115,7 +126,6 @@ var wide = {
} }
}); });
$(".dialog-prompt > input").keydown(function(event) { $(".dialog-prompt > input").keydown(function(event) {
$(".dialog-prompt > .tip").text(''); $(".dialog-prompt > .tip").text('');

View File

@ -172,6 +172,7 @@
<div id="dialogRemoveConfirm"> <div id="dialogRemoveConfirm">
{{.i18n.isDelete}} <b></b>? {{.i18n.isDelete}} <b></b>?
</div> </div>
<div id="dialogAlert"></div>
<div id="dialogNewFilePrompt" class="dialog-prompt"> <div id="dialogNewFilePrompt" class="dialog-prompt">
<input/><span class="tip"></span> <input/><span class="tip"></span>
</div> </div>
@ -193,6 +194,8 @@
"create": "{{.i18n.create}}", "create": "{{.i18n.create}}",
"create_file": "{{.i18n.create_file}}", "create_file": "{{.i18n.create_file}}",
"create_dir": "{{.i18n.create_dir}}", "create_dir": "{{.i18n.create_dir}}",
"tip": "{{.i18n.tip}}",
"confirm": "{{.i18n.confirm}}"
}, },
"channel": { "channel": {
"editor": '{{.conf.EditorChannel}}', "editor": '{{.conf.EditorChannel}}',