This commit is contained in:
Van 2014-09-26 15:39:13 +08:00
parent a8b6f4d44c
commit 2c9097b5b8
13 changed files with 268 additions and 137 deletions

View File

@ -23,9 +23,11 @@
"D:\\go\\src\\pkg" "D:\\go\\src\\pkg"
], ],
"Files": [ "Files": [
"E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\time\\1.json" "E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\time\\1.json",
"E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\time\\pkg\\time.go",
"E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\time\\main.go"
], ],
"CurrentFile": "E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\time\\1.json" "CurrentFile": "E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\time\\main.go"
} }
} }
] ]

View File

@ -28,7 +28,8 @@
"goget": "go get", "goget": "go get",
"goinstall": "go install", "goinstall": "go install",
"build_n_run": "构建 & 运行", "build_n_run": "构建 & 运行",
"full_screen": "全屏", "max_editor": "编辑器窗口最大化",
"restore_editor": "编辑器窗口还原",
"unread_notification": "未读通知", "unread_notification": "未读通知",
"notification_2": "没有检查到 gocode这将会导致 [自动完成] 失效", "notification_2": "没有检查到 gocode这将会导致 [自动完成] 失效",
"notification_3": "没有检查到 ide_stub这将会导致 [跳转到声明]、[查找使用] 失效", "notification_3": "没有检查到 ide_stub这将会导致 [跳转到声明]、[查找使用] 失效",
@ -42,6 +43,6 @@
"search": "搜索", "search": "搜索",
"notification": "通知", "notification": "通知",
"min": "最小化", "min": "最小化",
"max_side": "左侧窗口最大化", "restore_side": "左侧窗口还原",
"max_bottom": "底部窗口最大化" "restore_bottom": "底部窗口还原"
} }

View File

@ -3,7 +3,7 @@ body {
font-size: 13px; font-size: 13px;
margin: 0; margin: 0;
color: #000; color: #000;
overflow-x: hidden; overflow: hidden;
} }
ul { ul {
@ -72,8 +72,8 @@ ul {
content: "\f0c7"; content: "\f0c7";
} }
.ico-fullscreen:before { .ico-max:before {
content: "\e601"; content: "\f096";
} }
.ico-format:before { .ico-format:before {
@ -88,7 +88,7 @@ ul {
content: "\e608"; content: "\e608";
} }
.ico-max:before { .ico-restore:before {
content: "\e60c"; content: "\e60c";
} }
@ -173,20 +173,6 @@ ul {
position: relative; position: relative;
overflow: hidden; overflow: hidden;
} }
.side {
background-color: #FFF;
width: 20%;
position: absolute;
border-right: 1px solid #9B9B9B;
height: 100%;
z-index: 11;
}
.side-fullscreen {
width: 100%;
z-index: 1000;
}
/* end framework */ /* end framework */
/* start menu */ /* start menu */
@ -260,16 +246,16 @@ ul {
width: 80%; width: 80%;
height: 30%; height: 30%;
top: 70%; top: 70%;
z-index: 11; z-index: 7;
background-color: #fff; background-color: #fff;
} }
.bottom-window-group-fullscreen { .bottom-window-group-max {
height: 100%; height: 100%;
left: 0; left: 0;
top: -1px; top: 0;
width: 100%; width: 100%;
z-index: 1000; z-index: 11;
} }
.bottom-window-group textarea.output { .bottom-window-group textarea.output {

Binary file not shown.

View File

@ -23,5 +23,7 @@
<glyph unicode="&#xe60d;" d="M0 272v-96c0-8.836 7.164-16 16-16h480c8.836 0 16 7.164 16 16v96c0 8.836-7.164 16-16 16h-480c-8.836 0-16-7.164-16-16z" /> <glyph unicode="&#xe60d;" d="M0 272v-96c0-8.836 7.164-16 16-16h480c8.836 0 16 7.164 16 16v96c0 8.836-7.164 16-16 16h-480c-8.836 0-16-7.164-16-16z" />
<glyph unicode="&#xf021;" d="M431.714 178.286q0-1.428-0.286-2-18.286-76.572-76.572-124.143t-136.571-47.572q-41.715 0-80.715 15.714t-69.572 44.857l-36.857-36.857q-5.428-5.428-12.857-5.428t-12.857 5.428-5.428 12.857v128q0 7.428 5.428 12.857t12.857 5.428h128q7.428 0 12.857-5.428t5.429-12.857-5.428-12.857l-39.143-39.143q20.285-18.857 46-29.143t53.429-10.286q38.286 0 71.428 18.572t53.143 51.143q3.143 4.857 15.143 33.428 2.286 6.572 8.572 6.572h54.857q3.714 0 6.428-2.714t2.714-6.428zM438.857 406.857v-128q0-7.428-5.428-12.857t-12.857-5.428h-128q-7.428 0-12.857 5.428t-5.428 12.857 5.428 12.857l39.428 39.428q-42.286 39.143-99.714 39.143-38.286 0-71.428-18.571t-53.143-51.143q-3.143-4.857-15.143-33.429-2.285-6.572-8.572-6.572h-56.857q-3.715 0-6.428 2.714t-2.715 6.428v2q18.572 76.572 77.143 124.143t137.143 47.571q41.714 0 81.143-15.857t70-44.714l37.143 36.857q5.428 5.428 12.857 5.428t12.857-5.428 5.428-12.857z" /> <glyph unicode="&#xf021;" d="M431.714 178.286q0-1.428-0.286-2-18.286-76.572-76.572-124.143t-136.571-47.572q-41.715 0-80.715 15.714t-69.572 44.857l-36.857-36.857q-5.428-5.428-12.857-5.428t-12.857 5.428-5.428 12.857v128q0 7.428 5.428 12.857t12.857 5.428h128q7.428 0 12.857-5.428t5.429-12.857-5.428-12.857l-39.143-39.143q20.285-18.857 46-29.143t53.429-10.286q38.286 0 71.428 18.572t53.143 51.143q3.143 4.857 15.143 33.428 2.286 6.572 8.572 6.572h54.857q3.714 0 6.428-2.714t2.714-6.428zM438.857 406.857v-128q0-7.428-5.428-12.857t-12.857-5.428h-128q-7.428 0-12.857 5.428t-5.428 12.857 5.428 12.857l39.428 39.428q-42.286 39.143-99.714 39.143-38.286 0-71.428-18.571t-53.143-51.143q-3.143-4.857-15.143-33.429-2.285-6.572-8.572-6.572h-56.857q-3.715 0-6.428 2.714t-2.715 6.428v2q18.572 76.572 77.143 124.143t137.143 47.571q41.714 0 81.143-15.857t70-44.714l37.143 36.857q5.428 5.428 12.857 5.428t12.857-5.428 5.428-12.857z" />
<glyph unicode="&#xf05b;" d="M342 187.428h-31.143q-7.428 0-12.857 5.428t-5.428 12.857v36.572q0 7.428 5.428 12.857t12.857 5.429h31.143q-9.143 30.857-32.143 53.857t-53.857 32.143v-31.143q0-7.429-5.429-12.857t-12.857-5.428h-36.571q-7.428 0-12.857 5.428t-5.429 12.857v31.143q-30.857-9.143-53.857-32.143t-32.143-53.857h31.143q7.429 0 12.857-5.428t5.428-12.857v-36.571q0-7.428-5.428-12.857t-12.857-5.428h-31.143q9.143-30.857 32.143-53.857t53.857-32.143v31.143q0 7.428 5.428 12.857t12.857 5.428h36.571q7.428 0 12.857-5.428t5.429-12.857v-31.143q30.857 9.143 53.857 32.143t32.143 53.857zM438.857 242.286v-36.572q0-7.428-5.428-12.857t-12.857-5.428h-40.857q-10.572-46-44.143-79.572t-79.572-44.143v-40.857q0-7.428-5.428-12.857t-12.857-5.428h-36.571q-7.428 0-12.857 5.428t-5.429 12.857v40.857q-46 10.572-79.572 44.143t-44.143 79.572h-40.857q-7.428 0-12.857 5.428t-5.428 12.857v36.572q0 7.428 5.428 12.857t12.857 5.429h40.857q10.572 46 44.143 79.572t79.572 44.143v40.857q0 7.428 5.428 12.857t12.857 5.428h36.571q7.428 0 12.857-5.428t5.429-12.857v-40.857q46-10.571 79.572-44.143t44.143-79.572h40.857q7.428 0 12.857-5.428t5.428-12.857z" /> <glyph unicode="&#xf05b;" d="M342 187.428h-31.143q-7.428 0-12.857 5.428t-5.428 12.857v36.572q0 7.428 5.428 12.857t12.857 5.429h31.143q-9.143 30.857-32.143 53.857t-53.857 32.143v-31.143q0-7.429-5.429-12.857t-12.857-5.428h-36.571q-7.428 0-12.857 5.428t-5.429 12.857v31.143q-30.857-9.143-53.857-32.143t-32.143-53.857h31.143q7.429 0 12.857-5.428t5.428-12.857v-36.571q0-7.428-5.428-12.857t-12.857-5.428h-31.143q9.143-30.857 32.143-53.857t53.857-32.143v31.143q0 7.428 5.428 12.857t12.857 5.428h36.571q7.428 0 12.857-5.428t5.429-12.857v-31.143q30.857 9.143 53.857 32.143t32.143 53.857zM438.857 242.286v-36.572q0-7.428-5.428-12.857t-12.857-5.428h-40.857q-10.572-46-44.143-79.572t-79.572-44.143v-40.857q0-7.428-5.428-12.857t-12.857-5.428h-36.571q-7.428 0-12.857 5.428t-5.429 12.857v40.857q-46 10.572-79.572 44.143t-44.143 79.572h-40.857q-7.428 0-12.857 5.428t-5.428 12.857v36.572q0 7.428 5.428 12.857t12.857 5.429h40.857q10.572 46 44.143 79.572t79.572 44.143v40.857q0 7.428 5.428 12.857t12.857 5.428h36.571q7.428 0 12.857-5.428t5.429-12.857v-40.857q46-10.571 79.572-44.143t44.143-79.572h40.857q7.428 0 12.857-5.428t5.428-12.857z" />
<glyph unicode="&#xf096;" d="M320 390.857h-237.714q-18.857 0-32.285-13.428t-13.428-32.285v-237.715q0-18.857 13.428-32.286t32.285-13.428h237.714q18.857 0 32.286 13.428t13.428 32.286v237.714q0 18.857-13.428 32.286t-32.286 13.428zM402.286 345.143v-237.715q0-34-24.143-58.143t-58.143-24.143h-237.714q-34 0-58.143 24.143t-24.143 58.143v237.714q0 34 24.143 58.143t58.143 24.143h237.714q34 0 58.143-24.143t24.143-58.143z" horiz-adv-x="403" />
<glyph unicode="&#xf0c7;" d="M109.715 41.143h219.429v109.714h-219.429v-109.714zM365.714 41.143h36.572v256q0 4-2.857 11t-5.714 9.857l-80.286 80.285q-2.857 2.857-9.714 5.715t-11.143 2.857v-118.857q0-11.429-8-19.429t-19.428-8h-164.571q-11.428 0-19.428 8t-8 19.428v118.857h-36.572v-365.715h36.572v118.857q0 11.428 8 19.428t19.428 8h237.715q11.428 0 19.428-8t8-19.428v-118.857zM256 306.286v91.428q0 3.714-2.714 6.429t-6.428 2.714h-54.857q-3.714 0-6.429-2.714t-2.714-6.429v-91.428q0-3.714 2.714-6.428t6.428-2.714h54.857q3.714 0 6.429 2.714t2.714 6.428zM438.857 297.143v-265.143q0-11.428-8-19.428t-19.428-8h-384q-11.428 0-19.428 8t-8 19.428v384q0 11.428 8 19.428t19.428 8h265.143q11.428 0 25.143-5.714t21.714-13.714l80-80q8-8 13.714-21.714t5.714-25.143z" /> <glyph unicode="&#xf0c7;" d="M109.715 41.143h219.429v109.714h-219.429v-109.714zM365.714 41.143h36.572v256q0 4-2.857 11t-5.714 9.857l-80.286 80.285q-2.857 2.857-9.714 5.715t-11.143 2.857v-118.857q0-11.429-8-19.429t-19.428-8h-164.571q-11.428 0-19.428 8t-8 19.428v118.857h-36.572v-365.715h36.572v118.857q0 11.428 8 19.428t19.428 8h237.715q11.428 0 19.428-8t8-19.428v-118.857zM256 306.286v91.428q0 3.714-2.714 6.429t-6.428 2.714h-54.857q-3.714 0-6.429-2.714t-2.714-6.429v-91.428q0-3.714 2.714-6.428t6.428-2.714h54.857q3.714 0 6.429 2.714t2.714 6.428zM438.857 297.143v-265.143q0-11.428-8-19.428t-19.428-8h-384q-11.428 0-19.428 8t-8 19.428v384q0 11.428 8 19.428t19.428 8h265.143q11.428 0 25.143-5.714t21.714-13.714l80-80q8-8 13.714-21.714t5.714-25.143z" />
<glyph unicode="&#xf0e5;" d="M256 370.286q-58.286 0-109-19.857t-80.572-53.572-29.857-72.857q0-32 20.428-61t57.572-50.143l24.857-14.286-7.714-27.428q-6.857-26-20-49.143 43.428 18 78.572 48.857l12.286 10.857 16.286-1.714q19.714-2.286 37.143-2.286 58.285 0 109 19.857t80.572 53.572 29.857 72.857-29.857 72.857-80.572 53.572-109 19.857zM512 224q0-49.714-34.286-91.857t-93.143-66.572-128.572-24.428q-20 0-41.428 2.286-56.572-50-131.429-69.143-14-4-32.572-6.286h-1.428q-4.285 0-7.715 3t-4.572 7.857v0.286q-0.857 1.143-0.143 3.428t0.572 2.857 1.285 2.714l1.715 2.572t2 2.428 2.285 2.572q2 2.286 8.857 9.857t9.857 10.857 8.857 11.286 9.285 14.572 7.715 16.857 7.428 21.714q-44.857 25.428-70.715 62.857t-25.857 80.286q0 49.714 34.285 91.857t93.143 66.571 128.571 24.429 128.571-24.429 93.143-66.571 34.286-91.857z" />
</font></defs></svg> </font></defs></svg>

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Binary file not shown.

View File

@ -1,4 +1,18 @@
/* start side */ /* start side */
.side {
background-color: #FFF;
width: 20%;
position: absolute;
border-right: 1px solid #9B9B9B;
height: 100%;
z-index: 8;
}
.side-max {
width: 100%;
z-index: 11;
}
.side .tabs-panel { .side .tabs-panel {
overflow: auto; overflow: auto;
} }

View File

@ -58,13 +58,19 @@ var editors = {
}); });
$(".edit-panel .tabs").on("dblclick", "div", function () { $(".edit-panel .tabs").on("dblclick", function () {
editors.fullscreen(); if ($(".toolbars .ico-max").length === 1) {
windows.maxEditor();
} else {
windows.restoreEditor();
}
}); });
}, },
fullscreen: function () { getCurrentId: function () {
wide.curEditor.setOption("fullScreen", true); return $(".edit-panel .tabs .current").data("index");
wide.curEditor.focus(); },
getCurrentPath: function () {
return $(".edit-panel .tabs .current span:eq(0)").attr("title");
}, },
_initAutocomplete: function () { _initAutocomplete: function () {
CodeMirror.registerHelper("hint", "go", function (editor) { CodeMirror.registerHelper("hint", "go", function (editor) {
@ -251,14 +257,6 @@ var editors = {
extraKeys: { extraKeys: {
"Ctrl-\\": "autocompleteAnyWord", "Ctrl-\\": "autocompleteAnyWord",
".": "autocompleteAfterDot", ".": "autocompleteAfterDot",
"Esc": function (cm) {
if (cm.getOption("fullScreen")) {
cm.setOption("fullScreen", false);
}
},
"F11": function (cm) {
cm.setOption("fullScreen", !cm.getOption("fullScreen"));
},
"Ctrl-G": "gotoLine", "Ctrl-G": "gotoLine",
"Ctrl-E": "deleteLine", "Ctrl-E": "deleteLine",
"Ctrl-D": "doNothing", // 取消默认的 deleteLine "Ctrl-D": "doNothing", // 取消默认的 deleteLine
@ -283,6 +281,10 @@ var editors = {
// TODO: 关闭 tab 的时候要重置 // TODO: 关闭 tab 的时候要重置
}); });
editor.on('focus', function (cm) {
windows.clearSideBottom();
});
editor.setSize('100%', $(".edit-panel").height() - $(".edit-panel .tabs").height()); editor.setSize('100%', $(".edit-panel").height() - $(".edit-panel .tabs").height());
editor.setValue(data.content); editor.setValue(data.content);
editor.setOption("mode", data.mode); editor.setOption("mode", data.mode);
@ -306,5 +308,3 @@ var editors = {
}); });
} }
}; };
editors.init();

View File

@ -192,6 +192,14 @@ var hotkeys = {
if (event.ctrlKey === hotKeys.goFileTree.ctrlKey if (event.ctrlKey === hotKeys.goFileTree.ctrlKey
&& event.which === hotKeys.goFileTree.which) { // Ctrl+1 焦点切换到文件树 && event.which === hotKeys.goFileTree.which) { // Ctrl+1 焦点切换到文件树
// 有些元素需设置 tabindex 为 -1 时才可以 focus // 有些元素需设置 tabindex 为 -1 时才可以 focus
if (windows.isEditorMax()) {
// 编辑器全屏
$(".bottom-window-group").css("top", "100%");
$(".side").css({
"left": "0"
});
}
$("#files").focus(); $("#files").focus();
event.preventDefault(); event.preventDefault();
@ -201,6 +209,8 @@ var hotkeys = {
if (event.ctrlKey === hotKeys.goOutPut.ctrlKey if (event.ctrlKey === hotKeys.goOutPut.ctrlKey
&& event.which === hotKeys.goOutPut.which) { // Ctrl+4 焦点切换到输出窗口 && event.which === hotKeys.goOutPut.which) { // Ctrl+4 焦点切换到输出窗口
wide.bottomWindowTab.setCurrent("output"); wide.bottomWindowTab.setCurrent("output");
windows.flowBottom();
$(".bottom-window-group .output").focus(); $(".bottom-window-group .output").focus();
event.preventDefault(); event.preventDefault();
@ -209,6 +219,7 @@ var hotkeys = {
if (event.ctrlKey === hotKeys.goSearch.ctrlKey if (event.ctrlKey === hotKeys.goSearch.ctrlKey
&& event.which === hotKeys.goSearch.which) { // Ctrl+5 焦点切换到搜索窗口 && event.which === hotKeys.goSearch.which) { // Ctrl+5 焦点切换到搜索窗口
wide.bottomWindowTab.setCurrent("search"); wide.bottomWindowTab.setCurrent("search");
windows.flowBottom();
$(".bottom-window-group .search").focus(); $(".bottom-window-group .search").focus();
event.preventDefault(); event.preventDefault();
@ -218,6 +229,7 @@ var hotkeys = {
if (event.ctrlKey === hotKeys.goNotification.ctrlKey if (event.ctrlKey === hotKeys.goNotification.ctrlKey
&& event.which === hotKeys.goNotification.which) { // Ctrl+6 焦点切换到通知窗口 && event.which === hotKeys.goNotification.which) { // Ctrl+6 焦点切换到通知窗口
wide.bottomWindowTab.setCurrent("notification"); wide.bottomWindowTab.setCurrent("notification");
windows.flowBottom();
$(".bottom-window-group .notification").focus(); $(".bottom-window-group .notification").focus();
event.preventDefault(); event.preventDefault();

View File

@ -297,85 +297,6 @@ var wide = {
console.log('[output onerror] ' + e); console.log('[output onerror] ' + e);
}; };
}, },
_initFullscreen: function () {
$(".footer .ico-max:eq(1)").click(function () {
$(".bottom-window-group").animate({
"top": "70%"
}, function () {
$(".edit-panel").css("height", "70%");
var editorDatas = editors.data;
for (var i = 0, ii = editorDatas.length; i < ii; i++) {
editorDatas[i].editor.setSize("100%", $(".edit-panel").height() - $(".edit-panel .tabs").height());
}
$(".footer .ico-max:eq(1)").hide();
});
});
$(".bottom-window-group .ico-min").click(function () {
$(".edit-panel").css("height", "100%");
var editorDatas = editors.data;
for (var i = 0, ii = editorDatas.length; i < ii; i++) {
editorDatas[i].editor.setSize("100%", $(".content").height() - $(".edit-panel .tabs").height());
}
$(".bottom-window-group").css("top", "100%");
$(".footer .ico-max:eq(1)").show();
});
$(".bottom-window-group .tabs").dblclick(function () {
var $it = $(".bottom-window-group");
if ($it.hasClass("bottom-window-group-fullscreen")) {
$(".bottom-window-group").removeClass("bottom-window-group-fullscreen");
var bottomH = $(".bottom-window-group").height();
$(".bottom-window-group .output, notification").height(bottomH - 24);
$(".bottom-window-group .notification, .bottom-window-group .search").height(bottomH - 20);
} else {
var bottomH = $(".content, .ztree").height();
$(".bottom-window-group .output, notification").height(bottomH - 23);
$(".bottom-window-group .notification, .bottom-window-group .search").height(bottomH - 19);
$(".bottom-window-group").addClass("bottom-window-group-fullscreen");
}
});
$(".footer .ico-max:eq(0)").click(function () {
$(".side").animate({
"left": "0"
}, function () {
$(".edit-panel, .bottom-window-group").css({
"left": "20%",
"width": "80%"
});
$(".footer .ico-max:eq(0)").hide();
});
});
$(".side .ico-min").click(function () {
$(".side").css("left", "-20%");
$(".edit-panel, .bottom-window-group").css({
"left": "0",
"width": "100%"
});
$(".footer .ico-max:eq(0)").show();
});
$(".side .tabs").dblclick(function () {
var $it = $(".side");
if ($it.hasClass("side-fullscreen")) {
$it.removeClass("side-fullscreen");
} else {
$it.addClass("side-fullscreen");
}
});
},
_initFooter: function () { _initFooter: function () {
$(".footer .cursor").dblclick(function () { $(".footer .cursor").dblclick(function () {
$("#dialogGoLinePrompt").dialog("open"); $("#dialogGoLinePrompt").dialog("open");
@ -384,8 +305,6 @@ var wide = {
init: function () { init: function () {
this._initFooter(); this._initFooter();
this._initFullscreen();
this._initWS(); this._initWS();
this._initBottomWindowGroup(); this._initBottomWindowGroup();
@ -412,7 +331,7 @@ var wide = {
}, },
_save: function () { _save: function () {
var request = newWideRequest(); var request = newWideRequest();
request.file = $(".edit-panel .tabs .current span:eq(0)").attr("title"); request.file = editors.getCurrentPath();
request.code = wide.curEditor.getValue(); request.code = wide.curEditor.getValue();
$.ajax({ $.ajax({
@ -475,7 +394,7 @@ var wide = {
} }
var request = newWideRequest(); var request = newWideRequest();
request.file = $(".edit-panel .tabs .current span:eq(0)").attr("title"); request.file = editors.getCurrentPath();
request.code = wide.curEditor.getValue(); request.code = wide.curEditor.getValue();
$.ajax({ $.ajax({
@ -494,7 +413,7 @@ var wide = {
}, },
goget: function () { goget: function () {
var request = newWideRequest(); var request = newWideRequest();
request.file = $(".edit-panel .tabs .current span:eq(0)").attr("title"); request.file = editors.getCurrentPath();
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
@ -510,7 +429,7 @@ var wide = {
}, },
goinstall: function () { goinstall: function () {
var request = newWideRequest(); var request = newWideRequest();
request.file = $(".edit-panel .tabs .current span:eq(0)").attr("title"); request.file = editors.getCurrentPath();
request.code = wide.curEditor.getValue(); request.code = wide.curEditor.getValue();
$.ajax({ $.ajax({
@ -526,7 +445,7 @@ var wide = {
}); });
}, },
fmt: function () { fmt: function () {
var path = $(".edit-panel .tabs .current span:eq(0)").attr("title"); var path = editors.getCurrentPath();
var mode = wide.curEditor.getOption("mode"); var mode = wide.curEditor.getOption("mode");
var request = newWideRequest(); var request = newWideRequest();
@ -592,4 +511,6 @@ $(document).ready(function () {
hotkeys.init(); hotkeys.init();
notification.init(); notification.init();
session.init(); session.init();
editors.init();
windows.init();
}); });

188
static/js/windows.js Normal file
View File

@ -0,0 +1,188 @@
var windows = {
init: function () {
$(".footer .ico-restore:eq(1)").click(function () {
windows.restoreBottom();
if ($(".footer .ico-restore:eq(0)").css("display") === "none") {
$(".toolbars .ico-restore").removeClass("ico-restore").addClass("ico-max")
.attr({
"title": config.label.max_editor,
"onclick": "windows.maxEditor()"
});
}
});
$(".bottom-window-group .ico-min").click(function () {
windows.minBottom();
if ($(".footer .ico-restore:eq(0)").css("display") === "inline") {
$(".toolbars .ico-max").removeClass("ico-max").addClass("ico-restore")
.attr({
"title": config.label.restore_editor,
"onclick": "windows.restoreEditor()"
});
}
});
$(".bottom-window-group .tabs").dblclick(function () {
windows.maxBottom();
});
$(".footer .ico-restore:eq(0)").click(function () {
windows.restoreSide();
if ($(".footer .ico-restore:eq(1)").css("display") === "none") {
$(".toolbars .ico-restore").removeClass("ico-restore").addClass("ico-max")
.attr({
"title": config.label.max_editor,
"onclick": "windows.maxEditor()"
});
}
});
$(".side .ico-min").click(function () {
windows.minSide();
if ($(".footer .ico-restore:eq(1)").css("display") === "inline") {
$(".toolbars .ico-max").removeClass("ico-max").addClass("ico-restore")
.attr({
"title": config.label.restore_editor,
"onclick": "windows.restoreEditor()"
});
}
});
$(".side .tabs").dblclick(function () {
windows.maxSide();
});
$(window).click(function (event) {
if ($(event.target).closest(".footer").length === 1
|| $(event.target).closest(".bottom-window-group").length === 1) {
return false;
}
windows.clearSideBottom();
});
},
maxBottom: function () {
var $it = $(".bottom-window-group");
if ($it.hasClass("bottom-window-group-max")) {
windows.restoreBottom();
if ($(".side").css("left") !== "0px") {
$it.css({
"left": "0px",
"width": "100%"
});
}
} else {
$it.attr("style", "");
var bottomH = $(".content").height();
$(".bottom-window-group .output, notification").height(bottomH - 23);
$(".bottom-window-group .notification, .bottom-window-group .search").height(bottomH - 19);
$it.addClass("bottom-window-group-max");
}
},
maxSide: function () {
var $it = $(".side");
if ($it.hasClass("side-max")) {
windows.restoreSide();
} else {
$it.addClass("side-max");
}
},
restoreBottom: function () {
$(".bottom-window-group").removeClass("bottom-window-group-max");
var bottomH = $(".bottom-window-group").height();
$(".bottom-window-group .output, notification").height(bottomH - 24);
$(".bottom-window-group .notification, .bottom-window-group .search").height(bottomH - 20);
$(".bottom-window-group").animate({
"top": "70%"
}, function () {
$(".edit-panel").css("height", "70%");
var editorDatas = editors.data;
for (var i = 0, ii = editorDatas.length; i < ii; i++) {
editorDatas[i].editor.setSize("100%", $(".edit-panel").height() - $(".edit-panel .tabs").height());
}
$(".footer .ico-restore:eq(1)").hide();
});
},
restoreSide: function () {
$(".side").animate({
"left": "0"
}, function () {
$(".edit-panel, .bottom-window-group").css({
"left": "20%",
"width": "80%"
});
$(".footer .ico-restore:eq(0)").hide();
}).removeClass("side-max");
},
minBottom: function () {
$(".edit-panel").css("height", "100%");
var editorDatas = editors.data;
for (var i = 0, ii = editorDatas.length; i < ii; i++) {
editorDatas[i].editor.setSize("100%", $(".content").height() - $(".edit-panel .tabs").height());
}
$(".bottom-window-group").css("top", "100%");
$(".footer .ico-restore:eq(1)").show();
},
minSide: function () {
$(".side").css("left", "-20%").removeClass("side-max");
$(".edit-panel, .bottom-window-group").css({
"left": "0",
"width": "100%"
});
$(".footer .ico-restore:eq(0)").show();
},
maxEditor: function () {
$(".toolbars .ico-max").removeClass("ico-max").addClass("ico-restore")
.attr({
"title": config.label.restore_editor,
"onclick": "windows.restoreEditor()"
});
windows.minBottom();
windows.minSide();
wide.curEditor.focus();
},
restoreEditor: function () {
$(".toolbars .ico-restore").removeClass("ico-restore").addClass("ico-max")
.attr({
"title": config.label.max_editor,
"onclick": "windows.maxEditor()"
});
windows.restoreBottom();
windows.restoreSide();
wide.curEditor.focus();
},
clearSideBottom: function () {
if (!this.isEditorMax()) {
return false;
}
$(".side").css("left", "-20%");
$(".bottom-window-group").css("top", "100%");
},
flowBottom: function () {
if (this.isEditorMax()) {
$(".bottom-window-group").animate({"top": "70%"});
$(".side").css("left", "-20%");
}
},
isEditorMax: function () {
if ($(".toolbars .ico-restore").length === 1
&& $(".footer .ico-restore:eq(0)").css("display") === "inline"
&& $(".footer .ico-restore:eq(1)").css("display") === "inline") {
return true;
}
return false;
}
};

View File

@ -6,7 +6,6 @@
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/js/lib/codemirror-4.5/codemirror.css"> <link rel="stylesheet" href="{{.conf.StaticServer}}/static/js/lib/codemirror-4.5/codemirror.css">
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/js/lib/codemirror-4.5/addon/hint/show-hint.css"> <link rel="stylesheet" href="{{.conf.StaticServer}}/static/js/lib/codemirror-4.5/addon/hint/show-hint.css">
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/js/lib/codemirror-4.5/addon/lint/lint.css"> <link rel="stylesheet" href="{{.conf.StaticServer}}/static/js/lib/codemirror-4.5/addon/lint/lint.css">
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/js/lib/codemirror-4.5/addon/display/fullscreen.css">
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/js/lib/codemirror-4.5/addon/fold/foldgutter.css"> <link rel="stylesheet" href="{{.conf.StaticServer}}/static/js/lib/codemirror-4.5/addon/fold/foldgutter.css">
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/js/lib/codemirror-4.5/theme/lesser-dark.css"> <link rel="stylesheet" href="{{.conf.StaticServer}}/static/js/lib/codemirror-4.5/theme/lesser-dark.css">
@ -131,7 +130,7 @@
<span onclick="wide.run()" class="font-ico ico-buildrun" title="{{.i18n.build_n_run}}"></span> <span onclick="wide.run()" class="font-ico ico-buildrun" title="{{.i18n.build_n_run}}"></span>
<span onclick="wide.saveFile()" title="{{.i18n.save}}" class="font-ico ico-save"></span> <span onclick="wide.saveFile()" title="{{.i18n.save}}" class="font-ico ico-save"></span>
<span onclick="wide.fmt()" class="ico-format font-ico" title="{{.i18n.format}}"></span> <span onclick="wide.fmt()" class="ico-format font-ico" title="{{.i18n.format}}"></span>
<span class="font-ico ico-fullscreen" onclick="editors.fullscreen()" title="{{.i18n.full_screen}}"></span> <span class="font-ico ico-max" onclick="windows.maxEditor()" title="{{.i18n.max_editor}}"></span>
</div> </div>
<div class="tabs"></div> <div class="tabs"></div>
<div class="tabs-panel"></div> <div class="tabs-panel"></div>
@ -165,11 +164,15 @@
</div> </div>
<div class="footer fn-clear"> <div class="footer fn-clear">
<span title="{{.i18n.max_side}}" class="font-ico ico-max fn-none"></span> <div class="fn-left">
<span title="{{.i18n.max_bottom}}" class="font-ico ico-max fn-none"></span> <span title="{{.i18n.restore_side}}" class="font-ico ico-restore fn-none"></span>
<span class="cursor fn-right"></span> <span title="{{.i18n.resotre_bottom}}" class="font-ico ico-restore fn-none"></span>
</div>
<div class="fn-right">
<span class="cursor"></span>
<span class="notification-count" title="{{.i18n.unread_notification}}">{{.i18n.notification}}!</span> <span class="notification-count" title="{{.i18n.unread_notification}}">{{.i18n.notification}}!</span>
</div> </div>
</div>
<div id="dialogRemoveConfirm"> <div id="dialogRemoveConfirm">
{{.i18n.isDelete}} <b></b>? {{.i18n.isDelete}} <b></b>?
@ -188,6 +191,8 @@
var config = { var config = {
"latestSessionContent": {{.latestSessionContent}}, "latestSessionContent": {{.latestSessionContent}},
"label": { "label": {
"restore_editor": "{{.i18n.restore_editor}}",
"max_editor": "{{.i18n.max_editor}}",
"delete": "{{.i18n.delete}}", "delete": "{{.i18n.delete}}",
"cancel": "{{.i18n.cancel}}", "cancel": "{{.i18n.cancel}}",
"input_no_empty": "{{.i18n.input_no_empty}}", "input_no_empty": "{{.i18n.input_no_empty}}",
@ -228,7 +233,6 @@
<script type="text/javascript" src="{{.conf.StaticServer}}/static/js/lib/codemirror-4.5/addon/selection/active-line.js"></script> <script type="text/javascript" src="{{.conf.StaticServer}}/static/js/lib/codemirror-4.5/addon/selection/active-line.js"></script>
<script type="text/javascript" src="{{.conf.StaticServer}}/static/js/lib/codemirror-4.5/addon/hint/show-hint.js"></script> <script type="text/javascript" src="{{.conf.StaticServer}}/static/js/lib/codemirror-4.5/addon/hint/show-hint.js"></script>
<script type="text/javascript" src="{{.conf.StaticServer}}/static/js/lib/codemirror-4.5/addon/hint/anyword-hint.js"></script> <script type="text/javascript" src="{{.conf.StaticServer}}/static/js/lib/codemirror-4.5/addon/hint/anyword-hint.js"></script>
<script type="text/javascript" src="{{.conf.StaticServer}}/static/js/lib/codemirror-4.5/addon/display/fullscreen.js"></script>
<script type="text/javascript" src="{{.conf.StaticServer}}/static/js/lib/codemirror-4.5/addon/display/rulers.js"></script> <script type="text/javascript" src="{{.conf.StaticServer}}/static/js/lib/codemirror-4.5/addon/display/rulers.js"></script>
<script type="text/javascript" src="{{.conf.StaticServer}}/static/js/lib/codemirror-4.5/addon/edit/closebrackets.js"></script> <script type="text/javascript" src="{{.conf.StaticServer}}/static/js/lib/codemirror-4.5/addon/edit/closebrackets.js"></script>
<script type="text/javascript" src="{{.conf.StaticServer}}/static/js/lib/codemirror-4.5/addon/edit/matchbrackets.js"></script> <script type="text/javascript" src="{{.conf.StaticServer}}/static/js/lib/codemirror-4.5/addon/edit/matchbrackets.js"></script>
@ -260,6 +264,7 @@
<script type="text/javascript" src="{{.conf.StaticServer}}/static/js/wide.js?{{.conf.StaticResourceVersion}}"></script> <script type="text/javascript" src="{{.conf.StaticServer}}/static/js/wide.js?{{.conf.StaticResourceVersion}}"></script>
<script type="text/javascript" src="{{.conf.StaticServer}}/static/js/session.js?{{.conf.StaticResourceVersion}}"></script> <script type="text/javascript" src="{{.conf.StaticServer}}/static/js/session.js?{{.conf.StaticResourceVersion}}"></script>
<script type="text/javascript" src="{{.conf.StaticServer}}/static/js/menu.js?{{.conf.StaticResourceVersion}}"></script> <script type="text/javascript" src="{{.conf.StaticServer}}/static/js/menu.js?{{.conf.StaticResourceVersion}}"></script>
<script type="text/javascript" src="{{.conf.StaticServer}}/static/js/windows.js?{{.conf.StaticResourceVersion}}"></script>
<script type="text/javascript" src="{{.conf.StaticServer}}/static/js/hotkeys.js?{{.conf.StaticResourceVersion}}"></script> <script type="text/javascript" src="{{.conf.StaticServer}}/static/js/hotkeys.js?{{.conf.StaticResourceVersion}}"></script>
</body> </body>
</html> </html>