diff --git a/static/css/side.css b/static/css/side.css index 64d0855..8bcc8be 100644 --- a/static/css/side.css +++ b/static/css/side.css @@ -52,11 +52,11 @@ } #outline .ico { - margin: 2px 2px 0 2px; + margin: 1px 5px 0 5px; } .ico-func { - background-position: -122px -21px; + background-position: -123px -21px; } .ico-interface { diff --git a/static/css/themes/black.css b/static/css/themes/black.css index 7a9ce28..ac62b00 100644 --- a/static/css/themes/black.css +++ b/static/css/themes/black.css @@ -56,8 +56,7 @@ text-shadow: #292a2b 0px 1px 0px; } -.menu > ul > li > span:hover, -.menu > ul > li > span.selected { +.menu > ul > li.selected { background-color: #494949; color: #d4d4d4; box-shadow: 1px 0 0 0 #000000 inset, 1px 0 0 0 #000000, 0 1px 0 0 rgba(255, 255, 255, 0.15) inset; diff --git a/static/css/themes/default.css b/static/css/themes/default.css index 40bc43a..d186e6a 100644 --- a/static/css/themes/default.css +++ b/static/css/themes/default.css @@ -54,8 +54,7 @@ text-shadow: 0px 1px 0px #efefef; } -.menu > ul > li > span:hover, -.menu > ul > li > span.selected { +.menu > ul > li.selected { background-color: #cfcfcf; box-shadow: 1px 0 0 0 #b6b6b6 inset, 1px 0 0 0 #b6b6b6, 0 1px 0 0 rgba(255, 255, 255, 0.15) inset; color: #393939; diff --git a/static/images/ico-file.png b/static/images/ico-file.png index fd995a3..19fa86c 100644 Binary files a/static/images/ico-file.png and b/static/images/ico-file.png differ diff --git a/static/js/editors.js b/static/js/editors.js index b184ed7..bde5f7b 100644 --- a/static/js/editors.js +++ b/static/js/editors.js @@ -126,7 +126,9 @@ var editors = { }, clickAfter: function (id) { if (id === 'startPage') { + wide.curEditor = undefined; $(".footer .cursor").text(''); + wide.refreshOutline(); return false; } @@ -145,6 +147,7 @@ var editors = { var cursor = wide.curEditor.getCursor(); wide.curEditor.setCursor(cursor); wide.curEditor.focus(); + wide.refreshOutline(); $(".footer .cursor").text('| ' + (cursor.line + 1) + ':' + (cursor.ch + 1) + ' |'); }, @@ -176,10 +179,6 @@ var editors = { menu.disabled(['close-all']); } - if (id === 'startPage') { // 当前关闭的 tab 是起始页 - return false; - } - // 移除编辑器 for (var i = 0, ii = editors.data.length; i < ii; i++) { if (editors.data[i].id === id) { @@ -201,6 +200,7 @@ var editors = { tree.fileTree.cancelSelectedNode(); wide.curNode = undefined; wide.curEditor = undefined; + wide.refreshOutline(); $(".footer .cursor").text(''); return false; } @@ -222,6 +222,7 @@ var editors = { } } + wide.refreshOutline(); var cursor = wide.curEditor.getCursor(); $(".footer .cursor").text('| ' + (cursor.line + 1) + ':' + (cursor.ch + 1) + ' |'); } @@ -240,6 +241,10 @@ var editors = { this._initClose(); }, openStartPage: function () { + wide.curEditor = undefined; + wide.refreshOutline(); + $(".footer .cursor").text(''); + var dateFormat = function (time, fmt) { var date = new Date(time); var dateObj = { diff --git a/static/js/hotkeys.js b/static/js/hotkeys.js index 3364fc4..039280b 100644 --- a/static/js/hotkeys.js +++ b/static/js/hotkeys.js @@ -377,7 +377,7 @@ var hotkeys = { return; } - + if (event.ctrlKey === hotKeys.goOutline.ctrlKey && event.which === hotKeys.goOutline.which) { // Ctrl-2 焦点切换到大纲 hotKeys.goOutline.fun(); @@ -465,7 +465,9 @@ var hotkeys = { editors.tabs.setCurrent(nextId); wide.curNode = tree.fileTree.getNodeByTId(nextId); tree.fileTree.selectNode(wide.curNode); - + wide.refreshOutline(); + var cursor = wide.curEditor.getCursor(); + $(".footer .cursor").text('| ' + (cursor.line + 1) + ':' + (cursor.ch + 1) + ' |'); wide.curEditor.focus(); } diff --git a/static/js/menu.js b/static/js/menu.js index be81e28..4315e41 100644 --- a/static/js/menu.js +++ b/static/js/menu.js @@ -22,12 +22,11 @@ var menu = { this._initShare(); // 点击子菜单后消失 - $(".frame li").click(function () { - $(this).closest(".frame").hide(); - $(".menu > ul > li > a, .menu > ul> li > span").removeClass("selected"); + $(".menu .frame li").click(function () { + $(".frame").hide(); + $(".menu > ul > li").unbind().removeClass("selected"); + menu.subMenu(); }); - - }, _initShare: function () { $(".menu .ico-share").hover(function () { @@ -52,7 +51,7 @@ var menu = { urls.weibo = "http://v.t.sina.com.cn/share/share.php?title=" + title + "&url=" + url + "&pic=" + pic; urls.tencent = "http://share.v.t.qq.com/index.php?c=share&a=index&title=" + title + "&url=" + url + "&pic=" + pic; - + window.open(urls[key], "_blank", "top=100,left=200,width=648,height=618"); }); }, @@ -96,18 +95,24 @@ var menu = { }, // 焦点不在菜单上时需点击展开子菜单,否则为鼠标移动展开 subMenu: function () { - $(".menu > ul > li > a, .menu > ul> li > span").click(function () { + $(".menu > ul > li").click(function (event) { + if ($(event.target).closest(".frame").length === 1) { + return; + } var $it = $(this); - $it.next().show(); - $(".menu > ul > li > a, .menu > ul> li > span").removeClass("selected"); + $it.find('.frame').show(); + $(".menu > ul > li").removeClass("selected"); $(this).addClass("selected"); - $(".menu > ul > li > a, .menu > ul> li > span").unbind(); + $(".menu > ul > li").unbind(); - $(".menu > ul > li > a, .menu > ul> li > span").mouseover(function () { + $(".menu > ul > li").mouseover(function () { + if ($(event.target).closest(".frame").length === 1) { + return; + } $(".frame").hide(); - $(this).next().show(); - $(".menu > ul > li > a, .menu > ul> li > span").removeClass("selected"); + $(this).find('.frame').show(); + $(".menu > ul > li").removeClass("selected"); $(this).addClass("selected"); }); }); diff --git a/static/js/tabs.js b/static/js/tabs.js index 31a158d..e8f0015 100644 --- a/static/js/tabs.js +++ b/static/js/tabs.js @@ -110,6 +110,7 @@ $.extend(Tabs.prototype, { for (var i = 0; i < stack.length; i++) { if (id === stack[i]) { stack.splice(i, 1); + i--; } } diff --git a/static/js/wide.js b/static/js/wide.js index f4efe24..854f23c 100644 --- a/static/js/wide.js +++ b/static/js/wide.js @@ -19,11 +19,12 @@ var wide = { curEditor: undefined, curProcessId: undefined, // curent running process id (pid) refreshOutline: function () { - if (wide.curEditor.doc.getMode().name !== "go") { + if (!wide.curEditor || + (wide.curEditor && wide.curEditor.doc.getMode().name !== "go")) { $("#outline").html(''); return false; } - + var request = newWideRequest(); request.code = wide.curEditor.getValue(); @@ -36,20 +37,28 @@ var wide = { if (!data.succ) { return; } - + var outlineHTML = '