mirror of
https://shylinux.com/x/volcanos
synced 2025-04-25 08:48:06 +08:00
add some
This commit is contained in:
parent
db77a0a323
commit
877af916eb
@ -2,6 +2,12 @@ Volcanos("base", {help: "基础模块",
|
||||
isNone: function(c) {return c === undefined || c === null},
|
||||
isSpace: function(c) {return c == " " || c == "Enter"},
|
||||
|
||||
Path: function() {var res = "/"
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
res = (arguments[i].indexOf("/") == 0? "": res) + "/" + arguments[i]
|
||||
}
|
||||
return res
|
||||
},
|
||||
Int: function(value) {return parseInt(value)||0},
|
||||
Obj: function(value, def) {return typeof value == "string"? JSON.parse(value): value || def || {}},
|
||||
|
||||
|
@ -47,7 +47,7 @@ Volcanos("misc", {help: "工具模块",
|
||||
return msg[key] = value, key
|
||||
})
|
||||
|
||||
msg._hand = true, can.misc.POST(can, msg, can.Conf("iceberg")+(dataset.names||msg.names).toLowerCase(), option, function(msg) {
|
||||
msg._hand = true, can.misc.POST(can, msg, can.Conf("iceberg")+(msg.names||dataset.names||event.names||"").toLowerCase(), option, function(msg) {
|
||||
typeof cb == "function" && cb(msg)
|
||||
}), delete(event.msg)
|
||||
}),
|
||||
|
@ -2,8 +2,9 @@ var can = Volcanos("chrome", {
|
||||
_send: function(msg, cb) {chrome.extension.sendRequest(msg, cb)},
|
||||
_open: function(url) {chrome.windows.create({url: url})},
|
||||
|
||||
run: function(can, msg, cb) {
|
||||
can.misc.Run({names: "chrome", msg: msg}, can, {}, null, cb)
|
||||
run: function(can, msg, cb) {msg = can.Event({}, msg)
|
||||
msg.Option("sid", can.sid||"")
|
||||
can.misc.Run({names: "code/chrome/crx", msg: msg}, can, {}, null, cb)
|
||||
},
|
||||
|
||||
open: function(msg, cmd, cb) {
|
||||
@ -129,12 +130,24 @@ var can = Volcanos("chrome", {
|
||||
msg.Reply(msg)
|
||||
}, function() {can.user.toast("wss connect", "iceberg")})
|
||||
|
||||
can.run(can, {cmd: ["login", can.sid||""]}, function(msg) {
|
||||
can.sid = msg.Result()
|
||||
})
|
||||
|
||||
chrome.history.onVisited.addListener(function(item) {
|
||||
can.run(can, {names: "chrome/crx", cmd: ["history", item.id, item.url, item.title]}, function(msg) {
|
||||
can.run(can, {cmd: ["history", item.id, item.url, item.title]}, function(msg) {
|
||||
can.user.toast(item.url, item.title)
|
||||
})
|
||||
})
|
||||
|
||||
chrome.bookmarks.onCreated.addListener(function(id, item) {
|
||||
chrome.bookmarks.get(item.parentId, function(root) {
|
||||
can.run(can, {cmd: ["bookmark", item.id, item.url, item.title, root[0].title]}, function(msg) {
|
||||
can.user.toast(item.url, item.title)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
chrome.extension.onRequest.addListener(function(msg, sender, cb) {
|
||||
can.run(can, msg, cb)
|
||||
})
|
||||
|
@ -1,4 +1,4 @@
|
||||
var Config = {iceberg: "http://localhost:9020/chat/", volcano: "/",
|
||||
var Config = {iceberg: "http://localhost:9020/", volcano: "/",
|
||||
libs: ["lib/base", "lib/core", "lib/misc", "lib/page", "lib/user"],
|
||||
main: "chat", list: ["page/chat",
|
||||
"pane/Toast", "pane/Tutor", "pane/Debug",
|
||||
|
Loading…
x
Reference in New Issue
Block a user