From c66b9ab28b0392bc672702e812b74e65338a13ab Mon Sep 17 00:00:00 2001 From: shy Date: Wed, 1 May 2024 18:25:52 +0800 Subject: [PATCH] add some --- frame.js | 6 +++++- index.css | 15 +++++++++------ lib/core.js | 2 +- plugin/state.js | 9 ++++++--- plugin/table.js | 4 +++- 5 files changed, 24 insertions(+), 12 deletions(-) diff --git a/frame.js b/frame.js index ac231c9d..07bf4867 100644 --- a/frame.js +++ b/frame.js @@ -313,7 +313,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { _legend: can._legend, _option: can._option, _action: action||can._action, _output: output, _status: status||can._status, Update: can.Update, Option: can.Option, Action: can.Action, Status: can.Status, db: {}, ui: {layout: function() {}}, }, [display, msg.Option(ice.MSG_DISPLAY_CSS), chat.PLUGIN_TABLE_JS], function(sub) { sub.Conf(can.Conf()) - sub.db.hash = can.isCmdMode()? can.misc.SearchHash(can): [] + sub.db.hash = can.base.getValid(can.isCmdMode()? can.misc.SearchHash(can): [], can.misc.localStorage(can, [sub.ConfSpace()||can.misc.Search(can, ice.POD), sub.ConfIndex(), "hash"]))||[] var last = can.sub; last && can.core.CallFunc([last, "onaction.hidden"], {can: last}) sub.run = function(event, cmds, cb, silent) { var msg = sub.request(event)._caller() msg.RunAction(event, sub, cmds) || can.Update(event, can.Input(cmds, !silent), cb, silent) @@ -403,6 +403,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { type == html.PLUG || (type == html.STORY && item.style != html.FLOAT) || can.base.isIn(can.ConfIndex(), // web.DESKTOP, web.MESSAGE, web.VIMER, ) || (name = can.core.Keys(item.space||item._space, name)) + item.index && (item.help = item.help||can.user.trans(can, item.index.split(".").pop(), "")) var title = item.title || can.user.isMobile && (can.user.isEnglish(can)? name: (item.help||name)) || (!item.help || name == item.help || can.user.isEnglish(can)? name: name+"("+can.core.Split(item.help)[0]+")") target = can.base.isFunc(target)? target(): target return can.page.Append(can, target||can._output, [{view: [type, html.FIELDSET], style: item.style, list: [{type: html.LEGEND, list: [ @@ -1035,6 +1036,9 @@ Volcanos(chat.ONMOTION, {_init: function(can, target) { can.user.toast(can, "filter out "+count+" lines") }, 300) }, + cacheClear: function(can, key) { delete(can._cache_data[key]) + can.core.List(arguments, function(target, index) { index > 1 && delete(target._cache[key]) }) + }, cache: function(can, next) { var list = can.base.getValid(can.base.Obj(can.core.List(arguments).slice(2)), [can._output]) var data = can._cache_data = can._cache_data||{}, old = list[0]._cache_key var key = next(function(save) { if (old) { data[old] = save } }, function(hash, load) { var bak = data[hash]; if (bak) { load(bak) } return hash }) diff --git a/index.css b/index.css index 7db732fa..74709037 100644 --- a/index.css +++ b/index.css @@ -196,7 +196,7 @@ div.project div.action div.item input:hover { border-right:var(--box-notice); } div.project div.action div.item.icons input { display:none; } div.project div.action div.item.icons { background-color:var(--plugin-bg-color); padding:0; } div.project div.list { margin-left:var(--button-margin); clear:both; } -body.width6 div.project div.list { margin-left:var(--legend-margin); } +body.width6 fieldset.plugin>div.output>div.project div.list { margin-left:var(--legend-margin); } // div.project div.list { border-left:var(--disable-fg-color) dashed 1px; } div.project div.list fieldset { position:static; } div.project div.item.select { @@ -210,7 +210,7 @@ div.project div.item:not(.hide) { } div.project div.item img { height:var(--action-height); width:var(--action-height); } div.project div.item img { margin:0; } -div.project div.item input:not([type=button]) { border-right:0; } +div.project div.item:not(:hover) input:not([type=button]) { border-right:0; } div.project div.item.filter { padding:0; width:100%; position:sticky; top:0; } div.project div.item.filter>input { padding:0 25px; width:100% !important; } div.project div.item.search { padding:0; width:100%; } @@ -237,6 +237,7 @@ div.toggle.project { top:20%; left:0; border-top-right-radius:var(--plugin-radiu div.content>div.toggle.profile { top:20%; right:0; border-top-left-radius:var(--plugin-radius); border-bottom-left-radius:var(--plugin-radius); } div.content>div.toggle.display { left:20%; bottom:-52px; rotate:90deg; border-top-left-radius:var(--plugin-radius); border-bottom-left-radius:var(--plugin-radius); } div.project:not(.toggle) { width:var(--project-width); flex:0 0 var(--project-width); } +fieldset.story div.project:not(.toggle) { width:230px; flex:0 0 230px; } div.layout>div.profile:not(.toggle) { width:50%; flex:0 0 50%; } /* fieldset */ body.mobile div.item.online.state { display:none; } @@ -471,6 +472,7 @@ fieldset.vimer.insert>div.action div.tabs.select { border-top:var(--box-danger3) fieldset.vimer.insert>legend { border-top:var(--box-danger3) !important; } fieldset.plugin.vimer>legend { margin-right:31px; } div.action div.tabs:hover { background-color:var(--hover-bg-color); } +fieldset.story div.action div.tabs:not(.select) { display:none; } div.zone>div.item { background-color:var(--th-bg-color); } div.zone>div.list>div.zone>div.item { background-color:var(--th-bg-color); } div.tabs div { background-color:var(--plugin-bg-color); } @@ -526,8 +528,9 @@ fieldset.plugin { box-shadow:var(--plugin-box-shadow); border-radius:var(--plugi fieldset.story { box-shadow:var(--plugin-box-shadow); border-radius:var(--plugin-radius); } fieldset.float { box-shadow:var(--plugin-box-shadow); border:var(--plugin-border); border-radius:var(--plugin-radius); } fieldset:not(.panel):hover { box-shadow:var(--notice-box-shadow); } -fieldset.plugin>legend { box-shadow:var(--legend-box-shadow); margin-right:var(--legend-margin); } -fieldset.story>legend { box-shadow:var(--legend-box-shadow); border-top-left-radius:var(--plugin-radius); margin-right:var(--legend-margin); } +body:not(.cmd) fieldset.plugin>legend { box-shadow:var(--legend-box-shadow); margin-right:var(--legend-margin); } +body:not(.cmd) fieldset.story>legend { box-shadow:var(--legend-box-shadow); margin-right:var(--legend-margin); } +fieldset.story>legend { border-top-left-radius:var(--plugin-radius); } fieldset.float>form.option input { border-top:0; } fieldset.float>div.action input { border-top:0; } fieldset>form.option div.item:not(.icon) { box-shadow:var(--input-box-shadow); } @@ -795,9 +798,9 @@ body.print fieldset.draw div.output div.content svg { background-color:lightgray fieldset.Action>div.output>fieldset.ssh.cloud.profile { box-shadow:none; background-color:transparent; } fieldset.Action>div.output>fieldset.ssh.cloud.profile:hover { box-shadow:none; } fieldset.Action>div.output>fieldset.ssh.cloud.profile>div.output { background-color:transparent; } -fieldset.Action>div.output>fieldset.plugin>legend { border-top:var(--box-notice3); border-top-left-radius:0; } +body:not(.cmd) fieldset.Action>div.output>fieldset.plugin>legend { border-top:var(--box-notice3); border-top-left-radius:0; } // body.cmd fieldset.Action>div.output>fieldset.plugin>legend { min-width:var(--project-width); justify-content:center; } -fieldset.Action>div.output>fieldset.plugin>legend:not(:hover) { background-color:var(--output-bg-color); } +body:not(.cmd) fieldset.Action>div.output>fieldset.plugin>legend:not(:hover) { background-color:var(--output-bg-color); } fieldset.Action:not(.horizon):not(.grid)>fieldset.plugin>form.option>div.item.text.path>input { width:var(--project-width); } fieldset.web.code.docker.studio>div.output>fieldset>legend { display:none; } fieldset.web.code.docker.studio>div.output>fieldset>form.option>div:first-child { margin-left:var(--button-margin); } diff --git a/lib/core.js b/lib/core.js index 18f49779..7f9c939a 100644 --- a/lib/core.js +++ b/lib/core.js @@ -4,7 +4,7 @@ Volcanos("core", { }, Keys: function() { var list = [] for (var i = 0; i < arguments.length; i++) { var v = arguments[i]; switch (typeof v) { - case code.OBJECT: for (var j = 0; j < v.length; j++) { list.push(v[j]) } break + case code.OBJECT: for (var j = 0; j < v.length; j++) { v[j] && list.push(v[j]) } break case code.NUMBER: list.push(v+""); break case code.FUNCTION: v = v() default: v && list.push(v+"") diff --git a/plugin/state.js b/plugin/state.js index 783c961a..6e91d93e 100644 --- a/plugin/state.js +++ b/plugin/state.js @@ -1,6 +1,5 @@ Volcanos(chat.ONIMPORT, { - _process: function(can, msg) { - if (msg.IsErr()) { can.onappend.style(can, "warn", can.user.toastFailure(can, msg.Result())._target) } + _process: function(can, msg) { if (msg.IsErr()) { can.onappend.style(can, "warn", can.user.toastFailure(can, msg.Result())._target) } if (can.onimport[msg.OptionProcess()]) { return can.core.CallFunc([can.onimport, msg.OptionProcess()], {can: can, sub: can.sub, msg: msg, arg: msg.Option("_arg")}), true } }, _location: function(can, msg, arg) { can.user.jumps(arg) }, _replace: function(can, msg, arg) { location.replace(arg) }, @@ -173,7 +172,11 @@ Volcanos(chat.ONACTION, {list: ["刷新数据", }, "刷新数据": function(event, can) { can.Update(event, can.Input()), can.user.toastSuccess(can) }, "刷新界面": function(event, can) { var sub = can.sub; sub.onlayout._init(sub, sub.ConfHeight(), sub.ConfWidth()), can.user.toastSuccess(can) }, - "切换浮动": function(event, can, button, sub) { can.onaction._switch(can, sub, chat.FLOAT, function() { can.onmotion.hidden(can, can._action), can.onmotion.hidden(can, can._status), can.onmotion.float(can) }) }, + "切换浮动": function(event, can, button, sub) { + can.onaction._switch(can, sub, chat.FLOAT, function() { + // can.onmotion.hidden(can, can._action), can.onmotion.hidden(can, can._status) + can.onmotion.float(can) + }) }, "切换全屏": function(event, can, button, sub) { can.onaction._switch(can, sub, chat.FULL, function() { can.page.style(can, can._target, html.LEFT, "", html.TOP, can.onexport.marginTop(), html.BOTTOM, "") can.ConfHeight(can.page.height()-can.onexport.marginTop()-can.onexport.marginBottom(can)), can.ConfWidth(can.page.width()) }) }, diff --git a/plugin/table.js b/plugin/table.js index a4f0aa3a..6721c11c 100644 --- a/plugin/table.js +++ b/plugin/table.js @@ -292,7 +292,9 @@ Volcanos(chat.ONEXPORT, { session: function(can, key, value) { return can.misc[can.user.isWebview? "localStorage": "sessionStorage"](can, [can.Conf(ctx.INDEX), key, location.pathname].join(":"), value == ""? "": JSON.stringify(value)) }, action_value: function(can, key, def) { var value = can.Action(key); return can.base.isIn(value, ice.AUTO, key, undefined)? def: value }, tool: function(can) { can.misc.sessionStorage(can, [can.ConfIndex(), "tool"], JSON.stringify(can.page.Select(can, can._status, html.LEGEND, function(target) { return target._meta }))) }, - hash: function(can, hash) { can.misc.SearchHash(can, hash) }, + hash: function(can, hash) { can.misc.SearchHash(can, hash) + can.misc.localStorage(can, [can.ConfSpace()||can.misc.Search(can, ice.POD), can.ConfIndex(), "hash"], hash) + }, tabs: function(can) {}, }) Volcanos(chat.ONACTION, {