diff --git a/lib/user.js b/lib/user.js index e9c804d8..9cdf1c08 100644 --- a/lib/user.js +++ b/lib/user.js @@ -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)) diff --git a/plugin/local/wiki/feel.js b/plugin/local/wiki/feel.js index 0e541077..2b2f2ad9 100644 --- a/plugin/local/wiki/feel.js +++ b/plugin/local/wiki/feel.js @@ -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) { diff --git a/plugin/table.js b/plugin/table.js index 64da6f7e..17cee048 100644 --- a/plugin/table.js +++ b/plugin/table.js @@ -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) }, })