菜单栏
This commit is contained in:
parent
3e720d8179
commit
058f400dc5
|
@ -80,11 +80,20 @@
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.frame li.disabled {
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
.frame li:hover {
|
.frame li:hover {
|
||||||
background-color: #3875D7;
|
background-color: #3875D7;
|
||||||
color: #FFF;
|
color: #FFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.frame li.disabled:hover {
|
||||||
|
background-color: #F8F8F8;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
.frame a {
|
.frame a {
|
||||||
color: #000;
|
color: #000;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
|
|
@ -23,8 +23,8 @@ var editors = {
|
||||||
removeAfter: function (id, nextId) {
|
removeAfter: function (id, nextId) {
|
||||||
for (var i = 0, ii = editors.data.length; i < ii; i++) {
|
for (var i = 0, ii = editors.data.length; i < ii; i++) {
|
||||||
if (editors.data[i].id === id) {
|
if (editors.data[i].id === id) {
|
||||||
editors.data.splice(i, 1);
|
|
||||||
wide.fmt(tree.fileTree.getNodeByTId(editors.data[i].id).path, editors.data[i].editor);
|
wide.fmt(tree.fileTree.getNodeByTId(editors.data[i].id).path, editors.data[i].editor);
|
||||||
|
editors.data.splice(i, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,8 @@ var editors = {
|
||||||
wide.curNode = undefined;
|
wide.curNode = undefined;
|
||||||
|
|
||||||
wide.curEditor = undefined;
|
wide.curEditor = undefined;
|
||||||
|
|
||||||
|
menu.disabled(['save-all', 'close-all', 'run', 'go-get', 'go-install']);
|
||||||
$(".toolbars").hide();
|
$(".toolbars").hide();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -360,6 +362,8 @@ var editors = {
|
||||||
content: '<textarea id="editor' + id + '"></textarea>'
|
content: '<textarea id="editor' + id + '"></textarea>'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
menu.undisabled(['save-all', 'close-all', 'run', 'go-get', 'go-install']);
|
||||||
|
|
||||||
var rulers = [];
|
var rulers = [];
|
||||||
rulers.push({color: "#ccc", column: 120, lineStyle: "dashed"});
|
rulers.push({color: "#ccc", column: 120, lineStyle: "dashed"});
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,16 @@ var menu = {
|
||||||
$(this).closest(".frame").hide();
|
$(this).closest(".frame").hide();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
disabled: function (list) {
|
||||||
|
for (var i = 0, max = list.length; i < max; i++) {
|
||||||
|
$(".menu li." + list[i]).addClass("disabled");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
undisabled: function (list) {
|
||||||
|
for (var i = 0, max = list.length; i < max; i++) {
|
||||||
|
$(".menu li." + list[i]).removeClass("disabled");
|
||||||
|
}
|
||||||
|
},
|
||||||
// 焦点不在菜单上时需点击展开子菜单,否则为鼠标移动展开
|
// 焦点不在菜单上时需点击展开子菜单,否则为鼠标移动展开
|
||||||
subMenu: function () {
|
subMenu: function () {
|
||||||
$(".menu > ul > li > a, .menu > ul> li > span").click(function () {
|
$(".menu > ul > li > a, .menu > ul> li > span").click(function () {
|
||||||
|
|
|
@ -402,6 +402,10 @@ var wide = {
|
||||||
},
|
},
|
||||||
saveAllFiles: function () {
|
saveAllFiles: function () {
|
||||||
// TODO: 需要全部保存的接口
|
// TODO: 需要全部保存的接口
|
||||||
|
if ($(".menu li.save-all").hasClass("disabled")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
for (var i = 0, ii = editors.data.length; i < ii; i++) {
|
for (var i = 0, ii = editors.data.length; i < ii; i++) {
|
||||||
this.fmt(tree.fileTree.getNodeByTId(editors.data[i].id).path, editors.data[i].editor);
|
this.fmt(tree.fileTree.getNodeByTId(editors.data[i].id).path, editors.data[i].editor);
|
||||||
}
|
}
|
||||||
|
@ -410,6 +414,9 @@ var wide = {
|
||||||
// TODO: close file
|
// TODO: close file
|
||||||
},
|
},
|
||||||
closeAllFiles: function () {
|
closeAllFiles: function () {
|
||||||
|
if ($(".menu li.close-all").hasClass("disabled")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
this.saveAllFiles();
|
this.saveAllFiles();
|
||||||
editors.data = [];
|
editors.data = [];
|
||||||
tree.fileTree.cancelSelectedNode();
|
tree.fileTree.cancelSelectedNode();
|
||||||
|
@ -418,6 +425,7 @@ var wide = {
|
||||||
$(".toolbars").hide();
|
$(".toolbars").hide();
|
||||||
|
|
||||||
$(".edit-panel .tabs, .edit-panel .tabs-panel").html('');
|
$(".edit-panel .tabs, .edit-panel .tabs-panel").html('');
|
||||||
|
menu.disabled(['save-all', 'close-all', 'run', 'go-get', 'go-install']);
|
||||||
},
|
},
|
||||||
exit: function () {
|
exit: function () {
|
||||||
// TODO: exit
|
// TODO: exit
|
||||||
|
@ -447,6 +455,10 @@ var wide = {
|
||||||
},
|
},
|
||||||
// 构建 & 运行.
|
// 构建 & 运行.
|
||||||
run: function () {
|
run: function () {
|
||||||
|
if ($(".menu li.run").hasClass("disabled")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if ($(".toolbars .ico-stop").length === 1) {
|
if ($(".toolbars .ico-stop").length === 1) {
|
||||||
wide.stop();
|
wide.stop();
|
||||||
return false;
|
return false;
|
||||||
|
@ -471,6 +483,10 @@ var wide = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
goget: function () {
|
goget: function () {
|
||||||
|
if ($(".menu li.go-get").hasClass("disabled")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
var request = newWideRequest();
|
var request = newWideRequest();
|
||||||
request.file = editors.getCurrentPath();
|
request.file = editors.getCurrentPath();
|
||||||
|
|
||||||
|
@ -487,6 +503,10 @@ var wide = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
goinstall: function () {
|
goinstall: function () {
|
||||||
|
if ($(".menu li.go-install").hasClass("disabled")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
var request = newWideRequest();
|
var request = newWideRequest();
|
||||||
request.file = editors.getCurrentPath();
|
request.file = editors.getCurrentPath();
|
||||||
request.code = wide.curEditor.getValue();
|
request.code = wide.curEditor.getValue();
|
||||||
|
|
|
@ -26,10 +26,10 @@
|
||||||
<span>{{.i18n.file}}</span>
|
<span>{{.i18n.file}}</span>
|
||||||
<div class="frame">
|
<div class="frame">
|
||||||
<ul>
|
<ul>
|
||||||
<li onclick="wide.saveAllFiles()">
|
<li class="save-all disabled" onclick="wide.saveAllFiles()">
|
||||||
<span>{{.i18n.save_all_files}}</span>
|
<span>{{.i18n.save_all_files}}</span>
|
||||||
</li>
|
</li>
|
||||||
<li onclick="wide.closeAllFiles()">
|
<li class="close-all disabled" onclick="wide.closeAllFiles()">
|
||||||
<span>{{.i18n.close_all_files}}</span>
|
<span>{{.i18n.close_all_files}}</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="hr"></li>
|
<li class="hr"></li>
|
||||||
|
@ -43,14 +43,14 @@
|
||||||
<span>{{.i18n.run}}</span>
|
<span>{{.i18n.run}}</span>
|
||||||
<div class="frame">
|
<div class="frame">
|
||||||
<ul>
|
<ul>
|
||||||
<li onclick="wide.run()">
|
<li class="run disabled" onclick="wide.run()">
|
||||||
<span>{{.i18n.build_n_run}}</span>
|
<span>{{.i18n.build_n_run}}</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="hr"></li>
|
<li class="hr"></li>
|
||||||
<li onclick="wide.goget()">
|
<li class="go-get disabled" onclick="wide.goget()">
|
||||||
<span>{{.i18n.goget}}</span>
|
<span>{{.i18n.goget}}</span>
|
||||||
</li>
|
</li>
|
||||||
<li onclick="wide.goinstall()">
|
<li class="go-install disabled" onclick="wide.goinstall()">
|
||||||
<span>{{.i18n.goinstall}}</span>
|
<span>{{.i18n.goinstall}}</span>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
Loading…
Reference in New Issue