diff --git a/i18n/en_US.json b/i18n/en_US.json index 1245a42..43a5083 100644 --- a/i18n/en_US.json +++ b/i18n/en_US.json @@ -115,5 +115,7 @@ "sing_up_error": "Sign Up Error", "user_name_ruler": "Username only by az, AZ, 0-9, _ consisting of a length of 16", "password_no_match": "Password doesn't match the confirmation", - "discard": "Discard" + "discard": "Discard", + "close": "Close", + "close_other": "Close Other" } \ No newline at end of file diff --git a/i18n/ja_JP.json b/i18n/ja_JP.json index d73a439..3c6318c 100644 --- a/i18n/ja_JP.json +++ b/i18n/ja_JP.json @@ -115,5 +115,7 @@ "sing_up_error": "登録に失敗しました", "user_name_ruler": "16の長さからなる_ AZ、AZ、0-9、によってユーザ名のみ", "password_no_match": "一貫性のないパスワード入力", - "discard": "あきらめる" + "discard": "あきらめる", + "close": "クローズ", + "close_other": "閉じるその他" } diff --git a/i18n/zh_CN.json b/i18n/zh_CN.json index 38d8064..b0f23a0 100644 --- a/i18n/zh_CN.json +++ b/i18n/zh_CN.json @@ -115,5 +115,7 @@ "sing_up_error": "注册失败", "user_name_ruler": "用户名只能由 a-z, A-Z, 0-9, _ 组成,长度为16", "password_no_match": "密码输入不一致", - "discard": "放弃" + "discard": "放弃", + "close": "关闭", + "close_other": "关闭其它" } \ No newline at end of file diff --git a/i18n/zh_TW.json b/i18n/zh_TW.json index f871650..0530a94 100644 --- a/i18n/zh_TW.json +++ b/i18n/zh_TW.json @@ -115,5 +115,7 @@ "sing_up_error": "註冊失敗", "user_name_ruler": "用戶名只能由az, AZ, 0-9, _ 組成,長度為16", "password_no_match": "密碼輸入不一致", - "discard": "放棄" + "discard": "放棄", + "close": "關閉", + "close_other": "關閉其它" } \ No newline at end of file diff --git a/static/js/editors.js b/static/js/editors.js index 7e62829..72159c8 100644 --- a/static/js/editors.js +++ b/static/js/editors.js @@ -1,6 +1,24 @@ var editors = { data: [], tabs: {}, + close: function () { + $(".edit-panel .tabs > div[data-index=" + $(".edit-panel .frame").data("index") + "]").find(".ico-close").click(); + }, + closeOther: function () { + var currentIndex = $(".edit-panel .frame").data("index"); + + // 设置全部关闭标识 + var removeData = []; + $(".edit-panel .tabs > div").each(function (i) { + if (currentIndex !== $(this).data("index")) { + removeData.push($(this).data("index")); + } + }); + var firstIndex = removeData.splice(0, 1); + $("#dialogCloseEditor").data("removeData", removeData); + // 开始关闭 + $(".edit-panel .tabs > div[data-index=" + firstIndex + "]").find(".ico-close").click(); + }, _removeAllMarker: function () { var removeData = $("#dialogCloseEditor").data("removeData"); if (removeData && removeData.length > 0) { @@ -9,6 +27,28 @@ var editors = { $(".edit-panel .tabs > div[data-index=" + removeIndex + "] .ico-close").click(); } }, + _initClose: function () { + // 关闭、关闭其他、关闭所有 + $(".edit-panel").on("mousedown", '.tabs > div', function (event) { + event.stopPropagation(); + + if (event.button === 0) { // 左键 + $(".edit-panel .frame").hide(); + return false; + } + + // event.button === 2 右键 + var left = event.screenX; + if ($(".side").css("left") === "auto" || $(".side").css("left") === "0px") { + left = event.screenX - $(".side").width(); + } + $(".edit-panel .frame").show().css({ + "left": left + "px", + "top": "21px" + }).data('index', $(this).data("index")); + return false; + }); + }, init: function () { $("#dialogCloseEditor").dialog({ "modal": true, @@ -152,6 +192,7 @@ var editors = { this._initCodeMirrorHotKeys(); this.openStartPage(); + this._initClose(); }, openStartPage: function () { var dateFormat = function (time, fmt) { @@ -467,11 +508,11 @@ var editors = { tId = tree.getTIdByPath($it.attr("title")); tree.openFile(tree.fileTree.getNodeByTId(tId)); tree.fileTree.selectNode(wide.curNode); - + var oldLine = wide.curEditor.getCursor().line; var line = $it.find(".position").data("line") - 1; var cursor = CodeMirror.Pos(line, $it.find(".position").data("ch") - 1); - + wide.curEditor.setCursor(cursor); var half = Math.floor(wide.curEditor.getScrollInfo().clientHeight / wide.curEditor.defaultTextHeight() / 2); diff --git a/static/js/wide.js b/static/js/wide.js index 7789805..aec03cd 100644 --- a/static/js/wide.js +++ b/static/js/wide.js @@ -210,10 +210,10 @@ var wide = { $("#dialogGoLinePrompt").dialog("close"); var editor = wide.curEditor; var oldLine = editor.getCursor().line + 1; - + if (oldLine === line) { editor.focus(); - + return; } diff --git a/views/index.html b/views/index.html index 5254633..af00a81 100644 --- a/views/index.html +++ b/views/index.html @@ -154,6 +154,19 @@ +
+ +