mirror of
https://shylinux.com/x/volcanos
synced 2025-04-25 16:58:06 +08:00
opt some
This commit is contained in:
parent
1f918afb98
commit
54de21d8b9
7
frame.js
7
frame.js
@ -99,9 +99,9 @@ Volcanos(chat.ONENGINE, {help: "搜索引擎", _init: function(can, meta, list,
|
|||||||
name = can.base.trimPrefix(name, "can.")
|
name = can.base.trimPrefix(name, "can.")
|
||||||
var type = html.TEXT; command.list = can.core.List(command.list, function(item) {
|
var type = html.TEXT; command.list = can.core.List(command.list, function(item) {
|
||||||
switch (typeof item) {
|
switch (typeof item) {
|
||||||
case lang.STRING: return can.core.SplitInput(item)
|
case lang.STRING: item = can.core.SplitInput(item, type)
|
||||||
case lang.OBJECT: return type = item.type||type, item
|
} type = item.type
|
||||||
}
|
return item
|
||||||
}), command.can = can, arguments.callee.meta[name] = command
|
}), command.can = can, arguments.callee.meta[name] = command
|
||||||
}),
|
}),
|
||||||
listen: shy("监听事件", function(can, name, cb) {
|
listen: shy("监听事件", function(can, name, cb) {
|
||||||
@ -409,6 +409,7 @@ Volcanos(chat.ONAPPEND, {help: "渲染引擎", _init: function(can, meta, list,
|
|||||||
}
|
}
|
||||||
return run([ctx.ACTION, target.name])
|
return run([ctx.ACTION, target.name])
|
||||||
}
|
}
|
||||||
|
can.sup && can.sup.onexport && can.sup.onexport.record && can.sup.onexport.record(can.sup, line)
|
||||||
if (key == mdb.HASH && can.user.mod.isDiv) { return can.user.jumps("/chat/div/"+value) }
|
if (key == mdb.HASH && can.user.mod.isDiv) { return can.user.jumps("/chat/div/"+value) }
|
||||||
if (can.sup.onaction.change(event, can.sup, key, event.target.innerText).length == 0) {
|
if (can.sup.onaction.change(event, can.sup, key, event.target.innerText).length == 0) {
|
||||||
can.sup && can.sup._item_click && can.sup._item_click(value, key)
|
can.sup && can.sup._item_click && can.sup._item_click(value, key)
|
||||||
|
@ -273,6 +273,7 @@ Volcanos("user", {help: "用户操作", info: {}, agent: {
|
|||||||
need[item.name] = item.need
|
need[item.name] = item.need
|
||||||
|
|
||||||
item._init = function(target) {
|
item._init = function(target) {
|
||||||
|
item._enter = function(event) { action.submit(event, can, "submit") }
|
||||||
item.run = function(event, cmds, cb) {
|
item.run = function(event, cmds, cb) {
|
||||||
var _msg = can.request(event, {_handle: ice.TRUE, action: msg.Option(html.ACTION)}, msg, can.Option())
|
var _msg = can.request(event, {_handle: ice.TRUE, action: msg.Option(html.ACTION)}, msg, can.Option())
|
||||||
can.page.Select(can, ui.table, html.OPTION_ARGS, function(item) {
|
can.page.Select(can, ui.table, html.OPTION_ARGS, function(item) {
|
||||||
|
@ -46,6 +46,7 @@ Volcanos(chat.ONFIGURE, {help: "控件详情", key: {
|
|||||||
},
|
},
|
||||||
onkeydown: function(event, can, meta, cb, target, last) {
|
onkeydown: function(event, can, meta, cb, target, last) {
|
||||||
switch (event.key) {
|
switch (event.key) {
|
||||||
|
case "Enter": meta._enter && meta._enter(event); break
|
||||||
case "Escape": target._can? target._can.close(): target.blur(); return
|
case "Escape": target._can? target._can.close(): target.blur(); return
|
||||||
case "Tab": target._can && target._can.close(); return
|
case "Tab": target._can && target._can.close(); return
|
||||||
case "n":
|
case "n":
|
||||||
|
@ -421,6 +421,9 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
|
|||||||
},
|
},
|
||||||
toolkit: function(can, meta, cb) { meta.msg = true
|
toolkit: function(can, meta, cb) { meta.msg = true
|
||||||
can.onimport.plug(can, meta, can.ui.toolkit.output, function(sub) {
|
can.onimport.plug(can, meta, can.ui.toolkit.output, function(sub) {
|
||||||
|
sub.onexport.record = function(sub, line) { if (!line.file && !line.line) { return }
|
||||||
|
can.onimport.tabview(can, line.path||can.Option(nfs.PATH), can.base.trimPrefix(line.file, nfs.PWD)||can.Option(nfs.FILE), parseInt(line.line)), can.current.scroll(can.current.scroll()-4)
|
||||||
|
}
|
||||||
sub.onimport.size(sub, can.ConfHeight()/2, can.ConfWidth() - can.ui.profile.offsetWidth, true)
|
sub.onimport.size(sub, can.ConfHeight()/2, can.ConfWidth() - can.ui.profile.offsetWidth, true)
|
||||||
can._status.appendChild(sub._legend), sub._legend.onclick = function(event) {
|
can._status.appendChild(sub._legend), sub._legend.onclick = function(event) {
|
||||||
if (can.page.Select(can, can._status, ice.PT+html.SELECT)[0] == event.target) {
|
if (can.page.Select(can, can._status, ice.PT+html.SELECT)[0] == event.target) {
|
||||||
@ -437,7 +440,7 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
exts: function(can, url, cb) {
|
exts: function(can, url, cb) {
|
||||||
can.require([url], function() {}, function(can, name, sub) { name == chat.ONIMPORT && sub._init(can, can.base.ParseURL(sub._path), function(sub) {
|
can.require([url], function() {}, function(can, name, sub) { sub._init(can, sub, function(sub) {
|
||||||
can.extentions[url.split("?")[0]] = sub, can.base.isFunc(cb)? cb(sub): sub.select()
|
can.extentions[url.split("?")[0]] = sub, can.base.isFunc(cb)? cb(sub): sub.select()
|
||||||
}) })
|
}) })
|
||||||
},
|
},
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, args, cb) {
|
Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, cb) {
|
||||||
can.onimport.toolkit(can, {index: "web.code.favor"}, function(sub) {
|
can.onimport.toolkit(can, {index: "web.code.favor"}, function(sub) {
|
||||||
sub.run = function(event, cmds, cb) { var msg = can.request(event)
|
sub.run = function(event, cmds, cb) { var msg = can.request(event)
|
||||||
if (can.misc.runAction(can, msg, cmds, cb, kit.Dict(
|
if (can.misc.runAction(can, msg, cmds, cb, kit.Dict(
|
||||||
|
@ -1,55 +1,17 @@
|
|||||||
Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, args, cb) { var history = []; const SEARCH = "can.code.inner.search"
|
Volcanos(chat.ONPLUGIN, {help: "导入数据", _init: function(can, sub, cb) { const SEARCH = "can.code.inner.search"; var history = []
|
||||||
function show(msg, word) { if (!msg) { return } history.push(msg); var sub = msg._can; sub.Option("word", word||msg._word)
|
can.onengine.plugin(can, SEARCH, shy("搜索", {}, ["word=main", "filter", "grep:button", "make", "history", "last"], function(can, msg, cmds, cb) { can.misc.runAction(can, msg, cmds, cb, kit.Dict(
|
||||||
!sub.page.ClassList.has(sub, sub._legend, "select") && can.ui.search.select()
|
nfs.GREP, function(cmds) { can.runAction(msg, nfs.GREP, [cmds[0]], function(msg) { show(msg, cmds[0]) }) },
|
||||||
|
"history", function(cmds) { can.core.List(can.history, function(item) { msg.PushRecord(item) }), show(msg) },
|
||||||
|
"last", function(cmds) { history.pop(), show(history.pop()) },
|
||||||
|
)) })), can.onimport.toolkit(can, {index: SEARCH}, function(sub) { can.ui.search = sub, can.base.isFunc(cb) && cb(sub) })
|
||||||
|
|
||||||
|
function show(msg, word) { if (!msg) { return } history.push(msg); var sub = msg._can
|
||||||
|
sub.onimport.size(sub, can.ConfHeight()/4, can.ConfWidth()-can.ui.project.offsetWidth, true)
|
||||||
sub.onmotion.clear(sub), sub.onappend.table(sub, msg, function(value, key, index, line) {
|
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) {
|
return {text: ["", html.TD], list: [{text: [can.base.trimPrefix(value, nfs.PWD), html.DIV]}], onclick: function(event) { if (!line.line) { return }
|
||||||
line.line && can.onimport.tabview(can, line.path||can.Option(nfs.PATH), line.file.replace(ice.PWD, ""), parseInt(line.line))
|
can.onimport.tabview(can, line.path||can.Option(nfs.PATH), can.base.trimPrefix(line.file, nfs.PWD)||can.Option(nfs.FILE), parseInt(line.line)), can.current.scroll(can.current.scroll()-4)
|
||||||
}}
|
}}
|
||||||
}, sub._output), sub.onappend.board(sub, msg.Result()), sub.onappend._status(sub, msg.Option(ice.MSG_STATUS))
|
}, sub._output), sub.onappend.board(sub, msg.Result()), sub.onappend._status(sub, msg.Option(ice.MSG_STATUS))
|
||||||
|
!sub.page.ClassList.has(sub, sub._legend, html.SELECT) && sub.select(), sub.Focus(), sub.Option("word", word||msg._word||"")
|
||||||
}
|
}
|
||||||
can.onengine.plugin(can, SEARCH, shy("搜索", {}, [
|
|
||||||
{type: html.TEXT, name: "word", value: cli.MAIN, onkeydown: function(event, can) {
|
|
||||||
can.onmotion.selectTable(event, can.sup, event.target, function(tr) {
|
|
||||||
can.page.Select(can, tr, html.TD, function(td, index) { index == 0 && td.click() })
|
|
||||||
tr.scrollIntoView(), can._output.scrollTop -= 60
|
|
||||||
})
|
|
||||||
if (event.key == lang.ENTER) { can.sup.Update(event, [ctx.ACTION, event.ctrlKey? nfs.GREP: nfs.TAGS, can.sup.Option("word")]) }
|
|
||||||
if (event.key == lang.ESCAPE) { event.target.blur() }
|
|
||||||
}},
|
|
||||||
{type: html.TEXT, name: "filter", value: "", onkeydown: function(event, can) {
|
|
||||||
can.onmotion.selectInputTable(event, can.sup, null, event.target)
|
|
||||||
if (event.key == lang.ENTER) { can.sup.Update(event, [ctx.ACTION, event.ctrlKey? nfs.GREP: nfs.TAGS, can.sup.Option("word")]) }
|
|
||||||
if (event.key == lang.ESCAPE) { event.target.blur() }
|
|
||||||
}},
|
|
||||||
{type: html.BUTTON, name: nfs.TAGS},
|
|
||||||
{type: html.BUTTON, name: nfs.GREP},
|
|
||||||
{type: html.BUTTON, name: cli.MAKE},
|
|
||||||
{type: html.BUTTON, name: "history"},
|
|
||||||
{type: html.BUTTON, name: "last", _trans: "返回"},
|
|
||||||
], function(can, msg, cmds, cb) { if (can.misc.runAction(can, msg, cmds, cb, kit.Dict(
|
|
||||||
"history", function(cmds) {
|
|
||||||
can.core.List(can.history, function(item) {
|
|
||||||
msg.Push(nfs.FILE, item.file)
|
|
||||||
msg.Push(nfs.LINE, item.line)
|
|
||||||
msg.Push(mdb.TEXT, item.text)
|
|
||||||
})
|
|
||||||
show(msg)
|
|
||||||
},
|
|
||||||
nfs.TAGS, function(cmds) { msg.Option(kit.Dict(ice.MSG_HANDLE, ice.TRUE, ice.MSG_FIELDS, "path,file,line,text"))
|
|
||||||
can.runAction(msg, 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, can.ConfHeight()/4), show(msg, msg._word = cmds[0])
|
|
||||||
can.page.ClassList.has(sub, sub._target, html.SELECT) || sub._legend.click()
|
|
||||||
can.onmotion.focus(can, msg._can._inputs["word"]._target)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
nfs.GREP, function(cmds) { msg.Option(kit.Dict(ice.MSG_HANDLE, ice.TRUE, ice.MSG_FIELDS, "file,line,text", nfs.PATH, can.Option(nfs.PATH)))
|
|
||||||
can.runAction(msg, nfs.GREP, [cmds[0]], function(msg) { var sub = msg._can
|
|
||||||
can.page.style(can, sub._output, html.MAX_HEIGHT, can.ConfHeight()/4), show(msg, msg._word = cmds[0])
|
|
||||||
can.page.ClassList.has(sub, sub._target, html.SELECT) || sub._legend.click()
|
|
||||||
can.onmotion.focus(can, msg._can._inputs["word"]._target)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
"last", function(cmds) { history.pop(), show(history.pop()) },
|
|
||||||
))) { return } can.run(msg, cmds, function(msg) { show(msg) }, true) }))
|
|
||||||
can.onimport.toolkit(can, {index: SEARCH}, function(sub) { can.ui.search = sub, can.ui.search._show = show, can.base.isFunc(cb) && cb(sub) })
|
|
||||||
}})
|
}})
|
||||||
|
@ -232,5 +232,6 @@ Volcanos(chat.ONACTION, {help: "交互操作", list: [
|
|||||||
})
|
})
|
||||||
Volcanos(chat.ONEXPORT, {help: "导出数据",
|
Volcanos(chat.ONEXPORT, {help: "导出数据",
|
||||||
actionHeight: function(can) { return can._action.style.display == html.NONE || can._action.innerHTML == ""? 0: html.ACTION_HEIGHT },
|
actionHeight: function(can) { return can._action.style.display == html.NONE || can._action.innerHTML == ""? 0: html.ACTION_HEIGHT },
|
||||||
statusHeight: function(can) { return can._status.style.display == html.NONE || can._status.innerHTML == "" || can._status.offsetHeight == 0? 0: html.ACTION_HEIGHT }
|
statusHeight: function(can) { return can._status.style.display == html.NONE || can._status.innerHTML == "" || can._status.offsetHeight == 0? 0: html.ACTION_HEIGHT },
|
||||||
|
record: function(can, line) {},
|
||||||
})
|
})
|
||||||
|
1
proto.js
1
proto.js
@ -83,6 +83,7 @@ var cli = {
|
|||||||
SHOW: "show", FULL: "full",
|
SHOW: "show", FULL: "full",
|
||||||
}
|
}
|
||||||
var nfs = {
|
var nfs = {
|
||||||
|
PWD: "./",
|
||||||
ZML: "zml", IML: "iml", TXT: "txt",
|
ZML: "zml", IML: "iml", TXT: "txt",
|
||||||
HTML: "html", CSS: "css", JS: "js", GO: "go", SH: "sh", CSV: "csv", JSON: "json",
|
HTML: "html", CSS: "css", JS: "js", GO: "go", SH: "sh", CSV: "csv", JSON: "json",
|
||||||
PATH: "path", FILE: "file", LINE: "line", SIZE: "size",
|
PATH: "path", FILE: "file", LINE: "line", SIZE: "size",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user