From d138af4c297c34fa919f9cdccbc19dc483ca2e1f Mon Sep 17 00:00:00 2001 From: harveyshao Date: Tue, 12 Apr 2022 07:44:05 +0800 Subject: [PATCH] opt some --- lib/base.js | 1 + panel/search.js | 8 +++++--- plugin/local/wiki/word.css | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/base.js b/lib/base.js index 1bd607ce..e4bf0a6f 100644 --- a/lib/base.js +++ b/lib/base.js @@ -1,4 +1,5 @@ Volcanos("base", {help: "数据类型", Int: function(val, def) { return parseInt(val)||def||0 }, + Min: function(val, min) { return val > min? val: min }, Obj: function(val, def) { try { if (typeof val == lang.STRING) { if (val == "") { return def } val = JSON.parse(val) } diff --git a/panel/search.js b/panel/search.js index 2955233a..3103826d 100644 --- a/panel/search.js +++ b/panel/search.js @@ -11,7 +11,7 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg, can.onappend._status(can, can.base.Obj(msg.Option("_status"), []).concat({name: "selected", value: "0"})) can.getActionSize(function(msg, height) { - can.page.Modify(can, can.ui.profile, kit.Dict(html.MAX_HEIGHT, height-(table&&table.offsetHeight||0))) + can.page.Modify(can, can.ui.profile, kit.Dict(html.MAX_HEIGHT, can.base.Min(height-(table&&table.offsetHeight||0), height/2))) }) msg.Length() == 1 && can.page.Select(can, table, html.TD)[0].click() can.page.Select(can, can._output, "A", function(item) { @@ -43,7 +43,9 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg, can.getActionSize(function(msg, top, left, width, height) { can.page.Modify(can, can._target, {style: {top: top, left: left}}) - can.page.Modify(can, can._output, {style: kit.Dict(html.MAX_HEIGHT, height-71, html.MAX_WIDTH, width)}) + can.page.Modify(can, can._output, {style: kit.Dict(html.MAX_HEIGHT, height-71, html.MAX_WIDTH, width-2*html.PLUGIN_MARGIN)}) + can.page.Modify(can, can.ui.content, {style: kit.Dict(html.MAX_WIDTH, width-2*html.PLUGIN_MARGIN)}) + can.page.Modify(can, can.ui.display, {style: kit.Dict(html.MAX_WIDTH, width-2*html.PLUGIN_MARGIN)}) }) }, }) @@ -103,7 +105,7 @@ Volcanos("onaction", {help: "交互操作", list: [cli.CLEAR, cli.CLOSE, cli.DON var cmd = line.cmd == ctx.COMMAND? can.core.Keys(line.type, line.name.split(ice.SP)[0]): can.core.Keys(line.ctx, line.cmd) can.onappend.plugin(can, {type: chat.PLUGIN, index: cmd||msg.Option(mdb.INDEX)}, function(sub, meta) { - can.getActionSize(function(msg, height, width) { height -= can.ui.content.offsetHeight+204 + can.getActionSize(function(msg, height, width) { height = can.base.Min(height - can.ui.content.offsetHeight+204, height/2) can.page.Modify(can, sub._output, {style: kit.Dict(html.MAX_HEIGHT, height-26, html.MAX_WIDTH, width-40)}) sub.Conf(html.HEIGHT, height+28), sub.Conf(html.WIDTH, width-60) }) diff --git a/plugin/local/wiki/word.css b/plugin/local/wiki/word.css index ab7edb3a..f69d208b 100644 --- a/plugin/local/wiki/word.css +++ b/plugin/local/wiki/word.css @@ -23,7 +23,7 @@ fieldset.word.float { padding:0; margin:0; width:-webkit-fill-available; positio fieldset.word.float>div.action { display:contents; } fieldset.word.float>div.status { clear:none; } fieldset.word.float>div.output { background-color:#f0f8ff80; padding:20px; overflow:auto; } -fieldset.word.float>div.output>div.project { background:cornsilk; padding:10px; position:fixed; left:0; top:25px; z-index:100; } +fieldset.word.float>div.output>div.project { background:cornsilk; padding:10px; position:fixed; right:0; top:25px; z-index:100; } fieldset.word.float div.content div.page { margin-top:30px; display:none; } fieldset.word.float div.content div.page.show { display:block; } fieldset.word.float div.content.grid div.page { background-color:#a4cbecb5; margin:10px; height:200px; width:200px; overflow:auto; display:block; float:left; }