From bb0213d0938cbec05cc555041c27eb7d12edfbb1 Mon Sep 17 00:00:00 2001 From: shy Date: Thu, 28 Dec 2023 10:18:12 +0800 Subject: [PATCH] opt some --- frame.js | 7 ++++--- index.css | 7 +++---- plugin/state.js | 3 ++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/frame.js b/frame.js index f85b8e32..c1267b5d 100644 --- a/frame.js +++ b/frame.js @@ -426,7 +426,9 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { item._enter = function(event, value) { if (event.ctrlKey) { run(event, mdb.MODIFY, [key, value]) } } can.onmotion.modifys(can, event.target, function(event, value, old) { run(event, mdb.MODIFY, [key, value]) }, item) }, onmouseout: function() { - can.page.SelectChild(can, can._option, html.DIV_ITEM_TEXT, function(target) { can.page.ClassList.del(can, target, "will") }) + can.page.SelectChild(can, can._option, html.DIV_ITEM_TEXT, function(target) { + can.page.ClassList.del(can, target, "will") + }) }, onmouseover: function(event) { can.page.SelectChild(can, can._option, html.DIV_ITEM_TEXT, function(target) { can.page.ClassList.set(can, target, "will", can.page.ClassList.has(can, target, key)) @@ -439,7 +441,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { can.core.List(list, function(target) { can.onappend.style(can, "icons", target) var _icon = can.Conf("feature._icons."+target.name)||icon[target.name] can.page.insertBefore(can, [{icon: _icon, title: can.user.trans(can, target.name), onclick: target.onclick||function(event) { - can.Update(can.request(event, data, {_toast: "process"}), [ctx.ACTION, target.name]), can.onkeymap.prevent(event) + can.Update(can.request(event, data), [ctx.ACTION, target.name]) }}], target.nextSibling, target.parentNode) }) can.page.SelectOne(can, target, html.SPAN, function(span) { can.core.List(span.style, function(key) { target.style[key] = span.style[key] }) }) @@ -722,7 +724,6 @@ Volcanos(chat.ONMOTION, {_init: function(can, target) { }, scrollHold: function(can, cb, target) { target = target || can._output; var left = target.scrollLeft; cb(), target.scrollLeft = left }, scrollIntoView: function(can, target, margin) { if (can._scroll) { return } can._scroll = true, margin = margin||0 - if (!target.parentNode) { return } var offset = (target.offsetTop-margin) - target.parentNode.scrollTop, step = offset < 0? -20: 20 if (Math.abs(offset) > 1000) { return target.parentNode.scrollTop = (target.offsetTop-margin), delete(can._scroll) diff --git a/index.css b/index.css index a5920723..cf119487 100644 --- a/index.css +++ b/index.css @@ -36,7 +36,7 @@ body { --river-width:var(--project-width); --project-width:230px; --input-width:120px; --button-width:60px; --action-height:32px; --status-height:var(--action-height); --footer-height:var(--action-height); --header-height:48px; --plug-width:800px; --plug-height:480px; --story-height:var(--plug-height); --float-height:var(--story-height); --float-width:1000px; --desktop-width:1200px; --desktop-height:684px; - --textarea-height:96px; --qrcode-height:360px; --iframe-height:420px; --desktop-icon-size:80px; --desktop-icon-margin:10px; + --textarea-height:96px; --qrcode-height:360px; --iframe-height:420px; --desktop-icon-size:80px; --river-margin:80px; --action-margin:200px; --plugin-padding:10px; --plugin-margin:var(--plugin-padding); --legend-padding:20px; --title-margin:var(--legend-padding); @@ -71,7 +71,6 @@ body.width3 { /* 960-1280 平板横屏 */ body.width4 { /* 1280-1600 笔记本 显示器调试 */ --plugin-padding:10px; --action-button:6; --table-button:4; - --desktop-icon-margin:0; } body.width5 { /* 1600-1920 */ --plugin-padding:10px; @@ -106,7 +105,7 @@ table.content th.select[data-asc="0"] i.bi-sort-up { display:none; } table.content td { padding:var(--table-padding); } table.content td input.icons { display:none; } table.content td i:hover { background-color:var(--hover-bg-color); color:var(--hover-fg-color); cursor:pointer; } -table.content td i { padding:var(--input-padding); font-size:20px; } +table.content td i { padding:var(--input-padding); } body:not(.mobile) fieldset.plugin:not(.plug):not(.float):not(.full):not(.cmd)>div.output>table.content td input.icons { display:unset; } body:not(.mobile) fieldset.plugin:not(.plug):not(.float):not(.full):not(.cmd)>div.output>table.content td i { display:none; } table.content.checkbox th:first-child { text-align:center; padding:var(--table-padding); position:sticky; left:2px; z-index:1; } @@ -129,7 +128,7 @@ iframe { height:var(--iframe-height); width:100%; } /* fieldset */ fieldset>legend { box-shadow:var(--box-shadow); } fieldset>form.option>div.item:not(.icon) { margin-right:var(--button-margin); box-shadow:var(--box-shadow); } -// fieldset.story:not(.float)>form.option>div.item.icons:not(.icon) { margin-right:0; } +fieldset.story:not(.float)>form.option>div.item.icons:not(.icon) { margin-right:0; } fieldset>form.option>div.item.textarea { width:100%; height:var(--textarea-height); } fieldset>form.option>div.item.text.cmd { width:100%; } fieldset>form.option>div.item.text.cmd>input { background-color:var(--code-bg-color); color:var(--code-fg-color); width:100%; } diff --git a/plugin/state.js b/plugin/state.js index 76283a77..2d25d103 100644 --- a/plugin/state.js +++ b/plugin/state.js @@ -246,7 +246,8 @@ Volcanos(chat.ONEXPORT, { title: function(can, title) { can.isCmdMode() && can.user.title(title) }, marginTop: function() { return 0 }, marginBottom: function() { return 0 }, actionHeight: function(can) { return can.page.ClassList.has(can, can._target, html.OUTPUT)? 0: html.ACTION_HEIGHT }, - outputHeight: function(can) { var height = can.ConfHeight() - can.onexport.outputMargin(can) + outputHeight: function(can) { + var height = can.ConfHeight() - can.onexport.outputMargin(can) if (can.user.isMobile) { return can.ConfHeight() - can.onexport.actionHeight(can) - can.onexport.statusHeight(can) } can.page.SelectChild(can, can._output, html.TABLE, function(target) { height -= target.offsetHeight }) return can.base.Max(can.base.Min(height, can.ConfHeight()/2), can.ConfHeight()-html.ACTION_HEIGHT, 320)