diff --git a/frame.js b/frame.js index 0ac68f66..ce8109a7 100644 --- a/frame.js +++ b/frame.js @@ -163,7 +163,7 @@ Volcanos("onappend", {help: "渲染引擎", list: [], _init: function(can, meta, } meta.inputs && sub.onappend._option(sub, meta, sub._option, meta.msg) - if (meta.msg) { var msg = sub.request(); msg.Copy(can.base.Obj(meta.msg)), sub.onappend._output(sub, msg, msg.Option(ice.MSG_DISPLAY)) } + if (meta.msg) { var msg = sub.request(); msg.Copy(can.base.Obj(meta.msg)), sub.onappend._output(sub, msg, msg.Option(ice.MSG_DISPLAY)||meta.feature.display) } can.page.Modify(can, sub._legend, kit.Dict(can.Conf("legend_event")||"onmouseenter", function(event) { can.user.carte(event, sub, sub.onaction, sub.onaction.list.concat([["所有"].concat(can.core.Item(meta.feature._trans))], [cli.CLOSE])) diff --git a/page/index.css b/page/index.css index 032eb904..c272a8d8 100644 --- a/page/index.css +++ b/page/index.css @@ -13,6 +13,9 @@ div.code { clear:both; overflow:auto; } div.story { text-align:left; white-space:pre; } +p.story { + clear:both; +} div.story[data-type=spark] { background-color:#2169a9a6; color:white; box-shadow:4px 4px 10px 1px #626bd0; @@ -124,18 +127,21 @@ fieldset.panel>legend { display:none; } fieldset.plugin { margin:10px; padding:10px; background-color:#061c3c9e; box-shadow:2px 2px 10px 4px #626bd0; } fieldset.plugin>div.action { float:none; overflow:auto; } fieldset.plugin>div.status { border-top:1px solid darkcyan; } -fieldset.output { margin:0; padding:0; } -fieldset.output>legend { display:none; } -fieldset.output>form.option { display:none; } -fieldset.output>div.action { display:none; } -fieldset.output>div.status { display:none; } -fieldset.story>legend { display:block; padding:2px 20px; letter-spacing:4px; } + +fieldset.story>legend { display:block; padding:2px 20px; } fieldset.story>div.status { border-top:1px solid darkcyan; } fieldset.float { position:absolute; z-index:10; background-color:#023531cf; padding:0px; margin:0px; } fieldset.float>legend { float:left; } fieldset.float>div.action { display:block; float:none; height:2rem; overflow:auto; } fieldset.float table { color:white; } +fieldset.output { margin:0; padding:0; } +fieldset.output>legend { display:none; } +fieldset.output>form.option { display:none; } +fieldset.output>div.action { display:none; } +fieldset.output>div.status { display:none; } +fieldset.output div.toggle { display:none; } + fieldset.input { position:fixed; z-index:10; background-color:#0d4142a6; top:32px; } fieldset.input legend { display:none; } fieldset.input div.output { max-height:400px; } diff --git a/plugin/local/code/inner.js b/plugin/local/code/inner.js index a180a488..8edb89a9 100644 --- a/plugin/local/code/inner.js +++ b/plugin/local/code/inner.js @@ -16,7 +16,7 @@ Volcanos("onimport", {help: "导入数据", _init: function(can, msg, cb, target can.base.isFunc(cb) && cb(msg) can.onimport.tabview(can, can.Option(nfs.PATH), can.Option(nfs.FILE), can.Option(nfs.LINE)) - can.onimport.project(can, paths, function() { + can.Conf("mode") == "simple"? can.onimport._simple(can): can.onimport.project(can, paths, function() { can.onimport._toolkit(can, can.ui.toolkit), can.onimport._session(can, msg), can.onimport._keydown(can) can.onmotion.delay(can, function() { can.core.Next(files.slice(1), function(file, next) { @@ -25,6 +25,10 @@ Volcanos("onimport", {help: "导入数据", _init: function(can, msg, cb, target }) }) }, + _simple: function(can, target) { + can.Conf(html.HEIGHT, ""), can.ui.project._toggle() + can.page.ClassList.add(can, can._fields, "output") + }, _project: function(can, target) { target._toggle = function(event) { can.onmotion.toggle(can, target), can.onimport.layout(can) } }, @@ -165,6 +169,10 @@ Volcanos("onimport", {help: "导入数据", _init: function(can, msg, cb, target }, target) }, layout: function(can) { var height = can.ConfHeight(), width = can.ConfWidth() + can.page.styleWidth(can, can.ui.profile_output, can.profile_size[can.onexport.keys(can)]||(width-can.ui.project.offsetWidth)/2) + can.page.styleWidth(can, can.ui.content, width-can.ui.project.offsetWidth-can.ui.profile.offsetWidth-26) + + if (!height) { return } can.page.style(can, can.ui.content, can.user.mod.isCmd? html.HEIGHT: html.MAX_HEIGHT, height) if (can.ui.project.style.display != html.NONE) { can.page.styleHeight(can, can.ui.project, can.ui.content.offsetHeight) @@ -173,9 +181,6 @@ Volcanos("onimport", {help: "导入数据", _init: function(can, msg, cb, target can.page.styleHeight(can, can.ui.content, (can.ui.project.offsetHeight||height)-can.ui.display.offsetHeight) } - can.page.styleWidth(can, can.ui.profile_output, can.profile_size[can.onexport.keys(can)]||(width-can.ui.project.offsetWidth)/2) - can.page.styleWidth(can, can.ui.content, width-can.ui.project.offsetWidth-can.ui.profile.offsetWidth-26) - if (can.page.ClassList.has(can, can._fields, "full")) { can.page.styleHeight(can, can.ui.profile_output, can.ui.content.offsetHeight) } else { diff --git a/plugin/local/wiki/word.css b/plugin/local/wiki/word.css index 4ea9fd9e..a3159641 100644 --- a/plugin/local/wiki/word.css +++ b/plugin/local/wiki/word.css @@ -56,8 +56,19 @@ fieldset.word br.story { } fieldset.word p.story { - white-space:pre; + /* white-space:pre; */ } +fieldset.word div.story[data-name=field]>div.menu { + float:left; width:120px; + overflow:auto; +} +fieldset.word div.story[data-name=field]>div.menu div.list { + padding-left:10px; +} +fieldset.word div.story[data-name=field]>div.list { + float:left; +} + fieldset.word p.story[data-name=inner] { padding:4px 10px; margin:10px 0px; background-color:#4b6c8a7a; diff --git a/plugin/local/wiki/word.js b/plugin/local/wiki/word.js index 48ea1c8e..4bda0f76 100644 --- a/plugin/local/wiki/word.js +++ b/plugin/local/wiki/word.js @@ -23,7 +23,7 @@ Volcanos("onimport", {help: "导入数据", _init: function(can, msg, cb, target can.getActionSize(function(msg) { can.page.style(can, nav, html.HEIGHT, can.Conf(html.HEIGHT)+(can.user.mod.isCmd? msg.Option(html.MARGIN_Y): 0)) - can.Conf(html.WIDTH, can.Conf(html.WIDTH)-nav.offsetWidth-(can.user.mod.isCmd? 10: 20)) + can.Conf(html.WIDTH, can.Conf(html.WIDTH)-nav.offsetWidth-(can.user.mod.isCmd? 10: 20)-10) can.page.Modify(can, can._output, {style: kit.Dict( html.HEIGHT, can.sup._navmenu.offsetHeight, html.MAX_WIDTH, can.Conf(html.WIDTH), html.FLOAT, html.LEFT, html.CLEAR, html.NONE @@ -41,6 +41,47 @@ Volcanos("onimport", {help: "导入数据", _init: function(can, msg, cb, target can.user.mod.isCmd && target.tagName == "H1" && can.user.title(data.text) }, spark: function(can, data, target) { + if (data[mdb.NAME] == chat.FIELD) { + function deep(text) { var d = 0 + for (var i = 0; i < text.length; i++) { + switch (text[i]) { + case "\t": d += 4; break + case " ": d++; break + default: return d + } + } + return d + } + var list = []; can.core.List(target.innerText.split(ice.NL), function(line) { var _deep = deep(line) + while (list.length > 0) { if (_deep <= list[list.length-1]._deep) { list.pop() } else { break } } + var ls = can.core.Split(line), item = {_deep: _deep, meta: {index: ls[0], name: ls[1], args: ls.slice(2)}, list: []} + if (list.length > 0) { list[list.length-1].list.push(item) } list.push(item) + }) + + var first; function show(item, index, target, output) { + var ui = can.page.Append(can, target, [{view: [html.ITEM, html.DIV, item.meta.name||item.meta.index], onclick: function(event) { + if (ui.list.innerText) { return can.onmotion.toggle(can, ui.list) } + can.onmotion.select(can, view.menu, html.DIV_ITEM, event.target) + if (can.onmotion.cache(can, function() { return index }, output)) { return } + can.core.List(item.list, function(item) { + can.onappend.plugin(can, item.meta, function(sub) { + sub.run = function(event, cmds, cb, silent) { + can.run(event, can.misc.concat(can, [ctx.ACTION, ice.RUN, item.meta.index], cmds), cb, true) + } + sub.ConfWidth(item.meta.width = can.ConfWidth()-165) + sub.ConfHeight(item.meta.height = can.ConfHeight()-300) + can.page.style(can, sub._output, html.MAX_WIDTH, sub.ConfWidth()-2*html.PLUGIN_MARGIN) + can.page.style(can, sub._status, html.MAX_WIDTH, sub.ConfWidth()-2*html.PLUGIN_MARGIN) + }, output) + }) + }}, {view: html.LIST}]) + can.core.List(item.list, function(item) { item.list.length > 0 && show(item, can.core.Keys(index, item.meta.index), ui.list, output) }) + ui.list.innerText == "" && (first = first||ui.item) + } + + var view = can.page.Appends(can, target, [{view: html.MENU}, {view: html.LIST}]) + return show(list[0], list[0]._index, view.menu, view.list), first.click() + } if (data[mdb.NAME] == html.INNER) { return can.onmotion.copy(can, target) } can.page.Select(can, target, html.A, function(item) { can.onmotion.link(can, item) }) can.page.Select(can, target, html.SPAN, function(item) { can.onmotion.copy(can, item) }) @@ -62,8 +103,8 @@ Volcanos("onimport", {help: "导入数据", _init: function(can, msg, cb, target sub.run = function(event, cmds, cb, silent) { can.run(event, can.misc.concat(can, [ctx.ACTION, chat.STORY, data.type, data.name, data.text], cmds), cb, true) } - sub.Conf(html.HEIGHT, can.Conf(html.HEIGHT)) - sub.Conf(html.WIDTH, item.width = (width||can.Conf(html.WIDTH))-20) + sub.ConfHeight(can.ConfHeight()) + sub.ConfWidth(item.width = (width||can.ConfWidth())-20) can.core.Value(item, "auto.cmd") && can.core.Timer300ms(function() { var msg = sub.request({}, can.core.Value(item, "opts")); msg.Option(ice.MSG_HANDLE, ice.TRUE) @@ -90,7 +131,8 @@ Volcanos("onkeymap", {help: "键盘交互", list: [], }, }, _engine: {}, }) -Volcanos("onaction", {help: "控件交互", list: [], +Volcanos("onaction", {help: "控件交互", list: ["view"], + _trans: {view: "视图"}, play: function(event, can) { var list = [], current = [] can.page.Select(can, can._output, wiki.ITEM, function(item) { switch (item.tagName) { @@ -140,7 +182,13 @@ Volcanos("onaction", {help: "控件交互", list: [], }) }, document.body) }, - + view: function(event, can) { + if (can._height) { + can.page.styleHeight(can, can._target, can._height), can.page.styleHeight(can, can.sup._navmenu, can._height), delete(can._height) + } else { can._height = can.page.styleHeight(can, can._target) + can.page.styleHeight(can, can._target, ""), can.page.styleHeight(can, can.sup._navmenu, "") + } + }, }) Volcanos("ondetail", {help: "交互操作", list: ["删除"], _init: function(can, msg, list, cb, target) { }, diff --git a/proto.js b/proto.js index 9f0bdde4..9c367f38 100644 --- a/proto.js +++ b/proto.js @@ -348,6 +348,9 @@ var Volcanos = shy("火山架", {iceberg: "/chat/", volcano: "/frame.js", args: } res = can.core.Value(can._conf, arguments[i], arguments[i+1]) } + if (res == undefined && key.indexOf("feature.") == -1) { + return can.Conf(can.core.Keys("feature", key)) + } return res }, _conf: {}, }