1
0
mirror of https://shylinux.com/x/volcanos synced 2025-04-25 08:48:06 +08:00
This commit is contained in:
shaoying 2022-12-15 09:14:44 +08:00
parent 12af5ef04f
commit 5e516f3b86
4 changed files with 113 additions and 107 deletions

View File

@ -56,30 +56,20 @@ setTimeout(function() { Volcanos({
can.onappend.plugin(can, {type: chat.CONTEXTS, index: arg[0], args: can.base.Obj(arg[1])}, function(sub, meta) { can.onappend.plugin(can, {type: chat.CONTEXTS, index: arg[0], args: can.base.Obj(arg[1])}, function(sub, meta) {
sub.run = function(event, cmds, cb) { msg.RunAction(event, can, cmds) || can.runActionCommand(event, meta.index, cmds, function(msg) { sub.run = function(event, cmds, cb) { msg.RunAction(event, can, cmds) || can.runActionCommand(event, meta.index, cmds, function(msg) {
can.onmotion.toggle(can, sub._option, true), can.onmotion.toggle(can, sub._action, true), can.onmotion.toggle(can, sub._output, true), can.onmotion.toggle(can, sub._status, true) can.onmotion.toggle(can, sub._option, true), can.onmotion.toggle(can, sub._action, true), can.onmotion.toggle(can, sub._output, true), can.onmotion.toggle(can, sub._status, true)
can.base.isFunc(cb) && cb(msg) can.base.isFunc(cb) && cb(msg)
}) } }) }
can.onmotion.move(can, sub._target, {left: msg.Option(html.LEFT), top: msg.Option(html.TOP), right: msg.Option(html.RIGHT), bottom: msg.Option(html.BOTTOM)}, function(target) { can.onmotion.move(can, sub._target, {left: msg.Option(html.LEFT), top: msg.Option(html.TOP), right: msg.Option(html.RIGHT), bottom: msg.Option(html.BOTTOM)}, function(target) {
can.page.style(can, sub._output, html.MAX_HEIGHT, window.innerHeight-target.offsetTop-80, html.MAX_WIDTH, window.innerWidth-target.offsetLeft-20) can.page.style(can, sub._output, html.MAX_HEIGHT, window.innerHeight-target.offsetTop-80, html.MAX_WIDTH, window.innerWidth-target.offsetLeft-20)
}) })
sub._legend.onclick = function(event) { sub._legend.onclick = function(event) { can.onmotion.toggle(can, sub._option), can.onmotion.toggle(can, sub._action), can.onmotion.toggle(can, sub._output), can.onmotion.toggle(can, sub._status) }
can.onmotion.toggle(can, sub._option), can.onmotion.toggle(can, sub._action), can.onmotion.toggle(can, sub._output), can.onmotion.toggle(can, sub._status)
}
msg.Option("selection")? can.onengine.listen(can, "onselection", function() { sub.Option(msg.Option("selection"), window.getSelection()), sub.Update() }): sub._legend.onclick() msg.Option("selection")? can.onengine.listen(can, "onselection", function() { sub.Option(msg.Option("selection"), window.getSelection()), sub.Update() }): sub._legend.onclick()
sub.onaction["保存参数"] = function(event) { can.run(can.request(event, {domain: location.host, id: msg.Option(mdb.ID)}), [chat.FIELD, mdb.MODIFY, html.TOP, sub._target.offsetTop, html.LEFT, sub._target.offsetLeft, ctx.ARGS, JSON.stringify(sub.Input([], true))]) } sub.onaction["保存参数"] = function(event) { can.run(can.request(event, {domain: location.host, id: msg.Option(mdb.ID)}), [chat.FIELD, mdb.MODIFY, html.TOP, sub._target.offsetTop, html.LEFT, sub._target.offsetLeft, ctx.ARGS, JSON.stringify(sub.Input([], true))]) }
}, document.body) }, document.body)
}, },
change: function(can, msg, arg) {
arg.length > 1 && can.page.Modify(can, arg[0], can.base.Obj(arg[1]))
arg.length > 0 && can.page.Select(can, document.body, arg[0], function(item) {
msg.Push(mdb.TEXT, item.outerHTML)
})
},
order: function(can, msg, arg) { order: function(can, msg, arg) {
var ui = can.user.input(event, can, [ctx.INDEX, ctx.ARGS, "selection", html.LEFT, html.TOP], function(args) { var ui = can.user.input(event, can, [ctx.INDEX, ctx.ARGS, "selection", html.LEFT, html.TOP], function(args) {
can.run(event, [chat.FIELD, mdb.INSERT, mdb.ZONE, location.host].concat(args), function(res) { can.run(event, [chat.FIELD, mdb.INSERT, web.DOMAIN, location.host].concat(args), function(res) { can.user.toastSuccess(can) })
can.user.toastSuccess(can)
})
}); can.page.style(can, ui._target, {left: 200, top: 200}) }); can.page.style(can, ui._target, {left: 200, top: 200})
can.page.ClassList.add(can, ui._target, chat.CONTEXTS) can.page.ClassList.add(can, ui._target, chat.CONTEXTS)
}, },

View File

@ -1,45 +1,40 @@
Volcanos({ Volcanos({
chrome: function(can, msg, arg, cb) { msg.detail = msg.detail.slice(3) chrome: function(can, msg, arg, cb) { msg.detail = msg.detail.slice(3)
if (arg.length == 0 || arg[0] == "") { if (arg.length == 0 || arg[0] == "") {
chrome.windows.getAll(function(wins) { chrome.windows.getAll(function(win) { can.core.List(win, function(win) { win.wid = win.id
can.core.List(wins, function(win) { win.wid = win.id msg.Push(win, ["type", "state", "wid", "focused", html.LEFT, html.TOP, html.WIDTH, html.HEIGHT])
msg.Push(win, ["type", "state", "wid", "focused", html.LEFT||"0", html.TOP||"0", html.WIDTH, html.HEIGHT]) }), can.base.isFunc(cb) && cb(msg) })
}), can.base.isFunc(cb) && cb(msg) } else if (arg.length == 1 || arg[1] == "") {
}) chrome.tabs.getAllInWindow(parseInt(arg[0]), function(tab) { can.core.Next(tab, function(tab, next) { var _msg = can.request(); _msg.detail = ["info"]
} else if (arg.length == 1 || arg[1] == "") { can._tabsend(can, _msg, function(res) { tab.tid = tab.id
chrome.tabs.getAllInWindow(parseInt(arg[0]), function(tabs) { msg.Push(tab, ["index", "tid", "active", html.WIDTH, html.HEIGHT])
can.core.Next(tabs, function(tab, next) { var _msg = can.request(); _msg.detail = ["info"] msg.Push("title", res&&res["title"][0]||"").Push("url", res&&res["url"][0]||"")
can._tabsend(can, _msg, function(res) { tab.tid = tab.id next()
msg.Push(tab, ["index", "tid", "active", html.WIDTH, html.HEIGHT]) }, tab.id)
msg.Push("title", res && res["title"][0] || "") }, function() { can.base.isFunc(cb) && cb(msg) }) })
msg.Push("url", res && res["url"][0] || "") } else if (arg[1] == "current") {
next() chrome.tabs.query({currentWindow: true, active: true}, function(tabs) { arg[1] = tabs[0].id
}, tab.id)
}, function() { can.base.isFunc(cb) && cb(msg) })
})
} else if (arg[1] == "current") {
chrome.tabs.query({currentWindow: true, active: true}, function(tabs) { arg[1] = tabs[0].id
can._tabsend(can, msg, null, arg[1]) can._tabsend(can, msg, null, arg[1])
}) })
} else { } else {
can._tabsend(can, msg, null, arg[1]) can._tabsend(can, msg, null, arg[1])
} }
}, },
_tabsend: function(can, msg, cb, target) { _tabsend: function(can, msg, cb, target) {
chrome.tabs.sendMessage(parseInt(target||msg.Option(ice.MSG_TARGET)), msg, cb||function(res) { msg.Copy(res), msg.Reply() }) chrome.tabs.sendMessage(parseInt(target||msg.Option(ice.MSG_TARGET)), msg, cb||function(res) { msg.Copy(res), msg.Reply() })
}, },
_daemon: function(can) { _daemon: function(can) {
can.misc.WSS(can, {type: html.CHROME, name: html.CHROME}, function(event, msg, cmd, arg, cb) { can.misc.WSS(can, {type: html.CHROME, name: html.CHROME}, function(event, msg, cmd, arg, cb) {
msg.Option(ice.MSG_TARGET)? can._tabsend(can, msg): can.core.CallFunc([can, cmd], {can: can, msg: msg, arg: arg, cb: cb}) msg.Option(ice.MSG_TARGET)? can._tabsend(can, msg): can.core.CallFunc([can, cmd], {can: can, msg: msg, arg: arg, cb: cb})
}) })
chrome.runtime.onMessage.addListener(function(req, sender, cb) { chrome.runtime.onMessage.addListener(function(req, sender, cb) {
var msg = can.request({}, {tid: sender.tab.id, url: sender.url}); can.core.List(req.option, function(key) { msg.Option(key, req[key][0]) }) var msg = can.request({}, {tid: sender.tab.id, url: sender.url}); can.core.List(req.option, function(key) { msg.Option(key, req[key][0]) })
return msg._source = [sender.tab.id], can.run(msg, req.detail||[], cb), true return msg._source = [sender.tab.id], can.run(msg, req.detail||[], cb), true
}) })
chrome.history && chrome.history.onVisited.addListener(function(item) { chrome.history && chrome.history.onVisited.addListener(function(item) {
can.run({}, ["sync", mdb.TYPE, mdb.LINK, mdb.NAME, item.title, mdb.LINK, item.url, "tid", item.id]) can.run({}, ["sync", mdb.TYPE, mdb.LINK, mdb.NAME, item.title, mdb.LINK, item.url, "tid", item.id])
}) })
}, },
_motion: function(can) { _motion: function(can) {
can.user.toast = function(can, message, title) { chrome.notifications.create(null, { can.user.toast = function(can, message, title) { chrome.notifications.create(null, {
message: message, title: title||can._name, iconUrl: "/favicon.ico", type: "basic", message: message, title: title||can._name, iconUrl: "/favicon.ico", type: "basic",

View File

@ -3,7 +3,7 @@
<meta charset="utf-8"> <meta charset="utf-8">
<link rel="stylesheet" href="/page/can.css"> <link rel="stylesheet" href="/page/can.css">
</head> </head>
<body style="width:1200px; height:600px; overflow:auto"> <body style="width:800px; height:600px; overflow:auto">
<script src="/page/can.js"></script> <script src="/page/can.js"></script>
<script src="/publish/chrome/popup.js"></script> <script src="/publish/chrome/popup.js"></script>
</body> </body>

View File

@ -1,61 +1,82 @@
Volcanos({name: "popup", iceberg: "http://localhost:9020/chat/", river: { Volcanos({name: "popup", iceberg: "http://localhost:9020/chat/", river: {
product: {name: "产品群", storm: { product: {name: "产品群", storm: {
office: {name: "办公 office", list: [ office: {name: "办公 office", list: [
{name: "feel", help: "影音媒体", index: "web.wiki.feel"}, {name: "feel", help: "影音媒体", index: "web.wiki.feel"},
{name: "draw", help: "思维导图", index: "web.wiki.draw"}, {name: "draw", help: "思维导图", index: "web.wiki.draw"},
{name: "data", help: "数据表格", index: "web.wiki.data"}, {name: "data", help: "数据表格", index: "web.wiki.data"},
{name: "plan", help: "计划任务", index: "web.team.plan"}, {name: "plan", help: "计划任务", index: "web.team.plan"},
{name: "think", help: "智库", index: "web.wiki.word", args: ["usr/learning/"]}, {name: "think", help: "智库", index: "web.wiki.word", args: ["usr/learning/"]},
{name: "index", help: "索引", index: "web.wiki.word", args: ["usr/learning/index.shy"]}, {name: "index", help: "索引", index: "web.wiki.word", args: ["usr/learning/index.shy"]},
{name: "context", help: "编程", index: "web.wiki.word", args: ["src/main.shy"]}, {name: "context", help: "编程", index: "web.wiki.word", args: ["src/main.shy"]},
]}, ]},
chrome: {name: "爬虫 chrome", list: [ chrome: {name: "爬虫 chrome", list: [
{name: "feel", help: "网页爬虫", index: "web.wiki.feel", args: ["spide/"], feature: { {name: "feel", help: "网页爬虫", index: "web.wiki.feel", args: ["spide/"], feature: {
display: "/plugin/local/wiki/feel.js", display: "/plugin/local/wiki/feel.js",
height: 200, limit: 3, height: 200, limit: 3,
}}, }},
{name: "cached", help: "爬虫缓存", index: "web.code.chrome.cache", args: []}, {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"]}, {name: "spided", help: "网页爬虫", index: "web.code.chrome.spide", args: location && location.protocol && location.protocol=="chrome-extension:"? ["1", "", "spide"]: ["1"]},
]}, ]},
}}, }},
project: {name: "研发群", storm: { project: {name: "研发群", storm: {
studio: {name: "研发 studio", list: [ studio: {name: "研发 studio", list: [
{name: "vimer", help: "编辑器", index: "web.code.vimer", args: ["src/", "main.go"]}, {name: "vimer", help: "编辑器", index: "web.code.vimer", args: ["src/,usr/volcanos/,usr/icebergs/,usr/toolkits/", "main.go"]},
{name: "repos", help: "代码库", index: "web.code.git.status"}, {name: "repos", help: "代码库", index: "web.code.git.status"},
{name: "plan", help: "任务表", index: "web.team.plan"}, {name: "favor", help: "收藏夹", index: "web.chat.favor"},
{name: "ctx", help: "上下文", index: "web.wiki.word", args: ["src/main.shy"]}, {name: "plan", help: "任务表", index: "web.team.plan"},
]}, {name: "ctx", help: "上下文", index: "web.wiki.word"},
web: {name: "网页 web", list: [ ]},
{name: "HTML5", help: "浏览器", index: "web.wiki.word", args: ["usr/icebergs/misc/chrome/chrome.shy"]}, chrome: {name: "网页 chrome", index: [
]}, "web.code.chrome.chrome",
}}, "web.code.chrome.daemon",
profile: {name: "测试群", storm: { "web.code.chrome.spide",
release: {name: "发布 release", index: [ "web.code.chrome.cache",
"web.code.publish", "web.code.compile", "web.code.autogen", "web.code.chrome.style",
]}, "web.code.chrome.field",
research: {name: "测试 research", index: [ ]},
"web.code.favor", "web.code.bench", "web.code.pprof", }},
"web.code.case", profile: {name: "测试群", storm: {
]}, release: {name: "发布 release", index: [
}}, "web.code.webpack",
operate: {name: "运维群", storm: { "web.code.compile",
aaa: {name: "权限 aaa", index: [ "web.code.publish",
"user", "sess", "role", "totp", "web.code.docker.client",
]}, "web.space",
web: {name: "应用 web", index: [ "web.dream",
"spide", "route", "share", "dream", "web.code.git.server",
]}, "web.code.git.status",
cli: {name: "系统 cli", index: [ ]},
"qrcode", "daemon", "system", "runtime", toolkit: {name: "工具 toolkit", index: [
]}, "web.code.favor",
nfs: {name: "文件 nfs", index: [ "web.code.xterm",
"cat", "dir", "tail", "trash", "web.code.inner",
]}, "web.code.vimer",
ssh: {name: "脚本 ssh", index: [ "web.code.bench",
"connect", "session", "service", "channel", "web.code.pprof",
"source", "screen", "web.code.oauth",
]}, ]},
}}, language: {name: "语言 language", index: [
}, "web.code.c",
}) "web.code.sh",
"web.code.py",
"web.code.shy",
"web.code.js",
"web.code.go",
]},
}},
operate: {name: "运维群", storm: {
aaa: {name: "权限 aaa", index: [
"offer", "email", "user", "totp", "sess", "role",
]},
web: {name: "应用 web", index: [
"broad", "serve", "space", "dream", "share", "cache", "spide",
]},
cli: {name: "系统 cli", index: [
"qrcode", "daemon", "system", "runtime", "mirrors", "forever", "host", "port",
]},
nfs: {name: "文件 nfs", index: [
"cat", "dir", "pack", "tail", "trash",
]},
}},
}})