From a588c3ed5c4af235b60b530fdf37e18b7b438c0a Mon Sep 17 00:00:00 2001 From: Van Date: Thu, 1 Jan 2015 22:15:54 +0800 Subject: [PATCH] outline --- i18n/en_US.json | 5 +- static/css/side.css | 18 +++++- static/css/themes/black.css | 5 ++ static/css/themes/default.css | 5 ++ static/css/wide.css | 2 +- static/js/hotkeys.js | 38 +++++------ static/js/windows.js | 118 ++++++++++++++++++++++++++++++---- views/index.html | 14 ++-- 8 files changed, 161 insertions(+), 44 deletions(-) diff --git a/i18n/en_US.json b/i18n/en_US.json index 1cd0513..db841e7 100644 --- a/i18n/en_US.json +++ b/i18n/en_US.json @@ -56,7 +56,7 @@ "find_previous": "Find Previous", "replace": "Replace", "replace_all": "Replace All", - "restore_bottom": "Bottom Windows Restore", + "restore_bottom": "Restore Bottom Windows", "file_format": "File Extension", "keyword": "Keyword", "user_guide": "User Guide", @@ -166,5 +166,6 @@ "govet": "go vet", "start-vet": "START [go vet]", "vet-succ": "[go vet] SUCCESS", - "vet-error": "[go vet] ERROR" + "vet-error": "[go vet] ERROR", + "restore_outline": "Restore Outline" } \ No newline at end of file diff --git a/static/css/side.css b/static/css/side.css index a8c30a9..0740a61 100644 --- a/static/css/side.css +++ b/static/css/side.css @@ -30,7 +30,23 @@ .side .tabs-panel { overflow: auto; } -/* start side */ +/* end side */ + +/* start side right */ +.side-right { + height: 70%; + position: absolute; + right: 0; + width: 20%; + z-index: 8; +} + +.side-right-max { + width: 100%; + height: 100%; + z-index: 11; +} +/* end side right */ /* start tree */ .ztree { diff --git a/static/css/themes/black.css b/static/css/themes/black.css index b44595b..e8e7414 100644 --- a/static/css/themes/black.css +++ b/static/css/themes/black.css @@ -19,6 +19,11 @@ border-right: 1px solid #000; } +.side-right { + background-color: #303130; + border-left: 1px solid #000; +} + .footer { background-color: #181B1D; border-top: 1px solid #000000; diff --git a/static/css/themes/default.css b/static/css/themes/default.css index 5ff3bb1..dcf7e17 100644 --- a/static/css/themes/default.css +++ b/static/css/themes/default.css @@ -19,6 +19,11 @@ border-right: 1px solid #919191; } +.side-right { + background-color: #FFF; + border-right: 1px solid #919191; +} + .footer { border-top: 1px solid #919191; background-color: #F0F0F0; diff --git a/static/css/wide.css b/static/css/wide.css index f97b3b0..1954191 100644 --- a/static/css/wide.css +++ b/static/css/wide.css @@ -333,7 +333,7 @@ width: 80%; position: absolute; left: 20%; - width: 80%; + width: 60%; height: 70%; overflow: hidden; } diff --git a/static/js/hotkeys.js b/static/js/hotkeys.js index 5c38bd3..5375f0b 100644 --- a/static/js/hotkeys.js +++ b/static/js/hotkeys.js @@ -41,11 +41,6 @@ var hotkeys = { $(".side").css({ "left": "0" }); - - if ($(".footer .ico-restore:eq(1)").css("display") === "inline") { - // 当底部最小化时 - $(".bottom-window-group").css("top", "100%").hide(); - } } $("#files").focus(); @@ -58,22 +53,27 @@ var hotkeys = { shiftKey: false, which: 50, fun: function () { - if (!wide.curEditor) { - return; + if ($(".footer .ico-restore:eq(2)").css("display") === "inline") { + // 当文件树最小化时 + $(".side-right").css({ + "right": "0" + }); } - - var request = newWideRequest(); - request.code = wide.curEditor.getValue(); - $.ajax({ - type: 'POST', - url: config.context + '/outline', - data: JSON.stringify(request), - dataType: "json", - success: function (data) { - console.log(data); - } - }); + $("#outline").focus(); + +// var request = newWideRequest(); +// request.code = wide.curEditor.getValue(); +// +// $.ajax({ +// type: 'POST', +// url: config.context + '/outline', +// data: JSON.stringify(request), +// dataType: "json", +// success: function (data) { +// console.log(data); +// } +// }); } }, // Ctrl-4 diff --git a/static/js/windows.js b/static/js/windows.js index a35edc5..b365cf5 100644 --- a/static/js/windows.js +++ b/static/js/windows.js @@ -17,9 +17,11 @@ var windows = { isMaxEditor: false, init: function () { + // bottom windows $(".footer .ico-restore:eq(1)").click(function () { windows.restoreBottom(); - if ($(".footer .ico-restore:eq(0)").css("display") === "none") { + if ($(".footer .ico-restore:eq(0)").css("display") === "none" + && $(".footer .ico-restore:eq(2)").css("display") === "none") { $(".toolbars .ico-restore").removeClass("ico-restore").addClass("ico-max") .attr({ "title": config.label.max_editor, @@ -30,7 +32,8 @@ var windows = { $(".bottom-window-group .ico-min").click(function () { windows.minBottom(); - if ($(".footer .ico-restore:eq(0)").css("display") === "inline") { + if ($(".footer .ico-restore:eq(0)").css("display") === "inline" + && $(".footer .ico-restore:eq(2)").css("display") === "inline") { $(".toolbars .ico-max").removeClass("ico-max").addClass("ico-restore") .attr({ "title": config.label.restore_editor, @@ -43,9 +46,11 @@ var windows = { windows.maxBottom(); }); + // side $(".footer .ico-restore:eq(0)").click(function () { windows.restoreSide(); - if ($(".footer .ico-restore:eq(1)").css("display") === "none") { + if ($(".footer .ico-restore:eq(1)").css("display") === "none" + && $(".footer .ico-restore:eq(2)").css("display") === "none") { $(".toolbars .ico-restore").removeClass("ico-restore").addClass("ico-max") .attr({ "title": config.label.max_editor, @@ -56,7 +61,8 @@ var windows = { $(".side .ico-min").click(function () { windows.minSide(); - if ($(".footer .ico-restore:eq(1)").css("display") === "inline") { + if ($(".footer .ico-restore:eq(1)").css("display") === "inline" + && $(".footer .ico-restore:eq(2)").css("display") === "inline") { $(".toolbars .ico-max").removeClass("ico-max").addClass("ico-restore") .attr({ "title": config.label.restore_editor, @@ -69,11 +75,41 @@ var windows = { windows.maxSide(); }); + // side right + $(".footer .ico-restore:eq(2)").click(function () { + windows.restoreSideRight(); + if ($(".footer .ico-restore:eq(1)").css("display") === "none" + && $(".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()" + }); + } + }); + + $(".side-right .ico-min").click(function () { + windows.minSideRight(); + if ($(".footer .ico-restore:eq(1)").css("display") === "inline" + && $(".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()" + }); + } + }); + + $(".side-right .tabs").dblclick(function () { + windows.maxSideRight(); + }); + $(window).click(function (event) { if ($(event.target).closest(".footer").length === 1 || $(event.target).closest(".bottom-window-group").length === 1 || $(event.target).closest(".toolbars").length === 1 - || $(event.target).closest(".side").length === 1) { + || $(event.target).closest(".side").length === 1 + || $(event.target).closest(".side-right").length === 1) { } else { windows.clearFloat(); } @@ -107,6 +143,14 @@ var windows = { $it.addClass("side-max"); } }, + maxSideRight: function () { + var $it = $(".side-right"); + if ($it.hasClass("side-right-max")) { + windows.restoreSideRight(); + } else { + $it.addClass("side-right-max"); + } + }, restoreBottom: function () { var $it = $(".bottom-window-group"); $it.removeClass("bottom-window-group-max").attr("style", ""); @@ -117,7 +161,7 @@ var windows = { $it.animate({ "top": "70%" }, function () { - $(".edit-panel").css("height", "70%"); + $(".edit-panel, .side-right").css("height", "70%"); var editorDatas = editors.data, height = $(".edit-panel").height() - $(".edit-panel .tabs").height(); @@ -146,11 +190,33 @@ var windows = { "width": "80%" }); + if ($(".footer .ico-restore:eq(2)").css("display") === "inline") { + // 当outline最小化时 + $(".edit-panel").css("width", "80%"); + } else { + $(".edit-panel").css("width", "60%"); + } + $(".footer .ico-restore:eq(0)").hide(); }).removeClass("side-max"); }, + restoreSideRight: function () { + $(".side-right").animate({ + "right": "0" + }, function () { + if ($(".footer .ico-restore:eq(0)").css("display") === "inline") { + // 当文件树最小化时 + $(".edit-panel").css("width", "80%"); + } else { + $(".edit-panel").css("width", "60%"); + } + + $(".footer .ico-restore:eq(2)").hide(); + }).removeClass("side-right-max"); + ; + }, minBottom: function () { - $(".edit-panel").css("height", "100%"); + $(".edit-panel, .side-right").css("height", "100%"); var editorDatas = editors.data, height = $(".content").height() - $(".edit-panel .tabs").height(); @@ -164,12 +230,36 @@ var windows = { minSide: function () { $(".side").css("left", "-20%").removeClass("side-max"); + var width = '80%'; + if ($(".footer .ico-restore:eq(2)").css("display") === "inline") { + // 当 outline 最小化时 + width = '100%'; + } + $(".edit-panel, .bottom-window-group").css({ "left": "0", - "width": "100%" + "width": width }); + + $(".bottom-window-group").css({ + "left": "0", + "width": '100%' + }); + + $(".footer .ico-restore:eq(0)").show(); }, + minSideRight: function () { + $(".side-right").css("right", "-20%"); + $(".footer .ico-restore:eq(2)").show(); + + if ($(".footer .ico-restore:eq(0)").css("display") === "inline") { + // 当文件树最小化时 + $(".edit-panel").css("width", "100%"); + } else { + $(".edit-panel").css("width", "80%"); + } + }, maxEditor: function () { $(".toolbars .ico-max").removeClass("ico-max").addClass("ico-restore") .attr({ @@ -179,6 +269,7 @@ var windows = { windows.minBottom(); windows.minSide(); + windows.minSideRight(); if (wide.curEditor) { wide.curEditor.focus(); } @@ -194,6 +285,7 @@ var windows = { windows.restoreBottom(); windows.restoreSide(); + windows.restoreSideRight(); if (wide.curEditor) { wide.curEditor.focus(); } @@ -210,6 +302,11 @@ var windows = { // 当底部最小化时 windows.minBottom(); } + + if ($(".footer .ico-restore:eq(2)").css("display") === "inline") { + // 当 outline 最小化时 + windows.minSideRight(); + } }, flowBottom: function () { if ($(".footer .ico-restore:eq(1)").css("display") === "inline") { @@ -220,11 +317,6 @@ var windows = { "width": "100%", "z-index": "8" }).show(); - - if ($(".footer .ico-restore:eq(0)").css("display") === "inline") { - // 当文件最小化时 - $(".side").css("left", "-20%"); - } } } }; \ No newline at end of file diff --git a/views/index.html b/views/index.html index c605945..195b833 100644 --- a/views/index.html +++ b/views/index.html @@ -467,23 +467,20 @@
- -
@@ -532,6 +529,7 @@
+
@@ -629,7 +627,7 @@ - +