1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-25 17:18:05 +08:00

opt chrome

This commit is contained in:
bergyu 2021-12-29 17:23:10 +08:00
parent 160e782def
commit 7355064173
5 changed files with 52 additions and 1 deletions

View File

@ -8,6 +8,7 @@ import (
)
func _file_name(m *ice.Message, arg ...string) string {
return path.Join(ice.USR_LOCAL_EXPORT, m.Option(ice.MSG_DOMAIN), path.Join(arg[:2]...), arg[2])
return kit.Select(path.Join(ice.USR_LOCAL_EXPORT, m.Option(ice.MSG_DOMAIN), path.Join(arg[:2]...), arg[2]), arg, 3)
}
func _domain_chain(m *ice.Message, chain string) string {

2
go.sum
View File

@ -1,4 +1,6 @@
shylinux.com/x/go-qrcode v0.0.1 h1:/eOGqMj1qtgs9Ymd12zTUa1gcJZs9S92kj2lb0QzKsE=
shylinux.com/x/go-qrcode v0.0.1/go.mod h1:KAbtU+KwiiABMZ/CJ0zh9PI2AX82Uf9rRYcQ4ODm4po=
shylinux.com/x/toolkits v0.4.3 h1:eDCYnfsU5JCRU3qG9e3n15K+37TNCtje8/tyfRWauV4=
shylinux.com/x/toolkits v0.4.3/go.mod h1:8LbYHe7oxBIqb6s4MSOD+4d28QvPdvkyCVtwB/JW7AA=
shylinux.com/x/websocket v0.0.1 h1:OBc21DxqsGlQ2+Pz76xqLyDNo1LV+PUUqfWi+1PZPDE=
shylinux.com/x/websocket v0.0.1/go.mod h1:AaSpMToOxbMULKQytzczeHPuqb708vK1vrAzCxLo/XE=

44
misc/chrome/change.go Normal file
View File

@ -0,0 +1,44 @@
package chrome
import (
ice "shylinux.com/x/icebergs"
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/web"
kit "shylinux.com/x/toolkits"
)
const (
SELECTOR = "selector"
PROPERTY = "property"
)
const CHANGE = "change"
func init() {
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
CHANGE: {Name: "change", Help: "编辑", Value: kit.Data(kit.MDB_SHORT, PROPERTY)},
}, Commands: map[string]*ice.Command{
CHANGE: {Name: "change wid tid selector:text@key property:textarea@key auto export import", Help: "编辑", Action: ice.MergeAction(map[string]*ice.Action{
mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
switch arg[0] {
case SELECTOR:
m.Push(arg[0], "video")
default:
m.Cmdy(mdb.INPUTS, m.PrefixKey(), "", mdb.HASH, arg)
}
}},
}, mdb.HashAction()), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
if len(arg) < 2 || arg[2] == "" {
m.Cmdy(web.SPACE, CHROME, CHROME, kit.Slice(arg, 0, 2))
return
}
if len(arg) > 3 {
m.Cmd(mdb.INSERT, m.PrefixKey(), "", mdb.HASH, SELECTOR, arg[2], PROPERTY, arg[3])
}
msg := m.Cmd(web.SPACE, CHROME, CHROME, kit.Slice(arg, 0, 2), CHANGE, kit.Slice(arg, 2))
msg.Table(func(index int, value map[string]string, head []string) {
m.Push(kit.MDB_TEXT, kit.ReplaceAll(value[kit.MDB_TEXT], "<", "&lt;", ">", "&gt;"))
})
}},
}})
}

View File

@ -15,6 +15,7 @@ field "收藏夹" web.code.chrome.favor
field "样式表" web.code.chrome.style
field "工具箱" web.code.chrome.field
field "蜘蛛侠" web.code.chrome.spide
field "编辑器" web.code.chrome.change
field "缓存池" web.code.chrome.cache
field "相册簿" web.wiki.feel

View File

@ -11,11 +11,14 @@ const SPIDE = "spide"
func init() {
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
SPIDE: {Name: "spide wid tid cmd auto", Help: "网页爬虫", Action: map[string]*ice.Action{
SPIDE: {Name: "spide wid tid cmd auto modify", Help: "网页爬虫", Action: map[string]*ice.Action{
web.DOWNLOAD: {Name: "download", Help: "下载", Hand: func(m *ice.Message, arg ...string) {
m.Cmd(CACHE, mdb.CREATE, arg)
m.ProcessHold()
}},
mdb.MODIFY: {Name: "modify selector property:textarea", Help: "编辑", Hand: func(m *ice.Message, arg ...string) {
m.Cmd(web.SPACE, CHROME, CHROME, m.Option("wid"), m.Option("tid"), mdb.MODIFY, m.Option("selector"), m.Option("property"))
}},
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
switch msg := m.Cmd(web.SPACE, CHROME, CHROME, arg); kit.Select(SPIDE, arg, 2) {
case SPIDE: