diff --git a/core/chat/macos/desktop.css b/core/chat/macos/desktop.css index d6398af0..44eab786 100644 --- a/core/chat/macos/desktop.css +++ b/core/chat/macos/desktop.css @@ -21,6 +21,7 @@ fieldset.macos.desktop>div.output>div.desktop>div.item:hover { background-color: fieldset.macos.desktop>div.output>div.desktop>div.item img { width:80px; border-radius:80px; } fieldset.macos.desktop>div.output>div.desktop>div.item>div.name { font-size:12px; width:80px; overflow:hidden; } fieldset.macos.desktop>div.output>div.desktop>fieldset { border-radius:10px; position:absolute; } +fieldset.macos.desktop>div.output>div.desktop>fieldset>div.output>table.content { width:100%; } fieldset.macos.desktop>div.output>div.desktop>fieldset>div.item.button { border-radius:20px; height:20px; width:20px; scale:0.7; position:absolute; top:17px; right:10px; } fieldset.macos.desktop>div.output>div.desktop>fieldset>legend { background-color:unset; padding-right:10px; margin:10px 0; } fieldset.macos.desktop>div.output>div.desktop>fieldset>form.option>*:not(.textarea) { margin:10px 0px 10px 10px; } diff --git a/core/chat/macos/finder.js b/core/chat/macos/finder.js index a0539afb..2693d88e 100644 --- a/core/chat/macos/finder.js +++ b/core/chat/macos/finder.js @@ -8,15 +8,13 @@ Volcanos(chat.ONIMPORT, { _init: function(can, msg) { can.onmotion.clear(can), c }) }); index == 0 && item.click() }), can.onmotion.hidden(can, can.ui.profile), can.onmotion.hidden(can, can.ui.display) }, - icons: function(can, msg, target) { - can.onimport.icon(can, msg = msg||can._msg, target, function(target, item) { can.page.Modify(can, target, { - onclick: function(event) { - can.sup.onexport.record(can.sup, item.name, mdb.NAME, item) - }, oncontextmenu: function(event) { can.user.carteRight(event, can, { - "add to desktop": function() { can.sup.onappend.desktop(item) }, - "add to dock": function() { can.sup.onappend.dock(item) }, - }, []) }, draggable: true, ondragstart: function(event) { window._drag_item = item }, - })}) - }, + icons: function(can, msg, target) { can.onimport.icon(can, msg = msg||can._msg, target, function(target, item) { can.page.Modify(can, target, { + onclick: function(event) { + can.sup.onexport.record(can.sup, item.name, mdb.NAME, item) + }, oncontextmenu: function(event) { can.user.carteRight(event, can, { + "add to desktop": function() { can.sup.onappend.desktop(item) }, + "add to dock": function() { can.sup.onappend.dock(item) }, + }, []) }, draggable: true, ondragstart: function(event) { window._drag_item = item }, + })}) }, layout: function(can) { can.ui.layout(can.ConfHeight(), can.ConfWidth()) }, }) diff --git a/core/chat/macos/macos.go b/core/chat/macos/macos.go index d3e035cd..c080212d 100644 --- a/core/chat/macos/macos.go +++ b/core/chat/macos/macos.go @@ -34,7 +34,7 @@ func CmdHashAction(arg ...string) ice.Actions { } }}, mdb.SELECT: {Name: "list hash auto create", Hand: func(m *ice.Message, arg ...string) { - mdb.HashSelect(m, arg...).Sort(mdb.NAME).Display(kit.PathJoin("/require/", strings.TrimPrefix(file, ice.Info.Make.Path))) + mdb.HashSelect(m, arg...).Sort(mdb.NAME).Display(strings.TrimPrefix(file, ice.Info.Make.Path)) }}, }, ctx.CmdAction(), mdb.HashAction(mdb.SHORT, kit.Select("", arg, 0), mdb.FIELD, kit.Select("time,hash,name,icon,text,index,args", arg, 1), kit.Slice(arg, 2))) } diff --git a/core/chat/macos/menu.go b/core/chat/macos/menu.go index abb2d9f5..e508666c 100644 --- a/core/chat/macos/menu.go +++ b/core/chat/macos/menu.go @@ -8,14 +8,9 @@ import ( const MENU = "menu" func init() { - Index.MergeCommands(ice.Commands{MENU: {Actions: ice.MergeActions(ice.Actions{ - ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { - if m.Cmd(MENU).Length() == 0 { - MenuAppend(m, "", Prefix(NOTIFICATIONS)) - MenuAppend(m, "", Prefix(SEARCHS)) - } - }}, - }, mdb.ImportantHashAction(), CmdHashAction())}}) + Index.MergeCommands(ice.Commands{ + MENU: {Actions: ice.MergeActions(mdb.ImportantHashAction(), CmdHashAction())}, + }) } func MenuAppend(m *ice.Message, name, index string, arg ...string) { install(m, MENU, name, index, arg...) diff --git a/core/chat/macos/menu.js b/core/chat/macos/menu.js index 05a36a83..39687d54 100644 --- a/core/chat/macos/menu.js +++ b/core/chat/macos/menu.js @@ -2,7 +2,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg) { can.page.Append(can, can._o {view: [html.ITEM], list: [{img: can.page.drawText(can, "n", 25, 0, 20)}], onclick: function(event) { can.sup.onexport.record(can, "notifications") }}, {view: [html.ITEM], list: [{img: can.page.drawText(can, "s", 25, 0, 20)}], onclick: function(event) { can.sup.onexport.record(can, "searchs") }}, ].concat(msg.Table(function(item) { - return {view: [html.ITEM], list: [{img: can.page.drawText(can, item.index, 25, 0, 20)}], onclick: function(event) { can.sup.onexport.record(can, item) }} + return {view: [html.ITEM], list: [{img: can.page.drawText(can, item.name||item.index, 25, 0, 20)}], onclick: function(event) { can.sup.onexport.record(can, item) }} }), [ {view: [html.MENU, "", location.hostname], onclick: function(event) { can.sup.onexport.record(can, html.DESKTOP) }}, {view: [html.MENU, "", "+"], onclick: function(event) { can.sup.onexport.record(can, mdb.CREATE) }}, diff --git a/core/chat/macos/notifications.go b/core/chat/macos/notifications.go index b4243d04..eb3c2b21 100644 --- a/core/chat/macos/notifications.go +++ b/core/chat/macos/notifications.go @@ -11,16 +11,14 @@ import ( const NOTIFICATIONS = "notifications" func init() { - Index.MergeCommands(ice.Commands{NOTIFICATIONS: {Name: "notifications list", Actions: ice.MergeActions(ice.Actions{ - mdb.PRUNES: {Name: "prunes", Hand: func(m *ice.Message, arg ...string) { - m.Conf("", kit.Keys(mdb.HASH), "") - }}, - web.DREAM_CREATE: {Hand: func(m *ice.Message, arg ...string) { - m.Cmd("", mdb.CREATE, m.OptionSimple(mdb.NAME), mdb.TEXT, "空间创建成功", ctx.INDEX, web.CHAT_IFRAME, ctx.ARGS, m.MergePod(m.Option(mdb.NAME))) - }}, - }, CmdHashAction()), Hand: func(m *ice.Message, arg ...string) { - mdb.HashSelect(m, arg...).SortStrR(mdb.TIME).Display("") - }}}) + Index.MergeCommands(ice.Commands{ + NOTIFICATIONS: {Name: "notifications list", Actions: ice.MergeActions(ice.Actions{ + mdb.PRUNES: {Name: "prunes", Hand: func(m *ice.Message, arg ...string) { m.Conf("", kit.Keys(mdb.HASH), "") }}, + web.DREAM_CREATE: {Hand: func(m *ice.Message, arg ...string) { + m.Cmd("", mdb.CREATE, m.OptionSimple(mdb.NAME), mdb.TEXT, "空间创建成功", ctx.INDEX, web.CHAT_IFRAME, ctx.ARGS, m.MergePod(m.Option(mdb.NAME))) + }}, + }, CmdHashAction()), Hand: func(m *ice.Message, arg ...string) { mdb.HashSelect(m, arg...).SortStrR(mdb.TIME).Display("") }}, + }) } func Notify(m *ice.Message, name, text string, arg ...string) { m.Cmd(NOTIFICATIONS, mdb.CREATE, mdb.NAME, name, mdb.TEXT, text, arg) diff --git a/core/chat/macos/notifications.js b/core/chat/macos/notifications.js index 977ae987..af167c4c 100644 --- a/core/chat/macos/notifications.js +++ b/core/chat/macos/notifications.js @@ -1,9 +1,9 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg) { can.page.Appends(can, can._output, msg.Table(function(item) { return {view: html.ITEM, _init: function(target) { - target.onclick = function(event) { can.sup.onexport.record(can.sup, item.index, ctx.INDEX, item), can.runAction(event, mdb.REMOVE, [item.hash], function() { can.page.Remove(can, target) }) } var ui = can.onappend.layout(can, [html.ICON, [[wiki.TITLE, mdb.TIME], wiki.CONTENT]], "", target) - can.page.Append(can, ui.icon, [{img: can.misc.PathJoin(item.icon||can.page.drawText(can, item.index, 60))}]) + can.page.Append(can, ui.icon, [{img: can.misc.PathJoin(item.icon||can.page.drawText(can, item.name||item.index, 60))}]) ui.title.innerHTML = item.name||"", ui.content.innerHTML = item.text||"", ui.time.innerHTML = item.time.split(lex.SP).pop().split(nfs.DF).slice(0, 2).join(nfs.DF) + target.onclick = function(event) { can.sup.onexport.record(can.sup, item.index, ctx.INDEX, item), can.runAction(event, mdb.REMOVE, [item.hash], function() { can.page.Remove(can, target) }) } }} })), msg.Length() == 0 && can.onmotion.hidden(can, can._fields), can.onappend._action(can), can.page.style(can, can._action, html.DISPLAY, html.BLOCK) }}) Volcanos(chat.ONACTION, {list: [web.UPDATE, mdb.PRUNES, web.TOGGLE], _trans: {update: "刷新", toggle: "隐藏"}, diff --git a/core/chat/macos/opens.go b/core/chat/macos/opens.go index 8aedbb28..5638fdb3 100644 --- a/core/chat/macos/opens.go +++ b/core/chat/macos/opens.go @@ -11,9 +11,9 @@ const OPENS = "opens" func init() { Index.MergeCommands(ice.Commands{ - OPENS: {Name: "open app auto", Hand: func(m *ice.Message, arg ...string) { + OPENS: {Name: "opens app auto", Hand: func(m *ice.Message, arg ...string) { if strings.HasPrefix(m.Option(ice.MSG_USERWEB), "http://localhost:") { - m.Cmd(cli.SYSTEM, "open", "-a", arg) + cli.Opens(m, arg...) } }}, }) diff --git a/core/chat/macos/searchs.go b/core/chat/macos/searchs.go index 5f702ecc..dbf76a7c 100644 --- a/core/chat/macos/searchs.go +++ b/core/chat/macos/searchs.go @@ -9,7 +9,9 @@ import ( const SEARCHS = "searchs" func init() { - Index.MergeCommands(ice.Commands{SEARCHS: {Name: "searchs keyword list", Hand: func(m *ice.Message, arg ...string) { - m.Cmdy(mdb.SEARCH, mdb.FOREACH, kit.Select("", arg, 0), "ctx,cmd,type,name,text") - }}}) + Index.MergeCommands(ice.Commands{ + SEARCHS: {Name: "searchs keyword list", Hand: func(m *ice.Message, arg ...string) { + m.Cmdy(mdb.SEARCH, mdb.FOREACH, kit.Select("", arg, 0), "ctx,cmd,type,name,text") + }}, + }) } diff --git a/core/chat/macos/session.go b/core/chat/macos/session.go index 9f8afba7..168b9a37 100644 --- a/core/chat/macos/session.go +++ b/core/chat/macos/session.go @@ -8,9 +8,11 @@ import ( const SESSION = "session" func init() { - Index.MergeCommands(ice.Commands{SESSION: {Actions: ice.MergeActions(mdb.ImportantHashAction(), CmdHashAction(mdb.NAME)), Hand: func(m *ice.Message, arg ...string) { - if mdb.HashSelect(m, arg...); len(arg) > 0 { - m.EchoIFrame(m.MergePodCmd("", DESKTOP, SESSION, arg[0])) - } - }}}) + Index.MergeCommands(ice.Commands{ + SESSION: {Actions: ice.MergeActions(mdb.ImportantHashAction(), CmdHashAction(mdb.NAME)), Hand: func(m *ice.Message, arg ...string) { + if mdb.HashSelect(m, arg...); len(arg) > 0 { + m.EchoIFrame(m.MergePodCmd("", DESKTOP, SESSION, arg[0])) + } + }}, + }) } diff --git a/render.go b/render.go index a0d99af7..ab8b9190 100644 --- a/render.go +++ b/render.go @@ -201,7 +201,10 @@ func (m *Message) EchoDownload(arg ...string) *Message { } func (m *Message) Display(file string, arg ...Any) { if file == "" { - file = kit.PathJoin("/require/", strings.TrimPrefix(kit.FileLine(2, 100), Info.Make.Path)) + file = strings.TrimPrefix(kit.FileLine(2, 100), Info.Make.Path) + } + if !strings.HasPrefix(file, PS) && !strings.HasPrefix(file, HTTP) { + file = "/require/" + file } m.Option(MSG_DISPLAY, kit.MergeURL(kit.Select(kit.ExtChange(file, JS), file, strings.Contains(file, QS)), arg...)) }