mirror of
https://shylinux.com/x/volcanos
synced 2025-04-25 16:58:06 +08:00
opt chrome
This commit is contained in:
parent
dfd8a1221c
commit
12af5ef04f
@ -1,9 +1,20 @@
|
|||||||
{
|
{
|
||||||
"manifest_version": 2,
|
"manifest_version": 2, "name": "volcanos", "version": "0.0.1",
|
||||||
"name": "volcanos", "version": "0.0.1",
|
|
||||||
"background": {"page": "/publish/chrome/daemon.html"},
|
"background": {"page": "/publish/chrome/daemon.html"},
|
||||||
"browser_action": {"default_popup": "/publish/chrome/popup.html"},
|
"browser_action": {"default_popup": "/publish/chrome/popup.html"},
|
||||||
"content_scripts": [{"matches": ["<all_urls>"], "permissions": [
|
"content_scripts": [
|
||||||
"tabs", "history", "cookies", "bookmarks", "contextMenus", "notifications", "http://localhost:9020/*"
|
{
|
||||||
], "css": ["/publish/chrome/contexts.css"], "js": ["/page/can.js", "/publish/chrome/contexts.js"]}]
|
"matches": ["<all_urls>"],
|
||||||
|
"permissions": [
|
||||||
|
"tabs",
|
||||||
|
"history",
|
||||||
|
"cookies",
|
||||||
|
"bookmarks",
|
||||||
|
"contextMenus",
|
||||||
|
"notifications",
|
||||||
|
"http://localhost:9020/*"
|
||||||
|
],
|
||||||
|
"css": ["/page/can.css"], "js": ["/page/can.js", "/publish/chrome/contexts.js"]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,10 @@ div.output div.project div.item>div.name { padding-left:20px; }
|
|||||||
div.output div.project div.zone>div.action>div.item { padding:0; margin:0; float:right; clear:none; }
|
div.output div.project div.zone>div.action>div.item { padding:0; margin:0; float:right; clear:none; }
|
||||||
div.output div.project div.zone>div.action>div.item input[type=text] { background-color:#ff000000; padding-left:10px; color:white; }
|
div.output div.project div.zone>div.action>div.item input[type=text] { background-color:#ff000000; padding-left:10px; color:white; }
|
||||||
|
|
||||||
|
fieldset.contexts {
|
||||||
|
background:radial-gradient(black, #00000073); color:white;
|
||||||
|
position:fixed; left:20px; top:100px; z-index:10;
|
||||||
|
}
|
||||||
fieldset.plugin { background-color:#061c3c9e; padding:10px; margin:10px; }
|
fieldset.plugin { background-color:#061c3c9e; padding:10px; margin:10px; }
|
||||||
fieldset.float { background-color:#0e3369; color:white; padding:0; margin:0; }
|
fieldset.float { background-color:#0e3369; color:white; padding:0; margin:0; }
|
||||||
fieldset.full { background-color:#0e3369; color:white; padding:0; margin:0; left:0; top:0; overflow:auto; }
|
fieldset.full { background-color:#0e3369; color:white; padding:0; margin:0; left:0; top:0; overflow:auto; }
|
||||||
|
@ -412,6 +412,8 @@ Volcanos(chat.ONSYNTAX, {
|
|||||||
"Volcanos": code.FUNCTION,
|
"Volcanos": code.FUNCTION,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
json: {
|
||||||
|
},
|
||||||
css: {
|
css: {
|
||||||
split: {
|
split: {
|
||||||
operator: ".[]()>,{:;}",
|
operator: ".[]()>,{:;}",
|
||||||
@ -529,6 +531,16 @@ Volcanos(chat.ONSYNTAX, {
|
|||||||
iml: {
|
iml: {
|
||||||
render: {},
|
render: {},
|
||||||
},
|
},
|
||||||
|
html: {
|
||||||
|
split: {
|
||||||
|
operator: ".[]()</>,{:;}",
|
||||||
|
},
|
||||||
|
keyword: {
|
||||||
|
"html": code.KEYWORD,
|
||||||
|
"head": code.KEYWORD,
|
||||||
|
"body": code.KEYWORD,
|
||||||
|
},
|
||||||
|
},
|
||||||
zml: {
|
zml: {
|
||||||
render: {},
|
render: {},
|
||||||
prefix: {
|
prefix: {
|
||||||
|
@ -7,12 +7,12 @@ setTimeout(function() { Volcanos({
|
|||||||
msg.Push(mdb.LINK, location.href)
|
msg.Push(mdb.LINK, location.href)
|
||||||
}
|
}
|
||||||
var has = {}; target = target||document.body
|
var has = {}; target = target||document.body
|
||||||
can.page.Select(can, target, html.IFRAME, function(target) {
|
can.page.Select(can, target, html.AUDIO, function(target) {
|
||||||
if (!target.src || has[target.src]) { return } has[target.src] = true
|
if (!target.src || has[target.src]) { return } has[target.src] = true
|
||||||
msg.Push(mdb.TYPE, html.IFRAME)
|
var name = target.src.split("?")[0].split(ice.PT).pop()
|
||||||
msg.Push(mdb.NAME, "")
|
msg.Push(mdb.TYPE, html.AUDIO)
|
||||||
|
msg.Push(mdb.NAME, html.AUDIO+ice.PT+name)
|
||||||
msg.Push(mdb.LINK, target.src)
|
msg.Push(mdb.LINK, target.src)
|
||||||
can.spide(can, msg, target.contentWindow.document.body)
|
|
||||||
})
|
})
|
||||||
can.page.Select(can, target, html.VIDEO, function(target) {
|
can.page.Select(can, target, html.VIDEO, function(target) {
|
||||||
if (!target.src || has[target.src]) { return } has[target.src] = true
|
if (!target.src || has[target.src]) { return } has[target.src] = true
|
||||||
@ -32,8 +32,43 @@ setTimeout(function() { Volcanos({
|
|||||||
}
|
}
|
||||||
msg.Push(mdb.LINK, target.src)
|
msg.Push(mdb.LINK, target.src)
|
||||||
})
|
})
|
||||||
|
can.page.Select(can, target, html.IFRAME, function(target) {
|
||||||
|
if (!target.src || has[target.src]) { return } has[target.src] = true
|
||||||
|
msg.Push(mdb.TYPE, html.IFRAME)
|
||||||
|
msg.Push(mdb.NAME, "")
|
||||||
|
msg.Push(mdb.LINK, target.src)
|
||||||
|
can.spide(can, msg, target.contentWindow.document.body)
|
||||||
|
})
|
||||||
|
can.page.Select(can, target, html.A, function(target) {
|
||||||
|
msg.Push(mdb.TYPE, html.A)
|
||||||
|
msg.Push(mdb.NAME, "")
|
||||||
|
msg.Push(mdb.LINK, target.href)
|
||||||
|
})
|
||||||
},
|
},
|
||||||
change: function(can, msg, arg) {
|
style: function(can, msg, arg) {
|
||||||
|
can.core.List(arg[0].split(ice.FS), function(item) {
|
||||||
|
can.page.Select(can, document.body, item, function(target) {
|
||||||
|
can.page.Modify(can, target, can.base.Obj(arg[1]))
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
field: function(can, msg, arg) {
|
||||||
|
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) {
|
||||||
|
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.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)
|
||||||
|
})
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
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))]) }
|
||||||
|
}, document.body)
|
||||||
|
},
|
||||||
|
change: function(can, msg, arg) {
|
||||||
arg.length > 1 && can.page.Modify(can, arg[0], can.base.Obj(arg[1]))
|
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) {
|
arg.length > 0 && can.page.Select(can, document.body, arg[0], function(item) {
|
||||||
msg.Push(mdb.TEXT, item.outerHTML)
|
msg.Push(mdb.TEXT, item.outerHTML)
|
||||||
@ -48,48 +83,6 @@ setTimeout(function() { Volcanos({
|
|||||||
}); 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)
|
||||||
},
|
},
|
||||||
field: function(can, msg, arg) {
|
|
||||||
can.onappend.plugin(can, {type: chat.CONTEXTS, index: arg[0], args: can.base.Obj(arg[1])}, function(sub, meta) {
|
|
||||||
var pos = {left: msg.Option(html.LEFT), top: msg.Option(html.TOP), right: msg.Option(html.RIGHT), bottom: msg.Option(html.BOTTOM)}
|
|
||||||
can.page.style(can, sub._target, pos)
|
|
||||||
can.onmotion.move(can, sub._target, pos, function(target) {
|
|
||||||
can.page.style(can, sub._output,
|
|
||||||
html.MAX_HEIGHT, can._root._height-target.offsetTop-80,
|
|
||||||
html.MAX_WIDTH, can._root._width-target.offsetLeft-20,
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
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)
|
|
||||||
}, msg.Option("selection")||sub._legend.onclick()
|
|
||||||
|
|
||||||
sub.run = function(event, cmds, cb) { if (msg.RunAction(event, can, cmds)) { return }
|
|
||||||
can.runActionCommand(event, meta.index, cmds, cb)
|
|
||||||
}
|
|
||||||
|
|
||||||
msg.Option("selection") && (can.onengine.listen(can, "onselection", function() {
|
|
||||||
sub.Option(msg.Option("selection"), window.getSelection()), sub.Update()
|
|
||||||
}))
|
|
||||||
|
|
||||||
sub.onaction["保存参数"] = function(event) {
|
|
||||||
can.request(event, {zone: location.host, id: msg.Option(mdb.ID)})
|
|
||||||
can.run(event, [chat.FIELD, mdb.MODIFY, html.TOP, sub._target.offsetTop])
|
|
||||||
can.run(event, [chat.FIELD, mdb.MODIFY, html.LEFT, sub._target.offsetLeft])
|
|
||||||
can.run(event, [chat.FIELD, mdb.MODIFY, ctx.ARGS, JSON.stringify(sub.Input([], true))])
|
|
||||||
can.user.toastSuccess(can)
|
|
||||||
}
|
|
||||||
}, document.body)
|
|
||||||
},
|
|
||||||
style: function(can, msg, arg) {
|
|
||||||
can.core.List(arg[0].split(ice.FS), function(item) {
|
|
||||||
can.page.Select(can, document.body, item, function(target) {
|
|
||||||
can.page.Modify(can, target, can.base.Obj(arg[1]))
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
info: function(can, msg, arg) {
|
info: function(can, msg, arg) {
|
||||||
msg.Push("title", document.title)
|
msg.Push("title", document.title)
|
||||||
@ -108,7 +101,7 @@ setTimeout(function() { Volcanos({
|
|||||||
},
|
},
|
||||||
}, function(can) {
|
}, function(can) {
|
||||||
can.run = function(event, cmds, cb) { if (cmds[0] == "_search") { return }
|
can.run = function(event, cmds, cb) { if (cmds[0] == "_search") { return }
|
||||||
var msg = can.request(event, {host: location.host}); msg.detail = can.misc.concat(can, ["page"], cmds)
|
var msg = can.request(event, {domain: location.host}); msg.detail = can.misc.concat(can, ["page"], cmds)
|
||||||
chrome.runtime.sendMessage(msg, function(res) { can.base.isFunc(cb) && cb(msg.Copy(res)) })
|
chrome.runtime.sendMessage(msg, function(res) { can.base.isFunc(cb) && cb(msg.Copy(res)) })
|
||||||
}, can._motion(can), can._daemon(can)
|
}, can._motion(can), can._daemon(can)
|
||||||
}) }, 100)
|
}) }, 100)
|
||||||
|
@ -3,14 +3,14 @@ Volcanos({
|
|||||||
if (arg.length == 0 || arg[0] == "") {
|
if (arg.length == 0 || arg[0] == "") {
|
||||||
chrome.windows.getAll(function(wins) {
|
chrome.windows.getAll(function(wins) {
|
||||||
can.core.List(wins, function(win) { win.wid = win.id
|
can.core.List(wins, function(win) { win.wid = win.id
|
||||||
msg.Push(win, ["wid", "type", "state", "focused", html.LEFT||"0", html.TOP||"0", 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] == "") {
|
} else if (arg.length == 1 || arg[1] == "") {
|
||||||
chrome.tabs.getAllInWindow(parseInt(arg[0]), function(tabs) {
|
chrome.tabs.getAllInWindow(parseInt(arg[0]), function(tabs) {
|
||||||
can.core.Next(tabs, function(tab, next) { var _msg = can.request(); _msg.detail = ["info"]
|
can.core.Next(tabs, function(tab, next) { var _msg = can.request(); _msg.detail = ["info"]
|
||||||
can._tabsend(can, _msg, function(res) { tab.tid = tab.id
|
can._tabsend(can, _msg, function(res) { tab.tid = tab.id
|
||||||
msg.Push(tab, ["tid", "active", html.WIDTH, html.HEIGHT, "index"])
|
msg.Push(tab, ["index", "tid", "active", html.WIDTH, html.HEIGHT])
|
||||||
msg.Push("title", res && res["title"][0] || "")
|
msg.Push("title", res && res["title"][0] || "")
|
||||||
msg.Push("url", res && res["url"][0] || "")
|
msg.Push("url", res && res["url"][0] || "")
|
||||||
next()
|
next()
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<link rel="stylesheet" type="text/css" href="/page/can.css">
|
<link rel="stylesheet" href="/page/can.css">
|
||||||
</head>
|
</head>
|
||||||
<body style="width:1200px; height:600px; overflow:auto">
|
<body style="width:1200px; height:600px; overflow:auto">
|
||||||
<script src="/page/can.js"></script>
|
<script src="/page/can.js"></script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user