mirror of
https://shylinux.com/x/icebergs
synced 2025-05-03 03:57:01 +08:00
opt vimer.css
This commit is contained in:
parent
48eab473bd
commit
bdc6a96a0d
@ -36,7 +36,7 @@ func Render(m *ice.Message, cmd string, args ...ice.Any) bool {
|
||||
if len(arg) == 0 {
|
||||
args = nil
|
||||
}
|
||||
if cmd != "" {
|
||||
if cmd != "" && cmd != ice.RENDER_DOWNLOAD {
|
||||
defer func() { m.Logs("Render", cmd, args) }()
|
||||
}
|
||||
switch cmd {
|
||||
@ -159,20 +159,30 @@ func RenderIndex(m *ice.Message, repos string, file ...string) *ice.Message {
|
||||
}
|
||||
func RenderMain(m *ice.Message, pod, index string, arg ...ice.Any) *ice.Message {
|
||||
if script := m.Cmdx(Space(m, pod), nfs.CAT, kit.Select(ice.SRC_MAIN_JS, index)); script != "" {
|
||||
return m.Echo(kit.Format(_main_template, script)).RenderResult()
|
||||
return m.Echo(kit.Renders(_main_template, ice.Maps{
|
||||
"version": renderVersion(m), "script": script,
|
||||
})).RenderResult()
|
||||
}
|
||||
return RenderIndex(m, ice.VOLCANOS)
|
||||
}
|
||||
func RenderCmd(m *ice.Message, cmd string, arg ...ice.Any) {
|
||||
RenderPodCmd(m, "", cmd, arg...)
|
||||
}
|
||||
func RenderPodCmd(m *ice.Message, pod, cmd string, arg ...ice.Any) {
|
||||
msg := m.Cmd(Space(m, pod), ctx.COMMAND, kit.Select("web.wiki.word", cmd))
|
||||
list := kit.Format(kit.List(kit.Dict(msg.AppendSimple(mdb.NAME, mdb.HELP),
|
||||
ctx.INDEX, cmd, ctx.ARGS, kit.Simple(arg), ctx.DISPLAY, m.Option(ice.MSG_DISPLAY),
|
||||
mdb.LIST, kit.UnMarshal(msg.Append(mdb.LIST)), mdb.META, kit.UnMarshal(msg.Append(mdb.META)),
|
||||
)))
|
||||
m.Echo(kit.Format(_cmd_template, list)).RenderResult()
|
||||
m.Echo(kit.Renders(_cmd_template, ice.Maps{
|
||||
"version": renderVersion(m), "list": list,
|
||||
})).RenderResult()
|
||||
}
|
||||
func RenderCmd(m *ice.Message, cmd string, arg ...ice.Any) {
|
||||
RenderPodCmd(m, "", cmd, arg...)
|
||||
func renderVersion(m *ice.Message) string {
|
||||
if strings.Contains(m.R.URL.RawQuery, "debug=true") {
|
||||
return kit.Format("?_v=%v&_t=%d", ice.Info.Make.Version, time.Now().Unix())
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var _main_template = `<!DOCTYPE html>
|
||||
@ -180,13 +190,14 @@ var _main_template = `<!DOCTYPE html>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=0.8,maximum-scale=0.8,user-scalable=no">
|
||||
<meta charset="utf-8"><title>volcanos</title>
|
||||
<link href="/favicon.ico" rel="shortcut icon" type="image/ico">
|
||||
<link href="/page/cache.css" rel="stylesheet">
|
||||
<link href="/page/index.css" rel="stylesheet">
|
||||
<link href="/page/cache.css{{.version}}" rel="stylesheet">
|
||||
<link href="/page/index.css{{.version}}" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<script src="/proto.js"></script>
|
||||
<script src="/page/cache.js"></script>
|
||||
<script>%s</script>
|
||||
<script src="/proto.js{{.version}}"></script>
|
||||
<script>Volcanos.meta.version = "{{.version}}"</script>
|
||||
<script src="/page/cache.js{{.version}}"></script>
|
||||
<script>{{.script}}</script>
|
||||
</body>
|
||||
`
|
||||
|
||||
@ -194,9 +205,10 @@ var _cmd_template = `<!DOCTYPE html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=0.8,maximum-scale=0.8,user-scalable=no">
|
||||
<meta charset="utf-8"><title>volcanos</title>
|
||||
<link href="/page/can.css" rel="stylesheet">
|
||||
<link href="/page/can.css{{.version}}" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<script src="/page/can.js"></script><script>Volcanos(%s)</script>
|
||||
<script>_version = "{{.version}}"</script>
|
||||
<script src="/page/can.js{{.version}}"></script><script>Volcanos({{.list}})</script>
|
||||
</body>
|
||||
`
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/web"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
|
||||
@ -12,7 +13,8 @@ func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
HTML: {Name: "html path auto", Help: "网页", Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Echo(`<iframe src="%s"></iframe>`, kit.MergeURL(path.Join("/require/", arg[2], arg[1]), "_", kit.Hashs("uniq")))
|
||||
p := kit.MergeURL(path.Join("/require/", arg[2], arg[1]), "_", kit.Hashs("uniq"))
|
||||
m.Push(mdb.LINK, p).Echo(`<iframe src="%s"></iframe>`, p).StatusTime(web.LINK, p)
|
||||
}},
|
||||
}, PlugAction())},
|
||||
})
|
||||
|
@ -81,7 +81,7 @@ func _js_exec(m *ice.Message, arg ...string) {
|
||||
}
|
||||
ctx.DisplayBase(m, path.Join("/require", path.Join(arg[2], arg[1])))
|
||||
key := ctx.GetFileCmd(kit.Replace(path.Join(arg[2], arg[1]), ".js", ".go"))
|
||||
ctx.ProcessCommand(m, kit.Select("can.code.inner._plugin", key), kit.Simple())
|
||||
ctx.ProcessCommand(m, kit.Select("can.plugin", key), kit.Simple())
|
||||
return
|
||||
args := kit.Simple("node", "-e", kit.Join(_js_main_script(m, arg...), ice.NL))
|
||||
m.Cmdy(cli.SYSTEM, args).StatusTime(ctx.ARGS, kit.Join(append([]string{ice.ICE_BIN, m.PrefixKey(), m.ActionKey()}, arg...), ice.SP))
|
||||
@ -94,7 +94,7 @@ const JSON = "json"
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
JS: {Name: "js path auto", Help: "前端", Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) { _js_show(m, arg...) }},
|
||||
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) { _js_exec(m, arg...) }},
|
||||
mdb.ENGINE: {Hand: func(m *ice.Message, arg ...string) { _js_exec(m, arg...) }},
|
||||
|
||||
TEMPLATE: {Hand: func(m *ice.Message, arg ...string) { m.Echo(_js_template) }},
|
||||
@ -110,12 +110,12 @@ func init() {
|
||||
} else if strings.HasSuffix(m.Option(mdb.TEXT), ice.PT) { // 方法
|
||||
key := kit.Slice(kit.Split(m.Option(mdb.TEXT), "\t ."), -1)[0]
|
||||
switch key {
|
||||
case "msg":
|
||||
m.Cmdy("web.code.vim.tags", "msg").Cut("name,text")
|
||||
case "can":
|
||||
m.Cmdy("web.code.vim.tags").Cut(mdb.ZONE)
|
||||
case "msg":
|
||||
m.Cmdy("web.code.vim.tags", key).Cut("name,text")
|
||||
default:
|
||||
m.Cmdy("web.code.vim.tags", strings.TrimPrefix(m.Option(mdb.TYPE), "can.")).Cut("name,text")
|
||||
m.Cmdy("web.code.vim.tags", key).Cut("name,text")
|
||||
}
|
||||
|
||||
} else { // 类型
|
||||
|
@ -81,9 +81,8 @@ func _field_show(m *ice.Message, name, text string, arg ...string) {
|
||||
msg.Echo(strings.TrimSpace(arg[i+1]))
|
||||
}
|
||||
kit.Value(meta, "msg", msg.FormatMeta(), kit.Keys(FEATURE, "mode"), "simple")
|
||||
|
||||
if text == "web.code.inner" {
|
||||
kit.Value(meta, kit.Keys(FEATURE, "display"), "/plugin/local/code/inner.js")
|
||||
kit.Value(meta, kit.Keys(FEATURE, ctx.DISPLAY), "/plugin/local/code/inner.js")
|
||||
kit.Value(meta, "plug", kit.UnMarshal(m.Cmdx(mdb.PLUGIN, kit.Ext(name))))
|
||||
kit.Value(meta, ARGS, kit.List(path.Dir(name)+ice.PS, path.Base(name)))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user