forked from x/icebergs
opt feel
This commit is contained in:
parent
1a4add15bb
commit
60c7b3d1ca
@ -160,7 +160,7 @@ func GetFileCmd(dir string) string {
|
||||
return ""
|
||||
}
|
||||
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) {
|
||||
file = path.Join(ice.ISH_PLUGED, file)
|
||||
}
|
||||
|
@ -213,12 +213,12 @@ var bind = []string{
|
||||
func Relative(m *ice.Message, p string) string {
|
||||
for i := 0; i < len(bind); i += 2 {
|
||||
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 kit.ExtChange(p, JS)
|
||||
}
|
||||
func SplitPath(m *ice.Message, p string) []string {
|
||||
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
|
||||
}
|
||||
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) {
|
||||
p := path.Join(arg...)
|
||||
switch ls := strings.Split(p, nfs.PS); ls[0] {
|
||||
|
@ -24,24 +24,23 @@ const FEEL = "feel"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
FEEL: {Name: "feel path auto prev next record1 record2 upload actions", Icon: "Photos.png", Help: "影音媒体", Actions: ice.MergeActions(ice.Actions{
|
||||
"record1": {Help: "截图"}, "record2": {Help: "录屏"},
|
||||
FEEL: {Name: "feel path auto upload record1 record2 actions", Icon: "Photos.png", Help: "影音媒体", Actions: ice.MergeActions(ice.Actions{
|
||||
web.UPLOAD: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Option(nfs.PATH, _feel_path(m, m.Option(nfs.PATH)))
|
||||
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]))
|
||||
}},
|
||||
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) {
|
||||
switch arg[0] {
|
||||
case mdb.TYPE:
|
||||
m.Push(arg[0], "image/png")
|
||||
m.Push(arg[0], web.IMAGE_PNG)
|
||||
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])
|
||||
}
|
||||
})
|
||||
}
|
||||
}},
|
||||
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) {
|
||||
m.Option(nfs.DIR_ROOT, _feel_path(m, ""))
|
||||
_wiki_list(m, kit.Slice(arg, 0, 1)...)
|
||||
_wiki_list(m.Options(nfs.DIR_ROOT, _feel_path(m, "")), kit.Slice(arg, 0, 1)...)
|
||||
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...))
|
||||
}
|
||||
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 text
|
||||
return web.SharePath(m, text)
|
||||
}
|
||||
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) {
|
||||
@ -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 {
|
||||
msg := _option(m, m.CommandKey(), name, strings.TrimSpace(text), arg...)
|
||||
return m.Echo(nfs.Template(msg,
|
||||
kit.Keys(kit.Select(m.CommandKey(), file), nfs.HTML),
|
||||
&Message{msg},
|
||||
))
|
||||
return m.Echo(nfs.Template(msg, kit.Keys(kit.Select(m.CommandKey(), file), nfs.HTML), &Message{msg}))
|
||||
}
|
||||
|
||||
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 {
|
||||
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) {
|
||||
switch arg[0] {
|
||||
case nfs.PATH:
|
||||
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)))
|
||||
case ctx.INDEX:
|
||||
m.Cmdy(ctx.COMMAND, mdb.SEARCH, ctx.COMMAND, ice.OptionFields(ctx.INDEX))
|
||||
default:
|
||||
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
|
||||
word.go
|
||||
wiki.shy
|
||||
|
||||
feel.go
|
||||
data.go
|
||||
draw.go
|
||||
data.go
|
||||
word.go
|
||||
|
||||
title.go
|
||||
refer.go
|
||||
brief.go
|
||||
spark.go
|
||||
parse.go
|
||||
chart.go
|
||||
field.go
|
||||
|
||||
order.go
|
||||
table.go
|
||||
field.go
|
||||
chart.go
|
||||
image.go
|
||||
video.go
|
||||
audio.go
|
||||
|
||||
style.go
|
||||
iframe.go
|
||||
portal.go
|
||||
portal.js
|
||||
portal.css
|
||||
|
Loading…
x
Reference in New Issue
Block a user