diff --git a/base/web/dream.go b/base/web/dream.go index 0b102bc7..06638b4b 100644 --- a/base/web/dream.go +++ b/base/web/dream.go @@ -48,7 +48,7 @@ func _dream_list(m *ice.Message) *ice.Message { stats[ice.INIT]++ } }) - return m.Sort("status,type,name", ice.STR, ice.STR, ice.STR).StatusTimeCount(stats) + return m.Sort("status,type,name", ice.STR, ice.STR, ice.STR_R).StatusTimeCount(stats) } func _dream_start(m *ice.Message, name string) { if m.Warn(name == "", ice.ErrNotValid, mdb.NAME) { @@ -153,14 +153,14 @@ func init() { gdb.Event(m, DREAM_INPUTS, arg) } }}, - nfs.CAT: {Name: "cat file*", Hand: func(m *ice.Message, arg ...string) { + nfs.CAT: {Name: "cat file*", Help: "文件", Hand: func(m *ice.Message, arg ...string) { mdb.HashSelect(m.Spawn()).Table(func(value ice.Maps) { m.Push(mdb.NAME, value[mdb.NAME]) m.Push(mdb.TEXT, m.Cmdx(SPACE, value[mdb.NAME], nfs.CAT, m.Option(nfs.FILE))) }) m.StatusTimeCount() }}, - ice.CMD: {Name: "cmd cmd*", Hand: func(m *ice.Message, arg ...string) { + ice.CMD: {Name: "cmd cmd*", Help: "命令", Hand: func(m *ice.Message, arg ...string) { GoToast(m, "", func(toast func(string, int, int)) []string { msg := mdb.HashSelect(m.Spawn()) msg.Table(func(index int, value ice.Maps) { diff --git a/base/web/option.go b/base/web/option.go index 2ac885f2..b64d4740 100644 --- a/base/web/option.go +++ b/base/web/option.go @@ -65,7 +65,8 @@ func PushPodCmd(m *ice.Message, cmd string, arg ...string) { kit.If(m.Length() > 0 && len(m.Appendv(SPACE)) == 0, func() { m.Table(func(value ice.Maps) { m.Push(SPACE, "") }) }) list := []string{} m.Cmds(SPACE, func(value ice.Maps) { - kit.If(kit.IsIn(value[mdb.TYPE], WORKER, SERVER), func() { list = append(list, value[mdb.NAME]) }) + // kit.If(kit.IsIn(value[mdb.TYPE], WORKER, SERVER), func() { list = append(list, value[mdb.NAME]) }) + kit.If(kit.IsIn(value[mdb.TYPE], WORKER), func() { list = append(list, value[mdb.NAME]) }) }) if len(list) == 0 { return diff --git a/base/web/render.go b/base/web/render.go index 52bb648c..15d1cbb6 100644 --- a/base/web/render.go +++ b/base/web/render.go @@ -32,7 +32,7 @@ func Render(m *ice.Message, cmd string, args ...ice.Any) bool { arg := kit.Simple(args...) kit.If(len(arg) == 0, func() { args = nil }) if cmd != "" { - if cmd != ice.RENDER_DOWNLOAD || !kit.HasPrefix(arg[0], ice.USR_VOLCANOS, ice.USR_INTSHELL) { + if cmd != ice.RENDER_DOWNLOAD || !kit.HasPrefix(arg[0], ice.USR_VOLCANOS, ice.USR_INTSHELL, "src/template/", "usr/icons/", "usr/node_modules/") { defer func() { m.Logs("Render", cmd, args) }() } } @@ -179,6 +179,7 @@ const ( WIKI_WORD = "web.wiki.word" WIKI_DRAW = "web.wiki.draw" WIKI_FEEL = "web.wiki.feel" + CHAT_HEADER = "web.chat.header" CHAT_IFRAME = "web.chat.iframe" CHAT_FAVOR = "web.chat.favor" CHAT_FLOWS = "web.chat.flows" diff --git a/base/web/serve.go b/base/web/serve.go index 4a290e3a..ff7616be 100644 --- a/base/web/serve.go +++ b/base/web/serve.go @@ -68,6 +68,12 @@ func _serve_main(m *ice.Message, w http.ResponseWriter, r *http.Request) bool { return !Render(RenderMain(msg), msg.Option(ice.MSG_OUTPUT), kit.List(msg.Optionv(ice.MSG_ARGS))...) } else if p := path.Join(kit.Select(ice.USR_VOLCANOS, ice.USR_INTSHELL, msg.IsCliUA()), r.URL.Path); nfs.Exists(msg, p) { return !Render(msg, ice.RENDER_DOWNLOAD, p) + } else if p = path.Join(nfs.USR, r.URL.Path); kit.HasPrefix(r.URL.Path, "/volcanos/", "/intshell/") && nfs.Exists(msg, p) { + return !Render(msg, ice.RENDER_DOWNLOAD, p) + } else if p = strings.TrimPrefix(r.URL.Path, "/require/"); kit.HasPrefix(r.URL.Path, "/require/src/", "/require/usr/icons/", "/require/usr/icebergs/") && nfs.Exists(msg, p) { + return !Render(msg, ice.RENDER_DOWNLOAD, p) + } else if p = path.Join("usr/node_modules/", strings.TrimPrefix(r.URL.Path, "/require/modules/")); kit.HasPrefix(r.URL.Path, "/require/modules/") && nfs.Exists(msg, p) { + return !Render(msg, ice.RENDER_DOWNLOAD, p) } } else if path.Join(r.URL.Path) == nfs.PS { r.URL.Path = kit.Select(nfs.PS, mdb.Config(m, ice.MAIN)) diff --git a/core/chat/macos/caculator.css b/core/chat/macos/caculator.css new file mode 100644 index 00000000..6dc20ce0 --- /dev/null +++ b/core/chat/macos/caculator.css @@ -0,0 +1,24 @@ +fieldset.web.chat.caculator>div.output>div.display { + text-align:right; + height:80px; + width:100%; + font-size:50px; +} +fieldset.web.chat.caculator>div.output>table { + width:100%; +} +fieldset.web.chat.caculator>div.output>table td { + text-align:center; + height:80px; + width:80px; +} +fieldset.web.chat.caculator>div.output>table tr:first-child td { + background-color:#46504d; color:white; +} +fieldset.web.chat.caculator>div.output>table td:last-child { + background-color:#fb9f0d !important; color:white; +} +fieldset.web.chat.caculator>div.output>table td:hover { + background-color:var(--hover-bg-color) !important; + cursor:pointer; +} diff --git a/core/chat/macos/caculator.go b/core/chat/macos/caculator.go index a819e301..97e9db3c 100644 --- a/core/chat/macos/caculator.go +++ b/core/chat/macos/caculator.go @@ -2,14 +2,11 @@ package macos import ( ice "shylinux.com/x/icebergs" - "shylinux.com/x/icebergs/base/ctx" ) func init() { const CACULATOR = "caculator" Index.MergeCommands(ice.Commands{ - CACULATOR: {Name: "caculator refresh", Icon: "usr/icons/Caculator.png", Hand: func(m *ice.Message, arg ...string) { - ctx.DisplayLocal(m, "") - }}, + CACULATOR: {Name: "caculator refresh", Icon: "usr/icons/Caculator.png", Hand: func(m *ice.Message, arg ...string) { m.Display("") }}, }) } diff --git a/core/chat/macos/caculator.js b/core/chat/macos/caculator.js new file mode 100644 index 00000000..f47d01df --- /dev/null +++ b/core/chat/macos/caculator.js @@ -0,0 +1,57 @@ +Volcanos(chat.ONIMPORT, { + _init: function(can, msg) { + var list = [ + ["AC", "+/-", "%", "/"], + ["7", "8", "9", "*"], + ["4", "5", "6", "-"], + ["1", "2", "3", "+"], + ["0", "00", ".", "="], + ] + can.ui.display = can.page.Append(can, can._output, [{view: "display", inner: "0"}])._target + var table = can.page.Append(can, can._output, [{type: html.TABLE}])._target + can.page.Append(can, table, can.core.List(list, function(list) { + return {type: html.TR, list: can.core.List(list, function(item) { + return {type: html.TD, inner: item, onclick: function(event) { + var cb = can.ondetail[item]; cb? cb(event, can, item): ( + can.ui.display.innerHTML = can.base.trimPrefix(can.ui.display.innerHTML + item, "0") + ) + }} + }) } + })) + }, + _show: function(can) { + }, +}, [""]) +Volcanos(chat.ONACTION, { + onkeydown: function(event, can) { + switch (event.key) { + case "=": + can.ondetail[event.key](evnt, can, event.key) + case "Shift": + case "Backspace": + break + default: + can.ui.display.innerHTML += event.key + } + }, +}) +Volcanos(chat.ONDETAIL, { + "AC": function(event, can, button) { + can.ui.display.innerHTML = "0" + }, + "=": function(event, can, button) { + var list = [] + can.core.List(can.core.Split(can.ui.display.innerHTML, "", "+-*/%"), function(item) { + switch (item) { + case "+": + case "-": + case "*": + case "/": + case "%": + default: list.push(item) + } + }) + }, + "+/-": function(event, can, button) { + }, +}) diff --git a/core/chat/macos/clock.css b/core/chat/macos/clock.css new file mode 100644 index 00000000..7c57dc2f --- /dev/null +++ b/core/chat/macos/clock.css @@ -0,0 +1,4 @@ +fieldset.web.chat.clock>div.output>svg g.number text { font-family:sans-serif; font-size:48px; } +fieldset.web.chat.clock>div.output>svg g.hour line { stroke-width:8px; } +fieldset.web.chat.clock>div.output>svg g.minute line { stroke-width:4px; } +fieldset.web.chat.clock>div.output>svg g.second line { stroke-width:2px; stroke:red; } diff --git a/core/chat/macos/clock.go b/core/chat/macos/clock.go index 9b0f0b78..de9d1223 100644 --- a/core/chat/macos/clock.go +++ b/core/chat/macos/clock.go @@ -2,14 +2,11 @@ package macos import ( ice "shylinux.com/x/icebergs" - "shylinux.com/x/icebergs/base/ctx" ) func init() { const CLOCK = "clock" Index.MergeCommands(ice.Commands{ - CLOCK: {Name: "clock refresh", Icon: "usr/icons/Clock.png", Hand: func(m *ice.Message, arg ...string) { - ctx.DisplayLocal(m, "") - }}, + CLOCK: {Name: "clock refresh", Icon: "usr/icons/Clock.png", Hand: func(m *ice.Message, arg ...string) { m.Display("") }}, }) } diff --git a/core/chat/macos/clock.js b/core/chat/macos/clock.js new file mode 100644 index 00000000..02e76cf3 --- /dev/null +++ b/core/chat/macos/clock.js @@ -0,0 +1,21 @@ +Volcanos(chat.ONIMPORT, { + _init: function(can, msg, cb) { can.page.requireDraw(can, function() { + can.onmotion.hidden(can, can._status), can.base.isFunc(cb) && cb(msg) + can.onmotion.hidden(can, can._action), can.onimport._show(can) + }) }, + _show: function(can) { can.svg.Value("dominant-baseline", "middle") + can.onmotion.clear(can, can.svg), can.svg.Val(html.HEIGHT, can.ConfHeight()), can.svg.Val(html.WIDTH, can.ConfWidth()) + var x = can.ConfWidth()/2, y = can.ConfHeight()/2, r = can.base.Max(can.ConfHeight(), can.ConfWidth())/2-80, c = {x: x, y: y} + function pos(r, angle) { angle -= 90; return {x: x + r * Math.cos(angle * Math.PI / 180), y: y + r * Math.sin(angle * Math.PI / 180)} } + function line(g, c, p) { return can.onimport.draw(can, {shape: svg.LINE, points: [c, p]}, g) } + function group(name) { return can.onimport.group(can, name) } + var number = group("number"), second = group("second"), minute = group("minute"), hour = group("hour") + for (var i = 1; i <= 12; i++) { var p = pos(r, 360/12*i); can.onimport.draw(can, {shape: svg.TEXT, points: [p], style: {inner: i+""}}, number) } + can.core.Timer({internal: 100}, function(){ var t = new Date() + can.onmotion.clear(can, second), can.onmotion.clear(can, minute), can.onmotion.clear(can, hour) + line(hour, c, pos(r*0.6, t.getHours()%12*360/12+t.getMinutes()*30/60)) + line(minute, c, pos(r*0.8, t.getMinutes()*360/60)) + line(second, c, pos(r, t.getSeconds()*360/60)) + }) + }, +}, [""]) diff --git a/core/chat/macos/desktop.css b/core/chat/macos/desktop.css index 454cef4d..b6914fb3 100644 --- a/core/chat/macos/desktop.css +++ b/core/chat/macos/desktop.css @@ -12,7 +12,7 @@ fieldset.macos.desktop>div.output>fieldset.macos.notifications div.item div.titl fieldset.macos.desktop>div.output>fieldset.macos.notifications div.item div.time { font-size:var(--code-font-size); margin-top:10px; width:48px; } fieldset.macos.desktop>div.output>fieldset.macos.notifications div.item div.content { width:180px; } fieldset.macos.desktop>div.output>div.desktop:not(.select) { display:none; } -fieldset.macos.desktop>div.output>div.desktop>div.item { position:absolute; text-align:center; } +fieldset.macos.desktop>div.output>div.desktop>div.item { color:silver; position:absolute; text-align:center; } fieldset.macos.desktop>div.output>div.desktop>div.item img { object-fit:contain; height:var(--desktop-icon-size); width:var(--desktop-icon-size); } fieldset.macos.desktop>div.output>div.desktop>div.item>div.name { font-size:var(--code-font-size); width:var(--desktop-icon-size); overflow:hidden; } fieldset.macos.desktop>div.output>div.desktop>fieldset.select { z-index:1; } diff --git a/core/chat/oauth/client.go b/core/chat/oauth/client.go index 109208de..f307d317 100644 --- a/core/chat/oauth/client.go +++ b/core/chat/oauth/client.go @@ -74,8 +74,8 @@ func (s Client) Inputs(m *ice.Message, arg ...string) { } } func (s Client) Sso(m *ice.Message, arg ...string) { - mdb.Conf(m, "web.chat.header", kit.Keym(web.SSO, m.Option(mdb.NAME), web.URL), kit.MergeURL2(m.Option(web.DOMAIN), m.Option(OAUTH_URL), m.OptionSimple(CLIENT_ID), REDIRECT_URI, s.RedirectURI(m), RESPONSE_TYPE, CODE, STATE, m.Option(mdb.HASH))) - mdb.Conf(m, "web.chat.header", kit.Keym(web.SSO, m.Option(mdb.NAME), mdb.ICON), m.Option(mdb.ICON)) + mdb.Conf(m, web.CHAT_HEADER, kit.Keym(web.SSO, m.Option(mdb.NAME), web.URL), kit.MergeURL2(m.Option(web.DOMAIN), m.Option(OAUTH_URL), m.OptionSimple(CLIENT_ID), REDIRECT_URI, s.RedirectURI(m), RESPONSE_TYPE, CODE, STATE, m.Option(mdb.HASH))) + mdb.Conf(m, web.CHAT_HEADER, kit.Keym(web.SSO, m.Option(mdb.NAME), mdb.ICON), m.Option(mdb.ICON)) } func (s Client) Auth(m *ice.Message, arg ...string) { m.Options(REDIRECT_URI, s.RedirectURI(m), RESPONSE_TYPE, CODE, STATE, m.Option(mdb.HASH)) @@ -135,6 +135,5 @@ func (s Client) request(m *ice.Message, hash, api string, arg ...string) []strin m.Options(web.SPIDE_HEADER, ice.Maps{web.Authorization: msg.Append(TOKEN_PREFIX) + lex.SP + p}) }) kit.If(api == "", func() { api = path.Join(msg.Append(API_PREFIX), m.ActionKey()) }) - // kit.If(api == "", func() { api = path.Join(msg.Append(API_PREFIX), strings.ToLower(kit.FuncName(6))) }) return kit.Simple(kit.MergeURL2(msg.Append(web.DOMAIN), api), arg) } diff --git a/core/chat/sso.go b/core/chat/sso.go index 2ce14ef5..12034a92 100644 --- a/core/chat/sso.go +++ b/core/chat/sso.go @@ -21,8 +21,9 @@ func init() { web.RenderMain(m) return } - m.RenderRedirect(kit.MergeURL(m.Option(cli.BACK), ice.MSG_SESSID, m.Cmdx(web.SPACE, m.Option(web.SPACE), aaa.SESS, mdb.CREATE, - aaa.USERNAME, m.Option(ice.MSG_USERNAME), aaa.USERROLE, m.Option(ice.MSG_USERROLE), aaa.USERNICK, m.Option(ice.MSG_USERNICK), kit.Dict(ice.MSG_USERROLE, aaa.TECH)))) + msg := m.Cmd(aaa.USER, m.Option(ice.MSG_USERNAME)) + m.Cmdx(web.SPACE, m.Option(web.SPACE), aaa.USER, mdb.CREATE, msg.AppendSimple(aaa.USERNICK, aaa.USERNAME, aaa.USERROLE, aaa.USERZONE, aaa.AVATAR, aaa.AVATAR_URL, aaa.BACKGROUND, aaa.LANGUAGE)) + m.RenderRedirect(kit.MergeURL(m.Option(cli.BACK), ice.MSG_SESSID, m.Cmdx(web.SPACE, m.Option(web.SPACE), aaa.SESS, mdb.CREATE, aaa.USERNAME, m.Option(ice.MSG_USERNAME), aaa.USERROLE, m.Option(ice.MSG_USERROLE), kit.Dict(ice.MSG_USERROLE, aaa.TECH)))) }}, }) } diff --git a/core/code/compile.go b/core/code/compile.go index 8f17cd99..be95a996 100644 --- a/core/code/compile.go +++ b/core/code/compile.go @@ -74,6 +74,7 @@ func init() { }}, web.DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) { web.DreamProcess(m, []string{}, arg...) }}, }, ctx.ConfAction(cli.ENV, kit.Dict("GOPRIVATE", "shylinux.com,github.com", "GOPROXY", "https://goproxy.cn,direct", "CGO_ENABLED", "0"))), Hand: func(m *ice.Message, arg ...string) { + defer web.ToastProcess(m)() main, file, goos, arch := _compile_target(m, arg...) env := kit.Simple(cli.PATH, cli.BinPath(), cli.HOME, kit.Select(kit.Path(""), kit.Env(cli.HOME)), mdb.Configv(m, cli.ENV), m.Optionv(cli.ENV), cli.GOOS, goos, cli.GOARCH, arch) kit.If(runtime.GOOS == cli.WINDOWS, func() { env = append(env, "GOPATH", kit.HomePath(GO), "GOCACHE", kit.HomePath("go/go-build")) }) diff --git a/core/wiki/portal.go b/core/wiki/portal.go index 7e02ac4c..7b072606 100644 --- a/core/wiki/portal.go +++ b/core/wiki/portal.go @@ -2,10 +2,12 @@ package wiki import ( "path" + "strings" ice "shylinux.com/x/icebergs" "shylinux.com/x/icebergs/base/aaa" "shylinux.com/x/icebergs/base/ctx" + "shylinux.com/x/icebergs/base/lex" "shylinux.com/x/icebergs/base/mdb" "shylinux.com/x/icebergs/base/nfs" "shylinux.com/x/icebergs/base/web" @@ -14,12 +16,60 @@ import ( const PORTAL = "portal" -func init() { +func _portal_commands(m *ice.Message, arg ...string) { const ( - HEADER = "header" - NAV = "nav" - INDEX_SHY = "index.shy" + MAIN = "main" + BASE = "base" + CORE = "core" + MISC = "misc" ) + help := map[string]string{} + list := map[string][]string{} + m.Travel(func(p *ice.Context, c *ice.Context, key string, cmd *ice.Command) { + if p := kit.ExtChange(cmd.FileLine(), nfs.SHY); nfs.Exists(m, p) { + help[strings.TrimPrefix(m.PrefixKey(), "web.")] = p + } + if strings.Contains(cmd.FileLine(), ice.Info.Make.Module) || strings.HasPrefix(cmd.FileLine(), ice.Info.Make.Path+nfs.SRC) { + list[MAIN] = append(list[MAIN], m.PrefixKey()) + } else if strings.Contains(cmd.FileLine(), nfs.PS+ice.ICEBERGS) { + for _, mod := range []string{BASE, CORE, MISC} { + if strings.Contains(cmd.FileLine(), nfs.PS+mod) { + list[mod] = append(list[mod], m.PrefixKey()) + } + } + } + }) + text := []string{"navmenu `"} + for _, mod := range []string{BASE, CORE, MISC} { + text = append(text, kit.Format("%s %s/", map[string]string{MAIN: "业务模块", BASE: "基础模块", CORE: "核心模块", MISC: "其它模块"}[mod], mod)) + last := "ice" + for _, cmd := range list[mod] { + kit.If(mod != BASE, func() { cmd = strings.TrimPrefix(cmd, "web.") }) + if !strings.HasPrefix(cmd, last) { + last = strings.Split(cmd, nfs.PT)[0] + if p := path.Join(nfs.SRC_DOCUMENT, path.Join(arg...), mod, last); nfs.Exists(m, p) { + text = append(text, kit.Format(" %s %s/", last, last)) + } + } + cmd = strings.TrimPrefix(cmd, last+nfs.PT) + if p := path.Join(nfs.SRC_DOCUMENT, path.Join(arg...), mod, last, strings.Replace(cmd, nfs.PT, nfs.PS, -1)+".shy"); nfs.Exists(m, p) { + text = append(text, kit.Format(" %s %s.shy", cmd, cmd)) + } else if p, ok := help[last+nfs.PT+cmd]; ok { + text = append(text, kit.Format(" %s %s", cmd, strings.TrimPrefix(ctx.FileURI(p), "/require/"))) + } + } + } + text = append(text, "`") + m.Cmd(nfs.SAVE, path.Join(nfs.SRC_DOCUMENT, path.Join(arg...), INDEX_SHY), strings.Join(text, lex.NL)) +} + +const ( + HEADER = "header" + NAV = "nav" + INDEX_SHY = "index.shy" +) + +func init() { Index.MergeCommands(ice.Commands{ PORTAL: {Name: "portal path auto", Help: "网站门户", Actions: ice.MergeActions(ice.Actions{ nfs.PS: {Hand: func(m *ice.Message, arg ...string) { web.RenderCmd(m, "", arg) }}, @@ -37,6 +87,7 @@ func init() { web.DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) { web.DreamProcess(m, []string{}, arg...) }}, }, aaa.WhiteAction(ctx.COMMAND, ctx.RUN), aaa.RoleAction(ctx.COMMAND, ctx.RUN), ctx.CmdAction()), Hand: func(m *ice.Message, arg ...string) { if m.Push(HEADER, m.Cmdx(WORD, path.Join(nfs.SRC_DOCUMENT, INDEX_SHY))); len(arg) > 0 { + kit.If(path.Join(arg...) == "commands", func() { _portal_commands(m, arg...) }) m.Push(NAV, m.Cmdx(WORD, path.Join(nfs.SRC_DOCUMENT, path.Join(arg...), INDEX_SHY))) } m.Display("") diff --git a/core/wiki/portal.js b/core/wiki/portal.js index 6b9863b5..50847c19 100644 --- a/core/wiki/portal.js +++ b/core/wiki/portal.js @@ -1,11 +1,11 @@ Volcanos(chat.ONIMPORT, { - _init: function(can, msg) { can.require(["/plugin/local/wiki/word.js"]), can.Conf(html.PADDING, can.user.isMobile? 10: 40) - can.db = {nav: {}} - var p = "/cmd/web.wiki.portal" + _init: function(can, msg) { var p = "/cmd/web.wiki.portal" can.db.prefix = location.pathname.indexOf(p) > 0? location.pathname.split(p)[0]+p: "/wiki/portal/" can.db.current = can.isCmdMode()? can.base.trimPrefix(location.pathname, can.db.prefix+"/", can.db.prefix): can.Option(nfs.PATH) - can.onmotion.clear(can) - can.sup.onexport.link = function() { return can.db.prefix } + can.sup.onexport.link = function() { return can.db.prefix } + can.require(["/plugin/local/wiki/word.js"]), can.Conf(html.PADDING, can.user.isMobile? 10: 40) + can.onmotion.clear(can), can.isCmdMode() && can.onappend.style(can, html.OUTPUT) + if (can.isCmdMode()) { can.ConfHeight(can.page.height()), can.ConfWidth(can.page.width()) } can.ui = can.onappend.layout(can, [html.HEADER, [html.NAV, html.MAIN, html.ASIDE]], html.FLOW), can.onimport._scroll(can) can.ui.header.innerHTML = msg.Append(html.HEADER), can.ui.nav.innerHTML = msg.Append(html.NAV) if (msg.Append(html.NAV) == "") { @@ -16,12 +16,13 @@ Volcanos(chat.ONIMPORT, { if (can.ConfWidth() < 1000) { can.onmotion.hidden(can, can.ui.aside) } can.page.ClassList.del(can, can._fields, ice.HOME) } - can.isCmdMode() || can.onimport.layout(can, can.ConfHeight(), can.ConfWidth()) + can.db.nav = {} 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]) meta.style && can.page.style(can, target, can.base.Obj(meta.style)) }) - var file = can.db.current+(can.isCmdMode()? can.base.trimPrefix(location.hash, "#"): can.Option(nfs.FILE)) + var file = can.isCmdMode()? can.base.trimPrefix(location.hash, "#"): can.Option(nfs.FILE) + can.base.beginWith(file, nfs.SRC, nfs.USR) || (file = can.db.current+file) var nav = can.db.nav[file]; nav && nav.click() }, _scroll: function(can) { can.ui.main.onscroll = function(event) { var top = can.ui.main.scrollTop, select @@ -43,21 +44,20 @@ Volcanos(chat.ONIMPORT, { target.onclick = function(event) { can.onaction.route(event, can, item.route) } }, content: function(can, file) { - can.runActionCommand(event, web.WIKI_WORD, [nfs.SRC_DOCUMENT+can.db.current+file], function(msg) { can.ui.main.innerHTML = msg.Result(), can.onmotion.clear(can, can.ui.aside) + can.runActionCommand(event, web.WIKI_WORD, [(can.base.beginWith(file, "usr/", "src/")? "": nfs.SRC_DOCUMENT+can.db.current)+file], function(msg) { can.ui.main.innerHTML = msg.Result(), can.onmotion.clear(can, can.ui.aside) can.onimport._display(can, can.ui.main, function(target, meta) { meta.type == wiki.TITLE && can.onappend.style(can, meta.name, target._menu = can.onimport.item(can, {name: meta.text}, function(event) { target.scrollIntoView() }, function() {}, can.ui.aside)) }), can.onmotion.select(can, can.ui.aside, html.DIV_ITEM, 0) }) }, layout: function(can, height, width) { can.onmotion.delay(can, function() { padding = can.Conf(html.PADDING) - if (can.isCmdMode()) { can.onappend.style(can, html.OUTPUT), can.ConfHeight(can.page.height()), can.ConfWidth(can.page.width()) } can.ui.layout(height, width), can.ConfHeight(can.ui.main.offsetHeight), can.ConfWidth(can.ui.main.offsetWidth) if (can.user.isMobile && can.isCmdMode()) { can.page.style(can, can.ui.nav, html.HEIGHT, "", html.WIDTH, can.ConfWidth(can.page.width())) can.page.style(can, can.ui.main, html.HEIGHT, "", html.WIDTH, can.ConfHeight(can.page.width())) } can.core.List(can._plugins, function(sub) { sub.onimport.size(sub, can.base.Min(can.ConfHeight()/2, 300, 600), sub.Conf("_width")||(can.ConfWidth()-2*padding), true) }) - }, 100) }, + }, 10) }, }, [""]) Volcanos(chat.ONACTION, { route: function(event, can, route, internal) { @@ -65,7 +65,11 @@ Volcanos(chat.ONACTION, { if (!internal) { var params = ""; (can.misc.Search(can, log.DEBUG) == ice.TRUE && (params = "?debug=true")) if (link == nfs.PS) { return can.isCmdMode()? can.user.jumps(can.db.prefix+params): (can.Option(nfs.PATH, ""), can.Update()) } if (can.base.beginWith(link, web.HTTP, nfs.PS)) { return can.user.opens(link) } - if (link.indexOf(can.db.current) < 0 || link.endsWith(nfs.PS)) { return can.isCmdMode()? can.user.jumps(can.base.Path(can.db.prefix, link)+params): (can.Option(nfs.PATH, link), can.Update()) } + if (!can.base.beginWith(link, nfs.SRC, nfs.USR)) { + if (link.indexOf(can.db.current) < 0 || link.endsWith(nfs.PS)) { + return can.isCmdMode()? can.user.jumps(can.base.Path(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) if (can.onmotion.cache(can, function(save, load) { save({plugins: can._plugins}) diff --git a/core/wiki/title.go b/core/wiki/title.go index 48f3c01c..fed68731 100644 --- a/core/wiki/title.go +++ b/core/wiki/title.go @@ -20,7 +20,7 @@ func _title_parse(m *ice.Message, text string) string { list = list[:len(list)-1] } if len(ls) > 1 { - kit.If(!kit.HasPrefix(ls[1], nfs.PS, web.HTTP), func() { + kit.If(!kit.HasPrefix(ls[1], nfs.PS, web.HTTP, nfs.SRC, nfs.USR), func() { ls[1] = path.Join(kit.Select(path.Dir(m.Option(ice.MSG_SCRIPT)), list, -1), ls[1]) + kit.Select("", nfs.PS, strings.HasSuffix(ls[1], nfs.PS)) }) } diff --git a/misc/git/search.shy b/misc/git/search.shy new file mode 100644 index 00000000..62f11c07 --- /dev/null +++ b/misc/git/search.shy @@ -0,0 +1,3 @@ +title "web.code.git.search" +spark `search 命令,代码平台。` +