diff --git a/manifest.json b/manifest.json index b99c8ed3..185de454 100644 --- a/manifest.json +++ b/manifest.json @@ -5,6 +5,7 @@ "browser_action": {"default_popup": "/publish/chrome/popup.html"}, "content_scripts": [{"matches": [""], "js": ["/proto.js", "/lib/base.js", "/lib/core.js", "/lib/misc.js", "/lib/page.js", "/lib/user.js", + "/plugin/state.js", "/plugin/input.js", "/plugin/table.js", "/frame.js", "/publish/chrome/contexts.js" ]} ], diff --git a/plugin/input.js b/plugin/input.js index 98e8b76c..bd2cfb3b 100644 --- a/plugin/input.js +++ b/plugin/input.js @@ -1,3 +1,4 @@ +var _can_name = "/plugin/input.js" Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, meta, list, cb, target) { }, }) @@ -39,4 +40,4 @@ Volcanos("onaction", {help: "控件交互", list: [], _init: function(can, meta, }, }) Volcanos("onexport", {help: "导出数据", list: []}) - +var _can_name = "" diff --git a/plugin/state.js b/plugin/state.js index d7e3bc58..0bf5dedc 100644 --- a/plugin/state.js +++ b/plugin/state.js @@ -1,3 +1,4 @@ +var _can_name = "/plugin/state.js" Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, conf, list, cb, target) { }, _process: function(can, msg) { @@ -205,3 +206,4 @@ Volcanos("onaction", {help: "交互操作", list: [ "清空": function(event, can, name) { can.onmotion.clear(can, can._output) }, }) Volcanos("onexport", {help: "导出数据", list: []}) +var _can_name = "" diff --git a/plugin/table.js b/plugin/table.js index ee13548d..f3258db6 100644 --- a/plugin/table.js +++ b/plugin/table.js @@ -1,3 +1,4 @@ +var _can_name = "/plugin/table.js" Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg, list, cb, target) { can.onmotion.clear(can), can.base.isFunc(cb) && cb(msg) can.onappend.table(can, msg) @@ -19,3 +20,4 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg, }) Volcanos("onaction", {help: "控件交互", list: []}) Volcanos("onexport", {help: "导出数据", list: []}) +var _can_name = "" diff --git a/proto.js b/proto.js index 5ca7a7f9..06eadd8d 100644 --- a/proto.js +++ b/proto.js @@ -11,7 +11,7 @@ function shy(help, meta, list, cb) { cb.list = next("object") || [] return cb }; var _can_name = "" -var Volcanos = shy("火山架", {args: {}, pack: {}, libs: [], cache: {}}, [], function(name, can, libs, cb) { +var Volcanos = shy("火山架", {volcano: "/frame.js", args: {}, pack: {}, libs: [], cache: {}}, [], function(name, can, libs, cb) { var meta = arguments.callee.meta, list = arguments.callee.list if (typeof name == "object") { var Config = name; _can_name = "" meta.libs = Config.libs, meta.volcano = Config.volcano diff --git a/publish/chrome/chrome.js b/publish/chrome/chrome.js index 4e9139aa..0765afc3 100644 --- a/publish/chrome/chrome.js +++ b/publish/chrome/chrome.js @@ -31,7 +31,7 @@ Volcanos("chrome", { }) } else { chrome.tabs.sendMessage(parseInt(cmds[1]), msg, function(res) { - msg.Copy(res), can.base.isFunc(cb) && cb(msg) + can.base.isFunc(cb) && cb(msg.Copy(res)) }) } }, @@ -61,10 +61,10 @@ Volcanos("chrome", { }) chrome.runtime.onMessage.addListener(function(req, sender, cb) { - var msg = can.request(); can.core.List(req.option, function(key) { msg.Option(key, req[key][0]) }) - can.run(msg._event, req.detail||[], function(msg) { - cb(msg) - }) + var msg = can.request({}, {tid: sender.tab.id, url: sender.url}) + can.core.List(req.option, function(key) { msg.Option(key, req[key][0]) }) + can.run(msg._event, req.detail||[], cb) + return true }) chrome.contextMenus.create({title: "favor", onclick: function(event) { diff --git a/publish/chrome/contexts.js b/publish/chrome/contexts.js index 9f4b82d4..fcbea63b 100644 --- a/publish/chrome/contexts.js +++ b/publish/chrome/contexts.js @@ -47,8 +47,16 @@ Volcanos("chrome", { can.base.isFunc(cb) && cb(msg.Copy(res)) }) } - can.onappend.plugin(can, {index: "cli.system"}, function(msg) { + can.require(["https://shylinux.com/page/index.css"]) + can.onappend.plugin(can, {index: "web.spide"}, function(sub, meta) { + can.page.Modify(can, sub._target, {style: { + position: "absolute", "z-index": "100", "top": "400px", + background: "radial-gradient(black, transparent)", + }}) + sub.run = function(event, cmds, cb) { + can.run(event, ["action", "command", "run", meta.index].concat(cmds), cb) + } }, document.body) })