From ac54db626dc5a9f0340ab311d7f5e018129abeb3 Mon Sep 17 00:00:00 2001 From: shy Date: Tue, 27 Feb 2024 13:43:54 +0800 Subject: [PATCH] add some --- core/chat/message.css | 2 +- core/chat/message.go | 16 ++++------------ core/chat/message.js | 4 ++-- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/core/chat/message.css b/core/chat/message.css index 004f830d..e1faaebf 100644 --- a/core/chat/message.css +++ b/core/chat/message.css @@ -25,7 +25,7 @@ fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.list> fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.list>div.item.myself div.container>span.from { float:right; } fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.list>div.item.myself div.container { display:flex; flex-direction:column; align-items:flex-end; } fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.list>div.item.text div.content { padding:var(--input-padding) var(--button-padding); } -fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.list>div.item>div.container>div.content { display:flex; align-items:center; border-radius:5px; min-height:var(--header-height); width:fit-content; } +fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.list>div.item>div.container>div.content { display:flex; align-items:center; border-radius:var(--plugin-radius); min-height:var(--header-height); width:fit-content; } fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.list>div.item.plug { height:fit-content; } fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.list>div.item.plug div.content { padding:0; } fieldset.web.chat.message>div.output>div.layout>div.layout>div.content>div.list>div.item.myself { flex-direction:row-reverse; } diff --git a/core/chat/message.go b/core/chat/message.go index 74926fa4..2466ecd2 100644 --- a/core/chat/message.go +++ b/core/chat/message.go @@ -24,21 +24,13 @@ func init() { mdb.CREATE: {Name: "create type*=tech,void zone* icons* target"}, mdb.INSERT: {Hand: func(m *ice.Message, arg ...string) { mdb.ZoneInsert(m, append(arg, aaa.AVATAR, aaa.UserInfo(m, "", aaa.AVATAR, aaa.AVATAR), aaa.USERNICK, m.Option(ice.MSG_USERNICK), aaa.USERNAME, m.Option(ice.MSG_USERNAME))) - kit.If(mdb.HashSelectField(m, arg[0], "target"), func(p string) { - m.Cmd(web.SPACE, p, MESSAGE, tcp.RECV, arg[1:]) - }) - mdb.HashSelectUpdate(m, arg[0], func(value ice.Map) { - kit.Value(value, mdb.TIME, m.Time()) - }) + kit.If(mdb.HashSelectField(m, arg[0], "target"), func(p string) { m.Cmd(web.SPACE, p, MESSAGE, tcp.RECV, arg[1:]) }) + mdb.HashSelectUpdate(m, arg[0], func(value ice.Map) { kit.Value(value, mdb.TIME, m.Time()) }) }}, tcp.RECV: {Hand: func(m *ice.Message, arg ...string) { mdb.ZoneInsert(m, kit.Simple(mdb.ZONE, m.Option(ice.FROM_SPACE), web.SPACE, m.Option(ice.FROM_SPACE), arg, aaa.AVATAR, aaa.UserInfo(m, "", aaa.AVATAR, aaa.AVATAR), aaa.USERNICK, m.Option(ice.MSG_USERNICK), aaa.USERNAME, m.Option(ice.MSG_USERNAME))) - mdb.HashSelectUpdate(m, m.Option(ice.FROM_SPACE), func(value ice.Map) { - kit.Value(value, "target", m.Option(ice.FROM_SPACE)) - }) - mdb.HashSelectUpdate(m, m.Option(ice.FROM_SPACE), func(value ice.Map) { - kit.Value(value, mdb.TIME, m.Time()) - }) + mdb.HashSelectUpdate(m, m.Option(ice.FROM_SPACE), func(value ice.Map) { kit.Value(value, "target", m.Option(ice.FROM_SPACE)) }) + mdb.HashSelectUpdate(m, m.Option(ice.FROM_SPACE), func(value ice.Map) { kit.Value(value, mdb.TIME, m.Time()) }) }}, web.DREAM_CREATE: {Hand: func(m *ice.Message, arg ...string) { messageInsert(m, web.DREAM, mdb.TYPE, "plug", ctx.INDEX, IFRAME, ctx.ARGS, web.S(m.Option(mdb.NAME))) diff --git a/core/chat/message.js b/core/chat/message.js index 229018ca..7d38814f 100644 --- a/core/chat/message.js +++ b/core/chat/message.js @@ -53,7 +53,7 @@ Volcanos(chat.ONIMPORT, { can.page.Append(can, can.ui.message, [{view: [[html.ITEM, mdb.TIME], "", time]}]) } can.page.Append(can, can.ui.message, [{view: [[html.ITEM, value.type, myself? "myself": ""]], list: [ - {img: can.misc.Resource(can, (value.avatar == can.db.zone.zone? "": value.avatar)||can.db.zone.icons||"usr/icons/Messages.png")}, + {img: can.misc.Resource(can, (can.base.isIn(value.avatar, can.db.zone.zone, mdb.TYPE)? "": value.avatar)||can.db.zone.icons||"usr/icons/Messages.png")}, {view: html.CONTAINER, list: [{text: [value.usernick, "", nfs.FROM]}, can.onfigure[value.type||"text"](can, value)]}, ]}]) }), can.onappend._status(can, msg.Option(ice.MSG_STATUS)), can.onimport.layout(can) @@ -103,7 +103,7 @@ Volcanos(chat.ONFIGURE, { image: function(can, value) { return {view: wiki.CONTENT, list: [{img: can.misc.Resource(can, value.text)}]} }, text: function(can, value) { return {view: wiki.CONTENT, list: [{text: value.text||"[未知消息]"}]} }, plug: function(can, value) { var height = can.base.Min(can.ui.content.offsetHeight-210, 240) - var height = can.base.Max(320, height, height/(can.base.isIn(value.index, html.IFRAME)? 1: 2)), width = can.ui.content.offsetWidth-(can.user.isMobile? 60: 180) + var height = can.base.Max(html.PLUG_HEIGHT, height, height/(can.base.isIn(value.index, html.IFRAME)? 1: 2)), width = can.ui.content.offsetWidth-(can.user.isMobile? 60: 180) return {view: wiki.CONTENT, style: {height: height, width: width}, _init: function(target) { value.type = chat.STORY can.onappend.plugin(can, value, function(sub) { sub.onexport.output = function() { sub.onimport.size(sub, height, width)