forked from x/volcanos
opt some
This commit is contained in:
parent
1b92d0fbba
commit
cf209601e1
@ -130,6 +130,8 @@ Volcanos("misc", {help: "通信协议", Message: function(event, can) { var msg
|
|||||||
Run: function(event, can, dataset, cmds, cb) {
|
Run: function(event, can, dataset, cmds, cb) {
|
||||||
var msg = can.request(event||{}), skip = {_handle: true}
|
var msg = can.request(event||{}), skip = {_handle: true}
|
||||||
var form = {cmds: cmds||msg.cmd}; msg.option && msg.option.forEach(function(item) {
|
var form = {cmds: cmds||msg.cmd}; msg.option && msg.option.forEach(function(item) {
|
||||||
|
if (typeof msg.Option(item) == lang.OBJECT) { return }
|
||||||
|
if (typeof msg.Option(item) == lang.FUNCTION) { return }
|
||||||
!skip[item] && msg[item] && (form[item] = msg[item])
|
!skip[item] && msg[item] && (form[item] = msg[item])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -10,17 +10,23 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
|
|||||||
|
|
||||||
var hash = can.sup._hash||(location.hash||"#").slice(1)||true, list = msg.Table(function(value) {
|
var hash = can.sup._hash||(location.hash||"#").slice(1)||true, list = msg.Table(function(value) {
|
||||||
var item = can.onimport._item(can, value); value.hash == hash && (item.click(), hash = false)
|
var item = can.onimport._item(can, value); value.hash == hash && (item.click(), hash = false)
|
||||||
});
|
}); hash && can.onimport._create(can, [mdb.TYPE, "", mdb.NAME, "term"])
|
||||||
hash && can.onimport._create(can, [mdb.TYPE, "", mdb.NAME, "term"])
|
|
||||||
}, 500) })
|
}, 500) })
|
||||||
},
|
},
|
||||||
layout: function(can) {
|
layout: function(can) {
|
||||||
can.page.style(can, can.ui.content, html.HEIGHT, can.ConfHeight(), html.WIDTH, can.ConfWidth())
|
can.page.style(can, can.ui.content, html.HEIGHT, can.ConfHeight(), html.WIDTH, can.ConfWidth())
|
||||||
var term = can.ui.content._term; if (!term) { return }
|
var term = can.ui.content._term; if (!term) { return }
|
||||||
term._fit.fit(), can.onexport.term(can, term._item, term)
|
term._fit.fit(), can.onexport.term(can, term)
|
||||||
},
|
},
|
||||||
_size: function(can, item, size) {
|
_item: function(can, item) {
|
||||||
can.runAction(can.request({}, size, item), "resize", [], function() {})
|
item._menu = shy(can.ondetail, can.ondetail.list, function(event, button, meta) {
|
||||||
|
can.request(event, item, item.extra), meta[button](event, can, button, item)
|
||||||
|
})
|
||||||
|
return item._item = can.onimport.item(can, item, function(event) {
|
||||||
|
item._tabs? item._tabs.click(): item._tabs = can.onimport.tabs(can, [item], function(event) {
|
||||||
|
can.onimport._connect(can, item)
|
||||||
|
}), item._plugin && can.onmotion.toggle(can, item._plugin._target, true)
|
||||||
|
}, function(event) { can.user.carteRight(event, can, can.ondetail, can.ondetail.list, item._menu) })
|
||||||
},
|
},
|
||||||
_create: function(can, args, data) {
|
_create: function(can, args, data) {
|
||||||
can.runAction({}, mdb.CREATE, args, function(msg) {
|
can.runAction({}, mdb.CREATE, args, function(msg) {
|
||||||
@ -28,31 +34,11 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
|
|||||||
can.page.insertBefore(can, current, can.ui.project.firstChild).click()
|
can.page.insertBefore(can, current, can.ui.project.firstChild).click()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
_input: function(can, item, val) {
|
|
||||||
can.runAction(can.request({}, item), "input", [btoa(val)], function() {})
|
|
||||||
},
|
|
||||||
_item: function(can, item) {
|
|
||||||
item._menu = shy(can.ondetail, can.ondetail.list, function(event, button, meta) {
|
|
||||||
can.request(event, item, item.extra), meta[button](event, can, button, item)
|
|
||||||
})
|
|
||||||
return item._item = can.onimport.item(can, item, function(event) {
|
|
||||||
item._plugin && can.onmotion.toggle(can, item._plugin._target, true)
|
|
||||||
item._tabs? item._tabs.click(): item._tabs = can.onimport.tabs(can, [item], function(event) {
|
|
||||||
can.onimport._connect(can, item)
|
|
||||||
})
|
|
||||||
}, function(event) {
|
|
||||||
can.user.carteRight(event, can, can.ondetail, can.ondetail.list, item._menu)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
_plug: function(can, item) { can.onmotion.clear(can, can.ui.profile)
|
|
||||||
can.onimport.plug(can, item.extra, can.ui.profile, function(sub) { item._plugin = sub
|
|
||||||
can.page.style(can, sub._output, html.MAX_WIDTH, can.ConfWidth()*3/4)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
_connect: function(can, item, target) { target = target||can.ui.content
|
_connect: function(can, item, target) { target = target||can.ui.content
|
||||||
can.sup._hash = item.hash, can.isCmdMode() && (location.hash = item.hash)
|
can.sup._hash = item.hash, can.isCmdMode() && (location.hash = item.hash)
|
||||||
if (can.onmotion.cache(can, function() { return item.hash }, target, can.ui.profile)) {
|
if (can.onmotion.cache(can, function() { return item.hash }, target, can.ui.profile)) {
|
||||||
return item._term.focus(), can.onexport.term(can, item, item._term)
|
can.runAction(can.request(event, item), "select"), item._term.focus()
|
||||||
|
return can.onexport.term(can, item._term)
|
||||||
}
|
}
|
||||||
|
|
||||||
item.extra = can.base.Obj(item.extra, {})
|
item.extra = can.base.Obj(item.extra, {})
|
||||||
@ -61,7 +47,6 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
|
|||||||
term.loadAddon(new WebLinksAddon.WebLinksAddon())
|
term.loadAddon(new WebLinksAddon.WebLinksAddon())
|
||||||
|
|
||||||
term.open(target||can.ui.content)
|
term.open(target||can.ui.content)
|
||||||
term.onCursorMove(function(e) { can.onexport.term(can, item, term) })
|
|
||||||
term.onResize(function(size) { can.onimport._size(can, item, size) })
|
term.onResize(function(size) { can.onimport._size(can, item, size) })
|
||||||
fitAddon.fit()
|
fitAddon.fit()
|
||||||
|
|
||||||
@ -79,17 +64,29 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
|
|||||||
default: keyskip = false
|
default: keyskip = false
|
||||||
} }
|
} }
|
||||||
submode = event.ctrlKey && event.key == "g"
|
submode = event.ctrlKey && event.key == "g"
|
||||||
can.onexport.term(can, item, term)
|
can.onexport.term(can, term)
|
||||||
})
|
})
|
||||||
term.onData(function(val) {
|
term.onData(function(val) {
|
||||||
if (submode || keyskip) { keyskip = false; return }
|
if (submode || keyskip) { keyskip = false; return }
|
||||||
can.onimport._input(can, item, val)
|
can.onimport._input(can, item, val)
|
||||||
})
|
})
|
||||||
term.onTitleChange(function(title) { can.isCmdMode() && can.user.title(title) })
|
term.onTitleChange(function(title) { can.isCmdMode() && can.user.title(title) })
|
||||||
|
term.onCursorMove(function(e) { can.onexport.term(can, term) })
|
||||||
|
|
||||||
can.term[item.hash] = item._term = target._term = term, term._target = target, term._item = item
|
can.term[item.hash] = item._term = target._term = term, term._target = target, term._item = item
|
||||||
can.runAction(can.request(event, item), "select"), can.onimport._plug(can, item)
|
can.runAction(can.request(event, item), "select"), item._term.focus()
|
||||||
return item._term.focus(), can.onexport.term(can, item, term)
|
return can.onimport._plug(can, item), can.onexport.term(can, term)
|
||||||
|
},
|
||||||
|
_input: function(can, item, val) {
|
||||||
|
can.runAction(can.request({}, item), "input", [btoa(val)], function() {})
|
||||||
|
},
|
||||||
|
_size: function(can, item, size) {
|
||||||
|
can.runAction(can.request({}, size, item), "resize", [])
|
||||||
|
},
|
||||||
|
_plug: function(can, item) { can.onmotion.clear(can, can.ui.profile)
|
||||||
|
can.onimport.plug(can, item.extra, can.ui.profile, function(sub) { item._plugin = sub
|
||||||
|
can.page.style(can, sub._output, html.MAX_WIDTH, can.ConfWidth()*3/4)
|
||||||
|
})
|
||||||
},
|
},
|
||||||
grow: function(can, msg, type) { var term = can.term[msg.Option(mdb.HASH)]
|
grow: function(can, msg, type) { var term = can.term[msg.Option(mdb.HASH)]
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@ -130,7 +127,7 @@ Volcanos(chat.ONDETAIL, {help: "操作数据", list: ["share", "plugin", "theme"
|
|||||||
},
|
},
|
||||||
theme: function(event, can, button, item) {
|
theme: function(event, can, button, item) {
|
||||||
can.user.input(event, can, ["background", "selection", "cursor", "foreground"], function(args, data) {
|
can.user.input(event, can, ["background", "selection", "cursor", "foreground"], function(args, data) {
|
||||||
can.runAction(event, mdb.MODIFY, args), item._term.setOption("theme", data), can.base.Copy(item.extra, data)
|
can.runAction(event, mdb.MODIFY, args), can.base.Copy(item.extra, data), item._term.setOption("theme", data)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
rename: function(event, can, button, item) {
|
rename: function(event, can, button, item) {
|
||||||
@ -142,13 +139,13 @@ Volcanos(chat.ONDETAIL, {help: "操作数据", list: ["share", "plugin", "theme"
|
|||||||
can.runAction(event, button)
|
can.runAction(event, button)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
Volcanos(chat.ONEXPORT, {help: "导出数据", list: ["total", "type", "background", "rows", "cols", "cursorY", "cursorX", ctx.INDEX],
|
Volcanos(chat.ONEXPORT, {help: "导出数据", list: [mdb.TOTAL, mdb.TYPE, "background", "rows", "cols", "cursorY", "cursorX", ctx.INDEX],
|
||||||
term: function(can, item, term) {
|
term: function(can, term) { item = term._item
|
||||||
can.core.List(can.onexport.list, function(key) {
|
can.core.List(can.onexport.list, function(key) {
|
||||||
can.Status(key, can.base.getValid(item[key], item.extra[key], term[key], term.buffer.active[key], ""))
|
can.Status(key, can.base.getValid(item[key], item.extra[key], term[key], term.buffer.active[key], ""))
|
||||||
})
|
})
|
||||||
can.Status("total", can.page.Select(can, can.ui.project, html.DIV_ITEM).length)
|
can.Status(mdb.TOTAL, can.page.Select(can, can.ui.project, html.DIV_ITEM).length)
|
||||||
can.Status("type", item["type"]||"")
|
can.Status(mdb.TYPE, item[mdb.TYPE]||"")
|
||||||
return term
|
return term
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
1
proto.js
1
proto.js
@ -421,6 +421,7 @@ var Volcanos = shy("火山架", {iceberg: "/chat/", volcano: "/frame.js", pack:
|
|||||||
} else { // 加入队列
|
} else { // 加入队列
|
||||||
list.push(can)
|
list.push(can)
|
||||||
}
|
}
|
||||||
|
_can_path = _can_name||_can_path
|
||||||
|
|
||||||
if (can._follow) { libs = libs.concat(meta.libs, meta.volcano) }
|
if (can._follow) { libs = libs.concat(meta.libs, meta.volcano) }
|
||||||
if (libs && libs.length > 0) { // 解析参数
|
if (libs && libs.length > 0) { // 解析参数
|
||||||
|
Loading…
x
Reference in New Issue
Block a user