From 1fc2989b36d89c486e20df7f6913fda5c1c67e15 Mon Sep 17 00:00:00 2001 From: shy Date: Wed, 28 Feb 2024 23:29:56 +0800 Subject: [PATCH] add some --- const.js | 1 + frame.js | 3 ++- index.css | 6 ++++-- lib/page.js | 6 +++++- plugin/state.js | 2 +- plugin/table.js | 5 ++--- 6 files changed, 15 insertions(+), 8 deletions(-) diff --git a/const.js b/const.js index fa640cd7..33470e9a 100644 --- a/const.js +++ b/const.js @@ -104,6 +104,7 @@ var web = { CHAT: "chat", PORTAL: "portal", DESKTOP: "desktop", STUDIO: "studio", SERVICE: "service", + MESSAGE: "message", WORD: "word", CODE_GIT_SEARCH: "web.code.git.search", diff --git a/frame.js b/frame.js index ab07b9ad..ea73e459 100644 --- a/frame.js +++ b/frame.js @@ -364,7 +364,8 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { field: function(can, type, item, target) { type = type||html.STORY, item = item||{} var name = can.core.Split(item.nick||item.name||"").pop()||""; can.base.isIn(name, tcp.SERVER, tcp.CLIENT, web.STUDIO, web.SERVICE, mdb.SEARCH, - ) && (name = (item.index||"").split(".").slice(-2).join(".")), (type != html.PLUG && can.ConfIndex() != web.DESKTOP) && (name = can.core.Keys(item.space||item._space, name)) + web.MESSAGE, + ) && (name = (item.index||"").split(".").slice(-2).join(".")), (type != html.PLUG && !can.base.isIn(can.ConfIndex(), web.DESKTOP, web.MESSAGE)) && (name = can.core.Keys(item.space||item._space, name)) 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: [item.icon && {icon: item.icon}, {text: title}]}, {view: [html.OPTION, html.FORM]}, html.ACTION, html.OUTPUT, html.STATUS]}]) diff --git a/index.css b/index.css index a97cb99a..c3aa8404 100644 --- a/index.css +++ b/index.css @@ -144,6 +144,8 @@ div.output.card>div.item:hover { background-color:var(--plugin-bg-color); color: div.output.card>div.item.stop { color:var(--disable-fg-color); } div.output.card>div.item>div.title { font-size:var(--legend-font-size); font-weight:bold; padding-bottom:var(--input-padding); display:flex; align-items:center; overflow:hidden; } div.output.card>div.item>div.title>img { margin-right:var(--button-margin); margin-left:0; height:var(--header-height); width:var(--header-height); float:left; } +div.output.card>div.item>div.title>img.jpg { padding:var(--input-padding); } +div.item img.jpg { padding:var(--input-padding); } div.output.card>div.item>div.content { white-space:pre; font-size:var(--status-font-size); padding:var(--input-padding); height:var(--header-height); } div.output.card>div.item>div.action { text-align:right; width:calc(100% - var(--plugin-padding)); display:flex; position:absolute; bottom:var(--plugin-padding); } div.output.card>div.item>div.action>input { padding:0 var(--button-padding); margin-right:var(--input-margin); } @@ -161,7 +163,7 @@ div.project div.action { width:100%; } div.project div.list { margin-left:var(--button-margin); clear:both; } div.project div.list fieldset { position:static; } div.project div.item:not(.hide) { white-space:pre; line-height:24px; padding:0 var(--button-margin); display:flex; align-items:center; } -div.project div.item img { margin:var(--input-margin) !important; height:var(--action-height); width:var(--action-height); } +div.project div.item img { height:var(--action-height); width:var(--action-height); } div.project div.item.filter { padding:0; width:100%; } div.project div.item.filter>input { padding:0 25px; width:100% !important; } div.project div.item.search { padding:0; width:100%; } @@ -541,7 +543,7 @@ form.option>div.item.icon { font-size:var(--icon-font-size); padding:0 var(--inp form.option>div.item.icon.menu { font-size:28px; line-height:24px; display:flex; align-items:flex-start; display:none; } form.option>div.item.icon.refresh { font-size:28px; line-height:26px; display:flex; align-items:flex-start; } form.option>div.item.icon.goback { font-size:28px; line-height:26px; display:flex; align-items:flex-start; } -form.option>div.icon.delete { font-size:20px; line-height:30px; display:flex; align-items:flex-start; } +form.option>div.icon.delete { font-size:20px; line-height:32px; display:flex; align-items:flex-start; } form.option>div.item.icon.play { font-size:16px; } body.windows form.option>div.item.icon.delete { line-height:31px; display:flex; align-items:flex-start; } body.windows form.option>div.item.icon.menu { font-size:22px; line-height:32px; } diff --git a/lib/page.js b/lib/page.js index 29f62650..825234f4 100644 --- a/lib/page.js +++ b/lib/page.js @@ -81,7 +81,11 @@ Volcanos("page", { } else if (item.password) { var list = can.core.List(item.password); type = html.INPUT, name = list[0]||name||html.PASSWORD // data.className = list[1]||data.className||name, data.type = html.PASSWORD, data.autocomplete = data.autocomplete||"current-password" data.className = list[1]||data.className||name, data.type = html.PASSWORD - } else if (item.img) { var list = can.core.List(item.img); type = html.IMG, data.src = list[0] + } else if (item.img) { + var list = can.core.List(item.img); type = html.IMG, data.src = list[0] + if (can.base.contains(data.src, ".jpg")) { + data.className = data.className||"jpg" + } } else if (item.row) { type = html.TR, item.list = item.row.map(function(text) { return {text: [text, item.sub||html.TD]} }) } else if (item.th) { type = html.TR, item.list = item.th.map(function(text) { return {text: [text, html.TH]} }) } else if (item.td) { type = html.TR, item.list = item.td.map(function(text) { return can.base.isObject(text)? text: {text: [text||"", html.TD]} }) } diff --git a/plugin/state.js b/plugin/state.js index 8313657a..46f59f5e 100644 --- a/plugin/state.js +++ b/plugin/state.js @@ -162,7 +162,7 @@ Volcanos(chat.ONACTION, {list: ["刷新数据", "打开链接": function(event, can) { can.user.open(can.onexport.link(can)) }, "发送聊天": function(event, can) { can.user.input(event, can, [{name: "message", display: "/require/usr/icebergs/core/chat/message.js", run: function(event, cmds, cb) { - can._root.Header.run(event, [ctx.ACTION, "message"].concat(cmds), function(msg) { cb(msg) }) + can._root.Header.run(can.request(event, {pod: can.ConfSpace()}), [ctx.ACTION, "message"].concat(cmds), function(msg) { cb(msg) }) }}], function(list) { can._root.Header.run(event, [ctx.ACTION, "message", list[0], mdb.TYPE, "plug", web.SPACE, can.ConfSpace(), ctx.INDEX, can.ConfIndex(), ctx.ARGS, JSON.stringify(can.Option())]) }) diff --git a/plugin/table.js b/plugin/table.js index 1ea479f3..99fad28f 100644 --- a/plugin/table.js +++ b/plugin/table.js @@ -14,7 +14,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { if (img.indexOf("/require/") == 0 && value.origin) { img = value.origin + img } return {view: [[html.ITEM, value.type, value.status]], list: [ {view: [wiki.TITLE, html.DIV], list: [ - value.icon && {img: img}, {view: wiki.TITLE, list: [{text: value.name}, can.onappend.label(can, value)]}, + value.icon && {className: can.base.contains(img, ".jpg")? "jpg": "", img: img}, {view: wiki.TITLE, list: [{text: value.name}, can.onappend.label(can, value)]}, ]}, {view: [wiki.CONTENT, html.DIV, value.text]}, {view: html.ACTION, inner: value.action, _init: function(target) { can.onappend.mores(can, target, value, html.CARD_BUTTON) }}, ]} @@ -131,11 +131,10 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { } var icon = item.icon||item.icons var ui = can.page.Append(can, target, [{view: [[html.ITEM, item.type, item.status]], list: [ - icon && (can.base.contains(icon, ice.HTTP, ".png", ".jpg")? {img: can.misc.Resource(can, icon)}: {icon: icon}), + icon && (can.base.contains(icon, ice.HTTP, ".png", ".jpg")? {className: can.base.contains(icon, ".jpg")? "jpg": "", img: can.misc.Resource(can, icon)}: {icon: icon}), {text: item.nick||item.name||item.zone}], title: item.title, onclick: function(event) { can.onmotion.select(can, target, html.DIV_ITEM, event.currentTarget) cb(event, event.currentTarget, event.currentTarget._list && can.onmotion.toggle(can, event.currentTarget._list)) - // can.user.isMobile && oncontextmenu(event) }, oncontextmenu: oncontextmenu, }]); return ui._target },