mirror of
https://shylinux.com/x/volcanos
synced 2025-04-25 08:48:06 +08:00
opt copy
This commit is contained in:
parent
670116447d
commit
5132fe823b
19
frame.js
19
frame.js
@ -35,8 +35,6 @@ Volcanos("onengine", {help: "解析引擎", list: [], _init: function(can, meta,
|
||||
},
|
||||
|
||||
search: function(event, can, msg, pane, cmds, cb) {
|
||||
can.base.Log(can._name, "search", cmds)
|
||||
|
||||
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)
|
||||
}); if (!sub || !mod || !fun) { can.base.Warn("not found", cmds[1]); return }
|
||||
@ -97,9 +95,6 @@ Volcanos("onengine", {help: "解析引擎", list: [], _init: function(can, meta,
|
||||
{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"]},
|
||||
]},
|
||||
"context": {name: "理念 context", action: [
|
||||
{name: "contexts", help: "上下文", index: "web.wiki.word", args: ["src/task.shy"]},
|
||||
]},
|
||||
}},
|
||||
"project": {name: "研发群", storm: {
|
||||
"studio": {name: "研发 studio", action: [
|
||||
@ -421,31 +416,27 @@ Volcanos("onlayout", {help: "页面布局", list: [], _init: function(can, targe
|
||||
|
||||
can.page.Select(can, target, ["fieldset.left", "fieldset.right"], function(field, index) {
|
||||
can.page.Modify(can, field, {style: {height: height}})
|
||||
width -= field.offsetWidth
|
||||
|
||||
can.page.Select(can, field, "div.output", function(output) {
|
||||
can.page.Modify(can, output, {style: {height: height-32}})
|
||||
})
|
||||
width -= field.offsetWidth
|
||||
})
|
||||
|
||||
if (can.user.isMobile || can.user.Search(can, "share")) { return }
|
||||
can.onengine.trigger(can, can.request(event, {width: width, height: height}), "resize")
|
||||
|
||||
can.Action._width = width, can.Action._height = height
|
||||
|
||||
if (can.user.isMobile || can.user.Search(can, "pod") || can.user.Search(can, "share")) { return }
|
||||
|
||||
can.page.Select(can, target, ["fieldset.middle"], function(field, index) {
|
||||
can.page.Modify(can, field, {style: {height: height}})
|
||||
})
|
||||
can.page.Select(can, target, ["fieldset.middle>div.output"], function(output) {
|
||||
can.page.Modify(can, output, {style: {height: height}})
|
||||
})
|
||||
|
||||
can.core.List(can.onlayout.resize.list, function(item) {
|
||||
item(width, height)
|
||||
})
|
||||
},
|
||||
resize: shy("", {}, [], function(cb) { arguments.callee.list.push(cb) }),
|
||||
topic: function(can, topic) { topic && (can._topic = topic)
|
||||
can.user.topic(can, can._topic || can.user.Search(can, "topic") || ((can.user.Search(can, "pod")||can.base.isNight())? "black": "white"))
|
||||
},
|
||||
})
|
||||
Volcanos("onkeypop", {help: "键盘交互", list: [], _init: function(can, target) {
|
||||
can.core.Item(can.onkeypop._mode, function(item, value) { var engine = {}
|
||||
|
12
lib/user.js
12
lib/user.js
@ -38,13 +38,11 @@ Volcanos("user", {help: "用户模块", agent: {
|
||||
} catch(e) { } }
|
||||
return value
|
||||
},
|
||||
copy: function(can, text) {
|
||||
var input = can.page.Append(can, document.body, [{type: "input", value: text}]).first
|
||||
input.setSelectionRange(0,-1)
|
||||
input.focus()
|
||||
document.execCommand("Copy")
|
||||
can.page.Remove(can, input)
|
||||
can.user.toast(can, {text: text, title: "复制成功", width: 400})
|
||||
copy: function(event, can, text) {
|
||||
var input = can.page.Append(can, event.target.parentNode, [{type: "input", value: text}]).first
|
||||
input.setSelectionRange(0,-1), input.focus()
|
||||
document.execCommand("Copy"), can.page.Remove(can, input)
|
||||
can.user.toast(can, text, "复制成功")
|
||||
},
|
||||
|
||||
trans: function(can, text) {
|
||||
|
@ -93,12 +93,9 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
|
||||
can.menu = can.page.Append(can, target, [{view: ["menu", "some"], style: {float: "left"}}]).first
|
||||
},
|
||||
|
||||
topic: function(can, topic) { topic && (can._topic = topic)
|
||||
can.user.topic(can, can._topic || can.user.Search(can, TOPIC) || can.user.Search(can, POD) || (can.base.isNight()? "black": "white"))
|
||||
},
|
||||
time: function(can, target) {
|
||||
target.innerHTML = can.base.Time(null, "%w %H:%M:%S")
|
||||
can.onimport.topic(can)
|
||||
can.onlayout.topic(can)
|
||||
},
|
||||
|
||||
menu: function(can, cmds, cb) {
|
||||
@ -131,7 +128,7 @@ Volcanos("onaction", {help: "交互数据", list: [], _init: function(can, msg,
|
||||
}, can._output)
|
||||
}) }
|
||||
|
||||
can.onimport.topic(can)
|
||||
can.onlayout.topic(can)
|
||||
can.user.isLocalFile? init(): can.run({}, ["check"], function(msg) { msg.Result()? init(): can.user.login(can, init) })
|
||||
},
|
||||
|
||||
@ -171,9 +168,9 @@ Volcanos("onaction", {help: "交互数据", list: [], _init: function(can, msg,
|
||||
var ui = can.user.carte(event, can, can.onaction, ["pack", "white", "black", "print"])
|
||||
can.page.Modify(can, ui.first, {style: {top: can._target.offsetHeight}})
|
||||
},
|
||||
black: function(event, can, button) { can.onimport.topic(can, button) },
|
||||
white: function(event, can, button) { can.onimport.topic(can, button) },
|
||||
print: function(event, can, button) { can.onimport.topic(can, "white print") },
|
||||
black: function(event, can, button) { can.onlayout.topic(can, button) },
|
||||
white: function(event, can, button) { can.onlayout.topic(can, button) },
|
||||
print: function(event, can, button) { can.onlayout.topic(can, "white print") },
|
||||
|
||||
River: function(can) { can.run({}, ["search", "River.onmotion.toggle"]) },
|
||||
Footer: function(can) { can.run({}, ["search", "River.onmotion.autosize"]) },
|
||||
|
@ -19,7 +19,7 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
|
||||
can.page.Select(can, target, "td", function(item) {
|
||||
item.title = "点击复制"
|
||||
item.onclick = function(event) {
|
||||
can.user.copy(can, item.innerText)
|
||||
can.user.copy(event, can, item.innerText)
|
||||
}
|
||||
})
|
||||
},
|
||||
@ -27,14 +27,14 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
|
||||
if (list["name"] == "inner") {
|
||||
target.title = "点击复制"
|
||||
target.onclick = function(event) {
|
||||
can.user.copy(can, target.innerText)
|
||||
can.user.copy(event, can, target.innerText)
|
||||
}
|
||||
return
|
||||
}
|
||||
can.page.Select(can, target, "span", function(item) {
|
||||
item.title = "点击复制"
|
||||
item.onclick = function(event) {
|
||||
can.user.copy(can, item.innerText)
|
||||
can.user.copy(event, can, item.innerText)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
@ -148,13 +148,13 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
|
||||
spark: function(can, list, target) {
|
||||
if (list["name"] == "inner") {
|
||||
target.title = "点击复制", target.onclick = function(event) {
|
||||
can.user.copy(can, target.innerText)
|
||||
can.user.copy(event, can, target.innerText)
|
||||
}
|
||||
return
|
||||
}
|
||||
can.page.Select(can, target, "span", function(item) {
|
||||
item.title = "点击复制", item.onclick = function(event) {
|
||||
can.user.copy(can, item.innerText)
|
||||
can.user.copy(event, can, item.innerText)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user