forked from x/volcanos
opt chat
This commit is contained in:
parent
2b3dda7525
commit
b883657926
3
frame.js
3
frame.js
@ -35,7 +35,8 @@ Volcanos(chat.ONENGINE, {help: "搜索引擎", _init: function(can, meta, list,
|
||||
can.core.List(msg.Option(ice.MSG_FIELDS).split(ice.FS), function(item) {
|
||||
msg.Push(item, kit.Dict(ice.CTX, chat.ONENGINE, ice.CMD, ctx.COMMAND,
|
||||
mdb.TYPE, ice.CAN, mdb.NAME, name, mdb.TEXT, command.help,
|
||||
ctx.CONTEXT, ice.CAN, ctx.COMMAND, name
|
||||
ctx.CONTEXT, ice.CAN, ctx.COMMAND, name,
|
||||
ctx.INDEX, can.core.Keys(ice.CAN, name),
|
||||
)[item]||"")
|
||||
})
|
||||
})
|
||||
|
@ -1,7 +0,0 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"xterm": "^4.19.0",
|
||||
"xterm-addon-fit": "^0.5.0",
|
||||
"xterm-addon-web-links": "^0.6.0"
|
||||
}
|
||||
}
|
@ -32,12 +32,12 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg) {
|
||||
can.core.CallFunc([can.onaction, list[0]], [can, button])
|
||||
})
|
||||
},
|
||||
_share: function(can, share) { share && can.run({}, ["_share", share], function(msg) {
|
||||
_share: function(can, share) { share && can.run({}, [web.SHARE, share], function(msg) {
|
||||
msg.Length() == 1 && can.onengine.signal(can, chat.ONACTION_CMD)
|
||||
can.setHeader(chat.TOPIC, msg.OptionOrSearch(chat.TOPIC))
|
||||
can.user.title(msg.OptionOrSearch(chat.TITLE))
|
||||
|
||||
can.Conf(chat.RIVER, "_share", chat.STORM, share)
|
||||
can.Conf(chat.RIVER, web.SHARE, chat.STORM, share)
|
||||
msg.Length() > 0 && can.onimport._init(can, msg)
|
||||
}) },
|
||||
_cmd: function(can, item, next) {
|
||||
|
@ -147,7 +147,6 @@ Volcanos(chat.ONACTION, {help: "交互数据", _init: function(can, cb, target)
|
||||
"logout": "退出登录",
|
||||
},
|
||||
onmain: function(can, msg) {
|
||||
debugger
|
||||
can.run({}, [], function(msg) {
|
||||
if (!can.Conf(aaa.USERNICK, msg.Option(aaa.USERNICK)||msg.Option(ice.MSG_USERNAME))) {
|
||||
msg.Option(chat.SSO)? can.user.jumps(msg.Option(chat.SSO)): can.user.login(can, function() {
|
||||
|
@ -123,7 +123,8 @@ Volcanos(chat.ONACTION, {help: "控件交互", list: ["create", "share", "refres
|
||||
{name: mdb.TYPE, values: [chat.PUBLIC, chat.PROTECTED, chat.PRIVATE], _trans: "类型"},
|
||||
{name: mdb.NAME, value: "hi", _trans: "群名"}, {name: mdb.TEXT, value: "hello", _trans: "简介"},
|
||||
], function(args) {
|
||||
can.runAction(event, mdb.CREATE, args, function(msg) { can.misc.Search(can, {river: msg.Result()}) })
|
||||
can.runAction(event, mdb.CREATE, args, function(msg) {
|
||||
can.misc.Search(can, {river: msg.Result()}) })
|
||||
})
|
||||
},
|
||||
share: function(event, can) {
|
||||
@ -152,21 +153,21 @@ Volcanos(chat.ONDETAIL, {help: "菜单交互",
|
||||
can.onmotion.share(event, can, [{name: chat.TITLE, value: storm}], [mdb.TYPE, chat.STORM])
|
||||
},
|
||||
"添加工具": function(event, can, button, river, storm) {
|
||||
can.user.select(event, can, ctx.COMMAND, "context,command", function(item, next) {
|
||||
can.run({}, [river, chat.STORM, ctx.ACTION, mdb.INSERT, mdb.HASH, storm].concat([ice.POD, "", ice.CTX, item[0], ice.CMD, item[1]]), function(msg) { next() })
|
||||
can.user.select(event, can, ctx.COMMAND, "index", function(item, next) {
|
||||
can.run({}, [river, chat.STORM, ctx.ACTION, mdb.INSERT, mdb.HASH, storm].concat([web.SPACE, "", ctx.INDEX, item[0]]), function(msg) { next() })
|
||||
}, function() { can.misc.Search(can, {river: river, storm: storm}) })
|
||||
},
|
||||
"共享工具": function(event, can, button, river, storm) {
|
||||
can.user.select(event, can, mdb.PLUGIN, "name,context,command,argument", function(item, next) {
|
||||
can.user.select(event, can, mdb.PLUGIN, "name,index,args", function(item, next) {
|
||||
can.user.share(can, can.request(event), [river, ctx.ACTION, chat.SHARE, mdb.TYPE, chat.FIELD,
|
||||
mdb.NAME, item[2], mdb.TEXT, item[3], chat.TITLE, item[0], chat.RIVER, river, chat.STORM, storm,
|
||||
mdb.NAME, item[1], mdb.TEXT, item[2], chat.TITLE, item[0], chat.RIVER, river, chat.STORM, storm,
|
||||
])
|
||||
})
|
||||
},
|
||||
|
||||
"添加设备": function(event, can, button, river) {
|
||||
can.user.select(event, can, web.SPACE, "type,name,text", function(item, next) {
|
||||
can.run({}, [river, chat.NODE, ctx.ACTION, mdb.INSERT, mdb.TYPE, item[0], mdb.NAME, item[1]], function(msg) { next() })
|
||||
can.run({}, [river, chat.NODES, ctx.ACTION, mdb.INSERT, mdb.TYPE, item[0], mdb.NAME, item[1]], function(msg) { next() })
|
||||
})
|
||||
},
|
||||
"共享设备": function(event, can, button, river, storm) {
|
||||
@ -201,7 +202,7 @@ Volcanos(chat.ONDETAIL, {help: "菜单交互",
|
||||
"保存参数": function(event, can, button, river, storm) {
|
||||
can.getAction(ctx.ARGS, function(item, next, index, array) { var msg = can.request({}, {hash: storm, id: item.dataset.id})
|
||||
var toast = can.user.toast(can, (index+1)+ice.PS+array.length, button, 10000, (index+1)*100/array.length)
|
||||
can.run(msg, [river, chat.STORM, ctx.ACTION, mdb.MODIFY, ice.ARG, item.dataset.args], function(msg) {
|
||||
can.run(msg, [river, chat.STORM, ctx.ACTION, mdb.MODIFY, ctx.ARGS, item.dataset.args], function(msg) {
|
||||
can.onmotion.delay(can, function() {
|
||||
toast.close(), next(), index == array.length-1 && can.user.toastSuccess(can, button)
|
||||
})
|
||||
|
@ -118,7 +118,8 @@ Volcanos(chat.ONACTION, {help: "交互操作", list: [cli.CLOSE, cli.CLEAR, cli.
|
||||
can.onappend.plugin(can, {type: "plug", index: cmd||msg.Option(mdb.INDEX)}, function(sub, meta) {
|
||||
sub.run = function(event, cmds, cb) { can.runActionCommand(event, meta.index, cmds, cb) }
|
||||
can.page.style(can, sub._output, html.MAX_WIDTH, sub.ConfWidth(can.ConfWidth()))
|
||||
sub.ConfHeight(can.ConfHeight()-2*html.ACTION_HEIGHT)
|
||||
sub.ConfHeight(can.ConfHeight()-2*html.ACTION_HEIGHT-117)
|
||||
can.page.style(can, sub._output, html.MAX_HEIGHT, sub.ConfHeight())
|
||||
sub.Focus()
|
||||
}, can.ui.profile)
|
||||
},
|
||||
|
@ -26,11 +26,11 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, conf, cb, ta
|
||||
_field: function(can, msg) {
|
||||
msg.Table(function(item) { item.type = chat.STORY, can.onappend._plugin(can, item, {type: chat.STORY, arg: can.base.Obj(item[ice.ARG], [])}, function(sub, meta) {
|
||||
sub.Conf(can.base.Obj(item.conf))
|
||||
if (sub.Conf("mode") == "simple") {
|
||||
if (sub.Conf("mode") == "simple") { (function() {
|
||||
var msg = can.request(); msg.Echo(sub.Conf("result"))
|
||||
sub.ConfHeight(can.ConfHeight()/2)
|
||||
return can.onappend._output(sub, msg, msg.Option(ice.MSG_DISPLAY)||sub.Conf("feature.display"))
|
||||
}
|
||||
can.onappend._output(sub, msg, msg.Option(ice.MSG_DISPLAY)||sub.Conf("feature.display"))
|
||||
})(); return }
|
||||
var opt = can.base.Obj(item[ice.OPT], [])
|
||||
sub.ConfHeight(can.ConfHeight())
|
||||
sub.ConfWidth(can.ConfWidth()-4*html.PLUGIN_MARGIN)
|
||||
@ -91,7 +91,7 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, conf, cb, ta
|
||||
})
|
||||
Volcanos(chat.ONACTION, {help: "交互操作", list: [
|
||||
"刷新数据", "切换全屏", "共享工具", "打开链接", "生成链接", "生成脚本", "生成图片", [
|
||||
"其它", "刷新页面", "保存参数", "清空参数", "扩展参数", "复制数据", "下载数据", "清空数据", "删除配置", "删除工具","摄像头",
|
||||
"其它", "刷新页面", "保存参数", "清空参数", "扩展参数", "复制数据", "下载数据", "清空数据", "删除配置", "查看配置", "删除工具","摄像头",
|
||||
],
|
||||
],
|
||||
_engine: function(event, can, button) { can.Update(event, [ctx.ACTION, button].concat(can.Input([], true))) },
|
||||
@ -149,6 +149,9 @@ Volcanos(chat.ONACTION, {help: "交互操作", list: [
|
||||
"清空数据": function(event, can) { can.onmotion.clear(can, can._output) },
|
||||
"删除工具": function(event, can) { can.page.Remove(can, can._target) },
|
||||
"删除配置": function(event, can) { can.runAction(event, "config", ["reset"]) },
|
||||
"查看配置": function(event, can) { can.runAction(event, "config", ["select"], function(msg) {
|
||||
can.onappend.board(can, msg)
|
||||
}) },
|
||||
"帮助文档": function(event, can) { can.runAction(event, "help") },
|
||||
|
||||
"打包页面": function(event, can) { can.onengine.signal(can, "onwebpack", can.request(event)) },
|
||||
|
4
proto.js
4
proto.js
@ -147,7 +147,7 @@ var chat = {
|
||||
TITLE: "title", TOPIC: "topic", BLACK: "black", WHITE: "white", PRINT: "print",
|
||||
SHARE: "share", RIVER: "river", STORM: "storm", FIELD: "field",
|
||||
PUBLIC: "public", PROTECTED: "protected", PRIVATE: "private",
|
||||
USER: "user", TOOL: "tool", NODE: "node",
|
||||
USER: "user", TOOL: "tool", NODES: "nodes",
|
||||
|
||||
AGENT: "agent", CHECK: "check", GRANT: "grant",
|
||||
STATE: "state", MENUS: "menus", TRANS: "trans",
|
||||
@ -320,7 +320,7 @@ var Volcanos = shy("火山架", {iceberg: "/chat/", volcano: "/frame.js", pack:
|
||||
if (libs[i].indexOf("http") == 0) { continue }
|
||||
if (libs[i].indexOf("/") == 0) { continue }
|
||||
if (libs[i].indexOf(".css") == -1 && libs[i].indexOf(".js") == -1) { libs[i] = libs[i]+"/lib/"+libs[i]+".js" }
|
||||
libs[i] = "/require/node_modules/"+libs[i]
|
||||
libs[i] = "/require/lib/node_modules/"+libs[i]
|
||||
}
|
||||
can.require(libs, cb, each)
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user