forked from x/ContextOS
fix wiki
This commit is contained in:
parent
4b7153a9fe
commit
83c37956a7
@ -1,2 +1,4 @@
|
|||||||
~aaa
|
~aaa
|
||||||
user root shaoying shaoying
|
user root shaoying shaoying
|
||||||
|
user root oLqNu5iJYXXLbHM9WuvM0W1obfHM what
|
||||||
|
user root o978M0XIrcmco28CU1UbPgNxIL78 what
|
||||||
|
@ -548,11 +548,11 @@ var Index = &ctx.Context{Name: "mdb", Help: "数据中心",
|
|||||||
|
|
||||||
// 操作元素
|
// 操作元素
|
||||||
for i := 2; i < len(arg)-1; i += 2 {
|
for i := 2; i < len(arg)-1; i += 2 {
|
||||||
data = append(data, map[string]interface{}{"type": arg[i], "name": arg[i+1]})
|
data = append(data, map[string]interface{}{"name": arg[i], "type": arg[i+1]})
|
||||||
|
|
||||||
hi, _ := kit.Hash("type", "index", "name", arg[i])
|
hi, _ := kit.Hash("type", "index", "name", arg[i+1])
|
||||||
if index := m.Confm("note", hi); index == nil {
|
if index := m.Confm("note", hi); index == nil {
|
||||||
m.Cmd("mdb.note", "index", arg[i])
|
m.Cmd("mdb.note", "index", arg[i+1])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m.Confv("note", []string{hm, "data"}, data)
|
m.Confv("note", []string{hm, "data"}, data)
|
||||||
|
@ -208,7 +208,7 @@ var Index = &ctx.Context{Name: "chat", Help: "会议中心",
|
|||||||
cmd := strings.Split(m.Option("cmd"), " ")
|
cmd := strings.Split(m.Option("cmd"), " ")
|
||||||
if !m.Cmds("aaa.work", m.Option("bench"), "right", m.Option("username"), "mp", cmd[0]) {
|
if !m.Cmds("aaa.work", m.Option("bench"), "right", m.Option("username"), "mp", cmd[0]) {
|
||||||
m.Echo("no right %s %s", "chat", cmd[0])
|
m.Echo("no right %s %s", "chat", cmd[0])
|
||||||
} else if m.Cmdy("cli.source", m.Option("cmd")); m.Appends("redirect") {
|
} else if m.Cmdy(m.Option("cmd")); m.Appends("redirect") {
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}},
|
}},
|
||||||
|
@ -27,7 +27,9 @@ var Index = &ctx.Context{Name: "wiki", Help: "文档中心",
|
|||||||
"md": true,
|
"md": true,
|
||||||
}, Help: "路由数量"},
|
}, Help: "路由数量"},
|
||||||
"bench_disable": &ctx.Config{Name: "bench_disable", Value: "true", Help: "工作流"},
|
"bench_disable": &ctx.Config{Name: "bench_disable", Value: "true", Help: "工作流"},
|
||||||
"login_right": &ctx.Config{Name: "login_right", Value: "1", Help: "默认组件"},
|
"login": &ctx.Config{Name: "login", Value: map[string]interface{}{
|
||||||
|
"check": "false",
|
||||||
|
}, Help: "默认组件"},
|
||||||
|
|
||||||
"componet_group": &ctx.Config{Name: "component_group", Value: "index", Help: "默认组件"},
|
"componet_group": &ctx.Config{Name: "component_group", Value: "index", Help: "默认组件"},
|
||||||
"componet": &ctx.Config{Name: "componet", Value: map[string]interface{}{
|
"componet": &ctx.Config{Name: "componet", Value: map[string]interface{}{
|
||||||
@ -35,7 +37,7 @@ var Index = &ctx.Context{Name: "wiki", Help: "文档中心",
|
|||||||
map[string]interface{}{"name": "head", "template": "head"},
|
map[string]interface{}{"name": "head", "template": "head"},
|
||||||
map[string]interface{}{"name": "header", "template": "header"},
|
map[string]interface{}{"name": "header", "template": "header"},
|
||||||
map[string]interface{}{"name": "list", "template": "list",
|
map[string]interface{}{"name": "list", "template": "list",
|
||||||
"componet_ctx": "web.wiki", "componet_cmd": "wiki_list", "arguments": []interface{}{"h2", "int_r"},
|
"componet_ctx": "web.wiki", "componet_cmd": "wiki_list", "arguments": []interface{}{"time", "time_r"},
|
||||||
"pre_run": true,
|
"pre_run": true,
|
||||||
},
|
},
|
||||||
map[string]interface{}{"name": "text", "template": "text",
|
map[string]interface{}{"name": "text", "template": "text",
|
||||||
@ -49,7 +51,7 @@ var Index = &ctx.Context{Name: "wiki", Help: "文档中心",
|
|||||||
},
|
},
|
||||||
Commands: map[string]*ctx.Command{
|
Commands: map[string]*ctx.Command{
|
||||||
"wiki_list": &ctx.Command{Name: "wiki_list sort_field sort_order", Help: "wiki_list", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
"wiki_list": &ctx.Command{Name: "wiki_list sort_field sort_order", Help: "wiki_list", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
||||||
sort_field, sort_order := "h2", "int_r"
|
sort_field, sort_order := "time", "time_r"
|
||||||
if len(arg) > 0 {
|
if len(arg) > 0 {
|
||||||
sort_field, arg = arg[0], arg[1:]
|
sort_field, arg = arg[0], arg[1:]
|
||||||
}
|
}
|
||||||
|
@ -491,6 +491,8 @@ func Time(arg ...string) int {
|
|||||||
for _, v := range []string{
|
for _, v := range []string{
|
||||||
"2006-01-02 15:04:05",
|
"2006-01-02 15:04:05",
|
||||||
"2006-01-02 15:04",
|
"2006-01-02 15:04",
|
||||||
|
"2006-01-02",
|
||||||
|
"2006/01/02",
|
||||||
"01-02 15:04",
|
"01-02 15:04",
|
||||||
} {
|
} {
|
||||||
if t, e := time.ParseInLocation(v, arg[0], time.Local); e == nil {
|
if t, e := time.ParseInLocation(v, arg[0], time.Local); e == nil {
|
||||||
|
@ -5,9 +5,11 @@ var wiki = {
|
|||||||
},
|
},
|
||||||
nav: {
|
nav: {
|
||||||
min_width: 240,
|
min_width: 240,
|
||||||
|
border_width: 2,
|
||||||
},
|
},
|
||||||
article: {
|
article: {
|
||||||
padding: 20,
|
padding: 20,
|
||||||
|
max_width: 1000,
|
||||||
},
|
},
|
||||||
footer: {
|
footer: {
|
||||||
height: 40,
|
height: 40,
|
||||||
@ -29,6 +31,8 @@ function set_layout() {
|
|||||||
nav.className = "fixed"
|
nav.className = "fixed"
|
||||||
wiki.layout.article.width = window.innerWidth - nav.offsetWidth- 2*wiki.layout.article.padding
|
wiki.layout.article.width = window.innerWidth - nav.offsetWidth- 2*wiki.layout.article.padding
|
||||||
article.style.width = wiki.layout.article.width+"px"
|
article.style.width = wiki.layout.article.width+"px"
|
||||||
|
var space = wiki.layout.article.width - wiki.layout.article.max_width
|
||||||
|
article.style["margin-right"] = (space>0 ? space/2: 0) + "px"
|
||||||
} else {
|
} else {
|
||||||
nav.className = ""
|
nav.className = ""
|
||||||
article.style.width = ""
|
article.style.width = ""
|
||||||
@ -67,12 +71,13 @@ function init_layout() {
|
|||||||
|
|
||||||
header.style.height = wiki.layout.header.height+"px"
|
header.style.height = wiki.layout.header.height+"px"
|
||||||
footer.style.height = wiki.layout.footer.height+"px"
|
footer.style.height = wiki.layout.footer.height+"px"
|
||||||
nav.style.height = wiki.layout.nav.height+"px"
|
nav.style.height = wiki.layout.nav.height-wiki.layout.nav.border_width+"px"
|
||||||
nav.style.minWidth = wiki.layout.nav.min_width+"px"
|
nav.style.minWidth = wiki.layout.nav.min_width+"px"
|
||||||
nav.style.marginTop = wiki.layout.header.height+"px"
|
nav.style.marginTop = wiki.layout.header.height+"px"
|
||||||
article.style.minHeight = wiki.layout.article.min_height+"px"
|
article.style.minHeight = wiki.layout.article.min_height+"px"
|
||||||
article.style.marginTop = wiki.layout.header.height+"px"
|
article.style.marginTop = wiki.layout.header.height+"px"
|
||||||
article.style.padding = wiki.layout.article.padding+"px"
|
article.style.padding = wiki.layout.article.padding+"px"
|
||||||
|
article.style.maxWidth = wiki.layout.article.max_width+"px"
|
||||||
|
|
||||||
set_layout()
|
set_layout()
|
||||||
}
|
}
|
||||||
@ -189,14 +194,19 @@ function init_code() {
|
|||||||
function init_table(event) {
|
function init_table(event) {
|
||||||
var append = document.querySelectorAll("article table").forEach(add_sort)
|
var append = document.querySelectorAll("article table").forEach(add_sort)
|
||||||
}
|
}
|
||||||
|
function adjust() {
|
||||||
|
window.setTimeout(function(){
|
||||||
|
window.scrollBy(0, -80)
|
||||||
|
}, 100)
|
||||||
|
}
|
||||||
|
|
||||||
window.onresize = function (event) {
|
window.onresize = function (event) {
|
||||||
init_layout()
|
init_layout()
|
||||||
}
|
}
|
||||||
window.onload = function(event) {
|
window.onload = function(event) {
|
||||||
init_layout()
|
|
||||||
init_menu()
|
init_menu()
|
||||||
init_link()
|
init_link()
|
||||||
init_code()
|
init_code()
|
||||||
init_table()
|
init_table()
|
||||||
|
init_layout()
|
||||||
}
|
}
|
||||||
|
@ -52,6 +52,8 @@ header .search input:focus {
|
|||||||
nav {
|
nav {
|
||||||
overflow:auto;
|
overflow:auto;
|
||||||
float:left;
|
float:left;
|
||||||
|
max-width:400px;
|
||||||
|
border:solid 2px green;
|
||||||
}
|
}
|
||||||
nav.fixed {
|
nav.fixed {
|
||||||
position:fixed;
|
position:fixed;
|
||||||
@ -82,8 +84,8 @@ nav>ul>li>ul>li .mono {
|
|||||||
}
|
}
|
||||||
|
|
||||||
article {
|
article {
|
||||||
|
clear:both;
|
||||||
float:right;
|
float:right;
|
||||||
max-width:calc(100% - 40px);
|
|
||||||
}
|
}
|
||||||
article h2 {
|
article h2 {
|
||||||
cursor:alias;
|
cursor:alias;
|
||||||
@ -195,7 +197,7 @@ footer .title {
|
|||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><div onclick="action(event, 'toggle_list')">目录</div>
|
<li><div onclick="action(event, 'toggle_list')">目录</div>
|
||||||
<ul class="menu"></ul>
|
<ul class="menu" onclick="adjust(this)"></ul>
|
||||||
</li>
|
</li>
|
||||||
<li><div onclick="action(event, 'toggle_list')">链接</div>
|
<li><div onclick="action(event, 'toggle_list')">链接</div>
|
||||||
<ul class="link" hidden></ul>
|
<ul class="link" hidden></ul>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user