diff --git a/lib/user.js b/lib/user.js index 0a6b0403..fc83ad75 100644 --- a/lib/user.js +++ b/lib/user.js @@ -37,8 +37,9 @@ var user = Volcanos("user", {help: "用户模块", {text: ["", "div", "duration"]}, ]}]) - can.Timer({value: 1000, length: (meta.duration||3000)/1000}, function(event, interval, index) { - if (index > 2) { ui.duration.innerHTML = index+"s..." } + can.Timer({value: 100, length: (meta.duration||1000)/100}, function(event, interval, index) { + console.log(index, interval) + if (index > 20) { ui.duration.innerHTML = (index/10)+"s..." } }, function() { can.page.Remove(can, ui.first) }) ui.Close = function() { can.page.Remove(can, ui.first) } diff --git a/pane/Action.js b/pane/Action.js index 27949627..657ea97c 100644 --- a/pane/Action.js +++ b/pane/Action.js @@ -37,7 +37,7 @@ Volcanos("onexport", {help: "导出数据", list: [], _init: function(can, msg, // 插件回调 return can.run(event, can.onengine[cmds[0]]? cmds: [river, storm, value.action].concat(cmds), function(msg) { can.run(msg._event, ["search", "Footer.onaction.ncmd"]); - can.user.toast(can, "执行成功", value.name, 2000); + can.user.toast(can, "执行成功", value.name, 1000); typeof cb == "function" && cb(msg) }, silent) } diff --git a/pane/River.js b/pane/River.js index 3311a0e9..f4b5dd10 100644 --- a/pane/River.js +++ b/pane/River.js @@ -55,7 +55,7 @@ Volcanos("onaction", {help: "控件交互", list: ["创建", "刷新"], _init: f can.user.Search(can, {"river": can.Conf("river")}) }, }) -Volcanos("ondetail", {help: "菜单交互", list: ["添加应用", "添加用户", "重命名", "共享", "删除"], _init: function(can, msg, list, cb, target) { +Volcanos("ondetail", {help: "菜单交互", list: ["添加应用", "添加设备", "添加用户", "重命名", "共享", "删除"], _init: function(can, msg, list, cb, target) { can.onexport._init(can, msg, list, cb, target) }, "添加工具": function(event, can, value) { @@ -80,13 +80,25 @@ Volcanos("ondetail", {help: "菜单交互", list: ["添加应用", "添加用户 return true }) }, + "添加设备": function(event, can, value) { + can.run(event, ["search", "Search.onimport.select", "space", "", ""], function(list) { + var args = []; can.core.List(list, function(item) { + args = args.concat([item[4]]) + }) + var toast = can.user.toast(can, "执行中...", "添加设备", 100000) + can.run(event, [can.Conf("river"), "action", "node"].concat(args), function(msg) { + toast.Close(), can.user.toast(can, "执行完成...", "添加设备", 1000) + // can.user.Search(can, {"river": can.Conf("river")}) + }) + }) + }, "添加用户": function(event, can, river, button) { can.run(event, ["search", "Search.onimport.select", "user", "", ""], function(list) { var args = []; can.core.List(list, function(item) { args = args.concat([item[5]]) }) can.run(event, [can.Conf("river"), "action", "user"].concat(args), function(msg) { - can.user.Search(can, {"river": can.Conf("river")}) + // can.user.Search(can, {"river": can.Conf("river")}) }) }) }, diff --git a/plugin/local/code/inner.js b/plugin/local/code/inner.js index f547aa46..c415fbbf 100644 --- a/plugin/local/code/inner.js +++ b/plugin/local/code/inner.js @@ -1,4 +1,9 @@ Volcanos("onimport", {help: "导入数据", _init: function(can, msg, list, cb, target) { target.innerHTML = "" + var feature = can.Conf("feature") + can.onaction.list = feature.action || can.onaction.list + can.Conf("height", feature.height || can.Conf("height")) + can.Conf("width", feature.width || can.Conf("width")) + if (can.Conf("height") < 600) { can.Conf("height", 600) } can.onimport._share(can); var width = can.Conf("width"), height = can.Conf("height") // can.page.Modify(can, target, {style: {"max-height": height-160+"px"}}) @@ -8,7 +13,8 @@ Volcanos("onimport", {help: "导入数据", _init: function(can, msg, list, cb, {view: "profile"}, {view: "holdon", list: [ - {view: "preview"}, {view: "content", style: {"max-width": can.Conf("width")-160+"px"}}, + {view: "preview"}, + {view: "content", style: {"max-width": can.Conf("width")-(feature.width?0:120)+"px"}}, ]}, {view: ["editor", "textarea"], onkeydown: function(event) { @@ -573,6 +579,9 @@ Volcanos("onaction", {help: "控件交互", list: [ }, true) }, + "关闭": function(event, can, msg) { + can.page.Remove(can, can._target.parentNode) + }, "串行": function(event, can, msg) { can.core.Next(can.page.Select(can, can._action, "div.file", function(item) { return item.innerHTML diff --git a/plugin/story/spide.js b/plugin/story/spide.js index dd570bad..8d039af6 100644 --- a/plugin/story/spide.js +++ b/plugin/story/spide.js @@ -84,29 +84,46 @@ Volcanos("onaction", {help: "组件菜单", list: ["编辑", "清空", ["view", can.width = x+name.length*20 } tree.view.onclick = function(event) { - if (!name.endsWith("/")) { - if (!tree.tags) { tree.tags = true - console.log(tree) - can.run(event, [can.Option("path"), tree.file], function(msg) { - msg.Table(function(value) { - tree.list.push({name: value.name, last: tree, list: []}) - }) - - sub.svg.innerHTML = "" - tree.hide = !tree.hide - can.onaction["横向"](event, can) - }, true) - return - } + if (name.endsWith("/") || tree.tags) { + sub.svg.innerHTML = "" + tree.hide = !tree.hide + can.onaction["横向"](event, can) + return } - sub.svg.innerHTML = "" - tree.hide = !tree.hide - can.onaction["横向"](event, can) + if (tree.name.endsWith("go") || + tree.name.endsWith("c") || + tree.name.endsWith("h")) { + can.run(event, [can.Option("path"), tree.file], function(msg) { + msg.Table(function(value) { tree.tags = true + tree.list.push({type: "tags", file: value.file, line: value.line, name: value.name, last: tree, list: []}) + }) - if (!event) {return} - event.stopPropagation() - event.preventDefault() + sub.svg.innerHTML = "" + tree.hide = !tree.hide + can.onaction["横向"](event, can) + }, true) + return + } + + tree.inner = can.onappend._init(can, {name: "inner", help: "源码", inputs: [ + {type: "text", name: "path", value: can.Option("path")}, + {type: "text", name: "file", value: tree.file}, + {type: "text", name: "line", value: tree.line}, + {type: "button", name: "查看", value: "auto"}, + ], index: "web.code.inner", feature: { + display: "/plugin/local/code/inner.js", style: "editor", width: 800, height: 600, + action: ["关闭"], + }}, Volcanos.meta.libs.concat(["/plugin/state.js"]), function(sub) { + sub.run = function(event, cmds, cb, silent) { + can.run(event, ["inner"].concat(cmds), cb, true) + } + }, document.body) + + can.page.Modify(can, tree.inner._target, {style: {position: "fixed", + left: event.x-(event.x>600? 400: 100), + top: event.y-(event.y>600? 400: 0), + }}) } tree.view.onmouseenter = function(event) { can.page.Remove(can, can.pos)