From dc3163012180c84b55f7f577f2abce3cc818ca17 Mon Sep 17 00:00:00 2001 From: shaoying Date: Wed, 17 Feb 2021 23:28:47 +0800 Subject: [PATCH] opt some --- frame.js | 22 ++++- lib/user.js | 144 ++++++++++------------------- page/index.css | 184 ++++++++++++++++++------------------- pane/Footer.js | 16 ++-- pane/Search.js | 16 +--- plugin/input/date.js | 2 +- plugin/input/key.js | 2 +- plugin/input/province.js | 2 +- plugin/local/code/inner.js | 16 ++-- plugin/local/code/vimer.js | 2 +- plugin/local/wiki/word.css | 11 --- plugin/table.js | 23 +---- proto.js | 4 +- 13 files changed, 188 insertions(+), 256 deletions(-) diff --git a/frame.js b/frame.js index 13ba1258..4eaec60a 100644 --- a/frame.js +++ b/frame.js @@ -517,7 +517,7 @@ Volcanos("onlayout", {help: "页面布局", list: [], _init: function(can) { 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")) }, - figure: function(can, event) { var p = can._target + figure: function(event, can, target) { var p = target||can._target var layout = {left: event.clientX, top: event.clientY+10} can.page.Modify(can, p, {style: layout}) can.onmotion.move(can, p, layout) @@ -759,6 +759,26 @@ Volcanos("onmotion", {help: "动态交互", list: [], _init: function(can, targe }) }, + story: function(can, target) { + can.page.Select(can, target, ".story", function(target) { var data = target.dataset + can.page.Modify(can, target, {style: can.base.Obj(data.style)}) + + switch (data.type) { + case "spark": + if (data["name"] == "inner") { + target.title = "点击复制", target.onclick = function(event) { + can.user.copy(event, can, target.innerText) + } + } else { + can.page.Select(can, target, "span", function(item) { + item.title = "点击复制", item.onclick = function(event) { + can.user.copy(event, can, item.innerText) + } + }) + } + } + }) + }, clear: function(can, target) { can.page.Modify(can, target||can._output, "") }, diff --git a/lib/user.js b/lib/user.js index 0a92d60c..8378514c 100644 --- a/lib/user.js +++ b/lib/user.js @@ -49,11 +49,9 @@ Volcanos("user", {help: "用户模块", agent: { }) }, trans: function(can, text) { - if (typeof text == "function") { - text = text.name || "" - } + if (typeof text == "function") { text = text.name || "" } return can._trans && can._trans[text] || can.Conf("trans."+text) || can.Conf("feature.trans."+text) || { - + "submit": "提交", "cancel": "取消", }[text] || text }, topic: function(can, name) { @@ -62,52 +60,30 @@ Volcanos("user", {help: "用户模块", agent: { can.user.isMobile && can.page.ClassList.add(can, document.body, "mobile") can.user.isMobile && can.page.ClassList.set(can, document.body, "landscape", width > height) }, - toast: function(can, text, title, duration, progress) { - var meta = typeof text == "object"? text: {text: text, title: title||can._help, duration: duration, progress: progress} - var width = meta.width||400, height = meta.height||100 - if (width < 0) { width = window.innerWidth + width } + toast: function(can, content, title, duration, progress) { + var meta = typeof content == "object"? content: {content: content, title: title||can._help, duration: duration, progress: progress} + var width = meta.width||400, height = meta.height||100; if (width < 0) { width = window.innerWidth + width } var ui = can.page.Append(can, document.body, [{view: "toast", style: { - width: width, bottom: 100, left: document.body.clientWidth/2-width/2, + width: width, bottom: 100, left: window.innerWidth/2-width/2, }, list: [ {text: [meta.title||"", "div", "title"]}, - typeof meta.text == "object"? meta.text: {text: [meta.text||"执行成功", "div", "content"]}, - {view: ["button"], list: meta.button}, - {text: ["", "div", "duration"]}, - meta.progress > 0 && {text: ["", "div", "progress"], style: {width: width}, list: [ - {text: ["", "div", "current"], style: {width: meta.progress/100*width}}, + typeof meta.content == "object"? meta.content: {text: [meta.content||"执行成功", "div", "content"]}, + {view: "button", list: meta.button}, + {view: "duration"}, meta.progress > 0 && {view: "progress", style: {width: width}, list: [ + {view: "current", style: {width: meta.progress/100*width}}, ]}, - ], ondblclick: function(event) { ui.Close() }}]) - - var timer = can.core.Timer({interval: 100, length: (meta.duration||1000)/100}, function(event, interval, index) { - if (index > 20) { ui.duration.innerHTML = parseInt(index/10)+"."+(index%10)+"s..." } - }, function() { - can.page.Remove(can, ui.first), timer.stop = true - }) + ] }]); can.onmotion.story(can, ui.first) ui.Close = function() { can.page.Remove(can, ui.first), timer.stop = true } - - can.page.Select(can, ui.first, ".story", function(target) { var data = target.dataset - can.page.Modify(can, target, {style: can.base.Obj(data.style)}) - switch (data.type) { - case "spark": - if (data["name"] == "inner") { - target.title = "点击复制", target.onclick = function(event) { - 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(event, can, item.innerText) - } - }) - } - }) + var timer = can.core.Timer({interval: 100, length: (meta.duration||1000)/100}, function(event, interval, index) { + if (index > 20) { ui.duration.innerHTML = parseInt(index/10)+"."+(index%10)+"s..." } + }, ui.Close) can.run(can.request({}, { - text: meta.text, time: can.base.Time(), fileline: can.base.FileLine(2, 2), - })._event, ["search", "Footer.onimport.toast"], function() {}, true) + title: meta.title, content: meta.content, + time: can.base.Time(), fileline: can.base.FileLine(2, 2), + })._event, ["search", "Footer.onimport.toast"], null, true) return ui }, share: function(can, msg, cmd) { @@ -166,75 +142,55 @@ Volcanos("user", {help: "用户模块", agent: { event.preventDefault() return ui }, - input: function(event, can, form, cb) { // form [ string, {_input: }, array, object, button ] - function cbs(event, button) { - var data = {}, args = []; var list = can.page.Select(can, ui.table, "select,input,textarea", function(item) { - args.push(item.name, item.value) - return data[item.name] = item.value - }) - if (typeof cb == "function" && !cb(event, button, data, list, args)) { - can.page.Remove(can, ui.first) - } - } - + input: function(event, can, form, cb) { // form [ string, array, object, {_input: }, {button: []} ] var msg = can.request(event, can.Option()) - var x = event.clientX||200, y = event.clientY||48; y += 10; if (x > 600) { x -= 160 } - if (can.user.isMobile) { x = 100, y = 100 } + var x = event.clientX||200, y = event.clientY+10||48 - function Option(key, value) { - if (key == undefined) { value = {} - can.page.Select(can, ui.first, "input", function(item) { - item.name && item.value && (value[item.name] = item.value) - }); return value - } - if (typeof key == "object") { - return can.core.Item(key, arguments.callee), key - } - can.page.Select(can, ui.first, 'input[name='+key+']', function(item) { - value == undefined? value = item.value: item.value = value - }); return value - } - - - var button; var ui = can.page.Append(can, document.body, [{view: ["input inputs", "fieldset"], style: {left: x+"px", top: y+"px"}, list: [ + var button; var ui = can.page.Append(can, document.body, [{view: ["input inputs", "fieldset"], style: {left: x, top: y}, list: [ {view: ["option", "table"], list: can.core.List(form, function(item) { if (item.button) { button = item.button; return } - item.run = function(event, cmds, cb) { - var msg = can.request(event, Option()) - msg.Option("_handle", "true") - can.run(event, cmds, cb, true) - } - function _init(target) { + item.run = function(event, cmds, cb) { + var msg = can.request(event, function() { var value = {_handle: "true"} + can.page.Select(can, ui.table, "textarea,input,select", function(item) { + item.name && item.value && (value[item.name] = item.value) + }); return value + }) + can.run(event, cmds, cb, true) + } + can.onappend.figure(can, item, item.value, target) - target.value = target.value || msg.Option(typeof item == "string"? item: item.name) + target.value = target.value || msg.Option(item.name) } - return {type: ["tr"], list: [ - {type: "td", list: [{text: typeof item == "string"? item: item.length > 0? item[0]: item.name || ""}]}, - {type: "td", list: [typeof item == "string"? /* input */ {input: item, data: {autofocus: true}, _init: _init}: - item._input == "textarea"? /* textarea */ {type: "textarea", data: item, _init: _init}: - item._input == "select"? /* select */ {select: [[item.name].concat(item.values)], data: item}: - item._input? /* input */ {type: "input", data: (item.type = item._input, item), _init: _init}: - item.length > 0? /* select */ {select: [item]}: - /* other */ item, - ]}, - ]} + item = typeof item == "string"? {_input: "text", name: item}: + item.length > 0? {_input: "select", name: item[0], values: item.slice(1)}: item + + return {type: "tr", list: [{type: "td", list: [{text: item.name||""}]}, {type: "td", list: [ + item._input == "textarea"? /* textarea */ {type: "textarea", data: item, _init: _init}: + item._input == "select"? /* select */ {select: [[item.name].concat(item.values)], data: item}: + item._input? /* input */ {type: "input", data: (item.type = item._input, item), _init: _init}: + /* other */ item, + ]} ]} })}, {view: "action"}, ]}]) - can.onappend._action(can, button||["提交", "关闭"], ui.action, { + function cbs(event, button) { var data = {}, args = [], list = [] + list = can.page.Select(can, ui.table, "textarea,input,select", function(item) { + return args.push(item.name, item.value), data[item.name] = item.value + }) + typeof cb == "function" && !cb(event, button, data, list, args) && can.page.Remove(can, ui.first) + } + can.onappend._action(can, button||["submit", "cancel"], ui.action, { + cancel: function(event) { can.page.Remove(can, ui.first) }, _engine: function(event, can, key) { cbs(event, key) }, - "提交": function(event) { cbs(event, "提交") }, - "关闭": function(event) { can.page.Remove(can, ui.first) }, + submit: function(event) { cbs(event, "submit") }, }) - can.page.Select(can, ui.first, "textarea,input", function(item, index) { - index == 0 && can.core.Timer(100, function() { - item.focus(), item.setSelectionRange(0, -1) - }) + can.onlayout.figure(event, can, ui.first), can.page.Select(can, ui.table, "textarea,input", function(item, index) { + index == 0 && can.core.Timer(100, function() { item.focus(), item.setSelectionRange(0, -1) }) }) return ui }, diff --git a/page/index.css b/page/index.css index ee92415b..42d7c6aa 100644 --- a/page/index.css +++ b/page/index.css @@ -1,18 +1,15 @@ body.mobile.landscape fieldset.Header.head { position:unset; } +body.mobile.landscape fieldset.Header.head div.state.time { + display:block; +} body.mobile.landscape fieldset.Footer.foot { position:unset; } body.mobile.landscape fieldset.Action.main { margin-top:0; margin-bottom:0; } -body.mobile.landscape fieldset.Header.head div.state.time { - display:block; -} -body.mobile fieldset.Header.head div.state.time { - display:none; -} body.mobile fieldset.Header.head { position:fixed; top:0; width:-webkit-fill-available; @@ -20,6 +17,9 @@ body.mobile fieldset.Header.head { background-color:#000000b8; z-index:10; } +body.mobile fieldset.Header.head div.state.time { + display:none; +} body.mobile fieldset.Footer.foot { position:fixed; bottom:0; width:-webkit-fill-available; @@ -41,10 +41,10 @@ body.mobile fieldset.River>div.output div.list div.item { body.mobile fieldset.Action.main { margin-top:48px; margin-bottom:64px; } -body.mobile select { +body.mobile input { font-size:18px; } -body.mobile input { +body.mobile select { font-size:18px; } body.mobile div.carte { @@ -56,6 +56,10 @@ body { background:black; color:cyan; } +legend { + box-shadow:4px 4px 20px 4px #626bd0; + cursor:pointer; +} fieldset { margin:0; border:0; padding:0; } @@ -67,8 +71,6 @@ fieldset.plugin { background-color:#061c3c9e; margin:10px; padding:10px; } -fieldset.input>legend { -} fieldset.float { position:absolute; background-color:#023531cf; @@ -76,18 +78,12 @@ fieldset.float { fieldset.float>legend { display:none; } -legend { - box-shadow:4px 4px 20px 4px #626bd0; - cursor:pointer; -} -input[type=button] { - background-color:black; color:cyan; - letter-spacing:4px; - padding-left:10px; +input[name=cmd] { + width:160px; } -input[type=button]:hover { - background-color:gray; color:cyan; +input[name=date] { + width:150px; } input[type=text] { box-shadow: 4px 4px 10px 1px #626bd0; @@ -97,11 +93,13 @@ input[type=text] { input[type=text]:hover { background-color:white; } -input[name=cmd] { - width:160px; +input[type=button] { + background-color:black; color:cyan; + letter-spacing:4px; + padding-left:10px; } -fieldset>form.option>div.item input.args[name=date] { - width:150px; +input[type=button]:hover { + background-color:gray; color:cyan; } select { box-shadow: 4px 4px 10px 1px #626bd0; @@ -190,10 +188,78 @@ div.code { text-align:left; white-space:pre; overflow:auto; } +div.story { + text-align:left; +} div.hidden { display:none; } +div.toast { + background:#0e3369b3; color:yellow; + position:fixed; + overflow:auto; + padding:5px; + z-index:100; +} +div.toast div.title { + font-size:14px; + color:#cae850; +} +div.toast div.content { + text-align:center; + white-space:pre; +} +div.toast div.duration { + font-size:14px; + color:gray; +} +div.toast div.progress { + border:solid 2px green; + height:10px; +} +div.toast div.progress div.current { + background:red; + height:10px; +} + +div.carte { + position:fixed; + background:#295b61; + color:white; + padding:4px; + z-index:100; +} +div.carte div.item { + padding:3px 12px; + cursor:pointer; +} +div.carte div.item:hover { + background:red; +} + +div.upload { + background:black; color:yellow; + position:fixed; + padding:5px; + z-index:50; +} +div.upload div.item { + float:left; +} + +div.story[data-type=spark] { + background-color:#2169a9a6; color:white; + box-shadow: 4px 4px 10px 1px #626bd0; + padding:4px 10px; margin:10px 0px; + border-left:solid 4px blue; +} +div.story[data-type=spark] span:hover { + box-shadow: 4px 4px 10px 1px #29318e; + background-color:#c10c8a; + cursor:copy; +} + fieldset>form.option>div.item { float:left; margin-right:3px; min-height:26px; vertical-align:middle; @@ -265,9 +331,6 @@ fieldset>div.output td.project { fieldset>div.output td.profile { background-color:#71909c91; } -fieldset>div.output tr.display { - /* background-color:#71909c91; */ -} fieldset>div.output { clear:both; overflow:auto; @@ -318,59 +381,6 @@ body>fieldset.input.date table td:hover { background-color:red; } -div.carte { - position:fixed; - background:#295b61; - color:white; - padding:4px; - z-index:100; -} -div.carte div.item { - padding:3px 12px; - cursor:pointer; -} -div.carte div.item:hover { - background:red; -} - -div.upload { - background:black; color:yellow; - position:fixed; - padding:5px; - z-index:50; -} -div.upload div.item { - float:left; -} - -div.toast { - background:#0e3369b3; color:yellow; - position:fixed; - overflow:auto; - padding:5px; - z-index:100; -} -div.toast div.title { - font-size:14px; - color:#cae850; -} -div.toast div.content { - text-align:center; - white-space:pre; -} -div.toast div.duration { - font-size:14px; - color:gray; -} -div.toast div.progress { - border:solid 2px green; - height:10px; -} -div.toast div.progress div.current { - background:red; - height:10px; -} - body.black a { color:yellow; } @@ -424,10 +434,6 @@ body.white table input[type=button][value=启动] { background:#52ce78; } -body.white fieldset.story { - /* background-color:#7c8ea5ab; */ -} - body.white fieldset.Action { color:black; } @@ -470,16 +476,6 @@ body.print fieldset.Action { body.print fieldset.Action fieldset.plugin { padding-left:40px; } -body.print fieldset.Action fieldset.plugin>legend { - /* display:none; */ -} -body.print fieldset.Action fieldset.plugin>form.option { - /* display:none; */ -} body.print fieldset.River>div.output div.list div.item { background-color:white; } - -div.story { - text-align:left; -} diff --git a/pane/Footer.js b/pane/Footer.js index 6066ee32..93efe8f0 100644 --- a/pane/Footer.js +++ b/pane/Footer.js @@ -11,18 +11,16 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg, }) }, _toast: function(can, msg, target) { - can.toast = can.page.Append(can, target, [{view: ["toast", "div", ""], onclick: function(event) { - var ui = can.onappend.field(can, "story float", {}, document.body) + can.toast = can.page.Append(can, target, [{view: "toast", onclick: function(event) { + var ui = can.onappend.field(can, "story toast float", {}, document.body) can.run({}, ["search", "Action.onexport.size"], function(msg, top, left, width, height) { + can.page.Modify(can, ui.output, {style: {"max-width": width, "max-height": height-28}}) can.page.Modify(can, ui.first, {style: {top: top, left: left}}) } ) can.onappend._action(can, ["关闭", "刷新"], ui.action, { "关闭": function(event) { can.page.Remove(can, ui.first) }, - "刷新": function(event) { - can.page.Remove(can, ui.first) - can.toast.click() - }, + "刷新": function(event) { can.page.Remove(can, ui.first), can.toast.click() }, }) can.onappend.table(can, can._toast, function(value) { return {text: [value, "td"], onclick: function(event) { @@ -39,9 +37,9 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg, }) }, - toast: function(can, msg, text, time, fileline) { can._toast = can._toast || can.request() - can.page.Modify(can, can.toast, time.split(" ").pop()+" "+text) - can._toast.Push({time: time, fileline: fileline, text: text}) + toast: function(can, msg, title, content, fileline, time) { can._toast = can._toast || can.request() + can.page.Modify(can, can.toast, [time.split(" ").pop(), title, content].join(" ")) + can._toast.Push({time: time, fileline: fileline, title: title, content: content}) }, ncmd: function(can, target) { can.page.Select(can, target, "span.ncmd", function(item) { diff --git a/pane/Search.js b/pane/Search.js index 53b952c4..6004f06a 100644 --- a/pane/Search.js +++ b/pane/Search.js @@ -11,10 +11,6 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg, {view: "content"}, {view: ["display", "table"]}, {view: "preview"}, ]), typeof cb == "function" && cb(msg) can.page.ClassList.add(can, can.ui.display, "content") - - var header = can.run({}, ["search", "Header.onexport.height"])||0 - var footer = can.run({}, ["search", "Footer.onexport.height"])||0 - can.page.Modify(can, can._output, {style: {"max-height": window.innerHeight-header-footer-64}}) }, _table: function(can, msg, fields) { can.onmotion.clear(can, can.ui.content) var table = can.onappend.table(can, msg, function(value, key, index, line) { can.Status("count", index+1) @@ -55,19 +51,17 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg, typeof cb == "function" && cb(can.onexport.select(can)), can.onmotion.hide(can) } - can.run({}, ["search", "Header.onexport.height"], function(res) { - can.page.Modify(can, can._target, {style: {top: res}}) - }) - can.run({}, ["search", "River.onexport.width"], function(res) { - can.page.Modify(can, can._target, {style: {left: res}}) - }) - can.input = function(event, word) { cmds[1] = word can.onimport._word(can, msg, cmds, fields) } can.onmotion.show(can), can.ui.input.focus() can.onimport._word(can, msg, cmds, fields) + + can.run({}, ["search", "Action.onexport.size"], function(msg, top, left, width, height) { + can.page.Modify(can, can._output, {style: {"max-width": width, "max-height": height-75}}) + can.page.Modify(can, can._target, {style: {top: top, left: left}}) + } ) }, }) Volcanos("onaction", {help: "交互操作", list: ["关闭", "清空", "完成"], _init: function(can, msg, list, cb, target) { diff --git a/plugin/input/date.js b/plugin/input/date.js index afb30046..a7fd4896 100644 --- a/plugin/input/date.js +++ b/plugin/input/date.js @@ -56,7 +56,7 @@ Volcanos("onfigure", {help: "控件详情", list: [], date: {onclick: function(e for (var day = new Date(one); day < end; day.setDate(day.getDate()+1)) {add(day, "main")} for (var day = new Date(end); end.getDay() != 0 && day < tail; day.setDate(day.getDate()+1)) {add(day, "next")} - can.onlayout.figure(can, event); return now + can.onlayout.figure(event, can); return now }; show(now) }} }, ["/plugin/input/date.css"]) diff --git a/plugin/input/key.js b/plugin/input/key.js index a1d0e936..8a4caeb7 100644 --- a/plugin/input/key.js +++ b/plugin/input/key.js @@ -12,7 +12,7 @@ Volcanos("onfigure", {help: "控件详情", list: [], key: {onclick: function(ev target.value = line[key], can.page.Remove(can, can._target) }} }), can.Status("count", msg.Length()) - can.onlayout.figure(can, event) + can.onlayout.figure(event, can) }) }}}) diff --git a/plugin/input/province.js b/plugin/input/province.js index 18001e41..2644bdc7 100644 --- a/plugin/input/province.js +++ b/plugin/input/province.js @@ -9,7 +9,7 @@ Volcanos("onfigure", {help: "控件详情", list: [], province: {onclick: functi china_chart.setOption({geo: {map: 'china'}}), china_chart.on('click', function (params) { target.value = params.name, can.page.Remove(can, can._target) }), can.Status("count", 34) - can.onlayout.figure(can, event) + can.onlayout.figure(event, can) }) }}, }) diff --git a/plugin/local/code/inner.js b/plugin/local/code/inner.js index 151b91d2..f427c9ed 100644 --- a/plugin/local/code/inner.js +++ b/plugin/local/code/inner.js @@ -25,10 +25,10 @@ Volcanos("onimport", {help: "导入数据", _init: function(can, msg, list, cb, {view: "action"}, {view: "output"}, ]); can.ui.output = ui.output - can.onappend._action(can, ["关闭", "清空", "运行"], ui.action, { - "关闭": function(event) { can.onmotion.hidden(can, can.ui.display) }, - "清空": function(event) { can.onmotion.clear(can, can.ui.output) }, + can.onappend._action(can, ["运行", "清空", "关闭"], ui.action, { "运行": function(event) { can.onaction["运行"](event, can) }, + "清空": function(event) { can.onmotion.clear(can, can.ui.output) }, + "关闭": function(event) { can.onmotion.hidden(can, can.ui.display) }, }) }, _search: function(can, target) { @@ -157,7 +157,7 @@ Volcanos("onsyntax", {help: "语法高亮", list: ["keyword", "prefix", "line"], return p.line? p.line(can, line): line }, }) -Volcanos("onaction", {help: "控件交互", list: ["项目", "运行", "搜索"], +Volcanos("onaction", {help: "控件交互", list: ["项目", "收藏", "搜索", "运行"], "返回": function(event, can) { var last = can.history.pop(); last = can.history.pop() last && can.onimport.tabview(can, last.path, last.file, last.line) @@ -165,15 +165,13 @@ Volcanos("onaction", {help: "控件交互", list: ["项目", "运行", "搜索"] }, "项目": function(event, can) { var width = can.Conf("width")-(can.onmotion.toggle(can, can.ui.project)? 170: 0) - can.page.Modify(can, can.ui.content, {style: {"min-width": width}}) }, - "搜索": function(event, can) { can.onmotion.toggle(can, can.ui.search) }, "收藏": function(event, can) { can.onmotion.toggle(can, can.ui.favor._target) }, - "运行": function(event, can) { - var msg = can.request(event, {_toast: "运行中..."}) + "搜索": function(event, can) { can.onmotion.toggle(can, can.ui.search) }, + "运行": function(event, can) { var msg = can.request(event, {_toast: "运行中..."}) can.run(event, ["action", "engine", can.parse, can.Option("file"), can.Option("path")], function(msg) { - can.onappend.table(can, msg, function(value, key, index) { return {text: [value, "td"]} }, can.ui.output||can.ui.display) + can.onappend.table(can, msg, null, can.ui.output||can.ui.display) can.onappend.board(can, msg.Result(), can.ui.output||can.ui.display) can.page.Modify(can, can.ui.display, {style: {display: "block"}}) }, true) diff --git a/plugin/local/code/vimer.js b/plugin/local/code/vimer.js index 98916ab2..049789f5 100644 --- a/plugin/local/code/vimer.js +++ b/plugin/local/code/vimer.js @@ -297,7 +297,7 @@ Volcanos("onkeymap", {help: "键盘交互", list: ["command", "normal", "insert" can.onaction.rerankLine(can) }, }) -Volcanos("onaction", {help: "控件交互", list: ["项目", "搜索", "收藏", "运行"], +Volcanos("onaction", {help: "控件交互", list: ["项目", "收藏", "搜索", "运行"], save: function(event, can) { var msg = can.request(event, {content: can.onexport.content(can)}) can.run(event, ["action", "save", can.parse, can.Option("file"), can.Option("path")], function(msg) { can.user.toast(can, "保存成功") diff --git a/plugin/local/wiki/word.css b/plugin/local/wiki/word.css index bbebf1dc..9c93ae4d 100644 --- a/plugin/local/wiki/word.css +++ b/plugin/local/wiki/word.css @@ -53,17 +53,6 @@ fieldset.word p.story[data-name=inner]:hover { background-color:#c10c8a; cursor:copy; } -fieldset.word div.story[data-type=spark] { - background-color:#2169a9a6; color:white; - box-shadow: 4px 4px 10px 1px #626bd0; - padding:4px 10px; margin:10px 0px; - border-left:solid 4px blue; -} -fieldset.word div.story[data-type=spark] span:hover { - box-shadow: 4px 4px 10px 1px #29318e; - background-color:#c10c8a; - cursor:copy; -} fieldset.word svg.story { display:block; float:left; } diff --git a/plugin/table.js b/plugin/table.js index a3369921..ecd6560b 100644 --- a/plugin/table.js +++ b/plugin/table.js @@ -11,7 +11,7 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg, }) can.onappend.board(can, msg.Result()) - can.onimport._board(can, msg) + can.onmotion.story(can, can._output) }, _table: function(can, value, key, index, line, array) { return {text: [value, "td"], onclick: function(event) { var target = event.target @@ -29,25 +29,6 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg, }) }} }, - _board: function(can, msg) { - can.page.Select(can, can._output, ".story", function(item) { var data = item.dataset - can.page.Modify(can, item, {style: can.base.Obj(data.style)}) - can.core.CallFunc(can.onimport[data.type], [can, data, item]) - }) - }, - spark: function(can, list, target) { - if (list["name"] == "inner") { - target.title = "点击复制", target.onclick = function(event) { - 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(event, can, item.innerText) - } - }) - }, _process: function(can, msg) { var cb = can.onimport[msg.Option("_process")] @@ -76,7 +57,7 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg, }, can._output) can.onappend.board(can, msg.Result(), can._output) - can.onimport._board(can, msg) + can.onmotion.story(can, can._output) can.page.Modify(can, can._output, {style: {display: "block"}}) return true }, diff --git a/proto.js b/proto.js index 71921360..f5f41927 100644 --- a/proto.js +++ b/proto.js @@ -57,8 +57,8 @@ var Volcanos = shy("火山架", {pack: {}, libs: [], cache: {}}, [], function(na request: function(event, option) { event = event || {} event._msg = event._msg || can.misc.Message(event, can) - can.core.List(arguments, function(arg, index) { - index > 0 && can.core.Item(arg, event._msg.Option) + can.core.List(arguments, function(option, index) { + index > 0 && can.core.Item(typeof option == "function"? option(): option, event._msg.Option) }); return event._msg }, Conf: function(key, value) { return can.core.Value(can._conf, key, value) }, _conf: {},