mirror of
https://shylinux.com/x/volcanos
synced 2025-04-25 16:58:06 +08:00
opt inner.js
This commit is contained in:
parent
f5774929c4
commit
ff12cb5bc9
14
frame.js
14
frame.js
@ -36,6 +36,10 @@ Volcanos("onengine", {help: "搜索引擎", list: [], _init: function(can, meta,
|
||||
},
|
||||
_engine: function(event, can, msg, panel, cmds, cb) { return false },
|
||||
_plugin: function(event, can, msg, panel, cmds, cb) {
|
||||
if (can.onengine.plugin.meta[cmds[0]]) {
|
||||
can.core.CallFunc(can.onengine.plugin.meta[cmds[0]], {msg: msg, cmds: cmds.slice(1), cb: cb})
|
||||
return true
|
||||
}
|
||||
if (cmds[0] == ctx.ACTION && cmds[1] == ice.RUN && can.onengine.plugin.meta[cmds[2]]) {
|
||||
can.core.CallFunc(can.onengine.plugin.meta[cmds[2]], {msg: msg, cmds: cmds.slice(3), cb: cb})
|
||||
return true
|
||||
@ -70,7 +74,7 @@ Volcanos("onengine", {help: "搜索引擎", list: [], _init: function(can, meta,
|
||||
can.core.CallFunc(cb, {msg: msg})
|
||||
})
|
||||
}),
|
||||
plugin: shy("添加插件", {}, [], function(can, name, command) {
|
||||
plugin: shy("添加插件", {}, [], function(can, name, command) { name = can.base.trimPrefix(name, "can.")
|
||||
var type = html.TEXT; command.list = can.core.List(command.list, function(item) {
|
||||
switch (typeof item) {
|
||||
case lang.OBJECT: return type = item.type||type, item
|
||||
@ -266,6 +270,7 @@ Volcanos("onappend", {help: "渲染引擎", list: [], _init: function(can, meta,
|
||||
function close(item) { var next = item.nextSibling || item.previousSibling
|
||||
item._close(item) || can.page.Remove(can, item), next && next.click()
|
||||
}
|
||||
can.core.Timer(10, function() { item.click() })
|
||||
can.page.Modify(can, item, {draggable: true, _close: cbs,
|
||||
oncontextmenu: function(event) {
|
||||
can.user.carte(event, can, kit.Dict(
|
||||
@ -534,7 +539,7 @@ Volcanos("onlayout", {help: "页面布局", list: [], _init: function(can, targe
|
||||
profile: function(can, target) { target = target||can._output
|
||||
var gt = "❯", lt = "❮"
|
||||
var down = "˅", up = "˄"
|
||||
return can.page.Append(can, target, [{view: [chat.LAYOUT, html.TABLE], list: [
|
||||
var ui = can.page.Append(can, target, [{view: [chat.LAYOUT, html.TABLE], list: [
|
||||
{view: [chat.PROJECT, html.TD], list: [
|
||||
{view: [chat.PROJECT]},
|
||||
]},
|
||||
@ -544,12 +549,15 @@ Volcanos("onlayout", {help: "页面布局", list: [], _init: function(can, targe
|
||||
{view: [chat.CONTENT]},
|
||||
{view: ["toggle project"], list: [{text: [gt, html.DIV]}], onclick: function(event) {
|
||||
event.target.innerHTML = can.onmotion.toggle(can, can.ui.project)? lt: gt
|
||||
ui.project._show && ui.project._show(event)
|
||||
}},
|
||||
{view: ["toggle profile"], list: [{text: [lt, html.DIV]}], onclick: function(event) {
|
||||
event.target.innerHTML = can.onmotion.toggle(can, can.ui.profile)? gt: lt
|
||||
ui.profile._show && ui.profile._show(event)
|
||||
}},
|
||||
{view: ["toggle display"], list: [{text: [down, html.DIV]}], onclick: function(event) {
|
||||
event.target.innerHTML = can.onmotion.toggle(can, can.ui.display)? down: up
|
||||
ui.display._show && ui.display._show(event)
|
||||
}},
|
||||
]},
|
||||
{view: [chat.PROFILE, html.TD], list: [
|
||||
@ -558,7 +566,7 @@ Volcanos("onlayout", {help: "页面布局", list: [], _init: function(can, targe
|
||||
]}]},
|
||||
{view: [chat.DISPLAY, html.TR], list: [{view: [chat.DISPLAY], style: {display: html.NONE}}]}
|
||||
]}
|
||||
] }])
|
||||
] }]); return ui
|
||||
},
|
||||
})
|
||||
Volcanos("onmotion", {help: "动态特效", list: [], _init: function(can, target) {
|
||||
|
@ -228,13 +228,16 @@ Volcanos("misc", {help: "通信协议", Message: function(event, can) { var msg
|
||||
}),
|
||||
|
||||
runAction: function(can, msg, cmds, cb, list) {
|
||||
if (cmds[0] == ctx.ACTION && list[cmds[1]]) { return list[cmds[1]](cmds.slice(2)) }
|
||||
if (list[cmds[0]]) { return list[cmds[0]](cmds.slice(1)) }
|
||||
if (cmds[0] == ctx.ACTION && list[cmds[1]]) { return list[cmds[1]](cmds.slice(2)), true }
|
||||
if (list[cmds[0]]) { return list[cmds[0]](cmds.slice(1)), true }
|
||||
},
|
||||
concat: function(can, to, from) { to = to||[], from = from||[]
|
||||
if (from[0] == ctx.ACTION && from[1] == ice.RUN && can.onengine.plugin.meta[from[2]]) {
|
||||
return from
|
||||
}
|
||||
if (can.onengine.plugin.meta[from[0]]) {
|
||||
return from
|
||||
}
|
||||
if (from[0] == "_search") { return from }
|
||||
return to.concat(from)
|
||||
},
|
||||
|
@ -303,6 +303,10 @@ Volcanos("page", {help: "用户界面", ClassList: {
|
||||
case html.IMG: return arguments[2]? "<img src='"+arguments[1]+"' height="+arguments[2]+">": "<img src='"+arguments[1]+"'>"
|
||||
}
|
||||
},
|
||||
replace: function(can, text, key, value) {
|
||||
text = can.base.replaceAll(text, "<", "<", ">", ">", key, value)
|
||||
return text
|
||||
},
|
||||
Color: function(text) { if (typeof text != lang.STRING) { return "" }
|
||||
if (text.indexOf("http://") == 0 || text.indexOf("https://") == 0 || text.indexOf("ftp://") == 0) {
|
||||
var ls = text.split(ice.SP);
|
||||
|
@ -68,6 +68,7 @@ Volcanos("user", {help: "用户操作", agent: {
|
||||
"list": "查看", "back": "返回", "run": "执行", "done": "完成", "share": "共享",
|
||||
"edit": "编辑", "save": "保存", "copy": "复制", "show": "显示", "hide": "隐藏",
|
||||
"project": "项目", "profile": "详情", "actions": "参数",
|
||||
"find": "查找", "grep": "搜索",
|
||||
|
||||
"open": "打开", "close": "关闭",
|
||||
"start": "启动", "stop": "停止",
|
||||
@ -98,7 +99,7 @@ Volcanos("user", {help: "用户操作", agent: {
|
||||
]},
|
||||
] }])
|
||||
|
||||
var action = can.onappend._action(can, meta.action||[], ui.action, {
|
||||
var action = can.onappend._action(can, meta.action||[""], ui.action, {
|
||||
close: function(event) { can.page.Remove(can, action._target), action.timer.stop = true },
|
||||
timer: can.core.Timer({interval: 100, length: (parseInt(meta.duration||1000))/100}, function(event, interval, index) {
|
||||
if (index > 30) { ui.duration.innerHTML = parseInt(index/10)+ice.PT+(index%10)+"s..." }
|
||||
|
@ -51,6 +51,7 @@ p.story[data-type=brief] {
|
||||
font-size:20px; font-family:cursive; font-weight:bolder;
|
||||
}
|
||||
|
||||
|
||||
select {
|
||||
background-color:black; color:cyan;
|
||||
font-size:14px; font-family:monospace;
|
||||
@ -137,12 +138,13 @@ table.layout div.toggle {
|
||||
position:absolute;
|
||||
}
|
||||
table.layout div.toggle.display>div {
|
||||
height:20px; width:100px;
|
||||
height:10px; width:100px;
|
||||
text-align:center;
|
||||
color:white;
|
||||
}
|
||||
table.layout div.toggle.display {
|
||||
margin-top:-10px;
|
||||
overflow:hidden;
|
||||
margin-top:-12px;
|
||||
height:10px; width:100px;
|
||||
position:sticky; left:20%;
|
||||
border-top-left-radius:10px;
|
||||
@ -304,6 +306,9 @@ fieldset>div.status>div.item {
|
||||
float:left; padding:4px;
|
||||
height:18px;
|
||||
}
|
||||
fieldset>div.status>div.item:hover {
|
||||
background:green;
|
||||
}
|
||||
fieldset>div.status>div.item>label {
|
||||
font-size:10px; color:#bdb8b8e0;
|
||||
}
|
||||
|
@ -1,3 +1,7 @@
|
||||
fieldset.inner>div.action {
|
||||
float:none; display:block;
|
||||
height:26px; overflow:auto;
|
||||
}
|
||||
fieldset.inner>div.action div.tabs {
|
||||
border:solid 2px red; padding:2px;
|
||||
}
|
||||
@ -11,26 +15,42 @@ fieldset.inner>div.action div.tabs.select {
|
||||
fieldset.inner>div.output {
|
||||
color:white;
|
||||
}
|
||||
fieldset.inner table.layout div.toggle.project {
|
||||
min-width:15px; font-size:24px;
|
||||
}
|
||||
fieldset.inner table.layout div.toggle.profile {
|
||||
min-width:15px; font-size:24px;
|
||||
}
|
||||
fieldset.inner table.layout div.toggle.display {
|
||||
height:15px; font-size:24px;
|
||||
margin-top:-17px;
|
||||
}
|
||||
fieldset.inner div.output div.toggle {
|
||||
display:none;
|
||||
/* display:none; */
|
||||
}
|
||||
fieldset.inner>div.output div.project {
|
||||
font-size:14px; font-family:monospace;
|
||||
max-width:180px; overflow:auto;
|
||||
}
|
||||
fieldset.inner>div.output>table.layout div.content {
|
||||
position:relative;
|
||||
padding-right:25px;
|
||||
}
|
||||
fieldset.inner>div.output div.content {
|
||||
font-size:16px; font-family:monospace;
|
||||
overflow:auto; padding-right:25px;
|
||||
position:relative;
|
||||
overflow:auto;
|
||||
color:white;
|
||||
}
|
||||
fieldset.inner>div.output div.content table.layout {
|
||||
width:-webkit-fill-available;
|
||||
}
|
||||
fieldset.inner>div.output div.content tr.select {
|
||||
background-color:#0000ff6b;
|
||||
}
|
||||
fieldset.inner>div.output div.content tr.select td.line {
|
||||
background-color:blue;
|
||||
border:solid 1px red;
|
||||
border-right:solid 2px red;
|
||||
background-color:blue;
|
||||
}
|
||||
fieldset.inner>div.output div.content td.line:hover {
|
||||
background-color:green;
|
||||
@ -44,7 +64,6 @@ fieldset.inner>div.output div.content td.text {
|
||||
padding-left:10px;
|
||||
white-space:pre;
|
||||
}
|
||||
|
||||
fieldset.inner>div.output div.content td.text span.comment {
|
||||
color:cyan; background-color:blue;
|
||||
}
|
||||
@ -63,49 +82,48 @@ fieldset.inner>div.output div.content td.text span.constant {
|
||||
fieldset.inner>div.output div.content td.text span.string {
|
||||
color:magenta;
|
||||
}
|
||||
|
||||
fieldset.inner>div.output>fieldset.toolkit>div.status>div.legend {
|
||||
float:left; padding:4px; cursor:pointer;
|
||||
fieldset.inner>div.output div.display {
|
||||
/* display:none; */
|
||||
}
|
||||
fieldset.inner>div.output>fieldset.toolkit>div.status>div.legend.select {
|
||||
background:green;
|
||||
fieldset.inner>div.output div.display>div.action>div.item {
|
||||
float:left;
|
||||
}
|
||||
fieldset.inner>div.output>fieldset.toolkit>div.status>div.legend:hover {
|
||||
background:green;
|
||||
fieldset.inner>div.output div.profile>div.action>div.item {
|
||||
float:left;
|
||||
}
|
||||
fieldset.inner>div.output>fieldset.toolkit>div.output>fieldset {
|
||||
display:none; margin:0;padding:0;
|
||||
fieldset.inner>div.output div.profile>div.output {
|
||||
clear:both;
|
||||
}
|
||||
fieldset.inner>div.output>fieldset.toolkit>div.output>fieldset>legend {
|
||||
display:none;
|
||||
fieldset.inner>div.output div.display>div.output {
|
||||
clear:both;
|
||||
}
|
||||
fieldset.inner>div.output>fieldset.toolkit>div.output>fieldset>div.output {
|
||||
height:260px;
|
||||
}
|
||||
fieldset.inner>div.output>fieldset.toolkit>div.output>fieldset.select {
|
||||
display:block;
|
||||
fieldset.inner>div.output div.display {
|
||||
border:solid 1px greenyellow;
|
||||
}
|
||||
|
||||
fieldset.inner>div.output div.search {
|
||||
padding:6px; border:solid 1px red;
|
||||
position:absolute;
|
||||
fieldset.inner div.output fieldset.toolkit {
|
||||
background:#0d969f8a;
|
||||
bottom:0;
|
||||
}
|
||||
fieldset.inner>div.output div.search div.tags {
|
||||
text-align:left; overflow:auto;
|
||||
}
|
||||
fieldset.inner>div.output div.search div.tags table {
|
||||
width:-webkit-fill-available;
|
||||
}
|
||||
fieldset.inner>div.output div.search td>div {
|
||||
max-height:100px;
|
||||
overflow:hidden;
|
||||
}
|
||||
fieldset.inner div.output fieldset.story {
|
||||
position:absolute;
|
||||
bottom:0px;
|
||||
background:#0d969f8a;
|
||||
}
|
||||
fieldset.inner>div.output fieldset.toolkit>div.output>fieldset {
|
||||
display:none; margin:0;padding:0;
|
||||
}
|
||||
fieldset.inner>div.output fieldset.toolkit>div.output>fieldset.select {
|
||||
display:block;
|
||||
}
|
||||
fieldset.inner>div.output fieldset.toolkit>div.output>fieldset>legend {
|
||||
display:none;
|
||||
}
|
||||
fieldset.inner>div.output fieldset.toolkit>div.status>div.legend {
|
||||
float:left; padding:4px; cursor:pointer;
|
||||
padding:4px 4px; border-right:solid 2px red;
|
||||
}
|
||||
fieldset.inner>div.output fieldset.toolkit>div.status>div.legend.select {
|
||||
background:green;
|
||||
}
|
||||
fieldset.inner>div.output fieldset.toolkit>div.status>div.legend:hover {
|
||||
background:green;
|
||||
}
|
||||
|
||||
body.white fieldset.inner>div.output div.project {
|
||||
@ -114,13 +132,15 @@ body.white fieldset.inner>div.output div.project {
|
||||
body.white fieldset.inner>div.output div.content {
|
||||
background-color:#013b675c;
|
||||
}
|
||||
body.white fieldset.inner>div.output div.content td.text span.string {
|
||||
color:#a703a7;
|
||||
}
|
||||
|
||||
body.white fieldset.inner>div.output div.content tr {
|
||||
background-color:#e1f1ff00;
|
||||
}
|
||||
body.white fieldset.inner>div.output div.content tr.select {
|
||||
background-color:#0000ff6b;
|
||||
}
|
||||
body.white fieldset.inner>div.output div.content td.text span.string {
|
||||
color:#a703a7;
|
||||
}
|
||||
|
||||
.unselectable {
|
||||
-webkit-touch-callout: none;
|
||||
|
@ -1,58 +1,119 @@
|
||||
Volcanos("onimport", {help: "导入数据", _init: function(can, msg, cb, target) {
|
||||
can.onmotion.clear(can), can.ui = can.onlayout.profile(can)
|
||||
can.onimport._content(can, target)
|
||||
can.onimport._output(can, target)
|
||||
can.onimport._favor(can, target)
|
||||
can.onimport._profile(can, target)
|
||||
can.onimport._project(can, target)
|
||||
can.onimport._display(can, target)
|
||||
can.onimport._search(can, target)
|
||||
can.onimport._favor(can, target)
|
||||
|
||||
msg.Option({path: can.Option(nfs.PATH), file: can.Option(nfs.FILE), line: can.Option(nfs.LINE)||1})
|
||||
can.tabview = can.tabview||{}, can.tabview[can.Option(nfs.PATH)+can.Option(nfs.FILE)] = msg
|
||||
can.history = can.history||[]
|
||||
|
||||
can.onimport.tabview(can, msg.Option(nfs.PATH), msg.Option(nfs.FILE), msg.Option(nfs.LINE)||1, function() {
|
||||
var repos = can.base.trimSuffix(can.base.trimPrefix(msg.Option(nfs.PATH), "usr/"), "/")
|
||||
can.onimport.toolkit(can, {index: "web.code.git.spide", args: [repos]})
|
||||
can.onimport.toolkit(can, {index: "web.code.git.trend", args: [repos]})
|
||||
can.onimport.toolkit(can, {index: "web.code.git.total", args: [repos]})
|
||||
can.onimport.project(can, msg.Option(nfs.PATH))
|
||||
can.onaction["工具"](event, can)
|
||||
can.base.isFunc(cb) && cb(msg)
|
||||
})
|
||||
},
|
||||
_content: function(can, target) { var height = can.Conf(html.HEIGHT)
|
||||
can.user.mod.isCmd && can.page.style(can, can._output, html.HEIGHT, can.Conf(html.HEIGHT))
|
||||
can.page.style(can, can.ui.project, html.MAX_HEIGHT, height)
|
||||
can.page.style(can, can.ui.content, html.MAX_HEIGHT, height)
|
||||
can.page.style(can, can.ui.display, html.DISPLAY, html.NONE)
|
||||
can.ui.toolkit = can.onappend.field(can, chat.STORY, {}, can._output)
|
||||
can.page.ClassList.add(can, can.ui.toolkit.fieldset, "toolkit")
|
||||
_project: function(can, target) {
|
||||
can.ui.project._show = function(event) {
|
||||
can.onimport._content(can)
|
||||
}
|
||||
},
|
||||
_output: function(can, target) {
|
||||
var ui = can.page.Append(can, can.ui.display, [{view: html.ACTION}, {view: html.OUTPUT}]); can.ui.output = ui.output
|
||||
|
||||
can.onappend._action(can, [cli.EXEC, cli.CLEAR, cli.CLOSE], ui.action, kit.Dict(
|
||||
cli.EXEC, function(event) { can.onaction[cli.EXEC](event, can) },
|
||||
cli.CLEAR, function(event) { can.onmotion.clear(can, can.ui.output) },
|
||||
cli.CLOSE, function(event) { can.onmotion.hidden(can, can.ui.display) },
|
||||
_content: function(can) { var height = can.Conf(html.HEIGHT)
|
||||
if (can.user.mod.isCmd) {
|
||||
can.page.style(can, can.ui.content, html.MAX_WIDTH, can.Conf(html.WIDTH)-can.ui.project.offsetWidth-33)
|
||||
can.page.style(can, can.ui.content, html.HEIGHT, height)
|
||||
can.page.style(can, can.ui.project, html.HEIGHT, height)
|
||||
can.page.style(can, can._output, html.WIDTH, can.Conf(html.WIDTH))
|
||||
} else {
|
||||
can.page.style(can, can.ui.content, html.MAX_HEIGHT, height)
|
||||
can.page.style(can, can.ui.project, html.MAX_HEIGHT, height)
|
||||
}
|
||||
},
|
||||
_profile: function(can, target) {
|
||||
var ui = can.page.Append(can, can.ui.profile, [{view: html.ACTION}, {view: html.OUTPUT}]); can.ui.profile_output = ui.output
|
||||
var action = can.onappend._action(can, [cli.EXEC, cli.CLEAR, cli.CLOSE], ui.action, kit.Dict(
|
||||
cli.EXEC, function(event) { can.onaction["展示"](event, can) },
|
||||
cli.CLEAR, function(event) { can.onmotion.clear(can, ui.output) },
|
||||
cli.CLOSE, function(event) { can.onmotion.hidden(can, can.ui.profile), can.onimport._content(can, target) },
|
||||
))
|
||||
can.ui.profile._show = function(event) {
|
||||
if (can.ui.profile.style.display == html.NONE) {
|
||||
action[cli.CLOSE](event)
|
||||
} else {
|
||||
can.onimport.profile(can)
|
||||
action[cli.EXEC](event)
|
||||
}
|
||||
}
|
||||
},
|
||||
_display: function(can, target) { can.ui.toolkit = can.onappend.field(can, "toolkit", {}, can._output)
|
||||
var ui = can.page.Append(can, can.ui.display, [{view: html.ACTION}, {view: html.OUTPUT}]); can.ui.output = ui.output
|
||||
var action = can.onappend._action(can, [cli.EXEC, cli.CLEAR, cli.CLOSE], ui.action, kit.Dict(
|
||||
cli.EXEC, function(event) { can.onaction["执行"](event, can) },
|
||||
cli.CLEAR, function(event) { can.onmotion.clear(can, can.ui.output) },
|
||||
cli.CLOSE, function(event) { can.onmotion.hidden(can, can.ui.display), can.onimport._content(can, target) },
|
||||
))
|
||||
can.ui.display._show = function(event) {
|
||||
if (can.ui.display.style.display == html.NONE) {
|
||||
action[cli.CLOSE](event)
|
||||
} else {
|
||||
can.onimport.display(can)
|
||||
action[cli.EXEC](event)
|
||||
}
|
||||
}
|
||||
},
|
||||
_search: function(can, target) {
|
||||
can.onengine.plugin(can, "can.code.inner.search", shy("搜索", {}, [
|
||||
{type: html.TEXT, name: "word", value: cli.MAIN}, {type: html.BUTTON, name: nfs.FIND}, {type: html.BUTTON, name: cli.BACK},
|
||||
], function(msg, cmds, cb) { can.misc.runAction(can, msg, cmds, cb, kit.Dict(
|
||||
nfs.FIND, function(cmds) { msg.Option(ice.MSG_HANDLE, ice.TRUE), msg.Option(ice.MSG_FIELDS, "file,line,text")
|
||||
can.run(msg._event, [ctx.ACTION, mdb.SEARCH, can.parse, cmds[0], can.Option(nfs.PATH)], function(msg) { var sub = msg._can
|
||||
can.page.style(can, sub._output, html.MAX_HEIGHT, 200)
|
||||
sub.Option("word", cmds[0])
|
||||
can.onmotion.hidden(can, can.ui.toolkit.fieldset, true), can.page.ClassList.has(sub, sub._target, html.SELECT) || sub._legend.click()
|
||||
sub.onmotion.clear(sub), sub.onappend.table(sub, msg, function(value, key, index, line) {
|
||||
return {text: ["", html.TD], list: [{text: [can.page.replace(can, value, ice.PWD, ""), html.DIV]}], onclick: function(event) {
|
||||
line.line && can.onimport.tabview(can, can.Option(nfs.PATH), line.file.replace(ice.PWD, ""), parseInt(line.line), function() {
|
||||
can.onaction.selectLine(can, line.line)
|
||||
})
|
||||
}}
|
||||
}, sub._output), sub.onappend._status(sub, msg.Option(ice.MSG_STATUS)), can.Status("标签数", msg.Length())
|
||||
}, true)
|
||||
},
|
||||
)) }))
|
||||
can.onimport.toolkit(can, {index: "can.code.inner.search"}, function(sub) { can.ui.search = sub })
|
||||
},
|
||||
_favor: function(can, target) {
|
||||
can.onimport.toolkit(can, {index: "web.code.git.spide", args: ["icebergs"]})
|
||||
can.onimport.toolkit(can, {index: "web.code.git.total", args: ["icebergs"]})
|
||||
can.onimport.toolkit(can, {index: "web.code.favor"}, function(sub) {
|
||||
sub.run = function(event, cmds, cb) { var msg = can.request(event)
|
||||
if (cmds && cmds[0] == ctx.ACTION) { switch (cmds[1]) {
|
||||
case code.INNER: can.onimport.tabview(can, msg.Option(nfs.PATH), msg.Option(nfs.FILE), msg.Option(nfs.LINE)); return
|
||||
} }
|
||||
if (can.misc.runAction(can, msg, cmds, cb, kit.Dict(
|
||||
code.INNER, function(cmds) {
|
||||
can.onimport.tabview(can, msg.Option(nfs.PATH), msg.Option(nfs.FILE), msg.Option(nfs.LINE))
|
||||
},
|
||||
))) { return }
|
||||
|
||||
can.run(event, can.misc.concat(can, [ctx.ACTION, code.FAVOR], cmds), function(msg) { var sub = msg._can;
|
||||
sub.onmotion.clear(sub), sub.onappend.table(sub, msg, function(value, key, index, line) {
|
||||
if (msg.append.length == 2 && msg.append[0] == mdb.KEY && msg.append[1] == mdb.VALUE) {
|
||||
if (key == mdb.VALUE) { key = line.key }
|
||||
}
|
||||
if (key != ctx.ACTION) {
|
||||
value = sub.base.replaceAll(value, "<", "<", ">", ">", "./", "")
|
||||
}
|
||||
if (key != ctx.ACTION) { value = sub.page.replace(sub, value, ice.PWD, "") }
|
||||
|
||||
return {text: ["", html.TD], list: [{text: [value, html.DIV]}], onclick: function(event) {
|
||||
if ([mdb.ZONE, mdb.ID].indexOf(key) > -1) {
|
||||
return sub.onaction.change(event, sub, key, value)
|
||||
if ([mdb.ZONE, mdb.ID].indexOf(key) > -1) { return sub.onaction.change(event, sub, key, value) }
|
||||
|
||||
if (target.tagName == "INPUT" && target.type == html.BUTTON) { var msg = sub.sup.request(event, line, sub.Option())
|
||||
return sub.run(event, [ctx.ACTION, target.name], function(msg) { sub.run() }, true)
|
||||
}
|
||||
|
||||
line.line && can.onimport.tabview(can, can.Option(nfs.PATH), line.file.replace("./", ""), parseInt(line.line), function() {
|
||||
line.line && can.onimport.tabview(can, can.Option(nfs.PATH), line.file.replace(ice.PWD, ""), parseInt(line.line), function() {
|
||||
can.onaction.selectLine(can, line.line)
|
||||
})
|
||||
}}
|
||||
@ -61,50 +122,10 @@ Volcanos("onimport", {help: "导入数据", _init: function(can, msg, cb, target
|
||||
}
|
||||
})
|
||||
},
|
||||
_search: function(can, target) {
|
||||
can.onengine.plugin(can, "code.inner.search", shy("搜索", {}, [
|
||||
{type: "text", name: "word", value: "main"},
|
||||
{type: "button", name: "find"},
|
||||
{type: "button", name: "back"},
|
||||
], function(msg, cmds, cb) { can.misc.runAction(can, msg, cmds, cb, {
|
||||
"find": function(cmds) { msg.Option(ice.MSG_HANDLE, ice.TRUE), msg.Option(ice.MSG_FIELDS, "file,line,text")
|
||||
can.run(msg._event, [ctx.ACTION, mdb.SEARCH, can.parse, cmds[0], can.Option(nfs.PATH)], function(msg) {
|
||||
var sub = msg._can; sub.onappend.table(sub, msg, function(value, key, index, line) {
|
||||
value = can.base.replaceAll(value, "<", "<", ">", ">", "./", "")
|
||||
return {text: ["", html.TD], list: [{text: [value, html.DIV]}], onclick: function(event) {
|
||||
line.line && can.onimport.tabview(can, can.Option(nfs.PATH), line.file.replace("./", ""), parseInt(line.line), function() {
|
||||
can.onaction.selectLine(can, line.line)
|
||||
})
|
||||
}}
|
||||
}, sub._output), sub.Status("标签数", msg.Length())
|
||||
}, true)
|
||||
},
|
||||
}) }))
|
||||
can.onimport.toolkit(can, {index: "can.code.inner.search"})
|
||||
},
|
||||
toolkit: function(can, meta, cb) {
|
||||
can.onappend.plugin(can, meta, function(sub) {
|
||||
sub.run = function(event, cmds, cb, silent) {
|
||||
can.run(event, can.misc.concat(can, [ctx.ACTION, ice.RUN, meta.index], cmds), cb, true)
|
||||
}
|
||||
sub.page.style(sub, sub._output, html.MAX_WIDTH, can.Conf(html.WIDTH))
|
||||
can.ui.toolkit.status.appendChild(sub._legend)
|
||||
sub._legend.onclick = function(event) {
|
||||
if (can.page.ClassList.has(can, sub._target, html.SELECT)) {
|
||||
can.page.ClassList.del(can, sub._target, html.SELECT)
|
||||
return
|
||||
}
|
||||
can.onmotion.select(can, can.ui.toolkit.output, html.FIELDSET, sub._target)
|
||||
can.onmotion.select(can, can.ui.toolkit.status, html.DIV_LEGEND, event.target)
|
||||
}
|
||||
sub._legend.ondblclick = sub._legend.onmouseenter, sub._legend.onmouseenter = function() {}
|
||||
can.base.isFunc(cb) && cb(sub)
|
||||
}, can.ui.toolkit.output)
|
||||
},
|
||||
|
||||
project: function(can, path) { can.Option({path: path})
|
||||
var msg = can.request({}, {dir_root: path, dir_deep: true})
|
||||
can.run(msg._event, ["./"], function(msg) { can.onmotion.clear(can, can.ui.project)
|
||||
can.run(msg._event, [ice.PWD], function(msg) { can.onmotion.clear(can, can.ui.project)
|
||||
can.onappend.tree(can, msg.Table(), nfs.PATH, ice.PS, function(event, item) {
|
||||
can.onimport.tabview(can, path, item.path)
|
||||
}, can.ui.project), can.Status("文件数", msg.Length())
|
||||
@ -124,11 +145,49 @@ Volcanos("onimport", {help: "导入数据", _init: function(can, msg, cb, target
|
||||
msg.Option({path: path, file: file, line: line||1})
|
||||
msg._tab = can.onappend.tabs(can, [{name: file.split(ice.PS).pop(), text: file}], function(event, meta) {
|
||||
can.onimport.tabview(can, path, file, "", cb)
|
||||
}, function(item) {
|
||||
delete(can.tabview[path+file])
|
||||
}), can.core.Timer(10, function() { msg._tab.click() })
|
||||
}, function(item) { delete(can.tabview[path+file]) })
|
||||
}, true)
|
||||
},
|
||||
profile: function(can, msg) {
|
||||
if (msg) {
|
||||
can.onappend.table(can, msg, null, can.ui.profile_output)
|
||||
can.onappend.board(can, msg.Result(), can.ui.profile_output)
|
||||
}
|
||||
can.page.style(can, can.ui.profile, html.DISPLAY, html.BLOCK)
|
||||
can.page.style(can, can.ui.profile, html.HEIGHT, can.ui.content.offsetHeight)
|
||||
},
|
||||
display: function(can, msg) {
|
||||
if (msg) {
|
||||
can.onappend.table(can, msg, null, can.ui.output||can.ui.display)
|
||||
can.onappend.board(can, msg.Result(), can.ui.output||can.ui.display)
|
||||
}
|
||||
can.page.style(can, can.ui.display, html.DISPLAY, html.BLOCK)
|
||||
can.page.style(can, can.ui.output, html.HEIGHT, 200)
|
||||
can.page.style(can, can.ui.content, html.HEIGHT, can.ui.project.offsetHeight-200-1*html.ACTION_HEIGHT)
|
||||
can.page.style(can, can.ui.profile, html.HEIGHT, can.ui.content.offsetHeight)
|
||||
},
|
||||
toolkit: function(can, meta, cb) {
|
||||
can.onappend.plugin(can, meta, function(sub) {
|
||||
sub.run = function(event, cmds, cb, silent) {
|
||||
can.run(event, can.misc.concat(can, [ctx.ACTION, ice.RUN, meta.index], cmds), cb, true)
|
||||
}
|
||||
sub.Conf(html.HEIGHT, 400), sub.Conf(html.WIDTH, can.Conf(html.WIDTH))
|
||||
sub.page.style(sub, sub._output, html.MAX_WIDTH, can.Conf(html.WIDTH))
|
||||
sub.page.style(sub, sub._output, html.MAX_HEIGHT, can.Conf(html.HEIGHT)-2*html.ACTION_HEIGHT)
|
||||
|
||||
can.ui.toolkit.status.appendChild(sub._legend)
|
||||
sub._legend.onclick = function(event) {
|
||||
if (can.page.ClassList.has(can, sub._target, html.SELECT)) {
|
||||
can.page.ClassList.del(can, sub._target, html.SELECT)
|
||||
return
|
||||
}
|
||||
can.onmotion.select(can, can.ui.toolkit.output, html.FIELDSET, sub._target)
|
||||
can.onmotion.select(can, can.ui.toolkit.status, html.DIV_LEGEND, event.target)
|
||||
}
|
||||
sub._legend.oncontextmenu = sub._legend.onmouseenter, sub._legend.onmouseenter = function() {}
|
||||
can.base.isFunc(cb) && cb(sub)
|
||||
}, can.ui.toolkit.output)
|
||||
},
|
||||
}, [""])
|
||||
Volcanos("onsyntax", {help: "语法高亮", list: ["keyword", "prefix", "line"], _init: function(can, msg) {
|
||||
can._cache_list = can._cache_list||{}, can._cache_list[can.file] = {current: can.current, max: can.max}
|
||||
@ -137,7 +196,7 @@ Volcanos("onsyntax", {help: "语法高亮", list: ["keyword", "prefix", "line"],
|
||||
can.parse = can.base.Ext(can.file), can.Status("模式", "normal")
|
||||
can.onmotion.select(can, can._action, chat.DIV_TABS, msg._tab)
|
||||
return can.file
|
||||
}, can.ui.content, can.ui.profile, can.ui.output)) {
|
||||
}, can.ui.content, can.ui.profile_output, can.ui.output)) {
|
||||
return can.onaction.selectLine(can, parseInt(msg.Option(nfs.LINE)))
|
||||
}
|
||||
|
||||
@ -149,7 +208,7 @@ Volcanos("onsyntax", {help: "语法高亮", list: ["keyword", "prefix", "line"],
|
||||
init(p = can.onsyntax[can.parse] = can.base.Obj(msg.Result()))
|
||||
}, true): init(p)
|
||||
},
|
||||
_parse: function(can, line) { line = can.base.replaceAll(line||"", "<", "<", ">", ">")
|
||||
_parse: function(can, line) { line = can.page.replace(can, line||"")
|
||||
var p = can.onsyntax[can.parse]; if (!p) { return line }
|
||||
p = can.onsyntax[p.link]||p
|
||||
|
||||
@ -180,20 +239,28 @@ Volcanos("onsyntax", {help: "语法高亮", list: ["keyword", "prefix", "line"],
|
||||
},
|
||||
})
|
||||
Volcanos("onaction", {help: "控件交互", list: ["项目", "工具"],
|
||||
"项目": function(event, can) {
|
||||
can.onmotion.toggle(can, can.ui.project)
|
||||
can.onimport._content(can)
|
||||
},
|
||||
|
||||
"展示": function(event, can) { var msg = can.request(event, {_toast: "运行中..."})
|
||||
can.run(event, [ctx.ACTION, mdb.ENGINE, can.parse, can.Option(nfs.FILE), can.Option(nfs.PATH)], function(msg) {
|
||||
can.onimport.profile(can, msg)
|
||||
}, true)
|
||||
},
|
||||
"执行": function(event, can) { var msg = can.request(event, {_toast: "运行中..."})
|
||||
can.run(event, [ctx.ACTION, mdb.ENGINE, can.parse, can.Option(nfs.FILE), can.Option(nfs.PATH)], function(msg) {
|
||||
can.onimport.display(can, msg)
|
||||
}, true)
|
||||
},
|
||||
"工具": function(event, can) { can.onmotion.toggle(can, can.ui.toolkit.fieldset) },
|
||||
|
||||
back: function(event, can) {
|
||||
var last = can.history.pop(); last = can.history.pop()
|
||||
last && can.onimport.tabview(can, last.path, last.file, last.line)
|
||||
can.Status("跳转数", can.history.length)
|
||||
},
|
||||
"项目": function(event, can) { can.onmotion.toggle(can, can.ui.project) },
|
||||
"工具": function(event, can) { can.onmotion.toggle(can, can.ui.toolkit.fieldset) },
|
||||
exec: function(event, can) { var msg = can.request(event, {_toast: "运行中..."})
|
||||
can.run(event, [ctx.ACTION, mdb.ENGINE, can.parse, can.Option(nfs.FILE), can.Option(nfs.PATH)], function(msg) {
|
||||
can.onappend.table(can, msg, null, can.ui.output||can.ui.display)
|
||||
can.onappend.board(can, msg.Result(), can.ui.output||can.ui.display)
|
||||
can.page.style(can, can.ui.display, html.DISPLAY, html.BLOCK)
|
||||
}, true)
|
||||
},
|
||||
|
||||
appendLine: function(can, value) {
|
||||
var ui = can.page.Append(can, can.ui.content, [{type: html.TR, list: [
|
||||
@ -271,30 +338,12 @@ Volcanos("onaction", {help: "控件交互", list: ["项目", "工具"],
|
||||
}
|
||||
} can.onkeymap && can.onkeymap.selectLine(can)
|
||||
},
|
||||
searchLine: function(event, can, value) { value = value.trim()
|
||||
can.page.Modify(can, can.ui.search, {style: {display: ""}})
|
||||
value = can.ui.word.value = value||can.ui.word.value||"main"
|
||||
|
||||
can.request(event, kit.Dict(ice.MSG_HANDLE, ice.TRUE, ice.MSG_FIELDS, "file,line,text"))
|
||||
can.run(event, [ctx.ACTION, mdb.SEARCH, can.parse, value, can.Option(nfs.PATH)], function(msg) {
|
||||
can.onmotion.hidden(can, can.ui.search, true)
|
||||
can.onmotion.clear(can, can.ui.tags)
|
||||
can.onappend.table(can, msg, function(value, key, index, line) {
|
||||
value = can.base.replaceAll(value, "<", "<", ">", ">", "./", "")
|
||||
|
||||
return {text: ["", html.TD], list: [{text: [value, html.DIV]}], onclick: function(event) {
|
||||
line.line && can.onimport.tabview(can, can.Option(nfs.PATH), line.file.replace("./", ""), parseInt(line.line), function() {
|
||||
can.onaction.selectLine(can, line.line)
|
||||
})
|
||||
}}
|
||||
}, can.ui.tags), can.Status("标签数", msg.Length())
|
||||
}, true)
|
||||
searchLine: function(event, can, value) { if (!can.ui.search) { return }
|
||||
can.ui.search.Update(event, [ctx.ACTION, nfs.FIND, value.trim()])
|
||||
},
|
||||
_searchLine: function(can, ui) {
|
||||
var s = document.getSelection().toString()
|
||||
var str = ui.text.innerText
|
||||
var begin = str.indexOf(s)
|
||||
var end = begin+s.length
|
||||
var s = document.getSelection().toString(), str = ui.text.innerText
|
||||
var begin = str.indexOf(s), end = begin+s.length
|
||||
|
||||
for (var i = begin; i >= 0; i--) {
|
||||
if (str[i].match(/[a-zA-Z0-9_.]/)) {
|
||||
|
@ -36,10 +36,6 @@ fieldset.inner>div.output input.command.insert {
|
||||
display:none;
|
||||
}
|
||||
|
||||
fieldset.inner>div.output div.display {
|
||||
border:solid 1px greenyellow;
|
||||
padding:10px;
|
||||
}
|
||||
fieldset.inner>div.output div.display input.cmd {
|
||||
font-size:16px; font-family:monospace;
|
||||
background-color:black; color:white;
|
||||
@ -50,6 +46,6 @@ fieldset.inner>div.output div.display div.output {
|
||||
overflow:auto;
|
||||
}
|
||||
fieldset.inner>div.output div.display div.output {
|
||||
max-height:160px;
|
||||
/* max-height:160px; */
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ Volcanos("onaction", {help: "用户操作", list: ["编辑", [ice.VIEW, "横向"
|
||||
_draw_horizontal: function(can, tree, x, y) { tree.x = x, tree.y = y
|
||||
can.onaction._draw(can, tree, x, y+tree.height*can.size/2, {"text-anchor": "start"})
|
||||
|
||||
tree.width = tree.view.Val("textLength")
|
||||
tree.width = tree.view.Val("textLength")||(tree.name||"").length*10
|
||||
if (x+tree.width > can.width) { can.width = x+tree.width }
|
||||
if (tree.hide) { return }
|
||||
|
||||
|
4
proto.js
4
proto.js
@ -11,6 +11,7 @@ var ice = {
|
||||
RUN: "run", RES: "res", ERR: "err",
|
||||
|
||||
OK: "ok", TRUE: "true", FALSE: "false", SUCCESS: "success", FAILURE: "failure", PROCESS: "process",
|
||||
PWD: "./",
|
||||
|
||||
AUTO: "auto", HELP: "help", HTTP: "http",
|
||||
VIEW: "view", MODE: "mode", SHIP: "ship",
|
||||
@ -100,6 +101,7 @@ var nfs = {
|
||||
PATH: "path", FILE: "file", LINE: "line", SIZE: "size",
|
||||
DIR: "dir", CAT: "cat", TRASH: "trash",
|
||||
DIR_ROOT: "dir_root",
|
||||
FIND: "find", GREP: "grep",
|
||||
}
|
||||
var tcp = {
|
||||
HOST: "host", PORT: "port",
|
||||
@ -223,7 +225,7 @@ var html = {
|
||||
STROKE_WIDTH: "stroke-width", STROKE: "stroke", FILL: "fill", FONT_SIZE: "font-size", MONOSPACE: "monospace",
|
||||
SCROLL: "scroll", HEIGHT: "height", WIDTH: "width", LEFT: "left", TOP: "top", RIGHT: "right", BOTTOM: "bottom",
|
||||
MAX_HEIGHT: "max-height", MAX_WIDTH: "max-width", MARGIN_X: "margin-x", MARGIN_Y: "margin-y",
|
||||
PLUGIN_MARGIN: 10, ACTION_HEIGHT: 26, ACTION_MARGIN: 200,
|
||||
PLUGIN_MARGIN: 10, ACTION_HEIGHT: 27, ACTION_MARGIN: 200,
|
||||
|
||||
FIXED: "fixed",
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user