mirror of
https://shylinux.com/x/icebergs
synced 2025-04-28 18:22:02 +08:00
opt feel
This commit is contained in:
parent
1a4add15bb
commit
60c7b3d1ca
@ -160,7 +160,7 @@ func GetFileCmd(dir string) string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
func GetCmdFile(m *ice.Message, cmds string) (file string) {
|
func GetCmdFile(m *ice.Message, cmds string) (file string) {
|
||||||
m.Search(cmds, func(key string, cmd *ice.Command) {
|
m.Search(kit.Select(m.PrefixKey(), cmds), func(key string, cmd *ice.Command) {
|
||||||
if file = strings.TrimPrefix(FileURI(kit.Split(cmd.FileLine(), nfs.DF)[0]), "/require/"); !nfs.Exists(m, file) {
|
if file = strings.TrimPrefix(FileURI(kit.Split(cmd.FileLine(), nfs.DF)[0]), "/require/"); !nfs.Exists(m, file) {
|
||||||
file = path.Join(ice.ISH_PLUGED, file)
|
file = path.Join(ice.ISH_PLUGED, file)
|
||||||
}
|
}
|
||||||
|
@ -213,12 +213,12 @@ 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]) {
|
||||||
if _p := strings.Replace(p, bind[i], bind[i+1], 1); Exists(m, kit.ExtChange(_p, JS)) {
|
if _p := kit.ExtChange(strings.Replace(p, bind[i], bind[i+1], 1), JS); Exists(m, _p) {
|
||||||
return _p
|
return _p
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return p
|
return kit.ExtChange(p, JS)
|
||||||
}
|
}
|
||||||
func SplitPath(m *ice.Message, p string) []string {
|
func SplitPath(m *ice.Message, p string) []string {
|
||||||
if kit.HasPrefix(p, ice.REQUIRE_SRC, ice.REQUIRE_USR) {
|
if kit.HasPrefix(p, ice.REQUIRE_SRC, ice.REQUIRE_USR) {
|
||||||
|
@ -126,6 +126,10 @@ func IsNotValidFieldShare(m *ice.Message, msg *ice.Message) bool {
|
|||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
func SharePath(m *ice.Message, p string) string {
|
||||||
|
kit.If(!kit.HasPrefix(p, nfs.PS, ice.HTTP), func() { p = path.Join(SHARE_LOCAL, p) })
|
||||||
|
return p
|
||||||
|
}
|
||||||
func ShareLocalFile(m *ice.Message, arg ...string) {
|
func ShareLocalFile(m *ice.Message, arg ...string) {
|
||||||
p := path.Join(arg...)
|
p := path.Join(arg...)
|
||||||
switch ls := strings.Split(p, nfs.PS); ls[0] {
|
switch ls := strings.Split(p, nfs.PS); ls[0] {
|
||||||
|
@ -24,24 +24,23 @@ const FEEL = "feel"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
FEEL: {Name: "feel path auto prev next record1 record2 upload actions", Icon: "Photos.png", Help: "影音媒体", Actions: ice.MergeActions(ice.Actions{
|
FEEL: {Name: "feel path auto upload record1 record2 actions", Icon: "Photos.png", Help: "影音媒体", Actions: ice.MergeActions(ice.Actions{
|
||||||
"record1": {Help: "截图"}, "record2": {Help: "录屏"},
|
|
||||||
web.UPLOAD: {Hand: func(m *ice.Message, arg ...string) {
|
web.UPLOAD: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Option(nfs.PATH, _feel_path(m, m.Option(nfs.PATH)))
|
m.Option(nfs.PATH, _feel_path(m, m.Option(nfs.PATH)))
|
||||||
up := kit.Simple(m.Optionv(ice.MSG_UPLOAD))
|
up := kit.Simple(m.Optionv(ice.MSG_UPLOAD))
|
||||||
m.Cmdy(web.CACHE, web.WATCH, m.Option(mdb.HASH), path.Join(m.Option(nfs.PATH), up[1]))
|
m.Cmdy(web.CACHE, web.WATCH, m.Option(mdb.HASH), path.Join(m.Option(nfs.PATH), up[1]))
|
||||||
}},
|
}},
|
||||||
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, kit.Select(_feel_path(m, m.Option(nfs.PATH)), arg, 0))
|
||||||
}},
|
}},
|
||||||
chat.FAVOR_INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
chat.FAVOR_INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
switch arg[0] {
|
switch arg[0] {
|
||||||
case mdb.TYPE:
|
case mdb.TYPE:
|
||||||
m.Push(arg[0], "image/png")
|
m.Push(arg[0], web.IMAGE_PNG)
|
||||||
case mdb.TEXT:
|
case mdb.TEXT:
|
||||||
if m.Option(mdb.TYPE) == "image/png" {
|
kit.If(m.Option(mdb.TYPE) == web.IMAGE_PNG, func() {
|
||||||
m.Cmdy(nfs.DIR, ice.USR_ICONS).CutTo(nfs.PATH, arg[0])
|
m.Cmdy(nfs.DIR, ice.USR_ICONS).CutTo(nfs.PATH, arg[0])
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
chat.FAVOR_TABLES: {Hand: func(m *ice.Message, arg ...string) {
|
chat.FAVOR_TABLES: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
@ -62,8 +61,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
}, chat.FavorAction(), WikiAction("", "png|PNG|jpg|JPG|jpeg|mp4|m4v|mov|MOV|webm")), Hand: func(m *ice.Message, arg ...string) {
|
}, 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, ""))
|
_wiki_list(m.Options(nfs.DIR_ROOT, _feel_path(m, "")), kit.Slice(arg, 0, 1)...)
|
||||||
_wiki_list(m, kit.Slice(arg, 0, 1)...)
|
|
||||||
ctx.DisplayLocal(m, "")
|
ctx.DisplayLocal(m, "")
|
||||||
}},
|
}},
|
||||||
})
|
})
|
||||||
|
@ -32,8 +32,7 @@ func _wiki_path(m *ice.Message, arg ...string) string {
|
|||||||
return path.Join(mdb.Config(m, nfs.PATH), path.Join(arg...))
|
return path.Join(mdb.Config(m, nfs.PATH), path.Join(arg...))
|
||||||
}
|
}
|
||||||
func _wiki_link(m *ice.Message, text string) string {
|
func _wiki_link(m *ice.Message, text string) string {
|
||||||
kit.If(!kit.HasPrefix(text, nfs.PS, ice.HTTP), func() { text = path.Join(web.SHARE_LOCAL, _wiki_path(m, text)) })
|
return web.SharePath(m, text)
|
||||||
return text
|
|
||||||
}
|
}
|
||||||
func _wiki_list(m *ice.Message, arg ...string) bool {
|
func _wiki_list(m *ice.Message, arg ...string) bool {
|
||||||
if m.OptionDefault(nfs.DIR_ROOT, _wiki_path(m)); len(arg) == 0 || kit.HasSuffix(arg[0], nfs.PS) {
|
if m.OptionDefault(nfs.DIR_ROOT, _wiki_path(m)); len(arg) == 0 || kit.HasSuffix(arg[0], nfs.PS) {
|
||||||
@ -56,10 +55,7 @@ func _wiki_upload(m *ice.Message, dir string) {
|
|||||||
}
|
}
|
||||||
func _wiki_template(m *ice.Message, file, name, text string, arg ...string) *ice.Message {
|
func _wiki_template(m *ice.Message, file, name, text string, arg ...string) *ice.Message {
|
||||||
msg := _option(m, m.CommandKey(), name, strings.TrimSpace(text), arg...)
|
msg := _option(m, m.CommandKey(), name, strings.TrimSpace(text), arg...)
|
||||||
return m.Echo(nfs.Template(msg,
|
return m.Echo(nfs.Template(msg, kit.Keys(kit.Select(m.CommandKey(), file), nfs.HTML), &Message{msg}))
|
||||||
kit.Keys(kit.Select(m.CommandKey(), file), nfs.HTML),
|
|
||||||
&Message{msg},
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const WIKI = "wiki"
|
const WIKI = "wiki"
|
||||||
@ -77,22 +73,22 @@ func Prefix(arg ...string) string { return web.Prefix(WIKI, kit.Keys(arg)) }
|
|||||||
|
|
||||||
func WikiAction(dir string, ext ...string) ice.Actions {
|
func WikiAction(dir string, ext ...string) ice.Actions {
|
||||||
return ice.Actions{ice.CTX_INIT: mdb.AutoConfig(nfs.PATH, dir, lex.REGEXP, kit.ExtReg(ext...)),
|
return ice.Actions{ice.CTX_INIT: mdb.AutoConfig(nfs.PATH, dir, lex.REGEXP, kit.ExtReg(ext...)),
|
||||||
web.UPLOAD: {Hand: func(m *ice.Message, arg ...string) { _wiki_upload(m, m.Option(nfs.PATH)) }},
|
|
||||||
nfs.TRASH: {Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
nfs.Trash(m, _wiki_path(m, kit.Select("some", kit.Select(m.Option(nfs.PATH), arg, 0))))
|
|
||||||
}},
|
|
||||||
nfs.SAVE: {Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
_wiki_save(m, m.Option(nfs.PATH), kit.Select(m.Option(mdb.TEXT), arg, 1))
|
|
||||||
}},
|
|
||||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
switch arg[0] {
|
switch arg[0] {
|
||||||
case nfs.PATH:
|
case nfs.PATH:
|
||||||
m.Option(nfs.DIR_REG, mdb.Config(m, lex.REGEXP))
|
m.Option(nfs.DIR_REG, mdb.Config(m, lex.REGEXP))
|
||||||
m.Cmdy(nfs.DIR, path.Join(mdb.Config(m, nfs.PATH), kit.Select("", arg, 1)))
|
m.Cmdy(nfs.DIR, path.Join(mdb.Config(m, nfs.PATH), kit.Select("", arg, 1)))
|
||||||
case ctx.INDEX:
|
default:
|
||||||
m.Cmdy(ctx.COMMAND, mdb.SEARCH, ctx.COMMAND, ice.OptionFields(ctx.INDEX))
|
mdb.HashInputs(m, arg)
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
|
web.UPLOAD: {Hand: func(m *ice.Message, arg ...string) { _wiki_upload(m, m.Option(nfs.PATH)) }},
|
||||||
|
nfs.SAVE: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
_wiki_save(m, m.Option(nfs.PATH), kit.Select(m.Option(mdb.TEXT), arg, 1))
|
||||||
|
}},
|
||||||
|
nfs.TRASH: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
nfs.Trash(m, _wiki_path(m, kit.Select("some", kit.Select(m.Option(nfs.PATH), arg, 0))))
|
||||||
|
}},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,19 +1,27 @@
|
|||||||
wiki.shy
|
|
||||||
wiki.go
|
wiki.go
|
||||||
word.go
|
wiki.shy
|
||||||
|
|
||||||
feel.go
|
feel.go
|
||||||
data.go
|
|
||||||
draw.go
|
draw.go
|
||||||
|
data.go
|
||||||
|
word.go
|
||||||
|
|
||||||
title.go
|
title.go
|
||||||
refer.go
|
refer.go
|
||||||
brief.go
|
brief.go
|
||||||
spark.go
|
spark.go
|
||||||
parse.go
|
parse.go
|
||||||
chart.go
|
field.go
|
||||||
|
|
||||||
order.go
|
order.go
|
||||||
table.go
|
table.go
|
||||||
field.go
|
chart.go
|
||||||
image.go
|
image.go
|
||||||
video.go
|
video.go
|
||||||
audio.go
|
audio.go
|
||||||
|
|
||||||
|
style.go
|
||||||
|
iframe.go
|
||||||
|
portal.go
|
||||||
|
portal.js
|
||||||
|
portal.css
|
||||||
|
Loading…
x
Reference in New Issue
Block a user