forked from x/volcanos
opt frame.js
This commit is contained in:
parent
20358167df
commit
0c3f6033a3
331
frame.js
331
frame.js
@ -3,25 +3,24 @@ Volcanos("onengine", {help: "搜索引擎", list: [], _init: function(can, meta,
|
|||||||
can.core.Next(list, function(item, next) { item.type = "panel"
|
can.core.Next(list, function(item, next) { item.type = "panel"
|
||||||
can.onappend._init(can, item, item.list, function(panel) {
|
can.onappend._init(can, item, item.list, function(panel) {
|
||||||
panel.onaction && panel.onappend._action(panel, item.action||panel.onaction.list)
|
panel.onaction && panel.onappend._action(panel, item.action||panel.onaction.list)
|
||||||
panel.Status = panel.Status || function(key, value) { panel.search({}, ["Footer.onimport."+key, value]) }
|
panel.Status = panel.Status || function(key, value) { panel.set("Footer", key, value) }
|
||||||
|
|
||||||
panel.run = function(event, cmds, cb) { var msg = panel.request(event); cmds = cmds || []
|
panel.run = function(event, cmds, cb) { var msg = panel.request(event); cmds = cmds || []
|
||||||
return (can.onengine[cmds[0]]||can.onengine[meta.main.engine]||can.onengine.remote)(event, can, msg, panel, cmds, cb)
|
return (can.onengine[cmds[0]]||can.onengine._remote)(event, can, msg, panel, cmds, cb)
|
||||||
}, can[item.name] = panel, next()
|
}, can[item.name] = panel, next()
|
||||||
}, target)
|
}, target)
|
||||||
}, function() {
|
}, function() { can.base.Copy(can.onengine.river, can.Conf("river"))
|
||||||
var panel = can[meta.main.name], msg = can.request()
|
var panel = can[meta.main.name]; panel.onaction._init(panel, can.request(), [], function(msg) { cb(msg)
|
||||||
panel.onmotion._init(panel, target), panel.onkeypop._init(panel, target)
|
panel.onmotion._init(panel, target), panel.onkeypop._init(panel, target)
|
||||||
panel.onaction._init(panel, msg, [], cb, panel._target)
|
can.misc.Log(can.user.title(), "run", can)
|
||||||
|
}, panel._target)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
search: function(event, can, msg, panel, cmds, cb) {
|
_search: function(event, can, msg, panel, cmds, cb) {
|
||||||
var sub, mod = can, fun = can, key = ""; can.core.List(cmds[1].split("."), function(value) {
|
var sub, mod = can, fun = can, key = ""; can.core.List(cmds[1].split("."), function(value) {
|
||||||
fun && (sub = mod, mod = fun, fun = mod[value], key = value)
|
fun && (sub = mod, mod = fun, fun = mod[value], key = value)
|
||||||
}); if (!sub || !mod || !fun) {
|
}); if (!sub || !mod || !fun) { can.misc.Warn("not found", cmds)
|
||||||
can.misc.Warn("not found", cmds)
|
return can.base.isFunc(cb) && cb(msg.Echo("warn: ", "not found: ", cmds))
|
||||||
can.base.isFunc(cb) && cb(msg.Echo("warn: ", "not found: ", cmds[1]))
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return can.core.CallFunc(fun, {
|
return can.core.CallFunc(fun, {
|
||||||
@ -30,173 +29,51 @@ Volcanos("onengine", {help: "搜索引擎", list: [], _init: function(can, meta,
|
|||||||
"list": cmds.slice(2), "cb": cb, "target": sub._target,
|
"list": cmds.slice(2), "cb": cb, "target": sub._target,
|
||||||
}, mod)
|
}, mod)
|
||||||
},
|
},
|
||||||
remote: function(event, can, msg, panel, cmds, cb) {
|
_remote: function(event, can, msg, panel, cmds, cb) {
|
||||||
delete(msg._handle), delete(msg._toast)
|
|
||||||
if (panel.onengine.engine(event, can, msg, panel, cmds, cb)) { return }
|
if (panel.onengine.engine(event, can, msg, panel, cmds, cb)) { return }
|
||||||
|
|
||||||
var key = panel._name+"."+cmds.join(",")
|
var key = panel._name+"."+cmds.join(",")
|
||||||
if (can.user.isLocalFile) { var msg = can.request(event); msg.Clear("append")
|
if (can.user.isLocalFile) { var msg = can.request(event); msg.Clear("append")
|
||||||
var res = Volcanos.meta.pack[key]; res? msg.Copy(res): can.user.toast(can, "缺失数据")
|
var res = Volcanos.meta.pack[key]; res? msg.Copy(res): can.user.toast(can, "缺失数据")
|
||||||
return typeof cb == "function" && cb(msg)
|
return can.base.isFunc(cb) && cb(msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
can.misc.Run(event, can, {names: (can.Conf("iceberg")||"/chat/")+panel._name, daemon: can.ondaemon._list[0]+"."+msg._daemon}, cmds, function(msg) {
|
can.misc.Run(event, can, {names: (can.Conf("iceberg")||"/chat/")+panel._name, daemon: can.ondaemon._list[0]+"."+msg._daemon}, cmds, function(msg) {
|
||||||
|
delete(msg._handle), delete(msg._toast)
|
||||||
Volcanos.meta.pack[key] = msg
|
Volcanos.meta.pack[key] = msg
|
||||||
can.base.isFunc(cb) && cb(msg)
|
can.base.isFunc(cb) && cb(msg)
|
||||||
})
|
})
|
||||||
|
|
||||||
panel.search(event, ["Footer.onimport.ncmd"])
|
|
||||||
}, engine: function(event, can, msg, panel, cmds, cb) { return false },
|
}, engine: function(event, can, msg, panel, cmds, cb) { return false },
|
||||||
listen: shy("事件回调", {}, [], function(can, name, cb) {
|
|
||||||
|
listen: shy("监听事件", {}, [], function(can, name, cb) {
|
||||||
arguments.callee.meta[name] = (arguments.callee.meta[name]||[]).concat(cb)
|
arguments.callee.meta[name] = (arguments.callee.meta[name]||[]).concat(cb)
|
||||||
}),
|
}),
|
||||||
signal: shy("事件触发", function(can, name, msg) { msg = msg || can.request()
|
signal: shy("触发事件", function(can, name, msg) { msg = msg || can.request()
|
||||||
can.core.List(can.onengine.listen.meta[name], function(cb) {
|
can.core.List(can.onengine.listen.meta[name], function(cb) {
|
||||||
can.core.CallFunc(cb, {msg: msg})
|
can.core.CallFunc(cb, {msg: msg})
|
||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
_merge: function(can, sub) {
|
river: {}, _merge: function(can, sub) {
|
||||||
typeof sub._init == "function" && can.core && sub._init(can, sub)
|
|
||||||
for (var k in sub["river"]) { can.onengine["river"] = sub["river"]; break }
|
for (var k in sub["river"]) { can.onengine["river"] = sub["river"]; break }
|
||||||
},
|
},
|
||||||
river: {
|
|
||||||
"serivce": {name: "运营群", storm: {
|
|
||||||
"wx": {name: "公众号 wx", action: [
|
|
||||||
{name: "微信公众号", help: "wx", index: "web.wiki.word", args: ["usr/icebergs/misc/wx/wx.shy"]},
|
|
||||||
]},
|
|
||||||
"mp": {name: "小程序 mp", action: [
|
|
||||||
{name: "微信小程序", help: "mp", index: "web.wiki.word", args: ["usr/icebergs/misc/mp/mp.shy"]},
|
|
||||||
]},
|
|
||||||
"lark": {name: "机器人 lark", action: [
|
|
||||||
{name: "飞书机器人", help: "lark", index: "web.wiki.word", args: ["usr/icebergs/misc/lark/lark.shy"]},
|
|
||||||
]},
|
|
||||||
"share": {name: "上下文 share", action: [
|
|
||||||
{name: "系统上下文", help: "shylinux/contexts", index: "web.wiki.word", args: ["usr/learning/社会/管理/20200724.shy"]},
|
|
||||||
]},
|
|
||||||
}},
|
|
||||||
"product": {name: "产品群", storm: {
|
|
||||||
"office": {name: "办公 office", action: [
|
|
||||||
{name: "feel", help: "影音媒体", index: "web.wiki.feel"},
|
|
||||||
{name: "draw", help: "思维导图", index: "web.wiki.draw"},
|
|
||||||
{name: "data", help: "数据表格", index: "web.wiki.data"},
|
|
||||||
{name: "plan", help: "计划任务", index: "web.team.plan"},
|
|
||||||
{name: "think", help: "智库", index: "web.wiki.word", args: ["usr/learning/"]},
|
|
||||||
{name: "index", help: "索引", index: "web.wiki.word", args: ["usr/learning/index.shy"]},
|
|
||||||
{name: "context", help: "编程", index: "web.wiki.word", args: ["usr/learning/自然/编程/index.shy"]},
|
|
||||||
]},
|
|
||||||
"english": {name: "英汉 english", action: [
|
|
||||||
{name: "english", help: "英汉", index: "web.wiki.alpha.alpha", args: ["word", "hi"]},
|
|
||||||
{name: "chinese", help: "汉英", index: "web.wiki.alpha.alpha", args: ["line", "你好"]},
|
|
||||||
{name: "wubi", help: "五笔", index: "web.code.input.wubi", args: ["word", "wqvb"]},
|
|
||||||
{name: "wubi", help: "五笔", index: "web.code.input.wubi", args: ["line", "你好"]},
|
|
||||||
]},
|
|
||||||
"learning": {name: "学习 learning", action: [
|
|
||||||
{name: "golang", help: "编程", index: "web.wiki.word", args: ["usr/golang-story/src/main.shy"]},
|
|
||||||
{name: "tmux", help: "粘贴", index: "web.code.tmux.text"},
|
|
||||||
{name: "study", help: "学习", index: "web.wiki.word", args: ["usr/learning/study.shy"]},
|
|
||||||
]},
|
|
||||||
"chrome": {name: "爬虫 chrome", action: [
|
|
||||||
{name: "feel", help: "网页爬虫", index: "web.wiki.feel", args: ["spide/"], feature: {
|
|
||||||
display: "/plugin/local/wiki/feel.js",
|
|
||||||
height: 200, limit: 3,
|
|
||||||
}},
|
|
||||||
{name: "cached", help: "爬虫缓存", index: "web.code.chrome.cache", args: []},
|
|
||||||
{name: "spided", help: "网页爬虫", index: "web.code.chrome.spide", args: location && location.protocol && location.protocol=="chrome-extension:"? ["1", "", "spide"]: ["1"]},
|
|
||||||
]},
|
|
||||||
}},
|
|
||||||
"project": {name: "研发群", storm: {
|
|
||||||
"studio": {name: "研发 studio", action: [
|
|
||||||
{name: "vimer", help: "编辑器", index: "web.code.vimer", args: ["src/", "main.go"]},
|
|
||||||
{name: "repos", help: "代码库", index: "web.code.git.status"},
|
|
||||||
{name: "plan", help: "任务表", index: "web.team.plan"},
|
|
||||||
{name: "contexts", help: "上下文", index: "web.wiki.word", args: ["src/main.shy"]},
|
|
||||||
]},
|
|
||||||
"cli": {name: "命令 cli", action: [
|
|
||||||
{name: "bash", help: "命令行", index: "web.wiki.word", args: ["usr/icebergs/misc/bash/bash.shy"]},
|
|
||||||
{name: "tmux", help: "命令行", index: "web.wiki.word", args: ["usr/icebergs/misc/tmux/tmux.shy"]},
|
|
||||||
{name: "git", help: "代码库", index: "web.wiki.word", args: ["usr/icebergs/misc/git/git.shy"]},
|
|
||||||
{name: "vim", help: "编辑器", index: "web.wiki.word", args: ["usr/icebergs/misc/vim/vim.shy"]},
|
|
||||||
{name: "ssh", help: "命令行", index: "web.wiki.word", args: ["usr/icebergs/base/ssh/ssh.shy"]},
|
|
||||||
{name: "zsh", help: "命令行", index: "web.wiki.word", args: ["usr/icebergs/misc/bash/zsh.shy"]},
|
|
||||||
]},
|
|
||||||
"web": {name: "网页 web", action: [
|
|
||||||
{name: "HTML5", help: "浏览器", index: "web.wiki.word", args: ["usr/icebergs/misc/chrome/chrome.shy"]},
|
|
||||||
]},
|
|
||||||
"linux": {name: "系统 linux", action: [
|
|
||||||
{name: "idc", help: "平台", index: "web.wiki.word", args: ["usr/linux-story/idc/idc.shy"]},
|
|
||||||
{name: "iso", help: "系统", index: "web.wiki.word", args: ["usr/linux-story/iso/iso.shy"]},
|
|
||||||
{name: "iot", help: "设备", index: "web.wiki.word", args: ["usr/linux-story/iot/iot.shy"]},
|
|
||||||
{name: "linux", help: "系统", index: "web.wiki.word", args: ["usr/linux-story/src/main.shy"]},
|
|
||||||
]},
|
|
||||||
"nginx": {name: "代理 nginx", action: [
|
|
||||||
{name: "nginx", help: "代理", index: "web.wiki.word", args: ["usr/nginx-story/src/main.shy"]},
|
|
||||||
]},
|
|
||||||
"context": {name: "编程 context", action: [
|
|
||||||
{name: "grafana", help: "可视化", index: "web.wiki.word", args: ["usr/golang-story/src/grafana/grafana.shy"]},
|
|
||||||
{name: "gogs", help: "代码库", index: "web.wiki.word", args: ["usr/golang-story/src/gogs/gogs.shy"]},
|
|
||||||
{name: "golang", help: "编程", index: "web.wiki.word", args: ["usr/golang-story/src/main.shy"]},
|
|
||||||
]},
|
|
||||||
"redis": {name: "缓存 redis", action: [
|
|
||||||
{name: "redis", help: "缓存", index: "web.wiki.word", args: ["usr/redis-story/src/main.shy"]},
|
|
||||||
]},
|
|
||||||
"mysql": {name: "数据 mysql", action: [
|
|
||||||
{name: "mysql", help: "数据存储", index: "web.wiki.word", args: ["usr/mysql-story/src/main.shy"]},
|
|
||||||
]},
|
|
||||||
}},
|
|
||||||
"profile": {name: "测试群", storm: {
|
|
||||||
"release": {name: "发布 release", index: [
|
|
||||||
"web.code.publish", "web.code.compile", "web.code.autogen",
|
|
||||||
]},
|
|
||||||
"research": {name: "测试 research", index: [
|
|
||||||
"web.code.favor", "web.code.bench", "web.code.pprof",
|
|
||||||
]},
|
|
||||||
}},
|
|
||||||
"operate": {name: "运维群", storm: {
|
|
||||||
"ctx": {name: "模块 ctx", index: [
|
|
||||||
"context", "command", "config",
|
|
||||||
]},
|
|
||||||
"cli": {name: "系统 cli", index: [
|
|
||||||
"system", "daemon", "python", "output",
|
|
||||||
"runtime", "process",
|
|
||||||
]},
|
|
||||||
"web": {name: "网络 web", index: [
|
|
||||||
"route", "serve", "space", "dream",
|
|
||||||
"spide", "share", "cache", "story",
|
|
||||||
]},
|
|
||||||
"aaa": {name: "权限 aaa", index: [
|
|
||||||
"user", "sess", "role", "totp",
|
|
||||||
]},
|
|
||||||
|
|
||||||
"nfs": {name: "文件 nfs", index: [
|
|
||||||
"nfs.cat", "nfs.dir", "nfs.tail", "nfs.trash",
|
|
||||||
]},
|
|
||||||
"ssh": {name: "脚本 ssh", index: [
|
|
||||||
"aaa.totp", "web.code.tmux.session",
|
|
||||||
"connect", "session", "service", "channel",
|
|
||||||
]},
|
|
||||||
}},
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
Volcanos("ondaemon", {help: "推荐引擎", list: [], _init: function(can) {
|
Volcanos("ondaemon", {help: "推荐引擎", list: [], _init: function(can) {
|
||||||
if (can.user.isLocalFile) { return }
|
if (can.user.isLocalFile) { return }
|
||||||
can.misc.WSS(can, {type: "chrome", name: can.user.Search(can, "daemon")||""}, function(event, msg, cmd, arg) { if (!msg) { return }
|
can.misc.WSS(can, {type: "chrome", name: can.user.Search(can, "daemon")||""}, function(event, msg, cmd, arg) { if (!msg) { return }
|
||||||
if (can.base.isFunc(can.ondaemon[cmd])) {
|
if (can.base.isFunc(can.ondaemon[cmd])) {
|
||||||
can.core.CallFunc(can.ondaemon[cmd], {
|
can.core.CallFunc(can.ondaemon[cmd], {
|
||||||
"can": can, "msg": msg,
|
"can": can, "msg": msg, "cmd": cmd, "arg": arg,
|
||||||
"cmd": cmd, "arg": arg,
|
|
||||||
"cb": function() { msg.Reply() },
|
"cb": function() { msg.Reply() },
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
can.onengine.search({}, can, msg, can, ["search", cmd].concat(arg), function() {
|
can.onengine._search({}, can, msg, can, ["_search", cmd].concat(arg), function() {
|
||||||
msg.Reply()
|
msg.Reply()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
}, _list: [""],
|
||||||
_list: [""],
|
|
||||||
toast: function(can, msg, arg) { arg[0] = can
|
toast: function(can, msg, arg) { arg[0] = can
|
||||||
Volcanos.meta.float.toast && can.page.Remove(can, Volcanos.meta.float.toast._target)
|
can.onmotion.float.add(can, "float", can.core.CallFunc(can.user.toast, {can: can, msg: msg, cmds: arg}))
|
||||||
Volcanos.meta.float.toast = can.core.CallFunc(can.user.toast, {can: can, msg: msg, cmds: arg})
|
|
||||||
},
|
},
|
||||||
grow: function(can, msg, arg) {
|
grow: function(can, msg, arg) {
|
||||||
var sub = can.ondaemon._list[msg.Option("_target")]
|
var sub = can.ondaemon._list[msg.Option("_target")]
|
||||||
@ -387,12 +264,6 @@ Volcanos("onappend", {help: "渲染引擎", list: [], _init: function(can, meta,
|
|||||||
return can.onappend._output(can, meta, event, can.Pack(cmds, silent), cb, silent)
|
return can.onappend._output(can, meta, event, can.Pack(cmds, silent), cb, silent)
|
||||||
}, can._outputs.push(table), table._msg = msg
|
}, can._outputs.push(table), table._msg = msg
|
||||||
|
|
||||||
if (table.onimport && table.onimport._require) { var ls = display.split("/"); ls.pop()
|
|
||||||
can.require(can.core.List(table.onimport._require, function(item) {
|
|
||||||
return ls.join("/")+"/"+item
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
|
|
||||||
table.onimport && table.onimport._init && table.onimport._init(table, msg, msg.result||[], function(msg) {
|
table.onimport && table.onimport._init && table.onimport._init(table, msg, msg.result||[], function(msg) {
|
||||||
can.page.Modify(can, can._action, ""), can.page.Modify(can, can._status, "")
|
can.page.Modify(can, can._action, ""), can.page.Modify(can, can._status, "")
|
||||||
table.onaction && table.onappend._action(table, can.base.Obj(msg.Option("_action"), meta._action||table.onaction.list))
|
table.onaction && table.onappend._action(table, can.base.Obj(msg.Option("_action"), meta._action||table.onaction.list))
|
||||||
@ -537,7 +408,8 @@ Volcanos("onappend", {help: "渲染引擎", list: [], _init: function(can, meta,
|
|||||||
(meta.run||can.run)(event, cmds, cb, true)
|
(meta.run||can.run)(event, cmds, cb, true)
|
||||||
}, sub.Conf(meta)
|
}, sub.Conf(meta)
|
||||||
|
|
||||||
Volcanos.meta.float.input && can.page.Remove(can, Volcanos.meta.float.input._target), Volcanos.meta.float.input = sub
|
can.onmotion.float.add(can, "input", sub)
|
||||||
|
|
||||||
meta.style && sub.page.Modify(sub, sub._target, {style: meta.style})
|
meta.style && sub.page.Modify(sub, sub._target, {style: meta.style})
|
||||||
cb(event, sub, meta, target)
|
cb(event, sub, meta, target)
|
||||||
}, document.body)
|
}, document.body)
|
||||||
@ -575,10 +447,12 @@ Volcanos("onappend", {help: "渲染引擎", list: [], _init: function(can, meta,
|
|||||||
}, target)
|
}, target)
|
||||||
},
|
},
|
||||||
}, [], function(can) {})
|
}, [], function(can) {})
|
||||||
Volcanos("onlayout", {help: "页面布局", list: [], _init: function(can) {
|
Volcanos("onlayout", {help: "页面布局", list: [], _init: function(can, target) { target = document.body
|
||||||
var target = document.body, width = window.innerWidth, height = window.innerHeight
|
var width = window.innerWidth, height = window.innerHeight
|
||||||
can.user.isMobile && can.page.ClassList.add(can, document.body, "mobile")
|
can.user.isMobile && can.page.ClassList.add(can, target, "mobile")
|
||||||
can.user.isMobile && can.page.ClassList.set(can, document.body, "landscape", width > height)
|
can.user.isMobile && can.page.ClassList.set(can, target, "landscape", width > height)
|
||||||
|
|
||||||
|
document.body.onresize = function() { can.onlayout._init(can, target) }
|
||||||
|
|
||||||
can.page.Select(can, target, ["fieldset.head", "fieldset.foot"], function(field) {
|
can.page.Select(can, target, ["fieldset.head", "fieldset.foot"], function(field) {
|
||||||
height -= field.offsetHeight
|
height -= field.offsetHeight
|
||||||
@ -678,52 +552,52 @@ Volcanos("onmotion", {help: "动态特效", list: [], _init: function(can, targe
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
show: function(can, time, cb, target) { target = target || can._target
|
|
||||||
time = typeof time == "object"? time: {value: 10, length: time||20}
|
|
||||||
|
|
||||||
can.page.Modify(can, target, {style: {opacity: 0, display: "block"}})
|
|
||||||
can.core.Timer(time, function(event, value, index) {
|
|
||||||
can.page.Modify(can, target, {style: {opacity: (index+1)/time.length}})
|
|
||||||
}, cb)
|
|
||||||
},
|
|
||||||
hide: function(can, time, cb, target) { target = target || can._target
|
|
||||||
time = typeof time == "object"? time: {value: 10, length: time||20}
|
|
||||||
|
|
||||||
can.page.Modify(can, target, {style: {opacity: 1}})
|
|
||||||
can.core.Timer(time, function(event, value, index) {
|
|
||||||
can.page.Modify(can, target, {style: {opacity: 1-(index+1)/time.length}})
|
|
||||||
}, function() {
|
|
||||||
can.page.Modify(can, target, {style: {display: "none"}})
|
|
||||||
can.base.isFunc(cb) && cb()
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
focus: function(can, target) {
|
|
||||||
target.setSelectionRange(0, -1)
|
|
||||||
target.focus()
|
|
||||||
},
|
|
||||||
clear: function(can, target) {
|
clear: function(can, target) {
|
||||||
can.page.Modify(can, target||can._output, "")
|
can.page.Modify(can, target||can._output, "")
|
||||||
},
|
},
|
||||||
story: function(can, target) {
|
focus: function(can, target) {
|
||||||
can.page.Select(can, target||can._output, ".story", function(story) { var data = story.dataset
|
target.setSelectionRange(0, -1), target.focus()
|
||||||
can.page.Modify(can, story, {style: can.base.Obj(data.style)})
|
},
|
||||||
|
float: {
|
||||||
|
_hash: {},
|
||||||
|
del: function(can, key) {
|
||||||
|
this._hash[key] && can.page.Remove(can, this._hash[key]._target)
|
||||||
|
},
|
||||||
|
add: function(can, key, value) {
|
||||||
|
this.del(can, key), this._hash[key] = value
|
||||||
|
},
|
||||||
|
|
||||||
switch (data.type) {
|
auto: function(can, target, key) { var that = this
|
||||||
case "spark":
|
can.page.Modify(can, target, {onmouseover: function(event) {
|
||||||
if (data["name"] == "inner") {
|
if (event.target.tagName == "img") { return }
|
||||||
story.title = "点击复制", story.onclick = function(event) {
|
can.core.List(arguments, function(key, index) {
|
||||||
can.user.copy(event, can, story.innerText)
|
index > 1 && that.del(can, key)
|
||||||
}
|
})
|
||||||
} else {
|
}})
|
||||||
can.page.Select(can, story, "span", function(item) {
|
},
|
||||||
item.title = "点击复制", item.onclick = function(event) {
|
},
|
||||||
can.user.copy(event, can, item.innerText)
|
story: {
|
||||||
}
|
_hash: {
|
||||||
})
|
spark: function(can, meta, target) {
|
||||||
|
if (meta["name"] == "inner") {
|
||||||
|
target.title = "点击复制", target.onclick = function(event) {
|
||||||
|
can.user.copy(event, can, target.innerText)
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
})
|
can.page.Select(can, target, "span", function(item) {
|
||||||
|
item.title = "点击复制", item.onclick = function(event) {
|
||||||
|
can.user.copy(event, can, item.innerText)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
auto: function(can, target) { var that = this
|
||||||
|
can.page.Select(can, target||can._output, ".story", function(item) { var meta = item.dataset
|
||||||
|
can.page.Modify(can, item, {style: can.base.Obj(meta.style)})
|
||||||
|
can.core.CallFunc(that._hash[meta.type], [can, meta, target])
|
||||||
|
})
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
hidden: function(can, target) {
|
hidden: function(can, target) {
|
||||||
@ -780,13 +654,27 @@ Volcanos("onmotion", {help: "动态特效", list: [], _init: function(can, targe
|
|||||||
}
|
}
|
||||||
}}]); ui.first.focus(), ui.first.setSelectionRange(0, -1)
|
}}]); ui.first.focus(), ui.first.setSelectionRange(0, -1)
|
||||||
},
|
},
|
||||||
autosize: function(can, msg, list, cb, target) {
|
|
||||||
can.page.Select(can, target, "div.output", function(item, index) {
|
|
||||||
index == 0 && (item.style.height = "")
|
|
||||||
}), target.style.height = ""
|
|
||||||
can.base.isFunc(cb) && cb(msg)
|
|
||||||
},
|
|
||||||
|
|
||||||
|
autosize: function(can, target, max, min) {
|
||||||
|
can.page.Modify(can, target, {
|
||||||
|
onfocus: function(event) {
|
||||||
|
can.onmotion.resize(can, target, max, 10)
|
||||||
|
}, onmouseenter: function(event) {
|
||||||
|
can.onmotion.resize(can, target, max, 10)
|
||||||
|
}, onmouseleave: function(event) {
|
||||||
|
can.onmotion.resize(can, target, min, 5)
|
||||||
|
}, onblur: function(event) {
|
||||||
|
can.onmotion.resize(can, target, min, 5)
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
resize: function(can, target, width, speed) {
|
||||||
|
var begin = target.offsetWidth
|
||||||
|
var space = (width - begin) / 30
|
||||||
|
can.core.Timer({interval: speed||10, length: 30}, function() {
|
||||||
|
can.page.Modify(can, target, {style: {width: begin+=space}})
|
||||||
|
})
|
||||||
|
},
|
||||||
move: function(can, target, layout) { var begin
|
move: function(can, target, layout) { var begin
|
||||||
target.onmousedown = function(event) {
|
target.onmousedown = function(event) {
|
||||||
begin = {x: event.x, y: event.y, left: layout.left, top: layout.top, width: layout.width, height: layout.height}
|
begin = {x: event.x, y: event.y, left: layout.left, top: layout.top, width: layout.width, height: layout.height}
|
||||||
@ -804,32 +692,23 @@ Volcanos("onmotion", {help: "动态特效", list: [], _init: function(can, targe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
show: function(can, time, cb, target) { target = target || can._target
|
||||||
|
time = typeof time == "object"? time: {value: 10, length: time||20}
|
||||||
|
|
||||||
downward: function(can, target, top, speed) {
|
can.page.Modify(can, target, {style: {opacity: 0, display: "block"}})
|
||||||
var begin = target.offsetTop
|
can.core.Timer(time, function(event, value, index) {
|
||||||
var space = (top - begin) / 30
|
can.page.Modify(can, target, {style: {opacity: (index+1)/time.length}})
|
||||||
can.core.Timer({interval: speed||10, length: 30}, function() {
|
}, cb)
|
||||||
can.page.Modify(can, target, {style: {top: begin+=space}})
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
resize: function(can, target, width, speed) {
|
hide: function(can, time, cb, target) { target = target || can._target
|
||||||
var begin = target.offsetWidth
|
time = typeof time == "object"? time: {value: 10, length: time||20}
|
||||||
var space = (width - begin) / 30
|
|
||||||
can.core.Timer({interval: speed||10, length: 30}, function() {
|
can.page.Modify(can, target, {style: {opacity: 1}})
|
||||||
can.page.Modify(can, target, {style: {width: begin+=space}})
|
can.core.Timer(time, function(event, value, index) {
|
||||||
})
|
can.page.Modify(can, target, {style: {opacity: 1-(index+1)/time.length}})
|
||||||
},
|
}, function() {
|
||||||
autosize: function(can, target, max, min) {
|
can.page.Modify(can, target, {style: {display: "none"}})
|
||||||
can.page.Modify(can, target, {
|
can.base.isFunc(cb) && cb()
|
||||||
onfocus: function(event) {
|
|
||||||
can.onmotion.resize(can, target, max, 10)
|
|
||||||
}, onmouseenter: function(event) {
|
|
||||||
can.onmotion.resize(can, target, max, 10)
|
|
||||||
}, onmouseleave: function(event) {
|
|
||||||
can.onmotion.resize(can, target, min, 5)
|
|
||||||
}, onblur: function(event) {
|
|
||||||
can.onmotion.resize(can, target, min, 5)
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -10,6 +10,11 @@ Volcanos("base", {help: "数据类型",
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
Copy: function(to, from, fields) {
|
Copy: function(to, from, fields) {
|
||||||
|
if (arguments.length == 2) {
|
||||||
|
for (var k in from) { to[k] = from[k] }
|
||||||
|
return to
|
||||||
|
}
|
||||||
|
|
||||||
var list = []; for (var i = 2; i < arguments.length; i++) {
|
var list = []; for (var i = 2; i < arguments.length; i++) {
|
||||||
list.push(arguments[i])
|
list.push(arguments[i])
|
||||||
}
|
}
|
||||||
@ -17,6 +22,7 @@ Volcanos("base", {help: "数据类型",
|
|||||||
for (var i = 0; i < list.length; i++) {
|
for (var i = 0; i < list.length; i++) {
|
||||||
to[list[i]] = from[list[i]]
|
to[list[i]] = from[list[i]]
|
||||||
}
|
}
|
||||||
|
return to
|
||||||
},
|
},
|
||||||
Eq: function(to, from) { var self = arguments.callee
|
Eq: function(to, from) { var self = arguments.callee
|
||||||
if (typeof to != typeof from) { return false }
|
if (typeof to != typeof from) { return false }
|
||||||
|
14
lib/core.js
14
lib/core.js
@ -80,20 +80,26 @@ Volcanos("core", {help: "数据结构",
|
|||||||
return res
|
return res
|
||||||
}),
|
}),
|
||||||
CallFunc: shy("调用器", function(func, args, mod) { args = args || {}
|
CallFunc: shy("调用器", function(func, args, mod) { args = args || {}
|
||||||
|
var can = args["can"]||args[0], msg = args["msg"]||args[1], cmds = args["cmds"]||[]
|
||||||
|
|
||||||
|
// 查找调用
|
||||||
func = typeof func == "function"? func: typeof func == "string"? this.Value(mod||can, func):
|
func = typeof func == "function"? func: typeof func == "string"? this.Value(mod||can, func):
|
||||||
typeof func == "object" && func.length > 0? this.Value(func[0], this.Keys(func.slice(1))): null
|
typeof func == "object" && func.length > 0? this.Value(func[0], this.Keys(func.slice(1))): null
|
||||||
if (typeof func != "function") { return }
|
if (typeof func != "function") { return }
|
||||||
|
|
||||||
var can = args["can"]||args[0], msg = args["msg"]||args[1], cmds = args["cmds"]||[]
|
// 解析参数
|
||||||
|
|
||||||
var list = [], echo = false, cb = args["cb"]
|
var list = [], echo = false, cb = args["cb"]
|
||||||
this.List(func.toString().split(")")[0].split("(")[1].split(","), function(item, index) { item = item.trim()
|
this.List(func.toString().split(")")[0].split("(")[1].split(","), function(item, index) { item = item.trim()
|
||||||
list.push(args[item] || msg&&msg.Option&&msg.Option(item) || can&&can.Conf&&can.Conf(item) || cmds[index] || args[index] || null)
|
var arg = args[item] || msg&&msg.Option&&msg.Option(item) || can&&can.Conf&&can.Conf(item) || cmds[index] || args[index] || null
|
||||||
if (item == "cb") { echo = true }
|
if (item == "cb") { echo = true }
|
||||||
|
list.push(arg)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 执行调用
|
||||||
var res = func.apply(mod||can, list)
|
var res = func.apply(mod||can, list)
|
||||||
if (!echo && typeof cb == "function") { res && msg.Echo(res), arguments.callee.apply(this, [cb, {msg: msg, res: res}]) }
|
|
||||||
|
// 执行回调
|
||||||
|
if (!echo && typeof cb == "function") { res && msg && msg.Echo(res), arguments.callee.apply(this, [cb, {msg: msg, res: res}]) }
|
||||||
return res
|
return res
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
11
lib/user.js
11
lib/user.js
@ -67,7 +67,7 @@ Volcanos("user", {help: "用户操作", agent: {
|
|||||||
timer: can.core.Timer({interval: 100, length: (parseInt(meta.duration||1000))/100}, function(event, interval, index) {
|
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)+"."+(index%10)+"s..." }
|
if (index > 30) { ui.duration.innerHTML = parseInt(index/10)+"."+(index%10)+"s..." }
|
||||||
}, function() { action.close() }), _target: ui._target, ui: ui,
|
}, function() { action.close() }), _target: ui._target, ui: ui,
|
||||||
}); can.onmotion.story(can, ui._target)
|
}); can.onmotion.story.auto(can, ui._target)
|
||||||
|
|
||||||
can.search(can.request({}, {
|
can.search(can.request({}, {
|
||||||
title: meta.title, content: meta.content,
|
title: meta.title, content: meta.content,
|
||||||
@ -149,14 +149,11 @@ Volcanos("user", {help: "用户操作", agent: {
|
|||||||
} }] }
|
} }] }
|
||||||
}) }] ); can.onlayout.figure(event, can, ui._target)
|
}) }] ); can.onlayout.figure(event, can, ui._target)
|
||||||
|
|
||||||
Volcanos.meta.float.carte && can.page.Remove(can, Volcanos.meta.float.carte._target)
|
can.onmotion.float.add(can, "carte", ui)
|
||||||
return event.stopPropagation(), event.preventDefault(), Volcanos.meta.float.carte = ui, {_target: ui._target}
|
return event.stopPropagation(), event.preventDefault(), {_target: ui._target}
|
||||||
},
|
},
|
||||||
input: function(event, can, form, cb, button) { // form [ string, array, object, {_input: "select", values: []}
|
input: function(event, can, form, cb, button) { // form [ string, array, object, {_input: "select", values: []}
|
||||||
var msg = can.request(event, can.Option())
|
var msg = can.request(event, can.Option())
|
||||||
var option = {}; can.core.List(msg.Option(), function(key) {
|
|
||||||
option[key] = msg.Option(key)
|
|
||||||
})
|
|
||||||
var ui = can.page.Append(can, document.body, [{view: ["input"], style: {left: 0, top: 0}, list: [
|
var ui = can.page.Append(can, document.body, [{view: ["input"], style: {left: 0, top: 0}, list: [
|
||||||
{view: ["option", "table"], list: can.core.List(form, function(item) {
|
{view: ["option", "table"], list: can.core.List(form, function(item) {
|
||||||
item._input == "select" && (item = {select: [[item.name].concat(item.values)], data: item, name: item.name})
|
item._input == "select" && (item = {select: [[item.name].concat(item.values)], data: item, name: item.name})
|
||||||
@ -165,7 +162,7 @@ Volcanos("user", {help: "用户操作", agent: {
|
|||||||
|
|
||||||
item._init = function(target) {
|
item._init = function(target) {
|
||||||
item.run = function(event, cmds, cb) {
|
item.run = function(event, cmds, cb) {
|
||||||
var res = can.request(event, msg, option, function() { var value = {_handle: "true"}
|
var res = can.request(event, msg, function() { var value = {_handle: "true"}
|
||||||
can.page.Select(can, ui.table, "textarea,input,select", function(item) {
|
can.page.Select(can, ui.table, "textarea,input,select", function(item) {
|
||||||
item.name && item.value && (value[item.name] = item.value)
|
item.name && item.value && (value[item.name] = item.value)
|
||||||
}); return value
|
}); return value
|
||||||
|
120
page/index.js
120
page/index.js
@ -5,7 +5,7 @@ Volcanos({name: "chat", iceberg: "/chat/", volcano: "/frame.js",
|
|||||||
{name: "River", help: "群聊组", pos: "left", action: ["创建", "刷新"]},
|
{name: "River", help: "群聊组", pos: "left", action: ["创建", "刷新"]},
|
||||||
{name: "Action", help: "工作台", pos: "main"},
|
{name: "Action", help: "工作台", pos: "main"},
|
||||||
{name: "Footer", help: "状态条", pos: "foot", state: ["ncmd"]},
|
{name: "Footer", help: "状态条", pos: "foot", state: ["ncmd"]},
|
||||||
], main: {name: "Header", engine: "remote", list: ["/publish/order.js"]}, plugin: [
|
], main: {name: "Header", list: ["/publish/order.js"]}, plugin: [
|
||||||
"/plugin/state.js",
|
"/plugin/state.js",
|
||||||
"/plugin/input.js",
|
"/plugin/input.js",
|
||||||
"/plugin/table.js",
|
"/plugin/table.js",
|
||||||
@ -19,5 +19,121 @@ Volcanos({name: "chat", iceberg: "/chat/", volcano: "/frame.js",
|
|||||||
"/plugin/local/wiki/draw.js",
|
"/plugin/local/wiki/draw.js",
|
||||||
"/plugin/local/wiki/word.js",
|
"/plugin/local/wiki/word.js",
|
||||||
"/plugin/local/team/plan.js",
|
"/plugin/local/team/plan.js",
|
||||||
],
|
], river: {
|
||||||
|
"serivce": {name: "运营群", storm: {
|
||||||
|
"wx": {name: "公众号 wx", action: [
|
||||||
|
{name: "微信公众号", help: "wx", index: "web.wiki.word", args: ["usr/icebergs/misc/wx/wx.shy"]},
|
||||||
|
]},
|
||||||
|
"mp": {name: "小程序 mp", action: [
|
||||||
|
{name: "微信小程序", help: "mp", index: "web.wiki.word", args: ["usr/icebergs/misc/mp/mp.shy"]},
|
||||||
|
]},
|
||||||
|
"lark": {name: "机器人 lark", action: [
|
||||||
|
{name: "飞书机器人", help: "lark", index: "web.wiki.word", args: ["usr/icebergs/misc/lark/lark.shy"]},
|
||||||
|
]},
|
||||||
|
"share": {name: "上下文 share", action: [
|
||||||
|
{name: "系统上下文", help: "shylinux/contexts", index: "web.wiki.word", args: ["usr/learning/社会/管理/20200724.shy"]},
|
||||||
|
]},
|
||||||
|
}},
|
||||||
|
"product": {name: "产品群", storm: {
|
||||||
|
"office": {name: "办公 office", action: [
|
||||||
|
{name: "feel", help: "影音媒体", index: "web.wiki.feel"},
|
||||||
|
{name: "draw", help: "思维导图", index: "web.wiki.draw"},
|
||||||
|
{name: "data", help: "数据表格", index: "web.wiki.data"},
|
||||||
|
{name: "plan", help: "计划任务", index: "web.team.plan"},
|
||||||
|
{name: "think", help: "智库", index: "web.wiki.word", args: ["usr/learning/"]},
|
||||||
|
{name: "index", help: "索引", index: "web.wiki.word", args: ["usr/learning/index.shy"]},
|
||||||
|
{name: "context", help: "编程", index: "web.wiki.word", args: ["usr/learning/自然/编程/index.shy"]},
|
||||||
|
]},
|
||||||
|
"english": {name: "英汉 english", action: [
|
||||||
|
{name: "english", help: "英汉", index: "web.wiki.alpha.alpha", args: ["word", "hi"]},
|
||||||
|
{name: "chinese", help: "汉英", index: "web.wiki.alpha.alpha", args: ["line", "你好"]},
|
||||||
|
{name: "wubi", help: "五笔", index: "web.code.input.wubi", args: ["word", "wqvb"]},
|
||||||
|
{name: "wubi", help: "五笔", index: "web.code.input.wubi", args: ["line", "你好"]},
|
||||||
|
]},
|
||||||
|
"learning": {name: "学习 learning", action: [
|
||||||
|
{name: "golang", help: "编程", index: "web.wiki.word", args: ["usr/golang-story/src/main.shy"]},
|
||||||
|
{name: "tmux", help: "粘贴", index: "web.code.tmux.text"},
|
||||||
|
{name: "study", help: "学习", index: "web.wiki.word", args: ["usr/learning/study.shy"]},
|
||||||
|
]},
|
||||||
|
"chrome": {name: "爬虫 chrome", action: [
|
||||||
|
{name: "feel", help: "网页爬虫", index: "web.wiki.feel", args: ["spide/"], feature: {
|
||||||
|
display: "/plugin/local/wiki/feel.js",
|
||||||
|
height: 200, limit: 3,
|
||||||
|
}},
|
||||||
|
{name: "cached", help: "爬虫缓存", index: "web.code.chrome.cache", args: []},
|
||||||
|
{name: "spided", help: "网页爬虫", index: "web.code.chrome.spide", args: location && location.protocol && location.protocol=="chrome-extension:"? ["1", "", "spide"]: ["1"]},
|
||||||
|
]},
|
||||||
|
}},
|
||||||
|
"project": {name: "研发群", storm: {
|
||||||
|
"studio": {name: "研发 studio", action: [
|
||||||
|
{name: "vimer", help: "编辑器", index: "web.code.vimer", args: ["src/", "main.go"]},
|
||||||
|
{name: "repos", help: "代码库", index: "web.code.git.status"},
|
||||||
|
{name: "plan", help: "任务表", index: "web.team.plan"},
|
||||||
|
{name: "contexts", help: "上下文", index: "web.wiki.word", args: ["src/main.shy"]},
|
||||||
|
]},
|
||||||
|
"cli": {name: "命令 cli", action: [
|
||||||
|
{name: "bash", help: "命令行", index: "web.wiki.word", args: ["usr/icebergs/misc/bash/bash.shy"]},
|
||||||
|
{name: "tmux", help: "命令行", index: "web.wiki.word", args: ["usr/icebergs/misc/tmux/tmux.shy"]},
|
||||||
|
{name: "git", help: "代码库", index: "web.wiki.word", args: ["usr/icebergs/misc/git/git.shy"]},
|
||||||
|
{name: "vim", help: "编辑器", index: "web.wiki.word", args: ["usr/icebergs/misc/vim/vim.shy"]},
|
||||||
|
{name: "ssh", help: "命令行", index: "web.wiki.word", args: ["usr/icebergs/base/ssh/ssh.shy"]},
|
||||||
|
{name: "zsh", help: "命令行", index: "web.wiki.word", args: ["usr/icebergs/misc/bash/zsh.shy"]},
|
||||||
|
]},
|
||||||
|
"web": {name: "网页 web", action: [
|
||||||
|
{name: "HTML5", help: "浏览器", index: "web.wiki.word", args: ["usr/icebergs/misc/chrome/chrome.shy"]},
|
||||||
|
]},
|
||||||
|
"linux": {name: "系统 linux", action: [
|
||||||
|
{name: "idc", help: "平台", index: "web.wiki.word", args: ["usr/linux-story/idc/idc.shy"]},
|
||||||
|
{name: "iso", help: "系统", index: "web.wiki.word", args: ["usr/linux-story/iso/iso.shy"]},
|
||||||
|
{name: "iot", help: "设备", index: "web.wiki.word", args: ["usr/linux-story/iot/iot.shy"]},
|
||||||
|
{name: "linux", help: "系统", index: "web.wiki.word", args: ["usr/linux-story/src/main.shy"]},
|
||||||
|
]},
|
||||||
|
"nginx": {name: "代理 nginx", action: [
|
||||||
|
{name: "nginx", help: "代理", index: "web.wiki.word", args: ["usr/nginx-story/src/main.shy"]},
|
||||||
|
]},
|
||||||
|
"context": {name: "编程 context", action: [
|
||||||
|
{name: "grafana", help: "可视化", index: "web.wiki.word", args: ["usr/golang-story/src/grafana/grafana.shy"]},
|
||||||
|
{name: "gogs", help: "代码库", index: "web.wiki.word", args: ["usr/golang-story/src/gogs/gogs.shy"]},
|
||||||
|
{name: "golang", help: "编程", index: "web.wiki.word", args: ["usr/golang-story/src/main.shy"]},
|
||||||
|
]},
|
||||||
|
"redis": {name: "缓存 redis", action: [
|
||||||
|
{name: "redis", help: "缓存", index: "web.wiki.word", args: ["usr/redis-story/src/main.shy"]},
|
||||||
|
]},
|
||||||
|
"mysql": {name: "数据 mysql", action: [
|
||||||
|
{name: "mysql", help: "数据存储", index: "web.wiki.word", args: ["usr/mysql-story/src/main.shy"]},
|
||||||
|
]},
|
||||||
|
}},
|
||||||
|
"profile": {name: "测试群", storm: {
|
||||||
|
"release": {name: "发布 release", index: [
|
||||||
|
"web.code.publish", "web.code.compile", "web.code.autogen",
|
||||||
|
]},
|
||||||
|
"research": {name: "测试 research", index: [
|
||||||
|
"web.code.favor", "web.code.bench", "web.code.pprof",
|
||||||
|
]},
|
||||||
|
}},
|
||||||
|
"operate": {name: "运维群", storm: {
|
||||||
|
"ctx": {name: "模块 ctx", index: [
|
||||||
|
"context", "command", "config",
|
||||||
|
]},
|
||||||
|
"cli": {name: "系统 cli", index: [
|
||||||
|
"system", "daemon", "python", "output",
|
||||||
|
"runtime", "process",
|
||||||
|
]},
|
||||||
|
"web": {name: "网络 web", index: [
|
||||||
|
"route", "serve", "space", "dream",
|
||||||
|
"spide", "share", "cache", "story",
|
||||||
|
]},
|
||||||
|
"aaa": {name: "权限 aaa", index: [
|
||||||
|
"user", "sess", "role", "totp",
|
||||||
|
]},
|
||||||
|
|
||||||
|
"nfs": {name: "文件 nfs", index: [
|
||||||
|
"nfs.cat", "nfs.dir", "nfs.tail", "nfs.trash",
|
||||||
|
]},
|
||||||
|
"ssh": {name: "脚本 ssh", index: [
|
||||||
|
"aaa.totp", "web.code.tmux.session",
|
||||||
|
"connect", "session", "service", "channel",
|
||||||
|
]},
|
||||||
|
}},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
|
|
||||||
fieldset.Header.head {
|
|
||||||
display:none;
|
|
||||||
}
|
|
||||||
fieldset.River.left {
|
|
||||||
display:none;
|
|
||||||
}
|
|
||||||
fieldset.Footer.foot {
|
|
||||||
display:none;
|
|
||||||
}
|
|
||||||
|
|
@ -7,7 +7,6 @@
|
|||||||
<link rel="shortcut icon" type="image/ico" href="/favicon.ico">
|
<link rel="shortcut icon" type="image/ico" href="/favicon.ico">
|
||||||
<link rel="stylesheet" type="text/css" href="/page/index.css">
|
<link rel="stylesheet" type="text/css" href="/page/index.css">
|
||||||
<link rel="stylesheet" type="text/css" href="/page/share.css">
|
<link rel="stylesheet" type="text/css" href="/page/share.css">
|
||||||
<link rel="stylesheet" type="text/css" href="/page/print.css" media="print"/>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script src="/proto.js"></script>
|
<script src="/proto.js"></script>
|
||||||
|
@ -1,11 +1,24 @@
|
|||||||
Volcanos({name: "chat", iceberg: "/chat/", volcano: "/frame.js",
|
Volcanos({name: "chat", iceberg: "/chat/", volcano: "/frame.js",
|
||||||
libs: ["/lib/base.js", "/lib/core.js", "/lib/misc.js", "/lib/page.js", "/lib/user.js"], panels: [
|
libs: ["/lib/base.js", "/lib/core.js", "/lib/misc.js", "/lib/page.js", "/lib/user.js"], panels: [
|
||||||
|
{name: "Header", help: "标题栏", pos: "head", state: ["time", "username", "avatar"]},
|
||||||
|
{name: "Search", help: "搜索框", pos: "auto"},
|
||||||
|
{name: "River", help: "群聊组", pos: "left", action: ["创建", "刷新"]},
|
||||||
{name: "Action", help: "工作台", pos: "main"},
|
{name: "Action", help: "工作台", pos: "main"},
|
||||||
], main: {name: "Action", engine: "remote", list: ["/publish/order.js"]}, plugin: [
|
{name: "Footer", help: "状态条", pos: "foot", state: ["ncmd"]},
|
||||||
"/plugin/state.js",
|
], main: {name: "Header"}, river: {
|
||||||
"/plugin/input.js",
|
"serivce": {name: "运营群", storm: {
|
||||||
"/plugin/table.js",
|
"wx": {name: "公众号 wx", action: [
|
||||||
"/plugin/input/key.js",
|
{name: "微信公众号", help: "wx", index: "web.wiki.word", args: ["usr/icebergs/misc/wx/wx.shy"]},
|
||||||
"/plugin/input/date.js",
|
]},
|
||||||
],
|
"mp": {name: "小程序 mp", action: [
|
||||||
|
{name: "微信小程序", help: "mp", index: "web.wiki.word", args: ["usr/icebergs/misc/mp/mp.shy"]},
|
||||||
|
]},
|
||||||
|
"lark": {name: "机器人 lark", action: [
|
||||||
|
{name: "飞书机器人", help: "lark", index: "web.wiki.word", args: ["usr/icebergs/misc/lark/lark.shy"]},
|
||||||
|
]},
|
||||||
|
"share": {name: "上下文 share", action: [
|
||||||
|
{name: "系统上下文", help: "shylinux/contexts", index: "web.wiki.word", args: ["usr/learning/社会/管理/20200724.shy"]},
|
||||||
|
]},
|
||||||
|
}},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
@ -16,10 +16,7 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg)
|
|||||||
can.onaction._layout(can, can.Conf(can._LAYOUT)||can.user.Search(can, can._LAYOUT))
|
can.onaction._layout(can, can.Conf(can._LAYOUT)||can.user.Search(can, can._LAYOUT))
|
||||||
})
|
})
|
||||||
|
|
||||||
can.page.Modify(can, can._output, {onmouseover: function(event) {
|
can.onmotion.float.auto(can, can._output, "carte")
|
||||||
Volcanos.meta.float.carte && can.page.Remove(can, Volcanos.meta.float.carte._target)
|
|
||||||
// Volcanos.meta.float.input && can.page.Remove(can, Volcanos.meta.float.input._target)
|
|
||||||
}})
|
|
||||||
},
|
},
|
||||||
_plugin: function(can, river, storm, sub, item) {
|
_plugin: function(can, river, storm, sub, item) {
|
||||||
sub.run = function(event, cmds, cb) { var msg = sub.request(event)
|
sub.run = function(event, cmds, cb) { var msg = sub.request(event)
|
||||||
|
@ -33,15 +33,12 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
|
|||||||
|
|
||||||
can.base.isFunc(cb) && cb(msg)
|
can.base.isFunc(cb) && cb(msg)
|
||||||
|
|
||||||
can.page.Modify(can, can._output, {onmouseover: function(event) {
|
can.onmotion.float.auto(can, can._output, "carte", "input")
|
||||||
Volcanos.meta.float.carte && can.page.Remove(can, Volcanos.meta.float.carte._target)
|
|
||||||
Volcanos.meta.float.input && can.page.Remove(can, Volcanos.meta.float.input._target)
|
|
||||||
}})
|
|
||||||
},
|
},
|
||||||
_title: function(can, msg, target) {
|
_title: function(can, msg, target) {
|
||||||
can.user.title(can.user.Search(can, can._TITLE)||can.user.Search(can, "pod"))
|
can.user.title(can.user.Search(can, can._TITLE)||can.user.Search(can, "pod"))
|
||||||
!can.user.isMobile && can.core.List(msg.result||["github.com/shylinux/contexts"], function(item) {
|
!can.user.isMobile && can.core.List(msg.result||["github.com/shylinux/contexts"], function(item) {
|
||||||
can.page.Append(can, target, [{view: [can._TITLE, "div", item], onclick: function(event) {
|
can.page.Append(can, target, [{view: [can._TITLE, "div", item], title: "返回主页", onclick: function(event) {
|
||||||
can.onaction.title(event, can)
|
can.onaction.title(event, can)
|
||||||
}}])
|
}}])
|
||||||
})
|
})
|
||||||
@ -128,9 +125,10 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
|
|||||||
_time: function(can, target) {
|
_time: function(can, target) {
|
||||||
can.core.Timer({interval: 1000}, function() { can.onimport.time(can, target) })
|
can.core.Timer({interval: 1000}, function() { can.onimport.time(can, target) })
|
||||||
can.onappend.figure(can, {style: {"min-width": 306}}, "@date", target)
|
can.onappend.figure(can, {style: {"min-width": 306}}, "@date", target)
|
||||||
|
|
||||||
target.onmouseenter = function(event) { target.click()
|
target.onmouseenter = function(event) { target.click()
|
||||||
can.core.Timer(10, function() {
|
can.core.Timer(10, function() {
|
||||||
can.onlayout.figure(event, can, Volcanos.meta.float.input._target)
|
// can.onlayout.figure(event, can, Volcanos.meta.float.input._target)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -13,10 +13,8 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
|
|||||||
|
|
||||||
select && select.click()
|
select && select.click()
|
||||||
|
|
||||||
can.page.Modify(can, can._output, {onmouseover: function(event) {
|
can.onlayout._init(can)
|
||||||
Volcanos.meta.float.carte && can.page.Remove(can, Volcanos.meta.float.carte._target)
|
can.onmotion.float.auto(can, can._output, "carte", "input")
|
||||||
Volcanos.meta.float.input && can.page.Remove(can, Volcanos.meta.float.input._target)
|
|
||||||
}})
|
|
||||||
},
|
},
|
||||||
_main: function(can, msg) {
|
_main: function(can, msg) {
|
||||||
can._main_river = "project", can._main_storm = "studio"
|
can._main_river = "project", can._main_storm = "studio"
|
||||||
@ -114,7 +112,7 @@ Volcanos("onaction", {help: "控件交互", list: [], _init: function(can, msg,
|
|||||||
|
|
||||||
can.onengine.listen(can, "action.touch", function() {
|
can.onengine.listen(can, "action.touch", function() {
|
||||||
can.user.isMobile && can.onmotion.hidden(can)
|
can.user.isMobile && can.onmotion.hidden(can)
|
||||||
Volcanos.meta.float.carte && can.page.Remove(can, Volcanos.meta.float.carte._target)
|
can.onmotion.float.del(can, "carte")
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
storm: function(event, can, river) {
|
storm: function(event, can, river) {
|
||||||
@ -130,7 +128,8 @@ Volcanos("onaction", {help: "控件交互", list: [], _init: function(can, msg,
|
|||||||
can.sublist[river] = list
|
can.sublist[river] = list
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
action: function(event, can, river, storm) { can.onlayout._init(can)
|
action: function(event, can, river, storm) {
|
||||||
|
// can.onlayout._init(can)
|
||||||
can.onengine.signal(can, "storm.select", can.request(event, {
|
can.onengine.signal(can, "storm.select", can.request(event, {
|
||||||
river: can.Conf(can._RIVER, river), storm: can.Conf(can._STORM, storm),
|
river: can.Conf(can._RIVER, river), storm: can.Conf(can._STORM, storm),
|
||||||
}))
|
}))
|
||||||
|
@ -7,7 +7,7 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
|
|||||||
|
|
||||||
can.base.isFunc(cb) && cb(msg)
|
can.base.isFunc(cb) && cb(msg)
|
||||||
can.onappend.board(can, msg.Result())
|
can.onappend.board(can, msg.Result())
|
||||||
can.onmotion.story(can, can._output)
|
can.onmotion.story.auto(can, can._output)
|
||||||
},
|
},
|
||||||
_table: function(can, value, key, index, line, array, cb) {
|
_table: function(can, value, key, index, line, array, cb) {
|
||||||
return {text: [value, "td"], onclick: function(event) { var target = event.target
|
return {text: [value, "td"], onclick: function(event) { var target = event.target
|
||||||
@ -53,7 +53,7 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
|
|||||||
}, can._output)
|
}, can._output)
|
||||||
|
|
||||||
can.onappend.board(can, msg.Result(), can._output)
|
can.onappend.board(can, msg.Result(), can._output)
|
||||||
can.onmotion.story(can, can._output)
|
can.onmotion.story.auto(can, can._output)
|
||||||
can.page.Modify(can, can._output, {style: {display: "block"}})
|
can.page.Modify(can, can._output, {style: {display: "block"}})
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
@ -122,7 +122,7 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
|
|||||||
}).length == 0) {
|
}).length == 0) {
|
||||||
can.onappend.board(can, str)
|
can.onappend.board(can, str)
|
||||||
}
|
}
|
||||||
// can.onmotion.story(can, can._output)
|
// can.onmotion.story.auto(can, can._output)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
Volcanos("onaction", {help: "控件交互", list: []})
|
Volcanos("onaction", {help: "控件交互", list: []})
|
||||||
|
41
proto.js
41
proto.js
@ -11,7 +11,7 @@ function shy(help, meta, list, cb) {
|
|||||||
cb.list = next("object") || []
|
cb.list = next("object") || []
|
||||||
return cb
|
return cb
|
||||||
}; var _can_name = ""
|
}; var _can_name = ""
|
||||||
var Volcanos = shy("火山架", {args: {}, pack: {}, libs: [], cache: {}, float: {}}, [], function(name, can, libs, cb) {
|
var Volcanos = shy("火山架", {args: {}, pack: {}, libs: [], cache: {}}, [], function(name, can, libs, cb) {
|
||||||
var meta = arguments.callee.meta, list = arguments.callee.list
|
var meta = arguments.callee.meta, list = arguments.callee.list
|
||||||
if (typeof name == "object") { var Config = name; _can_name = ""
|
if (typeof name == "object") { var Config = name; _can_name = ""
|
||||||
meta.libs = Config.libs, meta.volcano = Config.volcano
|
meta.libs = Config.libs, meta.volcano = Config.volcano
|
||||||
@ -24,9 +24,7 @@ var Volcanos = shy("火山架", {args: {}, pack: {}, libs: [], cache: {}, float:
|
|||||||
// 根模块
|
// 根模块
|
||||||
name = Config.name, can = {_follow: Config.name, _target: document.body}
|
name = Config.name, can = {_follow: Config.name, _target: document.body}
|
||||||
libs = Preload.concat(Config.main.list, Config.libs), cb = function(can) {
|
libs = Preload.concat(Config.main.list, Config.libs), cb = function(can) {
|
||||||
can.onengine._init(can, can.Conf(Config), Config.panels, function(msg) { can.misc.Log(can.user.title(), "run", can)
|
can.onengine._init(can, can.Conf(Config), Config.panels, function(msg) {}, can._target)
|
||||||
document.body.onresize = function() { can.onlayout._init(can, can._target) }
|
|
||||||
}, can._target)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,12 +48,6 @@ var Volcanos = shy("火山架", {args: {}, pack: {}, libs: [], cache: {}, float:
|
|||||||
return // 加载完成
|
return // 加载完成
|
||||||
}
|
}
|
||||||
|
|
||||||
if (libs && libs[0] && libs[0][0] != "/" && libs[0].indexOf("http") == -1) {
|
|
||||||
can._require = can._require||[], can._require.push(libs[0])
|
|
||||||
can.require(libs.slice(1), cb, each)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// 请求模块
|
// 请求模块
|
||||||
function next() { can._load(libs[0], each), can.require(libs.slice(1), cb, each) }
|
function next() { can._load(libs[0], each), can.require(libs.slice(1), cb, each) }
|
||||||
meta.cache[libs[0]]? next(): meta._load(libs[0], next)
|
meta.cache[libs[0]]? next(): meta._load(libs[0], next)
|
||||||
@ -70,33 +62,26 @@ var Volcanos = shy("火山架", {args: {}, pack: {}, libs: [], cache: {}, float:
|
|||||||
|
|
||||||
}); return event._msg
|
}); return event._msg
|
||||||
},
|
},
|
||||||
const: function() {
|
|
||||||
can.core.List(arguments, function(v) {
|
get: function(name, key) { var event = {}
|
||||||
can["_"+v.toUpperCase()] = v
|
return can.search(event, [name+".onexport."+key])
|
||||||
})
|
|
||||||
},
|
},
|
||||||
get: function(target, field) {
|
set: function(name, key, value) { var event = {}
|
||||||
return can.search({}, [target+".onexport."+field])
|
var msg = can.request(event); msg.Option(key, value)
|
||||||
|
return can.search(event, [name+".onimport."+key])
|
||||||
},
|
},
|
||||||
set: function(target, field, value) { var event = {}
|
search: function(event, cmds, cb) { can.run && can.run(event, ["_search"].concat(cmds), cb, true) },
|
||||||
var msg = can.request(event, {}); msg.Option(field, value)
|
|
||||||
return can.search(event, [target+".onimport."+field])
|
const: function() { can.core.List(arguments, function(v) { can["_"+v.toUpperCase()] = v }) },
|
||||||
},
|
|
||||||
cmd: function(target, field) {
|
|
||||||
return can.search({}, [target+".onaction."+field])
|
|
||||||
},
|
|
||||||
search: function(event, cmds, cb) { can.run && can.run(event, ["search"].concat(cmds), cb, true) },
|
|
||||||
Conf: function(key, value) { return can.core.Value(can._conf, key, value) }, _conf: {},
|
Conf: function(key, value) { return can.core.Value(can._conf, key, value) }, _conf: {},
|
||||||
// }; can = can || {}; for (var k in proto) { can.hasOwnProperty(k) || (can[k] = proto[k]) }
|
|
||||||
}; can = can || {}; can.__proto__ = proto
|
}; can = can || {}; can.__proto__ = proto
|
||||||
|
|
||||||
if (_can_name) {
|
if (_can_name) { // 加入缓存
|
||||||
meta.cache[_can_name] = meta.cache[_can_name] || []
|
meta.cache[_can_name] = meta.cache[_can_name] || []
|
||||||
meta.cache[_can_name].push(can)
|
meta.cache[_can_name].push(can)
|
||||||
} else {
|
} else { // 加入队列
|
||||||
list.push(can)
|
list.push(can)
|
||||||
}
|
}
|
||||||
|
|
||||||
return can.require(libs, cb), can
|
return can.require(libs, cb), can
|
||||||
})
|
})
|
||||||
Volcanos.meta._load = function(url, cb) {
|
Volcanos.meta._load = function(url, cb) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user