1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-26 09:34:05 +08:00
This commit is contained in:
harveyshao 2021-08-12 01:52:58 +08:00
commit f18691ea29
5 changed files with 46 additions and 18 deletions

View File

@ -107,7 +107,7 @@ func _space_send(m *ice.Message, space string, arg ...string) {
} }
} }
m.Optionv(ice.MSG_OPTS, m.Optionv(ice.MSG_OPTS)) m.Optionv(ice.MSG_OPTS, m.Optionv(ice.MSG_OPTS))
m.Optionv(ice.MSG_OPTION, nil) m.Optionv(ice.MSG_OPTION, m.Optionv(ice.MSG_OPTS))
// 构造路由 // 构造路由
frame := m.Target().Server().(*Frame) frame := m.Target().Server().(*Frame)

View File

@ -96,6 +96,9 @@ var Index = &ice.Context{Name: ALPHA, Help: "英汉词典",
m.Cmdy(mdb.SELECT, m.Prefix("_cache"), "", mdb.HASH) m.Cmdy(mdb.SELECT, m.Prefix("_cache"), "", mdb.HASH)
}}, }},
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { }, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
if len(arg) < 2 {
return
}
defer m.StatusTimeCount() defer m.StatusTimeCount()
m.OptionFields("id,word,translation,definition") m.OptionFields("id,word,translation,definition")
if m.Cmdy(mdb.SELECT, m.Prefix("_cache"), "", mdb.HASH, "mw", arg[0]+arg[1]); len(m.Appendv("id")) > 0 { if m.Cmdy(mdb.SELECT, m.Prefix("_cache"), "", mdb.HASH, "mw", arg[0]+arg[1]); len(m.Appendv("id")) > 0 {

View File

@ -10,6 +10,7 @@ field chrome web.code.chrome.chrome
chapter "应用" chapter "应用"
field "同步流" web.code.chrome.sync field "同步流" web.code.chrome.sync
field "收藏夹" web.code.chrome.favor field "收藏夹" web.code.chrome.favor
field "工具箱" web.code.chrome.field
field "样式表" web.code.chrome.style field "样式表" web.code.chrome.style
field "蜘蛛侠" web.code.chrome.spide field "蜘蛛侠" web.code.chrome.spide
field "缓存池" web.code.chrome.cache field "缓存池" web.code.chrome.cache

36
misc/chrome/field.go Normal file
View File

@ -0,0 +1,36 @@
package chrome
import (
ice "github.com/shylinux/icebergs"
"github.com/shylinux/icebergs/base/mdb"
"github.com/shylinux/icebergs/base/web"
kit "github.com/shylinux/toolkits"
)
const FIELD = "field"
func init() {
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
FIELD: {Name: "field", Help: "工具", Value: kit.Data(
kit.MDB_SHORT, "zone", kit.MDB_FIELD, "time,id,index,args,style,left,top,selection",
)},
}, Commands: map[string]*ice.Command{
FIELD: {Name: "field zone id auto insert", Help: "工具", Action: ice.MergeAction(map[string]*ice.Action{
mdb.INSERT: {Name: "insert zone=golang.google.cn index=cli.system args=pwd", Help: "添加"},
SYNC: {Name: "sync hostname", Help: "同步", Hand: func(m *ice.Message, arg ...string) {
m.Cmd(FIELD, m.Option("hostname")).Table(func(index int, value map[string]string, head []string) {
m.Option(ice.MSG_OPTS, head)
for k, v := range value {
m.Option(k, v)
}
m.Cmd(web.SPACE, CHROME, CHROME, "1", m.Option("tid"), FIELD, value["index"], value["args"], value["top"])
})
}},
}, mdb.ZoneAction()), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
m.Fields(len(arg), mdb.ZONE_FIELD, m.Conf(FIELD, kit.META_FIELD))
if m.Cmdy(mdb.SELECT, m.PrefixKey(), "", mdb.ZONE, arg); len(arg) == 0 {
m.PushAction(mdb.REMOVE)
}
}},
}})
}

View File

@ -16,27 +16,15 @@ func init() {
"/page": {Name: "/page", Help: "网页", Action: map[string]*ice.Action{ "/page": {Name: "/page", Help: "网页", Action: map[string]*ice.Action{
ctx.COMMAND: {Name: "command", Help: "命令", Hand: func(m *ice.Message, arg ...string) { ctx.COMMAND: {Name: "command", Help: "命令", Hand: func(m *ice.Message, arg ...string) {
if len(arg) == 0 { if len(arg) == 0 {
m.Cmdy(STYLE, SYNC, m.OptionSimple("hostname")) m.Cmdy(STYLE, SYNC, m.OptionSimple("hostname"), ice.OptionFields(""))
m.Cmdy(FIELD, SYNC, m.OptionSimple("hostname"), ice.OptionFields(""))
switch m.Option("hostname") {
case "golang.google.cn":
m.Option("top", "200")
m.Option("selection", "word")
m.Result("web.wiki.alpha.alpha")
case "music.163.com":
m.Option("top", "200")
m.Result(SPIDE, "", m.Option("tid"))
case "localhost", "fib.woa.com":
return
}
return
m.Option("top", "200")
m.Echo("cli.runtime")
return return
} }
m.Cmdy(ctx.COMMAND, arg) m.Cmdy(ctx.COMMAND, arg)
}}, }},
FIELD: {Name: "field", Help: "执行", Hand: func(m *ice.Message, arg ...string) {
m.Cmdy(FIELD, arg)
}},
cli.RUN: {Name: "run", Help: "执行", Hand: func(m *ice.Message, arg ...string) { cli.RUN: {Name: "run", Help: "执行", Hand: func(m *ice.Message, arg ...string) {
m.Cmdy(arg) m.Cmdy(arg)
}}, }},