forked from x/icebergs
opt chat
This commit is contained in:
parent
f94cfdcc4c
commit
c6e9d87477
@ -111,9 +111,9 @@ func WhiteAction(key ...string) ice.Actions {
|
|||||||
}}}
|
}}}
|
||||||
}
|
}
|
||||||
func Right(m *ice.Message, key ...ice.Any) bool {
|
func Right(m *ice.Message, key ...ice.Any) bool {
|
||||||
if key := kit.Simple(key); len(key) > 2 && key[1] == "action" && kit.IsIn(kit.Format(key[2]), "run", "command") {
|
if key := kit.Simple(key); len(key) > 2 && key[1] == ice.ACTION && kit.IsIn(kit.Format(key[2]), ice.RUN, ice.COMMAND) {
|
||||||
return true
|
return true
|
||||||
} else if len(key) > 0 && key[0] == "etc/path" {
|
} else if len(key) > 0 && key[0] == ice.ETC_PATH {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return m.Option(ice.MSG_USERROLE) == ROOT || !m.Warn(m.Cmdx(ROLE, RIGHT, m.Option(ice.MSG_USERROLE), key, logs.FileLineMeta(-1)) != ice.OK,
|
return m.Option(ice.MSG_USERROLE) == ROOT || !m.Warn(m.Cmdx(ROLE, RIGHT, m.Option(ice.MSG_USERROLE), key, logs.FileLineMeta(-1)) != ice.OK,
|
||||||
|
@ -103,6 +103,7 @@ func _config_make(m *ice.Message, key string, arg ...string) {
|
|||||||
m.Echo(FormatPretty(mdb.Confv(msg, key, arg[0]), 0, 1))
|
m.Echo(FormatPretty(mdb.Confv(msg, key, arg[0]), 0, 1))
|
||||||
} else {
|
} else {
|
||||||
m.Echo(FormatPretty(mdb.Confv(msg, key), 0, 1))
|
m.Echo(FormatPretty(mdb.Confv(msg, key), 0, 1))
|
||||||
|
m.StatusTime(mdb.COUNT, kit.Length(mdb.Confv(msg, key, mdb.HASH)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func _config_list(m *ice.Message) {
|
func _config_list(m *ice.Message) {
|
||||||
|
@ -53,7 +53,8 @@ func ProcessField(m *ice.Message, cmd string, args ice.Any, arg ...string) *ice.
|
|||||||
} else {
|
} else {
|
||||||
m.Cmdy(COMMAND, cmd)
|
m.Cmdy(COMMAND, cmd)
|
||||||
}
|
}
|
||||||
m.Push(ARGS, kit.Format(_process_args(m, args))).Options(ice.MSG_INDEX, m.PrefixKey()).ProcessField(ACTION, m.ActionKey(), RUN)
|
m.Push(ARGS, kit.Format(_process_args(m, args))).Options(ice.MSG_INDEX, m.PrefixKey())
|
||||||
|
m.ProcessField(ACTION, m.ActionKey(), RUN)
|
||||||
} else {
|
} else {
|
||||||
if !PodCmd(m, cmd, arg[1:]) {
|
if !PodCmd(m, cmd, arg[1:]) {
|
||||||
kit.If(aaa.Right(m, cmd, arg[1:]), func() { m.Cmdy(cmd, arg[1:]) })
|
kit.If(aaa.Right(m, cmd, arg[1:]), func() { m.Cmdy(cmd, arg[1:]) })
|
||||||
|
@ -32,9 +32,6 @@ func init() {
|
|||||||
}, mdb.ZoneAction(mdb.SHORT, EVENT, mdb.FIELD, "time,id,cmd"), mdb.ClearOnExitHashAction())},
|
}, mdb.ZoneAction(mdb.SHORT, EVENT, mdb.FIELD, "time,id,cmd"), mdb.ClearOnExitHashAction())},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
func EventAction(arg ...string) ice.Actions {
|
|
||||||
return ice.Actions{ice.CTX_INIT: {Hand: func(m *ice.Message, _ ...string) { kit.For(arg, func(k string) { Watch(m, k) }) }}}
|
|
||||||
}
|
|
||||||
func EventsAction(arg ...string) ice.Actions {
|
func EventsAction(arg ...string) ice.Actions {
|
||||||
list := kit.DictList(arg...)
|
list := kit.DictList(arg...)
|
||||||
return ice.Actions{ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
return ice.Actions{ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
@ -48,10 +45,10 @@ func Watch(m *ice.Message, key string, arg ...string) *ice.Message {
|
|||||||
return m.Cmd(EVENT, LISTEN, EVENT, key, ice.CMD, kit.Join(arg, ice.SP))
|
return m.Cmd(EVENT, LISTEN, EVENT, key, ice.CMD, kit.Join(arg, ice.SP))
|
||||||
}
|
}
|
||||||
func Event(m *ice.Message, key string, arg ...ice.Any) *ice.Message {
|
func Event(m *ice.Message, key string, arg ...ice.Any) *ice.Message {
|
||||||
if list[key] == 0 {
|
if key = kit.Select(kit.Keys(m.CommandKey(), m.ActionKey()), key); list[key] == 0 {
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
return m.Cmdy(EVENT, HAPPEN, EVENT, kit.Select(kit.Keys(m.CommandKey(), m.ActionKey()), key), arg, logs.FileLineMeta(-1))
|
return m.Cmdy(EVENT, HAPPEN, EVENT, key, arg, logs.FileLineMeta(-1))
|
||||||
}
|
}
|
||||||
func EventDeferEvent(m *ice.Message, key string, arg ...ice.Any) func(string, ...ice.Any) {
|
func EventDeferEvent(m *ice.Message, key string, arg ...ice.Any) func(string, ...ice.Any) {
|
||||||
Event(m, key, arg...)
|
Event(m, key, arg...)
|
||||||
|
@ -164,11 +164,14 @@ func StatusHashAction(arg ...Any) ice.Actions {
|
|||||||
func ClearOnExitHashAction() ice.Actions {
|
func ClearOnExitHashAction() ice.Actions {
|
||||||
return ice.MergeActions(ice.Actions{ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) { Conf(m, m.PrefixKey(), HASH, "") }}})
|
return ice.MergeActions(ice.Actions{ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) { Conf(m, m.PrefixKey(), HASH, "") }}})
|
||||||
}
|
}
|
||||||
func ExportHashAction() ice.Actions {
|
func ExportHashAction(arg ...Any) ice.Actions {
|
||||||
return ice.Actions{
|
return ice.MergeActions(ice.Actions{
|
||||||
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) { HashExport(m, arg) }},
|
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
Config(m, IMPORTANT, ice.TRUE)
|
||||||
|
HashExport(m, arg)
|
||||||
|
}},
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { HashImport(m, arg) }},
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { HashImport(m, arg) }},
|
||||||
}
|
}, HashAction(arg...))
|
||||||
}
|
}
|
||||||
|
|
||||||
func HashKey(m *ice.Message) string {
|
func HashKey(m *ice.Message) string {
|
||||||
|
@ -123,7 +123,6 @@ func init() {
|
|||||||
if arg[0] == ice.ACTION {
|
if arg[0] == ice.ACTION {
|
||||||
m.Cmdy(DIR, arg)
|
m.Cmdy(DIR, arg)
|
||||||
} else {
|
} else {
|
||||||
// } else if !Show(m, arg[0]) {
|
|
||||||
_cat_list(m.Logs(FIND, m.OptionSimple(DIR_ROOT), FILE, arg[0]), arg[0])
|
_cat_list(m.Logs(FIND, m.OptionSimple(DIR_ROOT), FILE, arg[0]), arg[0])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -212,7 +212,9 @@ var bind = []string{
|
|||||||
func Relative(m *ice.Message, p string) string {
|
func Relative(m *ice.Message, p string) string {
|
||||||
for i := 0; i < len(bind); i += 2 {
|
for i := 0; i < len(bind); i += 2 {
|
||||||
if strings.HasPrefix(p, bind[i]) {
|
if strings.HasPrefix(p, bind[i]) {
|
||||||
return strings.Replace(p, bind[i], bind[i+1], 1)
|
if _p := strings.Replace(p, bind[i], bind[i+1], 1); Exists(m, kit.ExtChange(_p, JS)) {
|
||||||
|
return _p
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return p
|
return p
|
||||||
|
@ -158,6 +158,7 @@ func (f *Frame) Start(m *ice.Message, arg ...string) {
|
|||||||
if msg := m.Cmd(nfs.CAT, m.Option(ice.MSG_SCRIPT, f.source)); msg.IsErr() {
|
if msg := m.Cmd(nfs.CAT, m.Option(ice.MSG_SCRIPT, f.source)); msg.IsErr() {
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
|
kit.If(m.Option(nfs.CAT_CONTENT), func() { m.Option(nfs.CAT_CONTENT, "") })
|
||||||
buf := bytes.NewBuffer(make([]byte, 0, ice.MOD_BUFS))
|
buf := bytes.NewBuffer(make([]byte, 0, ice.MOD_BUFS))
|
||||||
f.stdin, f.stdout = bytes.NewBufferString(msg.Result()), buf
|
f.stdin, f.stdout = bytes.NewBufferString(msg.Result()), buf
|
||||||
defer func() { m.Echo(buf.String()) }()
|
defer func() { m.Echo(buf.String()) }()
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
package html
|
package html
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
kit "shylinux.com/x/toolkits"
|
||||||
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
DARK = "dark"
|
DARK = "dark"
|
||||||
LIGHT = "light"
|
LIGHT = "light"
|
||||||
@ -25,3 +31,13 @@ const (
|
|||||||
|
|
||||||
TEXT_PLAIN = "text/plain"
|
TEXT_PLAIN = "text/plain"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func IsImage(name, mime string) bool {
|
||||||
|
return strings.HasPrefix(mime, "image/") || kit.ExtIsImage(name)
|
||||||
|
}
|
||||||
|
func IsVideo(name, mime string) bool {
|
||||||
|
return strings.HasPrefix(mime, "video/") || kit.ExtIsVideo(name)
|
||||||
|
}
|
||||||
|
func IsAudio(name, mime string) bool {
|
||||||
|
return strings.HasPrefix(mime, "audio/")
|
||||||
|
}
|
||||||
|
@ -55,6 +55,10 @@ func _route_toast(m *ice.Message, space string, args ...string) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
ONLINE = "online"
|
||||||
|
OFFLINE = "offline"
|
||||||
|
)
|
||||||
const ROUTE = "route"
|
const ROUTE = "route"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -125,6 +129,19 @@ func init() {
|
|||||||
})
|
})
|
||||||
} else if mdb.HashSelect(m, arg...); len(arg) > 0 {
|
} else if mdb.HashSelect(m, arg...); len(arg) > 0 {
|
||||||
m.EchoIFrame(m.MergePod(arg[0]))
|
m.EchoIFrame(m.MergePod(arg[0]))
|
||||||
|
} else {
|
||||||
|
stat := map[string]int{}
|
||||||
|
list := m.CmdMap(SPACE, mdb.NAME)
|
||||||
|
m.Table(func(value ice.Maps) {
|
||||||
|
if _, ok := list[value[SPACE]]; ok {
|
||||||
|
m.Push(mdb.STATUS, ONLINE)
|
||||||
|
stat[ONLINE]++
|
||||||
|
} else {
|
||||||
|
m.Push(mdb.STATUS, OFFLINE)
|
||||||
|
stat[OFFLINE]++
|
||||||
|
}
|
||||||
|
})
|
||||||
|
m.StatusTimeCount(stat)
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
})
|
})
|
||||||
|
@ -180,7 +180,7 @@ func init() {
|
|||||||
kit.If(kit.IsIn(value[mdb.TYPE], WORKER, SERVER), func() { m.Push(arg[0], value[mdb.NAME]) })
|
kit.If(kit.IsIn(value[mdb.TYPE], WORKER, SERVER), func() { m.Push(arg[0], value[mdb.NAME]) })
|
||||||
})
|
})
|
||||||
case mdb.ICON:
|
case mdb.ICON:
|
||||||
m.Cmdy(nfs.DIR, ice.USR_ICONS, nfs.PATH)
|
m.Cmdy(nfs.DIR, ice.USR_ICONS, nfs.PATH).CutTo(nfs.PATH, arg[0])
|
||||||
case ctx.INDEX:
|
case ctx.INDEX:
|
||||||
if space := m.Option(SPACE); space != "" {
|
if space := m.Option(SPACE); space != "" {
|
||||||
m.Options(SPACE, []string{}).Cmdy(SPACE, space, mdb.INPUTS, arg)
|
m.Options(SPACE, []string{}).Cmdy(SPACE, space, mdb.INPUTS, arg)
|
||||||
|
@ -1,27 +1,27 @@
|
|||||||
chat.go
|
chat.go
|
||||||
chat.shy
|
chat.shy
|
||||||
|
portal.go
|
||||||
header.go
|
header.go
|
||||||
footer.go
|
footer.go
|
||||||
|
search.go
|
||||||
|
action.go
|
||||||
river.go
|
river.go
|
||||||
storm.go
|
storm.go
|
||||||
action.go
|
|
||||||
search.go
|
|
||||||
portal.go
|
|
||||||
iframe.go
|
|
||||||
trans.go
|
|
||||||
icons.go
|
icons.go
|
||||||
|
|
||||||
pod.go
|
pod.go
|
||||||
cmd.go
|
cmd.go
|
||||||
sso.go
|
sso.go
|
||||||
grant.go
|
grant.go
|
||||||
oauth
|
trans.go
|
||||||
|
iframe.go
|
||||||
|
keyboard.go
|
||||||
|
|
||||||
|
oauth
|
||||||
macos
|
macos
|
||||||
favor.go
|
favor.go
|
||||||
flows.go
|
flows.go
|
||||||
flows.js
|
flows.js
|
||||||
flows.css
|
flows.css
|
||||||
keyboard.go
|
|
||||||
location.go
|
location.go
|
||||||
location.shy
|
location.shy
|
||||||
|
@ -3,9 +3,7 @@ package chat
|
|||||||
import (
|
import (
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
"shylinux.com/x/icebergs/base/aaa"
|
"shylinux.com/x/icebergs/base/aaa"
|
||||||
"shylinux.com/x/icebergs/base/ctx"
|
|
||||||
"shylinux.com/x/icebergs/base/web"
|
"shylinux.com/x/icebergs/base/web"
|
||||||
kit "shylinux.com/x/toolkits"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const CMD = "cmd"
|
const CMD = "cmd"
|
||||||
@ -15,12 +13,12 @@ func init() {
|
|||||||
CMD: {Actions: web.ApiWhiteAction(), Hand: func(m *ice.Message, arg ...string) {
|
CMD: {Actions: web.ApiWhiteAction(), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if len(arg[0]) == 0 || arg[0] == "" {
|
if len(arg[0]) == 0 || arg[0] == "" {
|
||||||
web.RenderMain(m)
|
web.RenderMain(m)
|
||||||
} else if m.IsCliUA() {
|
} else if aaa.Right(m, arg) {
|
||||||
kit.If(aaa.Right(m, arg), func() { m.Cmdy(arg, m.Optionv(ice.ARG)).RenderResult() })
|
if m.IsCliUA() {
|
||||||
} else if arg[0] == web.CHAT_PORTAL {
|
m.Cmdy(arg, m.Optionv(ice.ARG)).RenderResult()
|
||||||
web.RenderMain(m)
|
} else {
|
||||||
} else if m.Cmdy(ctx.COMMAND, arg[0]); m.Length() > 0 {
|
web.RenderCmd(m, arg[0], arg[1:])
|
||||||
web.RenderCmd(m, m.Append(ctx.INDEX), arg[1:])
|
}
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
})
|
})
|
||||||
|
@ -4,27 +4,16 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
|
"shylinux.com/x/icebergs/base/aaa"
|
||||||
"shylinux.com/x/icebergs/base/cli"
|
"shylinux.com/x/icebergs/base/cli"
|
||||||
"shylinux.com/x/icebergs/base/ctx"
|
"shylinux.com/x/icebergs/base/ctx"
|
||||||
"shylinux.com/x/icebergs/base/gdb"
|
"shylinux.com/x/icebergs/base/gdb"
|
||||||
"shylinux.com/x/icebergs/base/mdb"
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
"shylinux.com/x/icebergs/base/nfs"
|
"shylinux.com/x/icebergs/base/nfs"
|
||||||
"shylinux.com/x/icebergs/base/ssh"
|
|
||||||
"shylinux.com/x/icebergs/base/tcp"
|
|
||||||
"shylinux.com/x/icebergs/base/web"
|
"shylinux.com/x/icebergs/base/web"
|
||||||
kit "shylinux.com/x/toolkits"
|
kit "shylinux.com/x/toolkits"
|
||||||
)
|
)
|
||||||
|
|
||||||
func _favor_is_image(m *ice.Message, name, mime string) bool {
|
|
||||||
return strings.HasPrefix(mime, "image/") || kit.ExtIsImage(name)
|
|
||||||
}
|
|
||||||
func _favor_is_video(m *ice.Message, name, mime string) bool {
|
|
||||||
return strings.HasPrefix(mime, "video/") || kit.ExtIsVideo(name)
|
|
||||||
}
|
|
||||||
func _favor_is_audio(m *ice.Message, name, mime string) bool {
|
|
||||||
return strings.HasPrefix(mime, "audio/")
|
|
||||||
}
|
|
||||||
|
|
||||||
const (
|
const (
|
||||||
FAVOR_INPUTS = "favor.inputs"
|
FAVOR_INPUTS = "favor.inputs"
|
||||||
FAVOR_TABLES = "favor.tables"
|
FAVOR_TABLES = "favor.tables"
|
||||||
@ -34,7 +23,7 @@ const FAVOR = "favor"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
FAVOR: {Name: "favor hash auto create upload getClipboardData", Help: "收藏夹", Actions: ice.MergeActions(ice.Actions{
|
FAVOR: {Name: "favor hash auto create upload getClipboardData", Help: "收藏夹", Icon: "favor.png", Actions: ice.MergeActions(ice.Actions{
|
||||||
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
if mdb.IsSearchPreview(m, arg) {
|
if mdb.IsSearchPreview(m, arg) {
|
||||||
m.Cmds("", func(value ice.Maps) {
|
m.Cmds("", func(value ice.Maps) {
|
||||||
@ -47,11 +36,18 @@ func init() {
|
|||||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
switch mdb.HashInputs(m, arg); arg[0] {
|
switch mdb.HashInputs(m, arg); arg[0] {
|
||||||
case mdb.TYPE:
|
case mdb.TYPE:
|
||||||
m.Push(arg[0], web.LINK, nfs.FILE, mdb.TEXT, ctx.INDEX, ssh.SHELL, cli.OPENS)
|
m.Push(arg[0], mdb.TEXT, ctx.INDEX, cli.OPENS)
|
||||||
case mdb.NAME:
|
case mdb.NAME:
|
||||||
switch m.Option(mdb.TYPE) {
|
switch m.Option(mdb.TYPE) {
|
||||||
case ctx.INDEX:
|
case ctx.INDEX:
|
||||||
ctx.CmdInputs(m, m.Option(mdb.TYPE)).RenameAppend(ctx.INDEX, arg[0])
|
m.Copy(mdb.HashInputs(m.Spawn(), ctx.INDEX).CutTo(ctx.INDEX, arg[0]))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
case mdb.TEXT:
|
||||||
|
switch m.Option(mdb.TYPE) {
|
||||||
|
case ctx.INDEX:
|
||||||
|
m.Option(ctx.INDEX, m.Option(mdb.NAME))
|
||||||
|
m.Copy(mdb.HashInputs(m.Spawn(), ctx.ARGS).CutTo(ctx.ARGS, arg[0]))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -62,7 +58,7 @@ func init() {
|
|||||||
"scanQRCode": {Name: "favor create", Help: "扫码"},
|
"scanQRCode": {Name: "favor create", Help: "扫码"},
|
||||||
"record1": {Name: "favor upload", Help: "截图"},
|
"record1": {Name: "favor upload", Help: "截图"},
|
||||||
"record2": {Name: "favor upload", Help: "录屏"},
|
"record2": {Name: "favor upload", Help: "录屏"},
|
||||||
mdb.CREATE: {Name: "create type name text*", Hand: func(m *ice.Message, arg ...string) {
|
mdb.CREATE: {Name: "create type name text", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if strings.HasPrefix(m.Option(mdb.TEXT), ice.HTTP) {
|
if strings.HasPrefix(m.Option(mdb.TEXT), ice.HTTP) {
|
||||||
m.OptionDefault(mdb.TYPE, mdb.LINK, mdb.NAME, kit.ParseURL(m.Option(mdb.TEXT)).Host)
|
m.OptionDefault(mdb.TYPE, mdb.LINK, mdb.NAME, kit.ParseURL(m.Option(mdb.TEXT)).Host)
|
||||||
}
|
}
|
||||||
@ -74,36 +70,25 @@ func init() {
|
|||||||
web.DOWNLOAD: {Hand: func(m *ice.Message, arg ...string) {
|
web.DOWNLOAD: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.ProcessOpen(web.MergeURL2(m, web.SHARE_LOCAL+m.Option(mdb.TEXT), nfs.FILENAME, m.Option(mdb.NAME)))
|
m.ProcessOpen(web.MergeURL2(m, web.SHARE_LOCAL+m.Option(mdb.TEXT), nfs.FILENAME, m.Option(mdb.NAME)))
|
||||||
}},
|
}},
|
||||||
ctx.DISPLAY: {Help: "预览", Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
if link := web.SHARE_LOCAL + m.Option(mdb.TEXT); _favor_is_image(m, m.Option(mdb.NAME), m.Option(mdb.TYPE)) {
|
|
||||||
m.EchoImages(link)
|
|
||||||
} else if _favor_is_video(m, m.Option(mdb.NAME), m.Option(mdb.TYPE)) {
|
|
||||||
m.EchoVideos(link)
|
|
||||||
} else {
|
|
||||||
m.Echo("<audio src=%s autoplay controls/>", link)
|
|
||||||
}
|
|
||||||
m.ProcessInner()
|
|
||||||
}},
|
|
||||||
"vimer": {Help: "源码", Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
ctx.Process(m, "", nfs.SplitPath(m, m.Option(mdb.TEXT)), arg...)
|
|
||||||
}},
|
|
||||||
"xterm": {Help: "命令", Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
ctx.Process(m, "", []string{mdb.TYPE, m.Option(mdb.TEXT), mdb.NAME, m.Option(mdb.NAME), mdb.TEXT, ""}, arg...)
|
|
||||||
}},
|
|
||||||
ctx.INDEX: {Help: "命令", Hand: func(m *ice.Message, arg ...string) {
|
ctx.INDEX: {Help: "命令", Hand: func(m *ice.Message, arg ...string) {
|
||||||
msg := mdb.HashSelects(m.Spawn(), m.Option(mdb.HASH))
|
if kit.HasPrefixList(arg, ctx.RUN) {
|
||||||
ls := kit.Split(msg.Option(mdb.TEXT))
|
msg := mdb.HashSelects(m.Spawn(), arg[1])
|
||||||
ctx.ProcessField(m, ls[0], ls[1:], arg...)
|
ctx.ProcessField(m, msg.Append(mdb.NAME), kit.Split(msg.Append(mdb.TEXT)), kit.Simple(ctx.RUN, arg[2:])...)
|
||||||
}},
|
} else {
|
||||||
ctx.RUN: {Hand: func(m *ice.Message, arg ...string) {
|
msg := mdb.HashSelects(m.Spawn(), m.Option(mdb.HASH))
|
||||||
m.Option(mdb.TYPE, mdb.HashSelects(m.Spawn(), m.Option(mdb.HASH)).Append(mdb.TYPE))
|
ctx.ProcessField(m, msg.Append(mdb.NAME), kit.Split(msg.Append(mdb.TEXT)), arg...)
|
||||||
ctx.Run(m, arg...)
|
m.Option(ice.FIELD_PREFIX, ctx.ACTION, m.ActionKey(), ctx.RUN, m.Option(mdb.HASH))
|
||||||
|
}
|
||||||
}},
|
}},
|
||||||
cli.OPENS: {Hand: func(m *ice.Message, arg ...string) { cli.Opens(m, m.Option(mdb.TEXT)) }},
|
cli.OPENS: {Hand: func(m *ice.Message, arg ...string) { cli.Opens(m, m.Option(mdb.TEXT)) }},
|
||||||
}, mdb.ImportantHashAction(), mdb.ExportHashAction()), Hand: func(m *ice.Message, arg ...string) {
|
}, FavorAction(), mdb.ExportHashAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if len(arg) > 0 && arg[0] == ctx.ACTION {
|
if len(arg) > 0 && arg[0] == ctx.ACTION {
|
||||||
m.Option(mdb.TYPE, mdb.HashSelects(m.Spawn(), m.Option(mdb.HASH)).Append(mdb.TYPE))
|
if m.Option(ice.MSG_INDEX) == m.PrefixKey() {
|
||||||
gdb.Event(m, FAVOR_ACTION, arg)
|
m.Option(mdb.TYPE, mdb.HashSelects(m.Spawn(), m.Option(mdb.HASH)).Append(mdb.TYPE))
|
||||||
|
gdb.Event(m, FAVOR_ACTION, arg)
|
||||||
|
} else if aaa.Right(m, m.Option(ice.MSG_INDEX), arg[3:]) {
|
||||||
|
m.Cmdy(m.Option(ice.MSG_INDEX), arg[3:])
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if len(arg) == 0 {
|
if len(arg) == 0 {
|
||||||
@ -115,46 +100,26 @@ func init() {
|
|||||||
}
|
}
|
||||||
if mdb.HashSelect(m, arg...); len(arg) > 0 {
|
if mdb.HashSelect(m, arg...); len(arg) > 0 {
|
||||||
text := m.Append(mdb.TEXT)
|
text := m.Append(mdb.TEXT)
|
||||||
if strings.HasPrefix(m.Append(mdb.TEXT), ice.VAR_FILE) {
|
|
||||||
text = web.SHARE_LOCAL + m.Append(mdb.TEXT)
|
|
||||||
if m.PushDownload(mdb.LINK, m.Append(mdb.NAME), text); len(arg) > 0 && _favor_is_image(m, m.Append(mdb.NAME), m.Append(mdb.TYPE)) {
|
|
||||||
m.PushImages(ctx.DISPLAY, text)
|
|
||||||
} else if _favor_is_video(m, m.Append(mdb.NAME), m.Append(mdb.TYPE)) {
|
|
||||||
m.PushVideos(ctx.DISPLAY, text)
|
|
||||||
}
|
|
||||||
text = tcp.PublishLocalhost(m, web.MergeLink(m, text))
|
|
||||||
}
|
|
||||||
m.PushScript(nfs.SCRIPT, text)
|
|
||||||
m.PushQRCode(cli.QRCODE, text)
|
m.PushQRCode(cli.QRCODE, text)
|
||||||
|
m.PushScript(text)
|
||||||
}
|
}
|
||||||
m.Table(func(value ice.Maps) {
|
m.Table(func(value ice.Maps) {
|
||||||
if msg := gdb.Event(m.Spawn(), FAVOR_TABLES, mdb.TYPE, value[mdb.TYPE]); msg.Append(ctx.ACTION) != "" {
|
delete(value, ctx.ACTION)
|
||||||
m.PushButton(msg.Append(ctx.ACTION))
|
if msg := gdb.Event(m.Spawn(value), FAVOR_TABLES, mdb.TYPE, value[mdb.TYPE]); msg.Append(ctx.ACTION) != "" {
|
||||||
|
m.PushButton(msg.Append(ctx.ACTION), mdb.REMOVE)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
switch value[mdb.TYPE] {
|
switch value[mdb.TYPE] {
|
||||||
case cli.OPENS:
|
|
||||||
m.PushButton(cli.OPENS, mdb.REMOVE)
|
|
||||||
case ssh.SHELL:
|
|
||||||
m.PushButton("xterm", mdb.REMOVE)
|
|
||||||
case ctx.INDEX:
|
case ctx.INDEX:
|
||||||
m.PushButton(ctx.INDEX, mdb.REMOVE)
|
m.PushButton(ctx.INDEX, mdb.REMOVE)
|
||||||
case nfs.FILE:
|
case cli.OPENS:
|
||||||
m.PushButton("vimer", mdb.REMOVE)
|
m.PushButton(cli.OPENS, mdb.REMOVE)
|
||||||
default:
|
default:
|
||||||
if strings.HasPrefix(value[mdb.TEXT], ice.VAR_FILE) {
|
m.PushButton(mdb.REMOVE)
|
||||||
if _favor_is_image(m, value[mdb.NAME], value[mdb.TYPE]) || _favor_is_video(m, value[mdb.NAME], value[mdb.TYPE]) || _favor_is_audio(m, value[mdb.NAME], value[mdb.TYPE]) {
|
|
||||||
m.PushButton(ctx.DISPLAY, web.DOWNLOAD, mdb.REMOVE)
|
|
||||||
} else {
|
|
||||||
m.PushButton(web.DOWNLOAD, mdb.REMOVE)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
m.PushButton(mdb.REMOVE)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}},
|
}},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func FavorAction() ice.Actions { return gdb.EventAction(FAVOR_INPUTS, FAVOR_TABLES, FAVOR_ACTION) }
|
func FavorAction() ice.Actions { return gdb.EventsAction(FAVOR_INPUTS, FAVOR_TABLES, FAVOR_ACTION) }
|
||||||
|
@ -27,7 +27,7 @@ func init() {
|
|||||||
mdb.MODIFY: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.MODIFY: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(mdb.MODIFY, m.PrefixKey(), kit.KeyHash(m.Option(mdb.ZONE)), mdb.HASH, m.OptionSimple(mdb.HASH), arg)
|
m.Cmdy(mdb.MODIFY, m.PrefixKey(), kit.KeyHash(m.Option(mdb.ZONE)), mdb.HASH, m.OptionSimple(mdb.HASH), arg)
|
||||||
}},
|
}},
|
||||||
}, mdb.HashAction(mdb.SHORT, mdb.ZONE, mdb.FIELD, "time,zone", mdb.FIELDS, "time,hash,name,space,index,args,prev,from,status"), mdb.ExportHashAction()), Hand: func(m *ice.Message, arg ...string) {
|
}, mdb.ExportHashAction(mdb.SHORT, mdb.ZONE, mdb.FIELD, "time,zone", mdb.FIELDS, "time,hash,name,space,index,args,prev,from,status")), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if arg = kit.Slice(arg, 0, 2); len(arg) == 0 || arg[0] == "" {
|
if arg = kit.Slice(arg, 0, 2); len(arg) == 0 || arg[0] == "" {
|
||||||
mdb.HashSelect(m)
|
mdb.HashSelect(m)
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,29 +1,25 @@
|
|||||||
(function() {
|
(function() { const ACTION_STORE = "web.flows:action:"
|
||||||
const ACTION_STORE = "web.flows:action:"
|
|
||||||
Volcanos(chat.ONIMPORT, {
|
Volcanos(chat.ONIMPORT, {
|
||||||
_init: function(can, msg, cb) { can.onmotion.clear(can), can.ui = can.onappend.layout(can), can.onmotion.hidden(can, can.ui.profile), can.onmotion.hidden(can, can.ui.display)
|
_init: function(can, msg, cb) { can.ui = can.onappend.layout(can), cb && cb(msg)
|
||||||
cb && cb(msg), can.core.Item(can.Action(), function(key) { can.onaction[key] = can.onaction[key]||can.onaction.refresh, can.Action(key, can.misc.localStorage(can, ACTION_STORE+key)) }), can.onkeymap._build(can)
|
can.core.Item(can.Action(), function(key) { can.onaction[key] = can.onaction[key]||can.onaction.refresh, can.Action(key, can.misc.localStorage(can, ACTION_STORE+key)) })
|
||||||
if (can.Option(mdb.ZONE)) { return can.onmotion.hidden(can, can.ui.project), can.onimport._content(can, msg, can.Option(mdb.ZONE)) } can.onimport._project(can, msg)
|
if (can.Option(mdb.ZONE)) { return can.onmotion.hidden(can, can.ui.project), can.onimport._content(can, msg, can.Option(mdb.ZONE)) } can.onimport._project(can, msg)
|
||||||
},
|
},
|
||||||
_project: function(can, msg) { var target; msg.Table(function(value) {
|
_project: function(can, msg) { var target; msg.Table(function(value) {
|
||||||
var item = can.onimport.item(can, value, function(event) { can.Option(mdb.ZONE, value.zone)
|
var item = can.onimport.item(can, value, function(event) { can.Option(mdb.ZONE, value.zone)
|
||||||
if (can.onmotion.cache(can, function(save, load) {
|
if (can.onmotion.cache(can, function(save, load) {
|
||||||
save({db: can.db, toggle: can.ui.toggle, _display_class: can.ui.display.className, _profile_class: can.ui.profile.className})
|
save({db: can.db, toggle: can.ui.toggle, _display_class: can.ui.display.className, _profile_class: can.ui.profile.className})
|
||||||
return load(value.zone, function(bak) {
|
return load(value.zone, function(bak) { can.db = bak.db, can.ui.toggle = bak.toggle
|
||||||
can.db = bak.db, can.ui.toggle = bak.toggle
|
|
||||||
can.ui.display.className = bak._display_class||can.ui.display.className
|
can.ui.display.className = bak._display_class||can.ui.display.className
|
||||||
can.ui.profile.className = bak._profile_class||can.ui.profile.className
|
can.ui.profile.className = bak._profile_class||can.ui.profile.className
|
||||||
})
|
})
|
||||||
}, can.ui.content, can.ui.display, can._status)) { return can.page.isDisplay(can.ui.profile) && can.onimport._profile(can, can.db.current), can.onimport.layout(can) }
|
}, can.ui.content, can.ui.display, can._status)) { return can.page.isDisplay(can.ui.profile) && can.onimport._profile(can, can.db.current), can.onimport.layout(can) }
|
||||||
can.run(event, [value.zone], function(msg) { can.onimport._content(can, msg, can.Option(mdb.ZONE)) })
|
can.run(event, [value.zone], function(msg) { can.onimport._content(can, msg, can.Option(mdb.ZONE)) })
|
||||||
}, null, can.ui.project); target = can.Option(mdb.ZONE) == value.zone? item: target||item
|
}, null, can.ui.project); target = value.zone == can.Option(mdb.ZONE)? item: target||item
|
||||||
}), target && target.click() },
|
}), target && target.click() },
|
||||||
_content: function(can, msg, zone) { if (msg.Length() == 0) { return can.Update(can.request({target: can._legend}, {title: mdb.INSERT, zone: zone}), [ctx.ACTION, mdb.INSERT]) }
|
_content: function(can, msg, zone) { if (msg.Length() == 0) { return can.Update(can.request({target: can._legend}, {title: mdb.INSERT, zone: zone}), [ctx.ACTION, mdb.INSERT]) }
|
||||||
can.db.list = {}; msg.Table(function(value) { can.db.list[value.hash] = value })
|
can.db.list = {}; msg.Table(function(value) { can.db.list[value.hash] = value })
|
||||||
var root; can.core.Item(can.db.list, function(key, item) { if (!item.prev && !item.from) { return root = item }
|
var root; can.core.Item(can.db.list, function(key, item) { if (!item.prev && !item.from) { return root = item }
|
||||||
try {
|
try { if (item.prev) { can.db.list[item.prev].next = item } if (item.from) { can.db.list[item.from].to = item } } catch(e) { console.log(e) }
|
||||||
if (item.prev) { can.db.list[item.prev].next = item } if (item.from) { can.db.list[item.from].to = item }
|
|
||||||
} catch(e) { console.log(e) }
|
|
||||||
}), can.db.root = root, can.db.current = root
|
}), can.db.root = root, can.db.current = root
|
||||||
var _list = can.onexport.travel(can, can.db.root, true), _msg = can.request(); can.core.List(_list, function(item) { _msg.Push(item, msg.append) })
|
var _list = can.onexport.travel(can, can.db.root, true), _msg = can.request(); can.core.List(_list, function(item) { _msg.Push(item, msg.append) })
|
||||||
var table = can.onappend.table(can, _msg, null, can.ui.display); can.page.Select(can, table, "tbody>tr", function(target, index) { _list[index]._tr = target })
|
var table = can.onappend.table(can, _msg, null, can.ui.display); can.page.Select(can, table, "tbody>tr", function(target, index) { _list[index]._tr = target })
|
||||||
@ -97,27 +93,8 @@ Volcanos(chat.ONIMPORT, {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
}, [""])
|
}, [""])
|
||||||
Volcanos(chat.ONDETAIL, {
|
|
||||||
_select: function(event, can, item) { if (!item) { return can.onmotion.hidden(can, can.ui.profile) }
|
|
||||||
can.isCmdMode() && item._rect.scrollIntoView(), can.db.current = item, can.onimport._profile(can, item)
|
|
||||||
can.page.Select(can, item._rect.parentNode, "", function(target) { var _class = (target.Value(html.CLASS)||"").split(lex.SP)
|
|
||||||
if (can.base.isIn(target, item._line, item._rect, item._text)) {
|
|
||||||
if (_class.indexOf(html.SELECT) == -1) { target.Value(html.CLASS, _class.concat([html.SELECT]).join(lex.SP).trim()) }
|
|
||||||
} else {
|
|
||||||
if (_class.indexOf(html.SELECT) > -1) { target.Value(html.CLASS, _class.filter(function(c) { return c != html.SELECT }).join(lex.SP).trim()) }
|
|
||||||
}
|
|
||||||
}), can.page.Select(can, item._tr.parentNode, "", function(target) { can.page.ClassList.set(can, target, html.SELECT, target == item._tr) })
|
|
||||||
},
|
|
||||||
onclick: function(event, can, _sub, item) { switch (_sub.svg.style.cursor) {
|
|
||||||
case "e-resize": can.Update(can.request(event, can.Action("direct") == "horizon"? {prev: item.hash}: {from: item.hash}), [ctx.ACTION, mdb.INSERT]); break
|
|
||||||
case "s-resize": can.Update(can.request(event, can.Action("direct") == "horizon"? {from: item.hash}: {prev: item.hash}), [ctx.ACTION, mdb.INSERT]); break
|
|
||||||
default: can.ondetail._select(event, can, item)
|
|
||||||
} can.onkeymap.prevent(event) },
|
|
||||||
oncontextmenu: function(event, can, _sub, item) { can.user.carteItem(event, can, item) },
|
|
||||||
})
|
|
||||||
Volcanos(chat.ONACTION, {
|
Volcanos(chat.ONACTION, {
|
||||||
list: [
|
list: ["create", "play", "prev", "next",
|
||||||
"create", "play", "prev", "next",
|
|
||||||
["travel", "deep", "wide"],
|
["travel", "deep", "wide"],
|
||||||
["direct", "vertical", "horizon"],
|
["direct", "vertical", "horizon"],
|
||||||
[html.HEIGHT, 80, 100, 120, 140, 200],
|
[html.HEIGHT, 80, 100, 120, 140, 200],
|
||||||
@ -151,8 +128,28 @@ Volcanos(chat.ONACTION, {
|
|||||||
if (can.page.isDisplay(can.ui.display)) { return can.onmotion.hidden(can, can.ui.display), can.onimport.layout(can) }
|
if (can.page.isDisplay(can.ui.display)) { return can.onmotion.hidden(can, can.ui.display), can.onimport.layout(can) }
|
||||||
can.onmotion.toggle(can, can.ui.project), can.onimport.layout(can)
|
can.onmotion.toggle(can, can.ui.project), can.onimport.layout(can)
|
||||||
},
|
},
|
||||||
onkeydown: function(event, can) { can.db._key_list = can.onkeymap._parse(event, can, mdb.PLUGIN, can.db._key_list, can.ui.content) },
|
|
||||||
plugin: function(event, can, msg) { can.ondetail._select(event, can, can.db.list[msg.Option(mdb.HASH)]) },
|
plugin: function(event, can, msg) { can.ondetail._select(event, can, can.db.list[msg.Option(mdb.HASH)]) },
|
||||||
|
onkeydown: function(event, can) { can.db._key_list = can.onkeymap._parse(event, can, mdb.PLUGIN, can.db._key_list, can.ui.content) },
|
||||||
|
})
|
||||||
|
Volcanos(chat.ONDETAIL, {
|
||||||
|
_select: function(event, can, item) { if (!item) { return can.onmotion.hidden(can, can.ui.profile) }
|
||||||
|
can.isCmdMode() && item._rect.scrollIntoView(), can.db.current = item, can.onimport._profile(can, item)
|
||||||
|
can.page.Select(can, item._rect.parentNode, "", function(target) { var _class = (target.Value(html.CLASS)||"").split(lex.SP)
|
||||||
|
if (can.base.isIn(target, item._line, item._rect, item._text)) {
|
||||||
|
if (_class.indexOf(html.SELECT) == -1) { target.Value(html.CLASS, _class.concat([html.SELECT]).join(lex.SP).trim()) }
|
||||||
|
} else {
|
||||||
|
if (_class.indexOf(html.SELECT) > -1) { target.Value(html.CLASS, _class.filter(function(c) { return c != html.SELECT }).join(lex.SP).trim()) }
|
||||||
|
}
|
||||||
|
}), can.page.Select(can, item._tr.parentNode, "", function(target) { can.page.ClassList.set(can, target, html.SELECT, target == item._tr) })
|
||||||
|
},
|
||||||
|
onclick: function(event, can, _sub, item) { switch (_sub.svg.style.cursor) {
|
||||||
|
case "e-resize":
|
||||||
|
can.Update(can.request(event, can.Action("direct") == "horizon"? {prev: item.hash}: {from: item.hash}), [ctx.ACTION, mdb.INSERT]); break
|
||||||
|
case "s-resize":
|
||||||
|
can.Update(can.request(event, can.Action("direct") == "horizon"? {from: item.hash}: {prev: item.hash}), [ctx.ACTION, mdb.INSERT]); break
|
||||||
|
default: can.ondetail._select(event, can, item)
|
||||||
|
} can.onkeymap.prevent(event) },
|
||||||
|
oncontextmenu: function(event, can, _sub, item) { can.user.carteItem(event, can, item) },
|
||||||
})
|
})
|
||||||
Volcanos(chat.ONEXPORT, {
|
Volcanos(chat.ONEXPORT, {
|
||||||
margin: function(can) { var margin = can.Action(html.MARGIN); return parseFloat(margin) },
|
margin: function(can) { var margin = can.Action(html.MARGIN); return parseFloat(margin) },
|
||||||
|
@ -2,8 +2,6 @@ package chat
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
"shylinux.com/x/icebergs/base/aaa"
|
|
||||||
"shylinux.com/x/icebergs/base/cli"
|
|
||||||
"shylinux.com/x/icebergs/base/ctx"
|
"shylinux.com/x/icebergs/base/ctx"
|
||||||
"shylinux.com/x/icebergs/base/mdb"
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
"shylinux.com/x/icebergs/base/nfs"
|
"shylinux.com/x/icebergs/base/nfs"
|
||||||
@ -17,7 +15,7 @@ func init() {
|
|||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
FOOTER: {Actions: ice.MergeActions(ice.Actions{
|
FOOTER: {Actions: ice.MergeActions(ice.Actions{
|
||||||
ice.HELP: {Hand: func(m *ice.Message, arg ...string) {
|
ice.HELP: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
ctx.ProcessField(m, web.WIKI_WORD, []string{ice.SRC_DOCUMENT + arg[0] + "/list.shy"}, arg...)
|
ctx.ProcessField(m, web.WIKI_WORD, []string{ctx.FileURI(kit.ExtChange(ctx.GetCmdFile(m, arg[0]), nfs.SHY))}, arg...)
|
||||||
}},
|
}},
|
||||||
nfs.SCRIPT: {Hand: func(m *ice.Message, arg ...string) {
|
nfs.SCRIPT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
ctx.ProcessField(m, web.CODE_VIMER, func() []string {
|
ctx.ProcessField(m, web.CODE_VIMER, func() []string {
|
||||||
@ -27,16 +25,7 @@ func init() {
|
|||||||
nfs.SOURCE: {Hand: func(m *ice.Message, arg ...string) {
|
nfs.SOURCE: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
ctx.ProcessField(m, web.CODE_VIMER, func() []string { return nfs.SplitPath(m, ctx.GetCmdFile(m, arg[0])) }, arg...)
|
ctx.ProcessField(m, web.CODE_VIMER, func() []string { return nfs.SplitPath(m, ctx.GetCmdFile(m, arg[0])) }, arg...)
|
||||||
}},
|
}},
|
||||||
ctx.CONFIG: {Hand: func(m *ice.Message, arg ...string) {
|
ctx.CONFIG: {Hand: func(m *ice.Message, arg ...string) { ctx.ProcessField(m, ctx.CONFIG, arg, arg...) }},
|
||||||
ctx.ProcessField(m, ctx.CONFIG, arg, arg...)
|
|
||||||
}},
|
|
||||||
ctx.RUN: {Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
if aaa.Right(m, arg) {
|
|
||||||
if m.Cmdy(arg); m.IsErrNotFound() {
|
|
||||||
m.RenderResult(m.Cmdx(cli.SYSTEM, arg))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}},
|
|
||||||
}, web.ApiWhiteAction()), Hand: func(m *ice.Message, arg ...string) {
|
}, web.ApiWhiteAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Result(kit.Select(ice.Info.Make.Email, mdb.Config(m, TITLE)))
|
m.Result(kit.Select(ice.Info.Make.Email, mdb.Config(m, TITLE)))
|
||||||
}},
|
}},
|
||||||
|
@ -37,7 +37,7 @@ func init() {
|
|||||||
m.ProcessLocation(web.MergeURL2(m, msg.Append(mdb.TEXT)))
|
m.ProcessLocation(web.MergeURL2(m, msg.Append(mdb.TEXT)))
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
}, aaa.RoleAction(aaa.CONFIRM), gdb.EventAction(web.SPACE_LOGIN)), Hand: func(m *ice.Message, arg ...string) {
|
}, aaa.RoleAction(aaa.CONFIRM), gdb.EventsAction(web.SPACE_LOGIN)), Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Echo("请授权: %s 访问设备: %s", arg[0], ice.Info.Hostname).Echo(lex.NL).EchoButton(aaa.CONFIRM)
|
m.Echo("请授权: %s 访问设备: %s", arg[0], ice.Info.Hostname).Echo(lex.NL).EchoButton(aaa.CONFIRM)
|
||||||
}},
|
}},
|
||||||
})
|
})
|
||||||
|
@ -47,31 +47,22 @@ func init() {
|
|||||||
case mdb.TYPE:
|
case mdb.TYPE:
|
||||||
m.Push(arg[0], web.LINK)
|
m.Push(arg[0], web.LINK)
|
||||||
default:
|
default:
|
||||||
if m.Option(mdb.TYPE) != "" && m.Option(mdb.TYPE) != web.LINK {
|
if m.Option(mdb.TYPE) == web.LINK {
|
||||||
return
|
switch arg[0] {
|
||||||
}
|
case mdb.NAME:
|
||||||
switch arg[0] {
|
m.Push(arg[0], web.UserWeb(m).Host)
|
||||||
case mdb.NAME:
|
case mdb.TEXT:
|
||||||
m.Push(arg[0], web.UserWeb(m).Host)
|
m.Push(arg[0], m.Option(ice.MSG_USERWEB))
|
||||||
case mdb.LINK, ctx.ARGS:
|
m.Copy(m.Cmd(web.SPIDE).CutTo(web.CLIENT_URL, arg[0]))
|
||||||
m.Push(arg[0], m.Option(ice.MSG_USERWEB))
|
}
|
||||||
m.Copy(m.Cmd(web.SPIDE).CutTo(web.CLIENT_URL, arg[0]))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
FAVOR_TABLES: {Hand: func(m *ice.Message, arg ...string) {
|
FAVOR_TABLES: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
kit.If(arg[1] == web.LINK, func() { m.PushButton(IFRAME, mdb.REMOVE) })
|
kit.If(m.Option(mdb.TYPE) == web.LINK, func() { m.PushButton(kit.Dict(m.CommandKey(), "网页")) })
|
||||||
}},
|
}},
|
||||||
FAVOR_ACTION: {Hand: func(m *ice.Message, arg ...string) {
|
FAVOR_ACTION: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
if m.Option(mdb.TYPE) != web.LINK {
|
kit.If(m.Option(mdb.TYPE) == web.LINK, func() { ctx.ProcessField(m, m.PrefixKey(), m.Option(mdb.TEXT)) })
|
||||||
return
|
|
||||||
}
|
|
||||||
switch kit.Select("", arg, 1) {
|
|
||||||
case web.OPEN:
|
|
||||||
m.ProcessOpen(m.Option(mdb.TEXT))
|
|
||||||
default:
|
|
||||||
ctx.ProcessField(m, m.PrefixKey(), []string{m.Option(mdb.TEXT)}, arg...)
|
|
||||||
}
|
|
||||||
}},
|
}},
|
||||||
}, FavorAction(), mdb.HashAction(mdb.SHORT, web.LINK, mdb.FIELD, "time,hash,type,name,link")), Hand: func(m *ice.Message, arg ...string) {
|
}, FavorAction(), mdb.HashAction(mdb.SHORT, web.LINK, mdb.FIELD, "time,hash,type,name,link")), Hand: func(m *ice.Message, arg ...string) {
|
||||||
list := []string{m.MergePodCmd("", web.WIKI_PORTAL, log.DEBUG, m.Option(log.DEBUG))}
|
list := []string{m.MergePodCmd("", web.WIKI_PORTAL, log.DEBUG, m.Option(log.DEBUG))}
|
||||||
|
@ -45,7 +45,7 @@ func init() {
|
|||||||
kit.If(arg[0] == mdb.TYPE, func() { m.Push(arg[0], LOCATION) })
|
kit.If(arg[0] == mdb.TYPE, func() { m.Push(arg[0], LOCATION) })
|
||||||
}},
|
}},
|
||||||
FAVOR_TABLES: {Hand: func(m *ice.Message, arg ...string) {
|
FAVOR_TABLES: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
kit.If(arg[1] == LOCATION, func() { m.PushButton(LOCATION, mdb.REMOVE) })
|
kit.If(m.Option(mdb.TYPE) == LOCATION, func() { m.PushButton(LOCATION) })
|
||||||
}},
|
}},
|
||||||
FAVOR_ACTION: {Hand: func(m *ice.Message, arg ...string) {
|
FAVOR_ACTION: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
kit.If(m.Option(mdb.TYPE) == LOCATION, func() { ctx.ProcessField(m, m.PrefixKey(), []string{m.Option(mdb.TEXT)}, arg...) })
|
kit.If(m.Option(mdb.TYPE) == LOCATION, func() { ctx.ProcessField(m, m.PrefixKey(), []string{m.Option(mdb.TEXT)}, arg...) })
|
||||||
|
@ -19,46 +19,28 @@ func init() {
|
|||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
APPLICATIONS: {Actions: ice.MergeActions(ice.Actions{
|
APPLICATIONS: {Actions: ice.MergeActions(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
FinderAppend(m, "Applications", m.PrefixKey())
|
FinderAppend(m, APPLICATIONS, m.PrefixKey())
|
||||||
|
defer Notify(m, "Infomation.png", cli.RUNTIME, "系统启动成功", ctx.INDEX, cli.RUNTIME)
|
||||||
m.Travel(func(p *ice.Context, c *ice.Context, key string, cmd *ice.Command) {
|
m.Travel(func(p *ice.Context, c *ice.Context, key string, cmd *ice.Command) {
|
||||||
kit.If(cmd.Icon, func() {
|
kit.If(cmd.Icon, func() {
|
||||||
if !kit.HasPrefix(cmd.Icon, nfs.PS, web.HTTP) {
|
if !kit.HasPrefix(cmd.Icon, nfs.PS, web.HTTP) {
|
||||||
if !nfs.Exists(m, cmd.Icon) {
|
kit.If(!nfs.Exists(m, cmd.Icon), func() { nfs.Exists(m, ice.USR_ICONS+cmd.Icon, func(p string) { cmd.Icon = p }) })
|
||||||
nfs.Exists(m, ice.USR_ICONS+cmd.Icon, func(p string) { cmd.Icon = p })
|
kit.If(!nfs.Exists(m, cmd.Icon), func() {
|
||||||
}
|
|
||||||
if !nfs.Exists(m, cmd.Icon) {
|
|
||||||
nfs.Exists(m, ctx.GetCmdFile(m, m.PrefixKey()), func(p string) { cmd.Icon = path.Join(path.Dir(p), cmd.Icon) })
|
nfs.Exists(m, ctx.GetCmdFile(m, m.PrefixKey()), func(p string) { cmd.Icon = path.Join(path.Dir(p), cmd.Icon) })
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
AppInstall(m, cmd.Icon, m.PrefixKey())
|
AppInstall(m, cmd.Icon, m.PrefixKey())
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
Notify(m, "usr/icons/Infomation.png", cli.RUNTIME, "系统启动成功", ctx.INDEX, cli.RUNTIME)
|
|
||||||
}},
|
}},
|
||||||
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) { mdb.Conf(m, m.PrefixKey(), mdb.HASH, "") }},
|
|
||||||
code.INSTALL: {Hand: func(m *ice.Message, arg ...string) { AppInstall(m, arg[0], arg[1]) }},
|
code.INSTALL: {Hand: func(m *ice.Message, arg ...string) { AppInstall(m, arg[0], arg[1]) }},
|
||||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.CREATE: {Name: "create space index args name icon"},
|
||||||
switch arg[0] {
|
}, PodCmdAction(), CmdHashAction("space,index,args"), mdb.ClearOnExitHashAction())},
|
||||||
case web.SPACE:
|
|
||||||
m.Cmdy(web.SPACE).CutTo(mdb.NAME, arg[0])
|
|
||||||
case ctx.INDEX:
|
|
||||||
m.Cmdy(web.Space(m, m.Option(web.SPACE)), ctx.COMMAND)
|
|
||||||
case ctx.ARGS:
|
|
||||||
m.Cmdy(web.Space(m, m.Option(web.SPACE)), ctx.COMMAND, mdb.INPUTS, m.Option(ctx.INDEX))
|
|
||||||
case mdb.ICON:
|
|
||||||
if m.Option(ctx.INDEX) != "" {
|
|
||||||
m.Cmd(web.Space(m, m.Option(web.SPACE)), m.Option(ctx.INDEX), mdb.INPUTS, arg[0]).Table(func(value ice.Maps) {
|
|
||||||
m.Push(arg[0], value[arg[0]]+"?pod="+kit.Keys(m.Option(ice.MSG_USERPOD), m.Option(web.SPACE)))
|
|
||||||
})
|
|
||||||
}
|
|
||||||
m.Cmd(nfs.DIR, USR_ICONS, func(value ice.Maps) { m.Push(arg[0], value[nfs.PATH]) })
|
|
||||||
}
|
|
||||||
}}, mdb.CREATE: {Name: "create space index args name icon"},
|
|
||||||
}, PodCmdAction(), CmdHashAction("space,index,args"))},
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
func install(m *ice.Message, cmd, icon, index string, arg ...string) {
|
func install(m *ice.Message, cmd, icon, index string, arg ...string) {
|
||||||
name := kit.TrimExt(path.Base(icon), "png")
|
name := kit.TrimExt(path.Base(icon), nfs.PNG, nfs.JPG)
|
||||||
|
nfs.Exists(m, ice.USR_ICONS+icon, func(p string) { icon = p })
|
||||||
m.Cmd(Prefix(cmd), mdb.CREATE, mdb.NAME, name, mdb.ICON, icon, ctx.INDEX, index, arg)
|
m.Cmd(Prefix(cmd), mdb.CREATE, mdb.NAME, name, mdb.ICON, icon, ctx.INDEX, index, arg)
|
||||||
}
|
}
|
||||||
func AppInstall(m *ice.Message, icon, index string, arg ...string) {
|
func AppInstall(m *ice.Message, icon, index string, arg ...string) {
|
||||||
|
@ -1,24 +1,6 @@
|
|||||||
fieldset.web.chat.caculator>div.output>div.display {
|
fieldset.web.chat.caculator>div.output>div.display { text-align:right; font-size:50px; height:80px; width:100%; }
|
||||||
text-align:right;
|
fieldset.web.chat.caculator>div.output>table { width:100%; }
|
||||||
height:80px;
|
fieldset.web.chat.caculator>div.output>table td { text-align:center; height:80px; width:80px; }
|
||||||
width:100%;
|
fieldset.web.chat.caculator>div.output>table tr:first-child td { background-color:#46504d; color:white; }
|
||||||
font-size:50px;
|
fieldset.web.chat.caculator>div.output>table td:last-child { background-color:#fb9f0d !important; color:white; }
|
||||||
}
|
fieldset.web.chat.caculator>div.output>table td:hover { background-color:var(--hover-bg-color) !important; cursor:pointer; }
|
||||||
fieldset.web.chat.caculator>div.output>table {
|
|
||||||
width:100%;
|
|
||||||
}
|
|
||||||
fieldset.web.chat.caculator>div.output>table td {
|
|
||||||
text-align:center;
|
|
||||||
height:80px;
|
|
||||||
width:80px;
|
|
||||||
}
|
|
||||||
fieldset.web.chat.caculator>div.output>table tr:first-child td {
|
|
||||||
background-color:#46504d; color:white;
|
|
||||||
}
|
|
||||||
fieldset.web.chat.caculator>div.output>table td:last-child {
|
|
||||||
background-color:#fb9f0d !important; color:white;
|
|
||||||
}
|
|
||||||
fieldset.web.chat.caculator>div.output>table td:hover {
|
|
||||||
background-color:var(--hover-bg-color) !important;
|
|
||||||
cursor:pointer;
|
|
||||||
}
|
|
||||||
|
@ -4,9 +4,10 @@ import (
|
|||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const CACULATOR = "caculator"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
const CACULATOR = "caculator"
|
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
CACULATOR: {Name: "caculator refresh", Icon: "Caculator.png", Hand: func(m *ice.Message, arg ...string) { m.Display("") }},
|
CACULATOR: {Icon: "Caculator.png", Hand: func(m *ice.Message, arg ...string) { m.Display("") }},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -7,40 +7,30 @@ Volcanos(chat.ONIMPORT, {
|
|||||||
["1", "2", "3", "+"],
|
["1", "2", "3", "+"],
|
||||||
["0", "00", ".", "="],
|
["0", "00", ".", "="],
|
||||||
]
|
]
|
||||||
can.ui.display = can.page.Append(can, can._output, [{view: "display", inner: "0"}])._target
|
can.ui.display = can.page.Append(can, can._output, [{view: html.DISPLAY, inner: "0"}])._target
|
||||||
var table = can.page.Append(can, can._output, [{type: html.TABLE}])._target
|
var table = can.page.Append(can, can._output, [{type: html.TABLE}])._target
|
||||||
can.page.Append(can, table, can.core.List(list, function(list) {
|
can.page.Append(can, table, can.core.List(list, function(list) {
|
||||||
return {type: html.TR, list: can.core.List(list, function(item) {
|
return {type: html.TR, list: can.core.List(list, function(item) {
|
||||||
return {type: html.TD, inner: item, onclick: function(event) {
|
return {type: html.TD, inner: item, onclick: function(event) { var cb = can.ondetail[item]
|
||||||
var cb = can.ondetail[item]; cb? cb(event, can, item): (
|
cb? cb(event, can, item): (can.ui.display.innerHTML = can.base.trimPrefix(can.ui.display.innerHTML + item, "0"))
|
||||||
can.ui.display.innerHTML = can.base.trimPrefix(can.ui.display.innerHTML + item, "0")
|
|
||||||
)
|
|
||||||
}}
|
}}
|
||||||
}) }
|
}) }
|
||||||
}))
|
}))
|
||||||
},
|
},
|
||||||
_show: function(can) {
|
|
||||||
},
|
|
||||||
}, [""])
|
}, [""])
|
||||||
Volcanos(chat.ONACTION, {
|
Volcanos(chat.ONACTION, {
|
||||||
onkeydown: function(event, can) {
|
onkeydown: function(event, can) {
|
||||||
switch (event.key) {
|
switch (event.key) {
|
||||||
case "=":
|
case "=": can.ondetail[event.key](evnt, can, event.key); break
|
||||||
can.ondetail[event.key](evnt, can, event.key)
|
|
||||||
case "Shift":
|
|
||||||
case "Backspace":
|
case "Backspace":
|
||||||
break
|
case "Shift": break
|
||||||
default:
|
default: can.ui.display.innerHTML += event.key
|
||||||
can.ui.display.innerHTML += event.key
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
Volcanos(chat.ONDETAIL, {
|
Volcanos(chat.ONDETAIL, {
|
||||||
"AC": function(event, can, button) {
|
"AC": function(event, can, button) { can.ui.display.innerHTML = "0" },
|
||||||
can.ui.display.innerHTML = "0"
|
"=": function(event, can, button) { var list = []
|
||||||
},
|
|
||||||
"=": function(event, can, button) {
|
|
||||||
var list = []
|
|
||||||
can.core.List(can.core.Split(can.ui.display.innerHTML, "", "+-*/%"), function(item) {
|
can.core.List(can.core.Split(can.ui.display.innerHTML, "", "+-*/%"), function(item) {
|
||||||
switch (item) {
|
switch (item) {
|
||||||
case "+":
|
case "+":
|
||||||
@ -52,6 +42,5 @@ Volcanos(chat.ONDETAIL, {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
"+/-": function(event, can, button) {
|
"+/-": function(event, can, button) {},
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
@ -4,9 +4,10 @@ import (
|
|||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const CLOCK = "clock"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
const CLOCK = "clock"
|
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
CLOCK: {Name: "clock refresh", Icon: "Clock.png", Hand: func(m *ice.Message, arg ...string) { m.Display("") }},
|
CLOCK: {Icon: "Clock.png", Hand: func(m *ice.Message, arg ...string) { m.Display("") }},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -14,22 +14,19 @@ func init() {
|
|||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
DESKTOP: {Help: "应用桌面", Actions: ice.MergeActions(ice.Actions{
|
DESKTOP: {Help: "应用桌面", Actions: ice.MergeActions(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
if mdb.HashImport(m); m.Cmd(DESKTOP).Length() == 0 {
|
if m.Cmd(DESKTOP).Length() == 0 {
|
||||||
DeskAppend(m, "usr/icons/Books.png", web.WIKI_WORD)
|
DeskAppend(m, "Books.png", web.WIKI_WORD)
|
||||||
DeskAppend(m, "usr/icons/Photos.png", web.WIKI_FEEL)
|
DeskAppend(m, "Photos.png", web.WIKI_FEEL)
|
||||||
DeskAppend(m, "usr/icons/Grapher.png", web.WIKI_DRAW)
|
DeskAppend(m, "Grapher.png", web.WIKI_DRAW)
|
||||||
DeskAppend(m, "usr/icons/Calendar.png", web.TEAM_PLAN)
|
DeskAppend(m, "Calendar.png", web.TEAM_PLAN)
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) { mdb.HashExport(m) }},
|
|
||||||
web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) {
|
web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
kit.Switch(m.Option(mdb.TYPE), kit.Simple(web.SERVER, web.WORKER), func() { m.PushButton(kit.Dict(m.CommandKey(), "桌面")) })
|
kit.Switch(m.Option(mdb.TYPE), kit.Simple(web.WORKER, web.SERVER), func() { m.PushButton(kit.Dict(m.CommandKey(), "桌面")) })
|
||||||
}},
|
}},
|
||||||
web.DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) { web.DreamProcess(m, []string{}, arg...) }},
|
web.DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) { web.DreamProcess(m, []string{}, arg...) }},
|
||||||
}, aaa.RoleAction(), PodCmdAction(), CmdHashAction(), mdb.ImportantHashAction())},
|
}, aaa.RoleAction(), PodCmdAction(), CmdHashAction(), mdb.ExportHashAction())},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func DeskAppend(m *ice.Message, icon, index string) {
|
func DeskAppend(m *ice.Message, icon, index string) { install(m, DESKTOP, icon, index) }
|
||||||
install(m, DESKTOP, icon, index)
|
|
||||||
}
|
|
||||||
|
@ -1,25 +1,26 @@
|
|||||||
(function() {
|
(function() {
|
||||||
Volcanos(chat.ONIMPORT, {
|
Volcanos(chat.ONIMPORT, {
|
||||||
_init: function(can, msg) { can.onmotion.clear(can), can.isCmdMode() && can.onappend.style(can, html.OUTPUT)
|
_init: function(can, msg) { can.isCmdMode() && can.onappend.style(can, html.OUTPUT)
|
||||||
can.onlayout.background(can, can.user.info.background||"/require/usr/icons/background.jpg", can._fields)
|
can.onlayout.background(can, can.user.info.background||"/require/usr/icons/background.jpg", can._fields)
|
||||||
can.onimport._menu(can), can.onimport._notifications(can), can.onimport._searchs(can), can.onimport._dock(can)
|
can.onimport._menu(can), can.onimport._notifications(can), can.onimport._searchs(can), can.onimport._dock(can)
|
||||||
},
|
},
|
||||||
_menu: function(can) { can.onappend.plugin(can, {_space: can.ConfSpace(), index: "web.chat.macos.menu", style: html.OUTPUT}, function(sub) { can.ui.menu = sub
|
_menu: function(can) { can.onappend.plugin(can, {index: "web.chat.macos.menu", style: html.OUTPUT}, function(sub) { can.ui.menu = sub
|
||||||
var cache = can.misc.sessionStorage(can, [can.ConfIndex(), "tabs"])
|
var tabs = can.misc.sessionStorage(can, [can.ConfIndex(), html.TABS])
|
||||||
sub.onexport.output = function() { can.onimport._desktop(can, can._msg)
|
sub.onexport.output = function() { can.onimport._desktop(can, can._msg)
|
||||||
can.Conf("session") && can.runActionCommand(event, "session", [can.Conf("session")], function(msg) {
|
var sess = can.misc.SearchHash(can)[0]||can.Conf("session")
|
||||||
|
sess? can.runActionCommand(event, "session", [sess], function(msg) {
|
||||||
var item = msg.TableDetail(); can.onimport.session(can, can.base.Obj(item.args))
|
var item = msg.TableDetail(); can.onimport.session(can, can.base.Obj(item.args))
|
||||||
}), can.onimport.session(can, cache)
|
}): can.isCmdMode() && can.onimport.session(can, tabs)
|
||||||
}
|
}
|
||||||
sub.onexport.record = function(sub, value, key, item) { delete(can.onfigure._path)
|
sub.onexport.record = function(sub, value, key, item) { delete(can.onfigure._path)
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case "create": can.onaction.create(event, can); break
|
|
||||||
case "desktop": var carte = can.user.carte(event, can, {}, can.core.Item(can.onfigure), function(event, button, meta, carte) {
|
|
||||||
can.onfigure[button](event, can, carte)
|
|
||||||
return true
|
|
||||||
}); break
|
|
||||||
case "notifications": can.ui.notifications._output.innerHTML && can.onmotion.toggle(can, can.ui.notifications._target); break
|
case "notifications": can.ui.notifications._output.innerHTML && can.onmotion.toggle(can, can.ui.notifications._target); break
|
||||||
case "searchs": can.onaction._search(can); break
|
case "searchs": can.onaction._search(can); break
|
||||||
|
case mdb.CREATE: can.onaction.create(event, can); break
|
||||||
|
case html.DESKTOP:
|
||||||
|
var carte = can.user.carte(event, can, {}, can.core.Item(can.onfigure), function(event, button, meta, carte) {
|
||||||
|
can.onfigure[button](event, can, carte); return true
|
||||||
|
}); break
|
||||||
default: can.onimport._window(can, value)
|
default: can.onimport._window(can, value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -48,8 +49,7 @@ Volcanos(chat.ONIMPORT, {
|
|||||||
}) },
|
}) },
|
||||||
_desktop: function(can, msg, name) { var target = can.page.Append(can, can._output, [html.DESKTOP])._target; can.ui.desktop = target
|
_desktop: function(can, msg, name) { var target = can.page.Append(can, can._output, [html.DESKTOP])._target; can.ui.desktop = target
|
||||||
target._tabs = can.onimport.tabs(can, [{name: name||"Desktop"+(can.page.Select(can, can._output, html.DIV_DESKTOP).length-1)}], function() {
|
target._tabs = can.onimport.tabs(can, [{name: name||"Desktop"+(can.page.Select(can, can._output, html.DIV_DESKTOP).length-1)}], function() {
|
||||||
can.onmotion.select(can, can._output, "div.desktop", target), can.ui.desktop = target
|
can.onmotion.select(can, can._output, "div.desktop", target), can.ui.desktop = target, can.onexport.tabs(can)
|
||||||
can.onexport.tabs(can)
|
|
||||||
}, function() { can.page.Remove(can, target) }, can.ui.menu._output), target._tabs._desktop = target
|
}, function() { can.page.Remove(can, target) }, can.ui.menu._output), target._tabs._desktop = target
|
||||||
target.ondragend = function() { can.onimport._item(can, window._drag_item) }
|
target.ondragend = function() { can.onimport._item(can, window._drag_item) }
|
||||||
can.onimport.__item(can, msg, target)
|
can.onimport.__item(can, msg, target)
|
||||||
@ -64,7 +64,7 @@ Volcanos(chat.ONIMPORT, {
|
|||||||
remove: function() { can.runAction(event, mdb.REMOVE, [item.hash]) },
|
remove: function() { can.runAction(event, mdb.REMOVE, [item.hash]) },
|
||||||
}); can.page.style(can, carte._target, html.TOP, event.y) },
|
}); can.page.style(can, carte._target, html.TOP, event.y) },
|
||||||
}) }) },
|
}) }) },
|
||||||
_window: function(can, item, cb) { if (!item.index) { return } item._space = can.ConfSpace()
|
_window: function(can, item, cb) { if (!item.index) { return }
|
||||||
item.height = can.ConfHeight()-125, item.width = can.ConfWidth()-200, item.left = (can.ConfWidth()-item.width)/2, item.top = 25
|
item.height = can.ConfHeight()-125, item.width = can.ConfWidth()-200, item.left = (can.ConfWidth()-item.width)/2, item.top = 25
|
||||||
if (can.ConfWidth() > 1400) { item.width = can.base.Min(can.ConfWidth()-600, 640, 1400), item.left = (can.ConfWidth()-item.width)/2 }
|
if (can.ConfWidth() > 1400) { item.width = can.base.Min(can.ConfWidth()-600, 640, 1400), item.left = (can.ConfWidth()-item.width)/2 }
|
||||||
if (can.ConfHeight() > 800) { item.height = can.base.Min(can.ConfHeight()-200, 320, 800), item.top = 50 }
|
if (can.ConfHeight() > 800) { item.height = can.base.Min(can.ConfHeight()-200, 320, 800), item.top = 50 }
|
||||||
@ -79,10 +79,8 @@ Volcanos(chat.ONIMPORT, {
|
|||||||
}, function(color, cb) { can.page.insertBefore(can, [{view: [[html.ITEM, html.BUTTON]], style: {"background-color": color, right: 10+20*index++}, onclick: cb}], sub._output) })
|
}, function(color, cb) { can.page.insertBefore(can, [{view: [[html.ITEM, html.BUTTON]], style: {"background-color": color, right: 10+20*index++}, onclick: cb}], sub._output) })
|
||||||
sub.onexport.marginTop = function() { return 25 }, sub.onexport.marginBottom = function() { return 100 }
|
sub.onexport.marginTop = function() { return 25 }, sub.onexport.marginBottom = function() { return 100 }
|
||||||
sub.onexport.actionHeight = function(sub) { return can.page.ClassList.has(can, sub._target, html.OUTPUT)? 0: html.ACTION_HEIGHT+20 }
|
sub.onexport.actionHeight = function(sub) { return can.page.ClassList.has(can, sub._target, html.OUTPUT)? 0: html.ACTION_HEIGHT+20 }
|
||||||
sub.onexport.output = function() { item.index == "web.chat.macos.opens" && can.page.Remove(can, sub._target)
|
sub.onexport.output = function() { sub.onimport.size(sub, item.height, can.base.Min(sub._target.offsetWidth, item.width), true)
|
||||||
sub.onimport.size(sub, item.height, can.base.Min(sub._target.offsetWidth, item.width), true)
|
sub._target._meta.args = can.base.trim(can.page.SelectArgs(can, sub._option, "", function(target) { return target.value })), can.onexport.tabs(can)
|
||||||
sub._target._meta.args = can.base.trim(can.page.SelectArgs(can, sub._option, "", function(target) { return target.value }))
|
|
||||||
can.onexport.tabs(can)
|
|
||||||
}, sub.onimport.size(sub, item.height, can.base.Min(sub._target.offsetWidth, item.width), true)
|
}, sub.onimport.size(sub, item.height, can.base.Min(sub._target.offsetWidth, item.width), true)
|
||||||
sub.onexport.record = function(sub, value, key, item) { can.onimport._window(can, item) }
|
sub.onexport.record = function(sub, value, key, item) { can.onimport._window(can, item) }
|
||||||
sub.onimport._open = function(sub, msg, arg) { can.onimport._window(can, {index: web.CHAT_IFRAME, args: [arg]}) }
|
sub.onimport._open = function(sub, msg, arg) { can.onimport._window(can, {index: web.CHAT_IFRAME, args: [arg]}) }
|
||||||
@ -99,13 +97,14 @@ Volcanos(chat.ONIMPORT, {
|
|||||||
cb && cb(sub)
|
cb && cb(sub)
|
||||||
}, can.ui.desktop)
|
}, can.ui.desktop)
|
||||||
},
|
},
|
||||||
session: function(can, list) { if (!list || list.length == 0 || !can.isCmdMode() || window != window.parent) { return }
|
session: function(can, list) { if (!list || list.length == 0) { return }
|
||||||
|
// if (!list || list.length == 0 || !can.isCmdMode() || window != window.parent) { return }
|
||||||
can.page.Select(can, can._output, html.DIV_DESKTOP, function(target) { can.page.Remove(can, target) })
|
can.page.Select(can, can._output, html.DIV_DESKTOP, function(target) { can.page.Remove(can, target) })
|
||||||
can.page.Select(can, can.ui.menu._output, html.DIV_TABS, function(target) { can.page.Remove(can, target) })
|
can.page.Select(can, can.ui.menu._output, html.DIV_TABS, function(target) { can.page.Remove(can, target) })
|
||||||
var _select; can.core.Next(list, function(item, next) {
|
var _select; can.core.Next(list, function(item, next) {
|
||||||
var _tabs = can.onimport._desktop(can, null, item.name); _select = (!_select || item.select)? _tabs: _select
|
var _tabs = can.onimport._desktop(can, null, item.name); _select = (!_select || item.select)? _tabs: _select
|
||||||
can.core.Next(item.list, function(item, next) {
|
can.core.Next(item.list, function(item, next) {
|
||||||
can.onimport._window(can, item, function(sub) { can.onmotion.delay(can, function() { next() }, 500) })
|
can.onimport._window(can, item, function(sub) { can.onmotion.delay(can, function() { next() }, 300) })
|
||||||
}, function() { next() })
|
}, function() { next() })
|
||||||
}, function() { _select && _select.click() })
|
}, function() { _select && _select.click() })
|
||||||
},
|
},
|
||||||
@ -118,8 +117,8 @@ Volcanos(chat.ONACTION, {list: ["full"],
|
|||||||
_search: function(can) { if (can.onmotion.toggle(can, can.ui.searchs._target)) {
|
_search: function(can) { if (can.onmotion.toggle(can, can.ui.searchs._target)) {
|
||||||
can.page.Select(can, can.ui.searchs._option, "input[name=keyword]", function(target) { can.onmotion.focus(can, target) })
|
can.page.Select(can, can.ui.searchs._option, "input[name=keyword]", function(target) { can.onmotion.focus(can, target) })
|
||||||
} },
|
} },
|
||||||
create: function(event, can) { can.onimport._desktop(can) },
|
|
||||||
full: function(event, can) { document.body.requestFullscreen() },
|
full: function(event, can) { document.body.requestFullscreen() },
|
||||||
|
create: function(event, can) { can.onimport._desktop(can) },
|
||||||
})
|
})
|
||||||
Volcanos(chat.ONKEYMAP, {
|
Volcanos(chat.ONKEYMAP, {
|
||||||
escape: function(event, can) { can.onmotion.hidden(can, can.ui.searchs._target) },
|
escape: function(event, can) { can.onmotion.hidden(can, can.ui.searchs._target) },
|
||||||
@ -147,6 +146,7 @@ Volcanos(chat.ONEXPORT, {
|
|||||||
})
|
})
|
||||||
Volcanos(chat.ONFIGURE, {
|
Volcanos(chat.ONFIGURE, {
|
||||||
"session\t>": function(event, can, carte) { can.runActionCommand(event, "session", [], function(msg) {
|
"session\t>": function(event, can, carte) { can.runActionCommand(event, "session", [], function(msg) {
|
||||||
|
var hash = can.misc.SearchHash(can)
|
||||||
var _carte = can.user.carteRight(event, can, {}, [{view: [html.ITEM, "", mdb.CREATE], onclick: function(event) {
|
var _carte = can.user.carteRight(event, can, {}, [{view: [html.ITEM, "", mdb.CREATE], onclick: function(event) {
|
||||||
can.user.input(event, can, [mdb.NAME], function(list) {
|
can.user.input(event, can, [mdb.NAME], function(list) {
|
||||||
var args = can.page.SelectChild(can, can._output, html.DIV_DESKTOP, function(target) {
|
var args = can.page.SelectChild(can, can._output, html.DIV_DESKTOP, function(target) {
|
||||||
@ -156,11 +156,15 @@ Volcanos(chat.ONFIGURE, {
|
|||||||
})
|
})
|
||||||
can.runActionCommand(event, "session", [ctx.ACTION, mdb.CREATE, mdb.NAME, list[0], ctx.ARGS, JSON.stringify(args)], function(msg) {
|
can.runActionCommand(event, "session", [ctx.ACTION, mdb.CREATE, mdb.NAME, list[0], ctx.ARGS, JSON.stringify(args)], function(msg) {
|
||||||
can.user.toastSuccess(can, "session created")
|
can.user.toastSuccess(can, "session created")
|
||||||
|
can.misc.SearchHash(can, list[0])
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}}].concat("", msg.Table(function(value) {
|
}}].concat("", msg.Table(function(value) {
|
||||||
return {view: [html.ITEM, "", value.name],
|
return {view: [html.ITEM, "", value.name+(value.name == hash[0]? " *": "")],
|
||||||
onclick: function() { can.onimport.session(can, can.base.Obj(value.args, [])) },
|
onclick: function() {
|
||||||
|
can.onimport.session(can, can.base.Obj(value.args, []))
|
||||||
|
can.misc.SearchHash(can, value.name)
|
||||||
|
},
|
||||||
oncontextmenu: function(event) { can.user.carteRight(event, can, {
|
oncontextmenu: function(event) { can.user.carteRight(event, can, {
|
||||||
open: function() { can.user.open(can.misc.MergePodCmd(can, {cmd: "desktop", session: value.name})) },
|
open: function() { can.user.open(can.misc.MergePodCmd(can, {cmd: "desktop", session: value.name})) },
|
||||||
remove: function() { can.runActionCommand(event, "session", [mdb.REMOVE, value.name], function() { can.user.toastSuccess(can, "session removed") }) },
|
remove: function() { can.runActionCommand(event, "session", [mdb.REMOVE, value.name], function() { can.user.toastSuccess(can, "session removed") }) },
|
||||||
@ -184,7 +188,7 @@ Volcanos(chat.ONFIGURE, {
|
|||||||
can.user.carteRight(event, can, {}, [{view: [html.ITEM, "", mdb.CREATE], onclick: function(event) {
|
can.user.carteRight(event, can, {}, [{view: [html.ITEM, "", mdb.CREATE], onclick: function(event) {
|
||||||
can.user.input(event, can, [ctx.INDEX, ctx.ARGS], function(data) { can.onimport._window(can, data) })
|
can.user.input(event, can, [ctx.INDEX, ctx.ARGS], function(data) { can.onimport._window(can, data) })
|
||||||
}}, ""].concat(can.page.Select(can, can.ui.desktop, "fieldset>legend", function(legend) {
|
}}, ""].concat(can.page.Select(can, can.ui.desktop, "fieldset>legend", function(legend) {
|
||||||
return {view: [html.ITEM, "", legend.innerText+(legend.parentNode.style["z-index"] == "10"? " *": "")], onclick: function(event) {
|
return {view: [html.ITEM, "", legend.innerText+(can.page.ClassList.has(can, legend.parentNode, html.SELECT)? " *": "")], onclick: function(event) {
|
||||||
can.ondetail.select(can, legend.parentNode)
|
can.ondetail.select(can, legend.parentNode)
|
||||||
}}
|
}}
|
||||||
})), function(event) {}, carte)
|
})), function(event) {}, carte)
|
||||||
|
@ -12,19 +12,16 @@ const DOCK = "dock"
|
|||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{DOCK: {Actions: ice.MergeActions(ice.Actions{
|
Index.MergeCommands(ice.Commands{DOCK: {Actions: ice.MergeActions(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
if mdb.HashImport(m); m.Cmd(DOCK).Length() == 0 {
|
if m.Cmd(DOCK).Length() == 0 {
|
||||||
DockAppend(m, "usr/icons/Finder.png", Prefix(FINDER))
|
DockAppend(m, "Finder.png", Prefix(FINDER))
|
||||||
DockAppend(m, "usr/icons/Safari.png", web.CHAT_IFRAME)
|
DockAppend(m, "Safari.png", web.CHAT_IFRAME)
|
||||||
DockAppend(m, "usr/icons/Terminal.png", web.CODE_XTERM)
|
DockAppend(m, "Terminal.png", web.CODE_XTERM)
|
||||||
DockAppend(m, "usr/icons/vimer.png", web.CODE_VIMER)
|
DockAppend(m, "go.png", web.CODE_COMPILE)
|
||||||
DockAppend(m, "usr/icons/go.png", web.CODE_COMPILE)
|
DockAppend(m, "git.png", web.CODE_GIT_STATUS)
|
||||||
DockAppend(m, "usr/icons/git.png", web.CODE_GIT_STATUS)
|
DockAppend(m, "vimer.png", web.CODE_VIMER)
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) { mdb.HashExport(m) }},
|
}, aaa.RoleAction(), CmdHashAction(), mdb.ExportHashAction())}})
|
||||||
}, aaa.RoleAction(), CmdHashAction(), mdb.ImportantHashAction())}})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func DockAppend(m *ice.Message, icon, index string) {
|
func DockAppend(m *ice.Message, icon, index string) { install(m, DOCK, icon, index) }
|
||||||
install(m, DOCK, icon, index)
|
|
||||||
}
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Volcanos(chat.ONIMPORT, {_init: function(can, msg) { can.onmotion.clear(can), can.page.style(can, can._output, html.MAX_WIDTH, can.page.width())
|
Volcanos(chat.ONIMPORT, {_init: function(can, msg) { can.page.style(can, can._output, html.MAX_WIDTH, can.page.width())
|
||||||
can.onimport.icon(can, msg = msg||can._msg, can._output, function(target, item) { can.page.Modify(can, target, {
|
can.onimport.icon(can, msg = msg||can._msg, can._output, function(target, item) { can.page.Modify(can, target, {
|
||||||
onclick: function(event) { can.sup.onexport.record(can, item.name, mdb.NAME, item) },
|
onclick: function(event) { can.sup.onexport.record(can, item.name, mdb.NAME, item) },
|
||||||
oncontextmenu: function(event) { var carte = can.user.carte(event, can, {
|
oncontextmenu: function(event) { var carte = can.user.carte(event, can, {
|
||||||
|
@ -14,6 +14,4 @@ func init() {
|
|||||||
}, CmdHashAction(mdb.NAME))}})
|
}, CmdHashAction(mdb.NAME))}})
|
||||||
}
|
}
|
||||||
|
|
||||||
func FinderAppend(m *ice.Message, icon, index string) {
|
func FinderAppend(m *ice.Message, icon, index string) { install(m, FINDER, icon, index) }
|
||||||
install(m, FINDER, icon, index)
|
|
||||||
}
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
Volcanos(chat.ONIMPORT, { _init: function(can, msg) { can.onmotion.clear(can), can.ui = can.onappend.layout(can), msg.Table(function(value, index) {
|
Volcanos(chat.ONIMPORT, {
|
||||||
|
_init: function(can, msg) { can.ui = can.onappend.layout(can), msg.Table(function(value, index) {
|
||||||
var item = can.onimport.item(can, value, function(event) { if (can.onmotion.cache(can, function() { return value.name }, can.ui.content)) { return }
|
var item = can.onimport.item(can, value, function(event) { if (can.onmotion.cache(can, function() { return value.name }, can.ui.content)) { return }
|
||||||
can.runActionCommand(event, value.index, [], function(msg) {
|
can.runActionCommand(event, value.index, [], function(msg) {
|
||||||
switch (value.name) {
|
switch (value.name) {
|
||||||
case "Applications": can.onimport.icons(can, msg, can.ui.content); break
|
case "applications": can.onimport.icons(can, msg, can.ui.content); break
|
||||||
default: can.onappend.table(can, msg, null, can.ui.content)
|
default: can.onappend.table(can, msg, null, can.ui.content)
|
||||||
} can.onimport.layout(can)
|
} can.onimport.layout(can)
|
||||||
})
|
})
|
||||||
|
@ -10,14 +10,11 @@ import (
|
|||||||
kit "shylinux.com/x/toolkits"
|
kit "shylinux.com/x/toolkits"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
USR_ICONS = "usr/icons/"
|
|
||||||
)
|
|
||||||
const MACOS = "macos"
|
const MACOS = "macos"
|
||||||
|
|
||||||
var Index = &ice.Context{Name: MACOS, Commands: ice.Commands{ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
var Index = &ice.Context{Name: MACOS, Commands: ice.Commands{
|
||||||
ice.Info.Load(m).Cmd(FINDER, ice.CTX_INIT)
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { ice.Info.Load(m).Cmd(FINDER, ice.CTX_INIT) }},
|
||||||
}}}}
|
}}
|
||||||
|
|
||||||
func init() { chat.Index.Register(Index, nil, DESKTOP, APPLICATIONS) }
|
func init() { chat.Index.Register(Index, nil, DESKTOP, APPLICATIONS) }
|
||||||
|
|
||||||
@ -27,17 +24,13 @@ func PodCmdAction(arg ...string) ice.Actions {
|
|||||||
file := kit.FileLine(2, 100)
|
file := kit.FileLine(2, 100)
|
||||||
return ice.Actions{
|
return ice.Actions{
|
||||||
mdb.SELECT: {Name: "list hash auto create", Hand: func(m *ice.Message, arg ...string) {
|
mdb.SELECT: {Name: "list hash auto create", Hand: func(m *ice.Message, arg ...string) {
|
||||||
msg := m.Spawn()
|
defer m.Display(ctx.FileURI(file))
|
||||||
mdb.HashSelect(msg, arg...).Sort(mdb.NAME)
|
msg := mdb.HashSelect(m.Spawn(), arg...).Sort(mdb.NAME)
|
||||||
web.PushPodCmd(msg, m.PrefixKey(), arg...)
|
web.PushPodCmd(msg, m.PrefixKey(), arg...)
|
||||||
has := map[string]bool{}
|
has := map[string]bool{}
|
||||||
msg.Table(func(index int, value ice.Maps, head []string) {
|
msg.Table(func(index int, value ice.Maps, head []string) {
|
||||||
if !has[value[ctx.INDEX]] {
|
kit.If(!has[value[ctx.INDEX]], func() { has[value[ctx.INDEX]] = true; m.Push("", value, head) })
|
||||||
has[value[ctx.INDEX]] = true
|
|
||||||
m.Push("", value, head)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
m.Display(ctx.FileURI(file))
|
|
||||||
}},
|
}},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -46,10 +39,10 @@ func CmdHashAction(arg ...string) ice.Actions {
|
|||||||
return ice.MergeActions(ice.Actions{
|
return ice.MergeActions(ice.Actions{
|
||||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
switch mdb.HashInputs(m, arg); arg[0] {
|
switch mdb.HashInputs(m, arg); arg[0] {
|
||||||
case mdb.NAME:
|
|
||||||
m.Cmd(nfs.DIR, USR_ICONS, func(value ice.Maps) { m.Push(arg[0], kit.TrimExt(value[nfs.PATH], nfs.PNG)) })
|
|
||||||
case mdb.ICON:
|
case mdb.ICON:
|
||||||
m.Cmd(nfs.DIR, USR_ICONS, func(value ice.Maps) { m.Push(arg[0], value[nfs.PATH]) })
|
m.Cmd(nfs.DIR, ice.USR_ICONS, func(value ice.Maps) { m.Push(arg[0], value[nfs.PATH]) })
|
||||||
|
case mdb.NAME:
|
||||||
|
m.Cmd(nfs.DIR, ice.USR_ICONS, func(value ice.Maps) { m.Push(arg[0], kit.TrimExt(value[nfs.PATH], nfs.PNG)) })
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
mdb.SELECT: {Name: "list hash auto create", Hand: func(m *ice.Message, arg ...string) {
|
mdb.SELECT: {Name: "list hash auto create", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
@ -1,17 +1,23 @@
|
|||||||
title "MacOS"
|
title "MacOS"
|
||||||
chain `
|
chain `
|
||||||
desktop
|
desktop.go
|
||||||
menu
|
menu.go
|
||||||
notifications
|
notifications.go
|
||||||
searchs
|
searchs.go
|
||||||
session
|
session.go
|
||||||
desktop
|
dock.go
|
||||||
window
|
finder.go
|
||||||
layout
|
applications.go
|
||||||
dock
|
caculator.go
|
||||||
Finder
|
clock.go
|
||||||
Applications
|
|
||||||
Pictures
|
|
||||||
Safari
|
|
||||||
Terminal
|
|
||||||
`
|
`
|
||||||
|
chain `
|
||||||
|
desktop.js
|
||||||
|
menu.js
|
||||||
|
notifications.js
|
||||||
|
dock.js
|
||||||
|
finder.js
|
||||||
|
caculator.js
|
||||||
|
clock.js
|
||||||
|
`
|
||||||
|
|
||||||
|
@ -10,9 +10,8 @@ const MENU = "menu"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
MENU: {Actions: ice.MergeActions(aaa.RoleAction(), CmdHashAction(), mdb.ImportantHashAction())},
|
MENU: {Actions: ice.MergeActions(aaa.RoleAction(), CmdHashAction(), mdb.ClearOnExitHashAction())},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
func MenuAppend(m *ice.Message, icon, index string) {
|
|
||||||
install(m, MENU, icon, index)
|
func MenuAppend(m *ice.Message, icon, index string) { install(m, MENU, icon, index) }
|
||||||
}
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb) {
|
Volcanos(chat.ONIMPORT, {_init: function(can, msg) { can.page.style(can, can._output, html.MAX_WIDTH, "")
|
||||||
can.page.Append(can, can._output, can.user.header(can)), can.page.Append(can, can._output, [
|
can.page.Append(can, can._output, can.user.header(can)), can.page.Append(can, can._output, [
|
||||||
{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, "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") }},
|
{view: [html.ITEM], list: [{img: can.page.drawText(can, "s", 25, 0, 20)}], onclick: function(event) { can.sup.onexport.record(can, "searchs") }},
|
||||||
@ -6,6 +6,6 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb) {
|
|||||||
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) }}
|
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, "", can.ConfSpace()||can.misc.Search(can, ice.POD)||location.host], onclick: function(event) { can.sup.onexport.record(can, html.DESKTOP) }},
|
{view: [html.MENU, "", can.ConfSpace()||can.misc.Search(can, ice.POD)||location.host], onclick: function(event) { can.sup.onexport.record(can, html.DESKTOP) }},
|
||||||
{view: [[html.MENU, mdb.CREATE], "", "+"], onclick: function(event) { can.sup.onexport.record(can, mdb.CREATE) }},
|
{view: [[html.MENU, mdb.CREATE], "", can.page.unicode.create], onclick: function(event) { can.sup.onexport.record(can, mdb.CREATE) }},
|
||||||
])), cb && cb(msg), can.page.style(can, can._output, html.MAX_WIDTH, "")
|
]))
|
||||||
}})
|
}})
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"shylinux.com/x/icebergs/base/ctx"
|
"shylinux.com/x/icebergs/base/ctx"
|
||||||
"shylinux.com/x/icebergs/base/gdb"
|
"shylinux.com/x/icebergs/base/gdb"
|
||||||
"shylinux.com/x/icebergs/base/mdb"
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
|
"shylinux.com/x/icebergs/base/nfs"
|
||||||
"shylinux.com/x/icebergs/base/web"
|
"shylinux.com/x/icebergs/base/web"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -12,18 +13,19 @@ const NOTIFICATIONS = "notifications"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
NOTIFICATIONS: {Name: "notifications list", Actions: ice.MergeActions(ice.Actions{
|
NOTIFICATIONS: {Actions: ice.MergeActions(ice.Actions{
|
||||||
web.DREAM_CREATE: {Hand: func(m *ice.Message, arg ...string) {
|
web.DREAM_CREATE: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
Notify(m, "usr/icons/Launchpad.png", m.Option(mdb.NAME), "空间创建成功", ctx.INDEX, web.CHAT_IFRAME, ctx.ARGS, m.MergePod(m.Option(mdb.NAME)))
|
Notify(m, "Launchpad.png", m.Option(mdb.NAME), "空间创建成功", ctx.INDEX, web.CHAT_IFRAME, ctx.ARGS, m.MergePod(m.Option(mdb.NAME)))
|
||||||
}},
|
}},
|
||||||
"read": {Hand: func(m *ice.Message, arg ...string) {
|
"read": {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmd(mdb.MODIFY, m.PrefixKey(), "", mdb.LIST, mdb.ID, m.Option(mdb.ID), mdb.STATUS, "read")
|
m.Cmd(mdb.MODIFY, m.PrefixKey(), "", mdb.LIST, m.OptionSimple(mdb.ID), mdb.STATUS, m.ActionKey())
|
||||||
}},
|
}},
|
||||||
}, gdb.EventAction(web.DREAM_CREATE), mdb.ListAction(mdb.FIELD, "time,id,status,icon,name,text,space,index,args")), Hand: func(m *ice.Message, arg ...string) {
|
}, gdb.EventsAction(web.DREAM_CREATE), mdb.ListAction(mdb.FIELD, "time,id,status,icon,name,text,space,index,args")), Hand: func(m *ice.Message, arg ...string) {
|
||||||
mdb.ListSelect(m, arg...).Display("")
|
mdb.ListSelect(m, arg...).Display("")
|
||||||
}},
|
}},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
func Notify(m *ice.Message, icon, name, text string, arg ...string) {
|
func Notify(m *ice.Message, icon, name, text string, arg ...string) {
|
||||||
|
nfs.Exists(m, ice.USR_ICONS+icon, func(p string) { icon = p })
|
||||||
m.Cmd(NOTIFICATIONS, mdb.INSERT, mdb.ICON, icon, mdb.NAME, name, mdb.TEXT, text, arg)
|
m.Cmd(NOTIFICATIONS, mdb.INSERT, mdb.ICON, icon, mdb.NAME, name, mdb.TEXT, text, arg)
|
||||||
}
|
}
|
||||||
|
@ -3,16 +3,13 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg) {
|
|||||||
var ui = can.onappend.layout(can, [html.ICON, [[wiki.TITLE, mdb.TIME], wiki.CONTENT]], "", 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.name||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)
|
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),
|
target.onclick = function(event) { can.sup.onexport.record(can.sup, item.index, ctx.INDEX, item)
|
||||||
can.runAction(can.request(event, item), "read", [], function() {
|
can.runAction(can.request(event, item), "read", [], function() { can.onappend.style(can, "read", target) })
|
||||||
can.onappend.style(can, "read", target)
|
}
|
||||||
return
|
|
||||||
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)
|
}} })), 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, {
|
Volcanos(chat.ONACTION, {
|
||||||
list: [web.REFRESH, mdb.PRUNES, html.TOGGLE],
|
list: [web.REFRESH, mdb.PRUNES, html.TOGGLE], _trans: {refresh: "刷新", toggle: "隐藏"},
|
||||||
_trans: {refresh: "刷新", toggle: "隐藏"},
|
|
||||||
refresh: function(event, can, button) { can.Update(event) },
|
|
||||||
toggle: function(event, can, button) { can.onmotion.hidden(can, can._fields) },
|
toggle: function(event, can, button) { can.onmotion.hidden(can, can._fields) },
|
||||||
|
refresh: function(event, can, button) { can.Update(event) },
|
||||||
})
|
})
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
package macos
|
|
||||||
|
|
||||||
import (
|
|
||||||
ice "shylinux.com/x/icebergs"
|
|
||||||
"shylinux.com/x/icebergs/base/cli"
|
|
||||||
"shylinux.com/x/icebergs/base/tcp"
|
|
||||||
kit "shylinux.com/x/toolkits"
|
|
||||||
)
|
|
||||||
|
|
||||||
const OPENS = "opens"
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
Index.MergeCommands(ice.Commands{
|
|
||||||
OPENS: {Name: "opens app auto", Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
if tcp.IsLocalHost(m, m.Option(ice.MSG_USERIP)) {
|
|
||||||
arg[0] = kit.ExtChange(arg[0], "app")
|
|
||||||
cli.Opens(m, arg...)
|
|
||||||
}
|
|
||||||
}},
|
|
||||||
})
|
|
||||||
}
|
|
@ -10,7 +10,7 @@ const SEARCHS = "searchs"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
SEARCHS: {Name: "searchs keyword list", Hand: func(m *ice.Message, arg ...string) {
|
SEARCHS: {Name: "searchs keyword list", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(mdb.SEARCH, mdb.FOREACH, kit.Select("", arg, 0), "ctx,cmd,type,name,text")
|
m.Cmdy(mdb.SEARCH, mdb.FOREACH, kit.Select("", arg, 0), "ctx,cmd,type,name,text")
|
||||||
}},
|
}},
|
||||||
})
|
})
|
||||||
|
@ -9,9 +9,9 @@ const SESSION = "session"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
SESSION: {Actions: ice.MergeActions(CmdHashAction(mdb.NAME), mdb.ImportantHashAction()), Hand: func(m *ice.Message, arg ...string) {
|
SESSION: {Actions: ice.MergeActions(CmdHashAction(mdb.NAME), mdb.ExportHashAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if mdb.HashSelect(m, arg...); len(arg) > 0 {
|
if mdb.HashSelect(m, arg...); len(arg) > 0 {
|
||||||
m.EchoIFrame(m.MergePodCmd("", DESKTOP, SESSION, arg[0]))
|
m.EchoIFrame(m.MergePodCmd("", DESKTOP) + "#" + m.Append(mdb.NAME))
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
})
|
})
|
||||||
|
@ -44,7 +44,7 @@ type Client struct {
|
|||||||
user string `name:"user" help:"用户"`
|
user string `name:"user" help:"用户"`
|
||||||
orgs string `name:"orgs" help:"组织"`
|
orgs string `name:"orgs" help:"组织"`
|
||||||
repo string `name:"repo" help:"资源"`
|
repo string `name:"repo" help:"资源"`
|
||||||
list string `name:"list hash auto" help:"授权"`
|
list string `name:"list hash auto" help:"授权" icon:"oauth.png"`
|
||||||
login string `name:"login" role:"void"`
|
login string `name:"login" role:"void"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ func init() {
|
|||||||
TO = "to"
|
TO = "to"
|
||||||
)
|
)
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
TRANS: {Name: "trans from@key to@key auto", Help: "传输", Icon: "Migration.png", Actions: ice.Actions{
|
TRANS: {Name: "trans from@key to@key auto", Help: "文件传输", Icon: "Migration.png", Actions: ice.Actions{
|
||||||
SEND: {Hand: func(m *ice.Message, arg ...string) {
|
SEND: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
defer web.ToastProcess(m)()
|
defer web.ToastProcess(m)()
|
||||||
p := web.ProxyUpload(m, m.Option(FROM), m.Option(nfs.PATH))
|
p := web.ProxyUpload(m, m.Option(FROM), m.Option(nfs.PATH))
|
||||||
|
@ -15,6 +15,7 @@ import (
|
|||||||
"shylinux.com/x/icebergs/base/ssh"
|
"shylinux.com/x/icebergs/base/ssh"
|
||||||
"shylinux.com/x/icebergs/base/tcp"
|
"shylinux.com/x/icebergs/base/tcp"
|
||||||
"shylinux.com/x/icebergs/base/web"
|
"shylinux.com/x/icebergs/base/web"
|
||||||
|
"shylinux.com/x/icebergs/core/chat"
|
||||||
kit "shylinux.com/x/toolkits"
|
kit "shylinux.com/x/toolkits"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -189,10 +190,32 @@ func init() {
|
|||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) {
|
web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
kit.Switch(m.Option(mdb.TYPE), kit.Simple(web.SERVER, web.WORKER), func() { m.PushButton(kit.Dict(m.CommandKey(), "编程")) })
|
kit.Switch(m.Option(mdb.TYPE), kit.Simple(web.WORKER, web.SERVER), func() {
|
||||||
|
m.PushButton(kit.Dict(m.CommandKey(), "编程"))
|
||||||
|
})
|
||||||
}},
|
}},
|
||||||
web.DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) { web.DreamProcess(m, []string{}, arg...) }},
|
web.DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) { web.DreamProcess(m, []string{}, arg...) }},
|
||||||
}, aaa.RoleAction(), mdb.HashAction(mdb.SHORT, nfs.PATH, mdb.FIELD, "time,path", ctx.TOOLS, "xterm,compile,runtime")), Hand: func(m *ice.Message, arg ...string) {
|
chat.FAVOR_INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
switch arg[0] {
|
||||||
|
case mdb.TYPE:
|
||||||
|
m.Push(arg[0], nfs.FILE)
|
||||||
|
case mdb.TEXT:
|
||||||
|
if m.Option(mdb.TYPE) == nfs.FILE {
|
||||||
|
m.Push(arg[0], "src/main.go", "src/main.shy")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}},
|
||||||
|
chat.FAVOR_TABLES: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
kit.If(m.Option(mdb.TYPE) == nfs.FILE, func() {
|
||||||
|
m.PushButton(kit.Dict(m.CommandKey(), "源码"))
|
||||||
|
})
|
||||||
|
}},
|
||||||
|
chat.FAVOR_ACTION: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
if m.Option(mdb.TYPE) == nfs.FILE {
|
||||||
|
ctx.ProcessField(m, m.PrefixKey(), nfs.SplitPath(m, m.Option(mdb.TEXT)))
|
||||||
|
}
|
||||||
|
}},
|
||||||
|
}, chat.FavorAction(), aaa.RoleAction(), mdb.HashAction(mdb.SHORT, nfs.PATH, mdb.FIELD, "time,path", ctx.TOOLS, "xterm,compile,runtime")), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if m.Cmdy(INNER, arg); arg[0] != ctx.ACTION {
|
if m.Cmdy(INNER, arg); arg[0] != ctx.ACTION {
|
||||||
kit.If(len(arg) > 1, func() { mdb.HashCreate(m.Spawn(), nfs.PATH, path.Join(kit.Slice(arg, 0, 2)...)) })
|
kit.If(len(arg) > 1, func() { mdb.HashCreate(m.Spawn(), nfs.PATH, path.Join(kit.Slice(arg, 0, 2)...)) })
|
||||||
m.Action(nfs.SAVE, COMPILE, "show", "exec")
|
m.Action(nfs.SAVE, COMPILE, "show", "exec")
|
||||||
|
@ -15,6 +15,7 @@ import (
|
|||||||
"shylinux.com/x/icebergs/base/ssh"
|
"shylinux.com/x/icebergs/base/ssh"
|
||||||
"shylinux.com/x/icebergs/base/web"
|
"shylinux.com/x/icebergs/base/web"
|
||||||
"shylinux.com/x/icebergs/base/web/html"
|
"shylinux.com/x/icebergs/base/web/html"
|
||||||
|
"shylinux.com/x/icebergs/core/chat"
|
||||||
"shylinux.com/x/icebergs/misc/xterm"
|
"shylinux.com/x/icebergs/misc/xterm"
|
||||||
kit "shylinux.com/x/toolkits"
|
kit "shylinux.com/x/toolkits"
|
||||||
)
|
)
|
||||||
@ -71,6 +72,9 @@ func _xterm_cmds(m *ice.Message, h string, cmd string, arg ...ice.Any) {
|
|||||||
m.ProcessHold()
|
m.ProcessHold()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
SHELL = "shell"
|
||||||
|
)
|
||||||
const XTERM = "xterm"
|
const XTERM = "xterm"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -80,7 +84,7 @@ func init() {
|
|||||||
kit.If(m.Cmd("").Length() == 0, func() { m.Cmd("", mdb.CREATE, mdb.TYPE, ISH) })
|
kit.If(m.Cmd("").Length() == 0, func() { m.Cmd("", mdb.CREATE, mdb.TYPE, ISH) })
|
||||||
}},
|
}},
|
||||||
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
if arg[1] == "shell" {
|
if arg[0] == SHELL {
|
||||||
m.PushSearch(mdb.TYPE, ssh.SHELL, mdb.NAME, SH, mdb.TEXT, "/bin/sh")
|
m.PushSearch(mdb.TYPE, ssh.SHELL, mdb.NAME, SH, mdb.TEXT, "/bin/sh")
|
||||||
}
|
}
|
||||||
mdb.IsSearchPreview(m, arg, func() []string { return []string{ssh.SHELL, SH, kit.Select("/bin/sh", os.Getenv("SHELL"))} })
|
mdb.IsSearchPreview(m, arg, func() []string { return []string{ssh.SHELL, SH, kit.Select("/bin/sh", os.Getenv("SHELL"))} })
|
||||||
@ -150,7 +154,27 @@ func init() {
|
|||||||
}
|
}
|
||||||
m.ProcessHold()
|
m.ProcessHold()
|
||||||
}},
|
}},
|
||||||
}, ctx.ProcessAction(), mdb.ImportantHashAction(mdb.FIELD, "time,hash,type,name,text,path,theme,daemon")), Hand: func(m *ice.Message, arg ...string) {
|
chat.FAVOR_INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
switch arg[0] {
|
||||||
|
case mdb.TYPE:
|
||||||
|
m.Push(arg[0], SHELL)
|
||||||
|
case mdb.TEXT:
|
||||||
|
if m.Option(mdb.TYPE) == SHELL {
|
||||||
|
m.Push(arg[0], "/bin/ish", kit.Select("/bin/sh", os.Getenv("SHELL")))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}},
|
||||||
|
chat.FAVOR_TABLES: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
kit.If(m.Option(mdb.TYPE) == SHELL, func() {
|
||||||
|
m.PushButton(kit.Dict(m.CommandKey(), "终端"))
|
||||||
|
})
|
||||||
|
}},
|
||||||
|
chat.FAVOR_ACTION: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
if m.Option(mdb.TYPE) == SHELL {
|
||||||
|
ctx.ProcessField(m, m.PrefixKey(), m.Cmdx("", mdb.CREATE, mdb.TYPE, m.Option(mdb.TEXT), mdb.NAME, m.Option(mdb.NAME), mdb.TEXT, ""))
|
||||||
|
}
|
||||||
|
}},
|
||||||
|
}, chat.FavorAction(), ctx.ProcessAction(), mdb.HashAction(mdb.FIELD, "time,hash,type,name,text,path,theme,daemon")), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if mdb.HashSelect(m, arg...); len(arg) == 0 {
|
if mdb.HashSelect(m, arg...); len(arg) == 0 {
|
||||||
if m.Length() == 0 {
|
if m.Length() == 0 {
|
||||||
m.Action(mdb.CREATE)
|
m.Action(mdb.CREATE)
|
||||||
|
@ -8,6 +8,8 @@ import (
|
|||||||
"shylinux.com/x/icebergs/base/mdb"
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
"shylinux.com/x/icebergs/base/nfs"
|
"shylinux.com/x/icebergs/base/nfs"
|
||||||
"shylinux.com/x/icebergs/base/web"
|
"shylinux.com/x/icebergs/base/web"
|
||||||
|
"shylinux.com/x/icebergs/base/web/html"
|
||||||
|
"shylinux.com/x/icebergs/core/chat"
|
||||||
kit "shylinux.com/x/toolkits"
|
kit "shylinux.com/x/toolkits"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -32,7 +34,34 @@ func init() {
|
|||||||
nfs.TRASH: {Hand: func(m *ice.Message, arg ...string) {
|
nfs.TRASH: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
nfs.Trash(m, _feel_path(m, m.Option(nfs.PATH)))
|
nfs.Trash(m, _feel_path(m, m.Option(nfs.PATH)))
|
||||||
}},
|
}},
|
||||||
}, WikiAction("", "png|PNG|jpg|JPG|jpeg|mp4|m4v|mov|MOV|webm")), Hand: func(m *ice.Message, arg ...string) {
|
chat.FAVOR_INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
switch arg[0] {
|
||||||
|
case mdb.TYPE:
|
||||||
|
m.Push(arg[0], "image/png")
|
||||||
|
case mdb.TEXT:
|
||||||
|
if m.Option(mdb.TYPE) == "image/png" {
|
||||||
|
m.Cmdy(nfs.DIR, ice.USR_ICONS).CutTo(nfs.PATH, arg[0])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}},
|
||||||
|
chat.FAVOR_TABLES: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
if html.IsImage(m.Option(mdb.NAME), m.Option(mdb.TYPE)) || html.IsVideo(m.Option(mdb.NAME), m.Option(mdb.TYPE)) || html.IsAudio(m.Option(mdb.NAME), m.Option(mdb.TYPE)) {
|
||||||
|
m.PushButton(kit.Dict(m.CommandKey(), "预览"))
|
||||||
|
}
|
||||||
|
}},
|
||||||
|
chat.FAVOR_ACTION: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
if m.Option(ctx.ACTION) == m.CommandKey() {
|
||||||
|
if link := web.SHARE_LOCAL + m.Option(mdb.TEXT); html.IsImage(m.Option(mdb.NAME), m.Option(mdb.TYPE)) {
|
||||||
|
m.EchoImages(link)
|
||||||
|
} else if html.IsVideo(m.Option(mdb.NAME), m.Option(mdb.TYPE)) {
|
||||||
|
m.EchoVideos(link)
|
||||||
|
} else if html.IsAudio(m.Option(mdb.NAME), m.Option(mdb.TYPE)) {
|
||||||
|
m.EchoAudios(link)
|
||||||
|
}
|
||||||
|
m.ProcessInner()
|
||||||
|
}
|
||||||
|
}},
|
||||||
|
}, chat.FavorAction(), WikiAction("", "png|PNG|jpg|JPG|jpeg|mp4|m4v|mov|MOV|webm")), Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Option(nfs.DIR_ROOT, _feel_path(m, ""))
|
m.Option(nfs.DIR_ROOT, _feel_path(m, ""))
|
||||||
_wiki_list(m, kit.Slice(arg, 0, 1)...)
|
_wiki_list(m, kit.Slice(arg, 0, 1)...)
|
||||||
ctx.DisplayLocal(m, "")
|
ctx.DisplayLocal(m, "")
|
||||||
|
@ -1,17 +1,24 @@
|
|||||||
package wiki
|
package wiki
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
"shylinux.com/x/icebergs/base/aaa"
|
"shylinux.com/x/icebergs/base/aaa"
|
||||||
"shylinux.com/x/icebergs/base/mdb"
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
"shylinux.com/x/icebergs/base/nfs"
|
"shylinux.com/x/icebergs/base/nfs"
|
||||||
"shylinux.com/x/icebergs/base/ssh"
|
"shylinux.com/x/icebergs/base/ssh"
|
||||||
|
"shylinux.com/x/icebergs/base/web"
|
||||||
"shylinux.com/x/icebergs/core/code"
|
"shylinux.com/x/icebergs/core/code"
|
||||||
"shylinux.com/x/icebergs/misc/git"
|
"shylinux.com/x/icebergs/misc/git"
|
||||||
kit "shylinux.com/x/toolkits"
|
kit "shylinux.com/x/toolkits"
|
||||||
)
|
)
|
||||||
|
|
||||||
func _word_show(m *ice.Message, name string, arg ...string) {
|
func _word_show(m *ice.Message, name string, arg ...string) {
|
||||||
|
if strings.HasPrefix(name, "/require/") {
|
||||||
|
m.Option(nfs.CAT_CONTENT, m.Cmdx(web.SPIDE, ice.OPS, web.SPIDE_RAW, http.MethodGet, name))
|
||||||
|
}
|
||||||
m.Options(ice.MSG_ALIAS, mdb.Configv(m, mdb.ALIAS), TITLE, map[string]int{})
|
m.Options(ice.MSG_ALIAS, mdb.Configv(m, mdb.ALIAS), TITLE, map[string]int{})
|
||||||
m.Cmdy(ssh.SOURCE, name, kit.Dict(nfs.DIR_ROOT, _wiki_path(m)))
|
m.Cmdy(ssh.SOURCE, name, kit.Dict(nfs.DIR_ROOT, _wiki_path(m)))
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,8 @@ func Render(m *Message, cmd string, args ...Any) string {
|
|||||||
return kit.Format(`<img src="%s">`, arg[0])
|
return kit.Format(`<img src="%s">`, arg[0])
|
||||||
case RENDER_VIDEOS:
|
case RENDER_VIDEOS:
|
||||||
return kit.Format(`<video src="%s" controls autoplay>`, arg[0])
|
return kit.Format(`<video src="%s" controls autoplay>`, arg[0])
|
||||||
|
case RENDER_AUDIOS:
|
||||||
|
return kit.Format(`<audio src="%s" controls autoplay>`, arg[0])
|
||||||
case RENDER_IFRAME:
|
case RENDER_IFRAME:
|
||||||
return kit.Format(`<iframe src="%s"></iframe>`, arg[0])
|
return kit.Format(`<iframe src="%s"></iframe>`, arg[0])
|
||||||
case RENDER_SCRIPT:
|
case RENDER_SCRIPT:
|
||||||
@ -197,6 +199,7 @@ func (m *Message) EchoAnchor(arg ...string) *Message { return m.Echo(Render(m, R
|
|||||||
func (m *Message) EchoQRCode(src string) *Message { return m.Echo(Render(m, RENDER_QRCODE, src)) }
|
func (m *Message) EchoQRCode(src string) *Message { return m.Echo(Render(m, RENDER_QRCODE, src)) }
|
||||||
func (m *Message) EchoImages(src string) *Message { return m.Echo(Render(m, RENDER_IMAGES, src)) }
|
func (m *Message) EchoImages(src string) *Message { return m.Echo(Render(m, RENDER_IMAGES, src)) }
|
||||||
func (m *Message) EchoVideos(src string) *Message { return m.Echo(Render(m, RENDER_VIDEOS, src)) }
|
func (m *Message) EchoVideos(src string) *Message { return m.Echo(Render(m, RENDER_VIDEOS, src)) }
|
||||||
|
func (m *Message) EchoAudios(src string) *Message { return m.Echo(Render(m, RENDER_AUDIOS, src)) }
|
||||||
func (m *Message) EchoIFrame(src string) *Message { return m.Echo(Render(m, RENDER_IFRAME, src)) }
|
func (m *Message) EchoIFrame(src string) *Message { return m.Echo(Render(m, RENDER_IFRAME, src)) }
|
||||||
func (m *Message) EchoScript(arg ...string) *Message { return m.Echo(Render(m, RENDER_SCRIPT, arg)) }
|
func (m *Message) EchoScript(arg ...string) *Message { return m.Echo(Render(m, RENDER_SCRIPT, arg)) }
|
||||||
func (m *Message) EchoDownload(arg ...string) *Message {
|
func (m *Message) EchoDownload(arg ...string) *Message {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user