1
0
mirror of https://shylinux.com/x/volcanos synced 2025-04-26 01:04:06 +08:00
This commit is contained in:
shylinux 2020-08-22 00:23:51 +08:00
parent e74c634524
commit 962beca9bc
3 changed files with 22 additions and 4 deletions

View File

@ -161,6 +161,11 @@ var user = Volcanos("user", {help: "用户模块",
action.upload.click()
return ui
},
download: function(can, path) {
var a = can.page.Append(can, document.body, [{type: "a", href: path, download: path.split("/").pop()}]).first
a.click()
can.page.Remove(can, a)
},
Share: shy("共享链接", function(can, objs, clear) {var obj = objs || {}; var path = location.pathname;
obj._path && (path = obj._path, delete(obj._path))

View File

@ -6,7 +6,10 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
can._msg = msg
can.path = can.request({}), can.list = []
msg.Table(function(value) { value.path.endsWith("/")? can.path.Push(value): can.list.push(value) })
msg.Table(function(value) {
if (value.path.startsWith("/local")) { return }
value.path.endsWith("/")? can.path.Push(value): can.list.push(value)
})
can.onappend.table(can, can.ui.project, "table", can.path)
can.page.Modify(can, can._action, {style: {display: "none"}})
@ -42,6 +45,14 @@ Volcanos("onfigure", {help: "组件菜单", list: [],
jpeg: function(can, path) { return can.onfigure.image(can, path) },
image: function(can, path) { return {img: path, height: can.height, onclick: function(event) {
can.Status("文件", path)
can.page.Append(can, document.body, [{img: path, style: {
position: "fixed", left: 0, top: 40,
height: window.innerHeight-40,
}, onclick: function(event) {
can.page.Remove(can, event.target)
}, }])
}, onmouseover: function(event) {
// can.Status("文件", path)
}, _init: function(target) {
can.Status("文件", path)
}
@ -72,6 +83,7 @@ Volcanos("onaction", {help: "组件菜单", list: [
["倍速", 0.1, 0.2, 0.5, 1, 2, 3, 5, 10],
],
"上传": function(event, can) { can.user.upload(event, can) },
"下载": function(event, can) { can.user.download(can, can.Status("文件")) },
"收藏": function(event, can) {
chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
chrome.tabs.sendMessage(tabs[0].id, { action: "copy" }, function (response) {

View File

@ -2,12 +2,13 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
can.ui = can.page.Append(can, can._target, [
{view: ["content", "div"]}, {view: ["display", "pre"]},
])
can.onappend.table(can, can.ui.content, "table", msg)
can.onappend.board(can, can.ui.display, "board", msg)
var refresh = msg.Option("_refresh") || can.Conf("feature")["_refresh"]
refresh && can.Timer(refresh, function() {
can.run({})
})
refresh && can.Timer(refresh, function() { can.run({}) })
return typeof cb == "function" && cb(msg)
},
})