forked from x/icebergs
opt feel
This commit is contained in:
parent
d92dfd27bd
commit
2dbf032e02
@ -148,6 +148,9 @@ func init() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
func Opens(m *ice.Message, arg ...string) {
|
func Opens(m *ice.Message, arg ...string) {
|
||||||
|
if len(arg) == 0 || arg[0] == "" {
|
||||||
|
return
|
||||||
|
}
|
||||||
switch runtime.GOOS {
|
switch runtime.GOOS {
|
||||||
case DARWIN:
|
case DARWIN:
|
||||||
if kit.Ext(arg[0]) == "app" {
|
if kit.Ext(arg[0]) == "app" {
|
||||||
|
@ -147,10 +147,14 @@ const RUNTIME = "runtime"
|
|||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
RUNTIME: {Name: "runtime info=bootinfo,ifconfig,diskinfo,hostinfo,userinfo,procstat,procinfo,bootinfo,api,cli,cmd,mod,env,path,chain,routine auto", Help: "运行环境", Actions: ice.MergeActions(ice.Actions{
|
RUNTIME: {Name: "runtime info=bootinfo,ifconfig,diskinfo,hostinfo,userinfo,procstat,procinfo,bootinfo,api,cli,cmd,mod,env,path,chain,routine auto", Help: "运行环境", Actions: ice.MergeActions(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { _runtime_init(m) }},
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
IFCONFIG: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy("tcp.host") }},
|
aaa.White(m, ice.ETC_PATH)
|
||||||
DISKINFO: {Hand: func(m *ice.Message, arg ...string) { _runtime_diskinfo(m) }},
|
aaa.White(m, ice.LICENSE)
|
||||||
HOSTINFO: {Hand: func(m *ice.Message, arg ...string) { _runtime_hostinfo(m) }},
|
_runtime_init(m)
|
||||||
|
}},
|
||||||
|
IFCONFIG: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy("tcp.host") }},
|
||||||
|
DISKINFO: {Hand: func(m *ice.Message, arg ...string) { _runtime_diskinfo(m) }},
|
||||||
|
HOSTINFO: {Hand: func(m *ice.Message, arg ...string) { _runtime_hostinfo(m) }},
|
||||||
HOSTNAME: {Hand: func(m *ice.Message, arg ...string) {
|
HOSTNAME: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
if len(arg) > 0 {
|
if len(arg) > 0 {
|
||||||
ice.Info.Hostname = mdb.Conf(m, RUNTIME, kit.Keys(NODE, mdb.NAME), mdb.Conf(m, RUNTIME, kit.Keys(BOOT, HOSTNAME), arg[0]))
|
ice.Info.Hostname = mdb.Conf(m, RUNTIME, kit.Keys(NODE, mdb.NAME), mdb.Conf(m, RUNTIME, kit.Keys(BOOT, HOSTNAME), arg[0]))
|
||||||
|
@ -112,13 +112,19 @@ const CAT = "cat"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
CAT: {Name: "cat path auto", Help: "文件", Actions: ice.MergeActions(ice.Actions{ice.CTX_INIT: mdb.AutoConfig(SOURCE, kit.DictList(
|
CAT: {Name: "cat path auto", Help: "文件", Actions: ice.MergeActions(ice.Actions{
|
||||||
HTML, CSS, JS, GO, SH, PY, SHY, CSV, JSON, CONFIGURE, PROTO, YAML, CONF, XML, YML, TXT, MD, strings.ToLower(ice.LICENSE), strings.ToLower(ice.MAKEFILE),
|
ice.CTX_INIT: mdb.AutoConfig(SOURCE, kit.DictList(
|
||||||
))}), Hand: func(m *ice.Message, arg ...string) {
|
HTML, CSS, JS, GO, SH, PY, SHY, CSV, JSON, CONFIGURE, PROTO, YAML, CONF, XML, YML, TXT, MD, strings.ToLower(ice.LICENSE), strings.ToLower(ice.MAKEFILE),
|
||||||
|
)),
|
||||||
|
}), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if len(arg) == 0 || strings.HasSuffix(arg[0], PS) {
|
if len(arg) == 0 || strings.HasSuffix(arg[0], PS) {
|
||||||
m.Cmdy(DIR, arg)
|
m.Cmdy(DIR, arg)
|
||||||
} else {
|
} else {
|
||||||
_cat_list(m.Logs(FIND, m.OptionSimple(DIR_ROOT), FILE, arg[0]), arg[0])
|
if arg[0] == "action" {
|
||||||
|
m.Cmdy(DIR, arg)
|
||||||
|
} else if !Show(m, arg[0]) {
|
||||||
|
_cat_list(m.Logs(FIND, m.OptionSimple(DIR_ROOT), FILE, arg[0]), arg[0])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
})
|
})
|
||||||
|
@ -110,7 +110,7 @@ func _dir_list(m *ice.Message, root string, dir string, level int, deep bool, di
|
|||||||
if m.IsCliUA() || m.Option(ice.MSG_USERROLE) == aaa.VOID {
|
if m.IsCliUA() || m.Option(ice.MSG_USERROLE) == aaa.VOID {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
m.PushButton(TRASH)
|
m.PushButton(mdb.SHOW, TRASH)
|
||||||
default:
|
default:
|
||||||
m.Push(field, "")
|
m.Push(field, "")
|
||||||
}
|
}
|
||||||
@ -183,6 +183,10 @@ func init() {
|
|||||||
}
|
}
|
||||||
}}, mdb.UPLOAD: {},
|
}}, mdb.UPLOAD: {},
|
||||||
TRASH: {Hand: func(m *ice.Message, arg ...string) { m.Cmd(TRASH, mdb.CREATE, m.Option(PATH)) }},
|
TRASH: {Hand: func(m *ice.Message, arg ...string) { m.Cmd(TRASH, mdb.CREATE, m.Option(PATH)) }},
|
||||||
|
mdb.SHOW: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
Show(m, m.Option(PATH))
|
||||||
|
m.ProcessInner()
|
||||||
|
}},
|
||||||
}, Hand: func(m *ice.Message, arg ...string) {
|
}, Hand: func(m *ice.Message, arg ...string) {
|
||||||
root, dir := kit.Select(PWD, m.Option(DIR_ROOT)), kit.Select(PWD, arg, 0)
|
root, dir := kit.Select(PWD, m.Option(DIR_ROOT)), kit.Select(PWD, arg, 0)
|
||||||
kit.If(strings.HasPrefix(dir, PS), func() { root = "" })
|
kit.If(strings.HasPrefix(dir, PS), func() { root = "" })
|
||||||
@ -232,6 +236,17 @@ func Dir(m *ice.Message, field string) *ice.Message {
|
|||||||
m.Copy(m.Cmd(DIR, PWD, kit.Dict(DIR_TYPE, TYPE_CAT)).Sort(field))
|
m.Copy(m.Cmd(DIR, PWD, kit.Dict(DIR_TYPE, TYPE_CAT)).Sort(field))
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
func Show(m *ice.Message, file string) bool {
|
||||||
|
switch strings.ToLower(kit.Ext(file)) {
|
||||||
|
case "png", "jpg":
|
||||||
|
m.EchoImages("/share/local/" + file)
|
||||||
|
case "mp4", "mov":
|
||||||
|
m.EchoVideos("/share/local/" + file)
|
||||||
|
default:
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
func DirDeepAll(m *ice.Message, root, dir string, cb func(ice.Maps), arg ...string) *ice.Message {
|
func DirDeepAll(m *ice.Message, root, dir string, cb func(ice.Maps), arg ...string) *ice.Message {
|
||||||
m.Options(DIR_TYPE, CAT, DIR_ROOT, root, DIR_DEEP, ice.TRUE)
|
m.Options(DIR_TYPE, CAT, DIR_ROOT, root, DIR_DEEP, ice.TRUE)
|
||||||
defer m.Options(DIR_TYPE, "", DIR_ROOT, "", DIR_DEEP, "")
|
defer m.Options(DIR_TYPE, "", DIR_ROOT, "", DIR_DEEP, "")
|
||||||
|
@ -164,8 +164,12 @@ const SERVE = "serve"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
|
"/exit": {Hand: func(m *ice.Message, arg ...string) { m.Cmd(ice.EXIT) }},
|
||||||
SERVE: {Name: "serve name auto start", Help: "服务器", Actions: ice.MergeActions(ice.Actions{
|
SERVE: {Name: "serve name auto start", Help: "服务器", Actions: ice.MergeActions(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { cli.NodeInfo(m, ice.Info.Pathname, WORKER) }},
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
cli.NodeInfo(m, ice.Info.Pathname, WORKER)
|
||||||
|
aaa.White(m, nfs.REQUIRE)
|
||||||
|
}},
|
||||||
DOMAIN: {Hand: func(m *ice.Message, arg ...string) {
|
DOMAIN: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
kit.If(len(arg) > 0, func() { ice.Info.Domain, ice.Info.Localhost = arg[0], false })
|
kit.If(len(arg) > 0, func() { ice.Info.Domain, ice.Info.Localhost = arg[0], false })
|
||||||
m.Echo(ice.Info.Domain)
|
m.Echo(ice.Info.Domain)
|
||||||
@ -175,6 +179,7 @@ func init() {
|
|||||||
}},
|
}},
|
||||||
SERVE_START: {Hand: func(m *ice.Message, arg ...string) {
|
SERVE_START: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Go(func() {
|
m.Go(func() {
|
||||||
|
cli.Opens(m, mdb.Config(m, cli.OPEN))
|
||||||
ssh.PrintQRCode(m, tcp.PublishLocalhost(m, _serve_address(m)))
|
ssh.PrintQRCode(m, tcp.PublishLocalhost(m, _serve_address(m)))
|
||||||
return
|
return
|
||||||
opened := false
|
opened := false
|
||||||
|
@ -49,7 +49,7 @@ const VIMER = "vimer"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
web.Index.MergeCommands(ice.Commands{
|
web.Index.MergeCommands(ice.Commands{
|
||||||
ice.REQUIRE_SRC: {Actions: ice.MergeActions(ctx.CmdAction(), aaa.RoleAction()), Hand: func(m *ice.Message, arg ...string) { web.ShareLocalFile(m, ice.SRC, path.Join(arg...)) }},
|
ice.REQUIRE_SRC: {Actions: ctx.CmdAction(), Hand: func(m *ice.Message, arg ...string) { web.ShareLocalFile(m, ice.SRC, path.Join(arg...)) }},
|
||||||
ice.REQUIRE_USR: {Hand: func(m *ice.Message, arg ...string) { web.ShareLocalFile(m, ice.USR, path.Join(arg...)) }},
|
ice.REQUIRE_USR: {Hand: func(m *ice.Message, arg ...string) { web.ShareLocalFile(m, ice.USR, path.Join(arg...)) }},
|
||||||
ice.REQUIRE_MODULES: {Hand: func(m *ice.Message, arg ...string) {
|
ice.REQUIRE_MODULES: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
p := path.Join(ice.USR_MODULES, path.Join(arg...))
|
p := path.Join(ice.USR_MODULES, path.Join(arg...))
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"path"
|
"path"
|
||||||
|
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
|
"shylinux.com/x/icebergs/base/aaa"
|
||||||
"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"
|
||||||
@ -29,7 +30,7 @@ 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.SERVER, web.WORKER), func() { m.PushButton(kit.Dict(m.CommandKey(), "导图")) })
|
||||||
}},
|
}},
|
||||||
}, ctx.CmdAction(), WikiAction("", nfs.SVG)), Hand: func(m *ice.Message, arg ...string) {
|
}, aaa.RoleAction(ctx.COMMAND, ctx.RUN), ctx.CmdAction(), WikiAction("", nfs.SVG)), Hand: func(m *ice.Message, arg ...string) {
|
||||||
kit.If(!_wiki_list(m, arg...), func() {
|
kit.If(!_wiki_list(m, arg...), func() {
|
||||||
_wiki_show(m, arg[0])
|
_wiki_show(m, arg[0])
|
||||||
kit.If(m.IsErr(), func() { m.Option(ice.MSG_OUTPUT, "") })
|
kit.If(m.IsErr(), func() { m.Option(ice.MSG_OUTPUT, "") })
|
||||||
|
@ -3,6 +3,7 @@ package wiki
|
|||||||
import (
|
import (
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
"shylinux.com/x/icebergs/base/ctx"
|
"shylinux.com/x/icebergs/base/ctx"
|
||||||
|
"shylinux.com/x/icebergs/base/nfs"
|
||||||
kit "shylinux.com/x/toolkits"
|
kit "shylinux.com/x/toolkits"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -12,7 +13,8 @@ func init() {
|
|||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
FEEL: {Name: "feel path auto prev next record1 record2 upload actions", Help: "影音媒体", Actions: ice.MergeActions(ice.Actions{
|
FEEL: {Name: "feel path auto prev next record1 record2 upload actions", Help: "影音媒体", Actions: ice.MergeActions(ice.Actions{
|
||||||
"record1": {Help: "截图"}, "record2": {Help: "录屏"},
|
"record1": {Help: "截图"}, "record2": {Help: "录屏"},
|
||||||
}, WikiAction(ice.USR_LOCAL_IMAGE, "png|PNG|jpg|JPG|jpeg|mp4|m4v|mov|MOV|webm")), Hand: func(m *ice.Message, arg ...string) {
|
}, WikiAction("", "png|PNG|jpg|JPG|jpeg|mp4|m4v|mov|MOV|webm")), Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
kit.If(nfs.Exists(m, ice.USR_LOCAL_IMAGE), func() { m.Option(nfs.DIR_ROOT, ice.USR_LOCAL_IMAGE) })
|
||||||
_wiki_list(m, kit.Slice(arg, 0, 1)...)
|
_wiki_list(m, kit.Slice(arg, 0, 1)...)
|
||||||
ctx.DisplayLocal(m, "")
|
ctx.DisplayLocal(m, "")
|
||||||
}},
|
}},
|
||||||
|
@ -5,7 +5,7 @@ fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] { di
|
|||||||
fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] div.item { padding:20px; height:var(--portal-header-height); }
|
fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] div.item { padding:20px; height:var(--portal-header-height); }
|
||||||
fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] div.item.space { padding:0px; margin:0 40px; }
|
fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] div.item.space { padding:0px; margin:0 40px; }
|
||||||
fieldset.web.wiki.portal>div.output>div.layout { display:flex; justify-content:center; }
|
fieldset.web.wiki.portal>div.output>div.layout { display:flex; justify-content:center; }
|
||||||
fieldset.web.wiki.portal>div.output>div.layout>div.nav { padding:40px 40px; border-right:lightgray solid 1px; min-width:240px; overflow:auto; }
|
fieldset.web.wiki.portal>div.output>div.layout>div.nav { padding:40px 40px; border-right:var(--plugin-border-color) solid 1px; min-width:240px; overflow:auto; }
|
||||||
fieldset.web.wiki.portal>div.output>div.layout>div.nav div.story[data-name=navmenu] div.item { padding:5px; }
|
fieldset.web.wiki.portal>div.output>div.layout>div.nav div.story[data-name=navmenu] div.item { padding:5px; }
|
||||||
fieldset.web.wiki.portal>div.output>div.layout>div.nav div.story[data-name=navmenu] div.list { padding-left:20px; }
|
fieldset.web.wiki.portal>div.output>div.layout>div.nav div.story[data-name=navmenu] div.list { padding-left:20px; }
|
||||||
fieldset.web.wiki.portal>div.output>div.layout>div.main { padding:40px; height:600px; min-width:400px; max-width:var(--portal-max-width); overflow:auto; }
|
fieldset.web.wiki.portal>div.output>div.layout>div.main { padding:40px; height:600px; min-width:400px; max-width:var(--portal-max-width); overflow:auto; }
|
||||||
@ -14,24 +14,19 @@ fieldset.web.wiki.portal>div.output>div.layout>div.aside div.item { padding:5px;
|
|||||||
fieldset.web.wiki.portal>div.output>div.layout>div.aside div.item.section { padding-left:20px; }
|
fieldset.web.wiki.portal>div.output>div.layout>div.aside div.item.section { padding-left:20px; }
|
||||||
body.dark fieldset.web.wiki.portal>div.output>div.layout { background-color:var(--plugin-bg-color); --code-bg-color:var(--output-bg-color); }
|
body.dark fieldset.web.wiki.portal>div.output>div.layout { background-color:var(--plugin-bg-color); --code-bg-color:var(--output-bg-color); }
|
||||||
body.dark fieldset.web.wiki.portal>div.output>div.layout>div.nav { border-right:gray solid 1px; }
|
body.dark fieldset.web.wiki.portal>div.output>div.layout>div.nav { border-right:gray solid 1px; }
|
||||||
|
|
||||||
fieldset.web.wiki.portal.home>div.output>div.layout>div.main p { white-space:pre-wrap; text-align:center; }
|
fieldset.web.wiki.portal.home>div.output>div.layout>div.main p { white-space:pre-wrap; text-align:center; }
|
||||||
|
fieldset.web.wiki.portal>div.output>div.layout>div.main>* { margin:20px auto; }
|
||||||
fieldset.web.wiki.portal>div.output>div.layout>div.main>* { margin:10px auto; }
|
|
||||||
fieldset.web.wiki.portal>div.output>div.layout>div.main h2 { margin-top:40px; }
|
fieldset.web.wiki.portal>div.output>div.layout>div.main h2 { margin-top:40px; }
|
||||||
fieldset.web.wiki.portal>div.output>div.layout>div.main h3 { margin-top:20px; }
|
fieldset.web.wiki.portal>div.output>div.layout>div.main h3 { margin-top:20px; }
|
||||||
fieldset.web.wiki.portal>div.output>div.layout>div.main p code { background-color:var(--code-bg-color); color:var(--code-fg-color); padding:0 10px; }
|
fieldset.web.wiki.portal>div.output>div.layout>div.main p code {
|
||||||
fieldset.web.wiki.portal>div.output>div.layout>div.main div.story[data-type=spark][data-name=shell] { background-color:var(--code-bg-color); color:var(--code-fg-color); margin:10px auto; }
|
background-color:var(--code-bg-color); color:var(--code-fg-color); padding:0 10px;
|
||||||
fieldset.web.wiki.portal>div.output>div.layout>div.main fieldset:not(.hide) { display:flex; flex-wrap:wrap; }
|
}
|
||||||
fieldset.web.wiki.portal>div.output>div.layout>div.main fieldset.inner.output div.content {
|
fieldset.web.wiki.portal>div.output>div.layout>div.main div.story[data-type=spark][data-name=shell] {
|
||||||
background-color:var(--code-bg-color);
|
background-color:var(--code-bg-color); color:var(--code-fg-color); padding:10px; margin:10px auto;
|
||||||
color:var(--code-fg-color);
|
}
|
||||||
--code-comment:silver;
|
fieldset.web.wiki.portal>div.output>div.layout>div.main fieldset.inner.output div.content {
|
||||||
--code-keyword:orange;
|
background-color:var(--code-bg-color); color:var(--code-fg-color); padding:10px 0;
|
||||||
--code-package:silver;
|
--code-comment:silver; --code-keyword:orange; --code-package:silver;
|
||||||
--code-datatype:silver;
|
--code-datatype:silver; --code-function:cyan;
|
||||||
--code-function:cyan;
|
--code-constant:silver; --code-string:silver; --code-object:silver;
|
||||||
--code-constant:silver;
|
|
||||||
--code-string:silver;
|
|
||||||
--code-object:silver;
|
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ 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"
|
||||||
kit "shylinux.com/x/toolkits"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const PORTAL = "portal"
|
const PORTAL = "portal"
|
||||||
@ -31,7 +30,7 @@ func init() {
|
|||||||
m.Copy(m.Spawn([]byte(m.Cmdx(nfs.CAT, p))))
|
m.Copy(m.Spawn([]byte(m.Cmdx(nfs.CAT, p))))
|
||||||
} else {
|
} else {
|
||||||
ctx.Run(m, arg...)
|
ctx.Run(m, arg...)
|
||||||
m.Cmd(nfs.SAVE, p, kit.Dict(nfs.CONTENT, m.FormatMeta()))
|
m.Cmd(nfs.SAVE, p, ice.Maps{nfs.CONTENT: m.FormatMeta(), nfs.DIR_ROOT: ""})
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
}, aaa.WhiteAction(ctx.COMMAND, ctx.RUN), aaa.RoleAction(ctx.COMMAND, ctx.RUN), ctx.CmdAction()), Hand: func(m *ice.Message, arg ...string) {
|
}, aaa.WhiteAction(ctx.COMMAND, ctx.RUN), aaa.RoleAction(ctx.COMMAND, ctx.RUN), ctx.CmdAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
@ -13,6 +13,7 @@ Volcanos(chat.ONIMPORT, {
|
|||||||
can.page.styleWidth(can, can.ui.nav, 240), can.page.styleWidth(can, can.ui.aside, 200)
|
can.page.styleWidth(can, can.ui.nav, 240), can.page.styleWidth(can, can.ui.aside, 200)
|
||||||
can.page.ClassList.del(can, can._fields, ice.HOME)
|
can.page.ClassList.del(can, can._fields, ice.HOME)
|
||||||
}
|
}
|
||||||
|
can.isCmdMode() || can.onimport.layout(can, can.ConfHeight(), can.ConfWidth())
|
||||||
can.page.Select(can, can._output, wiki.STORY_ITEM, function(target) { var meta = target.dataset||{}
|
can.page.Select(can, can._output, wiki.STORY_ITEM, function(target) { var meta = target.dataset||{}
|
||||||
can.core.CallFunc([can.onimport, can.onimport[meta.name]? meta.name: meta.type||target.tagName.toLowerCase()], [can, meta, target])
|
can.core.CallFunc([can.onimport, can.onimport[meta.name]? meta.name: meta.type||target.tagName.toLowerCase()], [can, meta, target])
|
||||||
meta.style && can.page.style(can, target, can.base.Obj(meta.style))
|
meta.style && can.page.style(can, target, can.base.Obj(meta.style))
|
||||||
@ -25,14 +26,14 @@ Volcanos(chat.ONIMPORT, {
|
|||||||
select = target, can.onmotion.select(can, can.ui.aside, html.DIV_ITEM, target._menu)
|
select = target, can.onmotion.select(can, can.ui.aside, html.DIV_ITEM, target._menu)
|
||||||
} })
|
} })
|
||||||
} },
|
} },
|
||||||
navmenu: function(can, meta, target) {
|
navmenu: function(can, meta, target) { var link
|
||||||
can.onimport.list(can, can.base.Obj(meta.data), function(event, item) {
|
can.onimport.list(can, can.base.Obj(meta.data), function(event, item) {
|
||||||
can.page.Select(can, target, html.DIV_ITEM, function(target) { target != event.target && can.page.ClassList.del(can, target, html.SELECT) })
|
can.page.Select(can, target, html.DIV_ITEM, function(target) { target != event.target && can.page.ClassList.del(can, target, html.SELECT) })
|
||||||
item.list && item.list.length > 0 || can.onaction.route(event, can, item.meta.link)
|
item.list && item.list.length > 0 || can.onaction.route(event, can, item.meta.link)
|
||||||
}, target, can.page.ClassList.has(can, target.parentNode, html.HEADER)? function(target, item) {
|
}, target, can.page.ClassList.has(can, target.parentNode, html.HEADER)? function(target, item) {
|
||||||
item.meta.link == nfs.SRC_DOCUMENT+can.db.current && can.onappend.style(can, html.SELECT, target)
|
item.meta.link == nfs.SRC_DOCUMENT+can.db.current && can.onappend.style(can, html.SELECT, target)
|
||||||
}: function(target, item) { can.db.nav[can.base.trimPrefix(item.meta.link, nfs.SRC_DOCUMENT)] = target
|
}: function(target, item) { can.db.nav[can.base.trimPrefix(item.meta.link, nfs.SRC_DOCUMENT)] = target
|
||||||
location.hash || item.list && item.list.length > 0 || can.onaction.route({}, can, item.meta.link, true)
|
location.hash || item.list && item.list.length > 0 || link || (link = can.onaction.route({}, can, item.meta.link, true))
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
button: function(can, meta, target) { var item = can.base.Obj(meta.meta)
|
button: function(can, meta, target) { var item = can.base.Obj(meta.meta)
|
||||||
@ -60,7 +61,8 @@ Volcanos(chat.ONACTION, {
|
|||||||
if (link.indexOf(can.db.current) < 0 || link.endsWith(nfs.PS)) { return can.isCmdMode()? can.user.jumps(can.db.prefix+link+params): (can.Option(nfs.PATH, link), can.Update()) }
|
if (link.indexOf(can.db.current) < 0 || link.endsWith(nfs.PS)) { return can.isCmdMode()? can.user.jumps(can.db.prefix+link+params): (can.Option(nfs.PATH, link), can.Update()) }
|
||||||
}
|
}
|
||||||
var file = can.base.trimPrefix(link, can.db.current); can.isCmdMode() && can.user.jumps("#"+file)
|
var file = can.base.trimPrefix(link, can.db.current); can.isCmdMode() && can.user.jumps("#"+file)
|
||||||
if (can.onmotion.cache(can, function(cache, key) { cache[key] = can._plugins, can._plugins = cache[file]||[]; return file }, can.ui.main, can.ui.aside)) { return }
|
if (can.onmotion.cache(can, function(cache, key) { cache[key] = can._plugins, can._plugins = cache[file]||[]; return file }, can.ui.main, can.ui.aside)) { return file }
|
||||||
can.onimport.content(can, file)
|
can.onimport.content(can, file)
|
||||||
|
return link
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -35,10 +35,9 @@ func _wiki_link(m *ice.Message, text string) string {
|
|||||||
return text
|
return text
|
||||||
}
|
}
|
||||||
func _wiki_list(m *ice.Message, arg ...string) bool {
|
func _wiki_list(m *ice.Message, arg ...string) bool {
|
||||||
if m.Option(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) {
|
||||||
kit.If(m.Option(nfs.DIR_DEEP) != ice.TRUE, func() { m.Cmdy(nfs.DIR, kit.Slice(arg, 0, 1), kit.Dict(nfs.DIR_TYPE, nfs.DIR)) })
|
kit.If(m.Option(nfs.DIR_DEEP) != ice.TRUE, func() { m.Cmdy(nfs.DIR, kit.Slice(arg, 0, 1), kit.Dict(nfs.DIR_TYPE, nfs.DIR)) })
|
||||||
m.Cmdy(nfs.DIR, kit.Slice(arg, 0, 1), kit.Dict(nfs.DIR_TYPE, nfs.CAT, nfs.DIR_REG, mdb.Config(m, lex.REGEXP)))
|
m.Copy(m.Cmd(nfs.DIR, kit.Slice(arg, 0, 1), kit.Dict(nfs.DIR_TYPE, nfs.CAT, nfs.DIR_REG, mdb.Config(m, lex.REGEXP))).SortStr(nfs.PATH))
|
||||||
m.SortStrR(mdb.TIME).StatusTimeCount()
|
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
ctx.DisplayLocal(m, path.Join(kit.PathName(2), kit.Keys(kit.FileName(2), nfs.JS)))
|
ctx.DisplayLocal(m, path.Join(kit.PathName(2), kit.Keys(kit.FileName(2), nfs.JS)))
|
||||||
|
@ -47,7 +47,11 @@ func Render(m *Message, cmd string, args ...Any) string {
|
|||||||
case RENDER_IMAGES:
|
case RENDER_IMAGES:
|
||||||
return kit.Format(`<img src="%s" style="max-height:%spx; max-width:%spx">`, arg[0], m.Option(MSG_HEIGHT), m.Option(MSG_WIDTH))
|
return kit.Format(`<img src="%s" style="max-height:%spx; max-width:%spx">`, arg[0], m.Option(MSG_HEIGHT), m.Option(MSG_WIDTH))
|
||||||
case RENDER_VIDEOS:
|
case RENDER_VIDEOS:
|
||||||
return kit.Format(`<video src="%s" style="max-height:%spx; max-width:%spx" controls>`, arg[0], m.Option(MSG_HEIGHT), m.Option(MSG_WIDTH))
|
if kit.Int(m.Option(MSG_HEIGHT)) < kit.Int(m.Option(MSG_WIDTH)) {
|
||||||
|
return kit.Format(`<video src="%s" height="%s" style="max-height:%spx; max-width:%spx" controls autoplay>`, arg[0], m.Option(MSG_HEIGHT), m.Option(MSG_HEIGHT), m.Option(MSG_WIDTH))
|
||||||
|
} else {
|
||||||
|
return kit.Format(`<video src="%s" width="%s" style="max-height:%spx; max-width:%spx" controls autoplay>`, arg[0], m.Option(MSG_WIDTH), m.Option(MSG_HEIGHT), m.Option(MSG_WIDTH))
|
||||||
|
}
|
||||||
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:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user