mirror of
https://shylinux.com/x/volcanos
synced 2025-04-25 16:58:06 +08:00
opt some
This commit is contained in:
parent
4258a1dec2
commit
d18228996d
10
frame.js
10
frame.js
@ -376,16 +376,16 @@ Volcanos("onappend", { _init: function(can, meta, list, cb, target, field) { met
|
|||||||
}])
|
}])
|
||||||
return ui.item.Meta = item, ui.item
|
return ui.item.Meta = item, ui.item
|
||||||
},
|
},
|
||||||
tree: function(can, target, msg, cb) {
|
tree: function(can, msg, target, cb) {
|
||||||
var list = {}; msg.Table(function(value) {
|
var list = {}; msg.Table(function(value) {
|
||||||
can.core.List(value.path.split("/"), function(item, index, array) {
|
can.core.List(value.path.split("/"), function(item, index, array) {
|
||||||
var last = array.slice(0, index).join("/")
|
var last = array.slice(0, index).join("/")
|
||||||
var name = array.slice(0, index+1).join("/")
|
var name = array.slice(0, index+1).join("/")
|
||||||
list[name] || (list[name] = can.page.Append(can, list[last]||target, [{text: [item, "div", "item"], style: {"margin-left": "10px"}, onclick: function(event) {
|
list[name] || (list[name] = can.page.Append(can, list[last]||target, [{view: ["item", "div", item+(index==array.length-1?"":"/")], onclick: function(event) {
|
||||||
var hide = list[name].style.display=="none"
|
var hide = list[name].style.display == "none"
|
||||||
can.page.Modify(can, list[name], {style: {display: hide? "": "none"}})
|
can.page.Modify(can, list[name], {style: {display: hide? "": "none"}})
|
||||||
!hide && typeof cb == "function" && cb(event, value)
|
index == array.length - 1 && typeof cb == "function" && cb(event, value)
|
||||||
}}, {view: "list", style: {"margin-left": "10px", display: "none"}}]).last)
|
}}, {view: "list", style: {display: "none"}}]).last)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -119,12 +119,16 @@ fieldset>div.output>div.project {
|
|||||||
float:left;
|
float:left;
|
||||||
/* position:fixed; */
|
/* position:fixed; */
|
||||||
}
|
}
|
||||||
fieldset>div.output>div.project>div.item {
|
fieldset>div.output>div.project div.item {
|
||||||
|
margin-left:10px;
|
||||||
clear:both;
|
clear:both;
|
||||||
}
|
}
|
||||||
fieldset>div.output>div.project>div.item:hover {
|
fieldset>div.output>div.project div.item:hover {
|
||||||
border:solid 1px red;
|
border:solid 1px red;
|
||||||
}
|
}
|
||||||
|
fieldset>div.output>div.project div.list {
|
||||||
|
margin-left:10px;
|
||||||
|
}
|
||||||
fieldset>div.output>pre.profile {
|
fieldset>div.output>pre.profile {
|
||||||
float:right;
|
float:right;
|
||||||
}
|
}
|
||||||
|
@ -25,13 +25,12 @@ fieldset.editor>div.output>div.project {
|
|||||||
max-width:120px;
|
max-width:120px;
|
||||||
color:white;
|
color:white;
|
||||||
}
|
}
|
||||||
fieldset.editor>div.output>div.project div.item0 {
|
|
||||||
}
|
|
||||||
fieldset.editor>div.output>div.project div.list0 {
|
|
||||||
}
|
|
||||||
fieldset.editor>div.output>div.project div.item {
|
fieldset.editor>div.output>div.project div.item {
|
||||||
cursor:pointer;
|
cursor:pointer;
|
||||||
}
|
}
|
||||||
|
fieldset.editor>div.output>div.project div.item:hover {
|
||||||
|
border:solid 2px red;
|
||||||
|
}
|
||||||
fieldset.editor>div.output>div.profile {
|
fieldset.editor>div.output>div.profile {
|
||||||
position:absolute; right:0;
|
position:absolute; right:0;
|
||||||
width:80px; overflow:auto;
|
width:80px; overflow:auto;
|
||||||
|
@ -8,7 +8,7 @@ Volcanos("onimport", {help: "导入数据", _init: function(can, msg, list, cb,
|
|||||||
{view: "profile"},
|
{view: "profile"},
|
||||||
|
|
||||||
{view: "holdon", list: [
|
{view: "holdon", list: [
|
||||||
{view: "preview"}, {view: "content", style: {"max-width": can.Conf("width")-260+"px"}},
|
{view: "preview"}, {view: "content", style: {"max-width": can.Conf("width")-280+"px"}},
|
||||||
]},
|
]},
|
||||||
|
|
||||||
{view: ["editor", "textarea"], onkeydown: function(event) {
|
{view: ["editor", "textarea"], onkeydown: function(event) {
|
||||||
@ -90,29 +90,12 @@ Volcanos("onimport", {help: "导入数据", _init: function(can, msg, list, cb,
|
|||||||
can.onaction.selectLine(can, line||1)
|
can.onaction.selectLine(can, line||1)
|
||||||
}, true)
|
}, true)
|
||||||
},
|
},
|
||||||
project: function(can, path) { can.Option({path: path}), can.ui.project.innerHTML = ""
|
project: function(can, path) { can.Option({path: path})
|
||||||
can.run({}, ["action", "project", path+"/"], function(res) {
|
can.run({}, [path+"/"], function(msg) { can.ui.project.innerHTML = ""
|
||||||
can.onappend.tree(can, can.ui.project, res, function(event, value) {
|
can.onappend.tree(can, msg, can.ui.project, function(event, value) {
|
||||||
value.path.indexOf(can.Option("path")) == 0 && (value.path = value.path.slice(can.Option("path").length+1))
|
can.onimport.tabview(can, can.Option("path"), value.path)
|
||||||
value.path.endsWith("/")? can.onimport.project(can, can.base.Path(can.Option("path"), value.path)):
|
|
||||||
can.onimport.tabview(can, can.Option("path"), value.path)
|
|
||||||
})
|
})
|
||||||
}, true)
|
}, true)
|
||||||
return
|
|
||||||
can.run({}, ["action", "project", path+"/"], function(res) { res.Table(function(value) {
|
|
||||||
value.path = value.path.slice(can.Option("path").length+1)
|
|
||||||
|
|
||||||
var title = can.core.List(["time", "size"], function(item) { return item + ": " + value[item] }).join("\n")
|
|
||||||
can.page.Append(can, can.ui.project, [{text: [value.path, "div", "item"], title: title,
|
|
||||||
onclick: function(event) {
|
|
||||||
value.path.endsWith("/")? can.onimport.project(can, can.base.Path(can.Option("path"), value.path)):
|
|
||||||
can.onimport.tabview(can, can.Option("path"), value.path)
|
|
||||||
},
|
|
||||||
ondblclick: function(event) {
|
|
||||||
can.onkeymap._remote(event, can, "运行", ["action", "运行", path, value.path])
|
|
||||||
},
|
|
||||||
}])
|
|
||||||
}) }, true)
|
|
||||||
},
|
},
|
||||||
}, ["/plugin/local/code/inner.css"])
|
}, ["/plugin/local/code/inner.css"])
|
||||||
Volcanos("onsyntax", {help: "语法高亮", list: ["keyword", "prefix", "line"], _init: function(can, msg) { can._msg = msg
|
Volcanos("onsyntax", {help: "语法高亮", list: ["keyword", "prefix", "line"], _init: function(can, msg) { can._msg = msg
|
||||||
@ -183,6 +166,63 @@ Volcanos("onsyntax", {help: "语法高亮", list: ["keyword", "prefix", "line"],
|
|||||||
"endif": "keyword",
|
"endif": "keyword",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
c: {link: "h"},
|
||||||
|
h: {
|
||||||
|
split: {
|
||||||
|
space: " ",
|
||||||
|
operator: "{[(.:,;!|<>)]}",
|
||||||
|
},
|
||||||
|
prefix: {
|
||||||
|
"//": "comment",
|
||||||
|
"/*": "comment",
|
||||||
|
"*": "comment",
|
||||||
|
},
|
||||||
|
keyword: {
|
||||||
|
"#include": "keyword",
|
||||||
|
"#define": "keyword",
|
||||||
|
"#ifndef": "keyword",
|
||||||
|
"#ifdef": "keyword",
|
||||||
|
"#else": "keyword",
|
||||||
|
"#endif": "keyword",
|
||||||
|
|
||||||
|
"typedef": "keyword",
|
||||||
|
|
||||||
|
"if": "keyword",
|
||||||
|
"else": "keyword",
|
||||||
|
"for": "keyword",
|
||||||
|
"while": "keyword",
|
||||||
|
"do": "keyword",
|
||||||
|
"range": "keyword",
|
||||||
|
"break": "keyword",
|
||||||
|
"continue": "keyword",
|
||||||
|
"switch": "keyword",
|
||||||
|
"case": "keyword",
|
||||||
|
"default": "keyword",
|
||||||
|
|
||||||
|
"return": "keyword",
|
||||||
|
|
||||||
|
"union": "datatype",
|
||||||
|
"struct": "datatype",
|
||||||
|
"extern": "datatype",
|
||||||
|
"unsigned": "datatype",
|
||||||
|
"static": "datatype",
|
||||||
|
"double": "datatype",
|
||||||
|
"const": "datatype",
|
||||||
|
"void": "datatype",
|
||||||
|
"long": "datatype",
|
||||||
|
"char": "datatype",
|
||||||
|
"int": "datatype",
|
||||||
|
|
||||||
|
"sizeof": "function",
|
||||||
|
"assert": "function",
|
||||||
|
"zmalloc": "function",
|
||||||
|
|
||||||
|
"NULL": "string",
|
||||||
|
"0": "string",
|
||||||
|
"1": "string",
|
||||||
|
"-1": "string",
|
||||||
|
},
|
||||||
|
},
|
||||||
sh: {
|
sh: {
|
||||||
prefix: {"#": "comment"},
|
prefix: {"#": "comment"},
|
||||||
suffix: {"\x7B": "comment"},
|
suffix: {"\x7B": "comment"},
|
||||||
@ -217,13 +257,6 @@ Volcanos("onsyntax", {help: "语法高亮", list: ["keyword", "prefix", "line"],
|
|||||||
"go": "function",
|
"go": "function",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
vim: {
|
|
||||||
prefix: {"\"": "comment"},
|
|
||||||
keyword: {
|
|
||||||
highlight: "keyword",
|
|
||||||
syntax: "keyword",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
shy: {
|
shy: {
|
||||||
prefix: {"#": "comment"},
|
prefix: {"#": "comment"},
|
||||||
profile: true,
|
profile: true,
|
||||||
@ -232,6 +265,13 @@ Volcanos("onsyntax", {help: "语法高亮", list: ["keyword", "prefix", "line"],
|
|||||||
"label": "keyword",
|
"label": "keyword",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
vim: {
|
||||||
|
prefix: {"\"": "comment"},
|
||||||
|
keyword: {
|
||||||
|
highlight: "keyword",
|
||||||
|
syntax: "keyword",
|
||||||
|
},
|
||||||
|
},
|
||||||
mod: {
|
mod: {
|
||||||
prefix: {"#": "comment"},
|
prefix: {"#": "comment"},
|
||||||
keyword: {
|
keyword: {
|
||||||
@ -363,63 +403,7 @@ Volcanos("onsyntax", {help: "语法高亮", list: ["keyword", "prefix", "line"],
|
|||||||
return array[index-2]=="can"&&array[index-1]=="."&&(libs[value]||libs[value.text])? {keyword: "function", text: value.text||value}: value
|
return array[index-2]=="can"&&array[index-1]=="."&&(libs[value]||libs[value.text])? {keyword: "function", text: value.text||value}: value
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
h: {
|
json: {link: "js"},
|
||||||
split: {
|
|
||||||
space: " ",
|
|
||||||
operator: "{[(.:,;!|<>)]}",
|
|
||||||
},
|
|
||||||
prefix: {
|
|
||||||
"//": "comment",
|
|
||||||
"/*": "comment",
|
|
||||||
"*": "comment",
|
|
||||||
},
|
|
||||||
keyword: {
|
|
||||||
"#include": "keyword",
|
|
||||||
"#define": "keyword",
|
|
||||||
"#ifndef": "keyword",
|
|
||||||
"#ifdef": "keyword",
|
|
||||||
"#else": "keyword",
|
|
||||||
"#endif": "keyword",
|
|
||||||
|
|
||||||
"typedef": "keyword",
|
|
||||||
|
|
||||||
"if": "keyword",
|
|
||||||
"else": "keyword",
|
|
||||||
"for": "keyword",
|
|
||||||
"while": "keyword",
|
|
||||||
"do": "keyword",
|
|
||||||
"range": "keyword",
|
|
||||||
"break": "keyword",
|
|
||||||
"continue": "keyword",
|
|
||||||
"switch": "keyword",
|
|
||||||
"case": "keyword",
|
|
||||||
"default": "keyword",
|
|
||||||
|
|
||||||
"return": "keyword",
|
|
||||||
|
|
||||||
"union": "datatype",
|
|
||||||
"struct": "datatype",
|
|
||||||
"extern": "datatype",
|
|
||||||
"unsigned": "datatype",
|
|
||||||
"static": "datatype",
|
|
||||||
"double": "datatype",
|
|
||||||
"const": "datatype",
|
|
||||||
"void": "datatype",
|
|
||||||
"long": "datatype",
|
|
||||||
"char": "datatype",
|
|
||||||
"int": "datatype",
|
|
||||||
|
|
||||||
"sizeof": "function",
|
|
||||||
"assert": "function",
|
|
||||||
"zmalloc": "function",
|
|
||||||
|
|
||||||
"NULL": "string",
|
|
||||||
"0": "string",
|
|
||||||
"1": "string",
|
|
||||||
"-1": "string",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
c: {link: "h"},
|
|
||||||
man3: {
|
man3: {
|
||||||
split: {
|
split: {
|
||||||
},
|
},
|
||||||
@ -441,14 +425,6 @@ Volcanos("onsyntax", {help: "语法高亮", list: ["keyword", "prefix", "line"],
|
|||||||
man1: {link: "man3"},
|
man1: {link: "man3"},
|
||||||
man8: {link: "man3"},
|
man8: {link: "man3"},
|
||||||
|
|
||||||
png: {
|
|
||||||
display: true,
|
|
||||||
show: function(can) {
|
|
||||||
can.page.Append(can, can.ui.display, can.core.List(can._msg.result, function(line) {
|
|
||||||
return {img: "/share/local/"+line, height: 400}
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
},
|
|
||||||
url: {
|
url: {
|
||||||
line: function(can, line) {
|
line: function(can, line) {
|
||||||
return {button: [line, function(event) {
|
return {button: [line, function(event) {
|
||||||
@ -467,6 +443,14 @@ Volcanos("onsyntax", {help: "语法高亮", list: ["keyword", "prefix", "line"],
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
png: {
|
||||||
|
display: true,
|
||||||
|
show: function(can) {
|
||||||
|
can.page.Append(can, can.ui.display, can.core.List(can._msg.result, function(line) {
|
||||||
|
return {img: "/share/local/"+line, height: 400}
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
},
|
||||||
jpg: {
|
jpg: {
|
||||||
display: true,
|
display: true,
|
||||||
show: function(can) {
|
show: function(can) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user