forked from x/ContextOS
add love.delay
This commit is contained in:
parent
935c845a8b
commit
c599beac02
@ -707,18 +707,18 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
|
|||||||
return
|
return
|
||||||
}},
|
}},
|
||||||
"date": &ctx.Command{Name: "date", Help: "日历", Form: map[string]int{"space": 1, "format": 2, "count": 1, "nature": 1, "cmd": -1}, Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
"date": &ctx.Command{Name: "date", Help: "日历", Form: map[string]int{"space": 1, "format": 2, "count": 1, "nature": 1, "cmd": -1}, Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
||||||
if m.Has("cmd") {
|
if m.Has("cmd") { // TODO 这是个漏洞
|
||||||
m.Log("fino", "what %v", m.Meta["cmd"])
|
|
||||||
m.Cmdy(m.Meta["cmd"])
|
m.Cmdy(m.Meta["cmd"])
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
show := map[int]string{0: "周日", 1: "周一", 2: "周二", 3: "周三", 4: "周四", 5: "周五", 6: "周六"}
|
show := map[int]string{0: "周日", 1: "周一", 2: "周二", 3: "周三", 4: "周四", 5: "周五", 6: "周六"}
|
||||||
|
|
||||||
|
space := m.Options("space")
|
||||||
format, format_time := "", ""
|
format, format_time := "", ""
|
||||||
if m.Has("format") {
|
if m.Has("format") {
|
||||||
format, format_time = kit.Select("%s", m.Meta["format"], 0), kit.Select("20060102", m.Meta["format"], 1)
|
format, format_time = kit.Select("%s", m.Meta["format"], 0), kit.Select("20060102", m.Meta["format"], 1)
|
||||||
}
|
}
|
||||||
space := m.Options("space")
|
|
||||||
now := kit.Times(m.Cmd("cli.time", arg).Append("datetime"))
|
now := kit.Times(m.Cmd("cli.time", arg).Append("datetime"))
|
||||||
n := kit.Int(kit.Select("1", m.Option("count")))
|
n := kit.Int(kit.Select("1", m.Option("count")))
|
||||||
if m.Has("nature") {
|
if m.Has("nature") {
|
||||||
|
@ -4,5 +4,5 @@ var version = struct {
|
|||||||
host string
|
host string
|
||||||
self int
|
self int
|
||||||
}{
|
}{
|
||||||
"2019-09-19 19:02:39", "centos", 562,
|
"2019-09-20 16:49:11", "centos", 563,
|
||||||
}
|
}
|
||||||
|
@ -1076,7 +1076,7 @@ var Index = &ctx.Context{Name: "nfs", Help: "存储中心",
|
|||||||
}},
|
}},
|
||||||
"json": &ctx.Command{Name: "json str", Help: "导入数据", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
"json": &ctx.Command{Name: "json str", Help: "导入数据", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
||||||
var data interface{}
|
var data interface{}
|
||||||
m.Assert(json.Unmarshal([]byte(arg[0]), &data))
|
m.Assert(json.Unmarshal([]byte(kit.Select("{}", arg, 0)), &data))
|
||||||
if b, e := json.MarshalIndent(data, "", " "); m.Assert(e) {
|
if b, e := json.MarshalIndent(data, "", " "); m.Assert(e) {
|
||||||
m.Echo(string(b))
|
m.Echo(string(b))
|
||||||
}
|
}
|
||||||
|
@ -1,2 +1,4 @@
|
|||||||
fieldset.item.demo div.output {
|
|
||||||
|
fieldset.item.love.date table td.today {
|
||||||
|
border:solid 2px red;
|
||||||
}
|
}
|
||||||
|
@ -2,17 +2,14 @@
|
|||||||
show: function(event) {
|
show: function(event) {
|
||||||
run(event, ["", "", "cmd", "ssh.data", "show", option.table.value], function(msg) {ctx.Table(msg, function(value) {
|
run(event, ["", "", "cmd", "ssh.data", "show", option.table.value], function(msg) {ctx.Table(msg, function(value) {
|
||||||
kit.Selector(output, ".s"+value[option.when.value].split(" ")[0].split("-").join(""), function(item) {
|
kit.Selector(output, ".s"+value[option.when.value].split(" ")[0].split("-").join(""), function(item) {
|
||||||
item.parentNode.style.backgroundColor = "red"
|
kit.classList.add(item.parentNode, "select")
|
||||||
item.parentNode.title = value[option.where.value]
|
item.parentNode.title = value[option.where.value]
|
||||||
})
|
})
|
||||||
})})
|
})})
|
||||||
},
|
},
|
||||||
show_after: function(msg) {
|
show_after: function(msg) {
|
||||||
var now = kit.format_date(new Date())
|
kit.Selector(output, ".s"+ kit.format_date().split(" ")[0].split("-").join(""), function(item) {
|
||||||
kit.Selector(output, ".s"+now.split(" ")[0].split("-").join(""), function(item) {
|
kit.classList.add(item.parentNode, "today")
|
||||||
item.parentNode.style.backgroundColor = "red"
|
|
||||||
item.innerText = "TODAY"
|
|
||||||
item.parentNode.title = "today"
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
}}}
|
}}}
|
||||||
|
@ -16,7 +16,7 @@ fun meet "第一眼" private \
|
|||||||
copy ssh.data insert _ when _ where __
|
copy ssh.data insert _ when _ where __
|
||||||
end
|
end
|
||||||
|
|
||||||
kit date "日历" "index.js" protected "cli.date" _ nature _ \
|
kit date "日历" "index.js" "index.css" protected "cli.date" _ nature _ \
|
||||||
\ space true format '<span class="%s">%s</span>' "s20060102" \
|
\ space true format '<span class="%s">%s</span>' "s20060102" \
|
||||||
text "2019-07-08" name "起始时间" \
|
text "2019-07-08" name "起始时间" \
|
||||||
text "date" name "截止时间" \
|
text "date" name "截止时间" \
|
||||||
@ -26,3 +26,16 @@ kit date "日历" "index.js" protected "cli.date" _ nature _ \
|
|||||||
button "查看" action auto \
|
button "查看" action auto \
|
||||||
button "显示" click show
|
button "显示" click show
|
||||||
|
|
||||||
|
fun delay "以后告诉你" private \
|
||||||
|
text "delay" name table imports plugin_table \
|
||||||
|
text "date" name when \
|
||||||
|
text "" name what view long \
|
||||||
|
button "记下了"
|
||||||
|
|
||||||
|
if $2 == "" || $3 == ""
|
||||||
|
copy ssh.data show _
|
||||||
|
return
|
||||||
|
end
|
||||||
|
copy ssh.data insert _ when _ what __
|
||||||
|
end
|
||||||
|
|
||||||
|
@ -75,16 +75,14 @@ function Meta(target, obj) {
|
|||||||
var text = JSON.parse(line.text)
|
var text = JSON.parse(line.text)
|
||||||
|
|
||||||
case "plugin":
|
case "plugin":
|
||||||
if (!text.name) {
|
if (!text.name) {return {}}
|
||||||
return {}
|
|
||||||
}
|
|
||||||
var id = "plugin"+this.ID()
|
var id = "plugin"+this.ID()
|
||||||
list.push({view: ["item", "fieldset", "", "field"], data: {id: id, Run: cb}, list: [
|
list.push({view: ["item", "fieldset", "", "field"], data: {id: id, Run: cb}, list: [
|
||||||
{text: [text.name+"("+text.help+")", "legend"]},
|
{text: [text.name+"("+text.help+")", "legend"]},
|
||||||
{view: ["option", "form", "", "option"], list: [{type: "input", style: {"display": "none"}}]},
|
{view: ["option", "form", "", "option"], list: [{type: "input", style: {"display": "none"}}]},
|
||||||
{view: ["output", "div", "", "output"]},
|
{view: ["output", "div", "", "output"]},
|
||||||
{script: ""+id+".Script="+(text.init||"{}")},
|
text.view?{styles: text.view}:null, text.init?{script: ""+id+".Script = "+text.init}:null,
|
||||||
{styles: text.view},
|
|
||||||
]})
|
]})
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -699,7 +697,7 @@ function Plugin(page, pane, field, runs) {
|
|||||||
var display = JSON.parse(meta.display||'{}')
|
var display = JSON.parse(meta.display||'{}')
|
||||||
var exports = JSON.parse(meta.exports||'["",""]')
|
var exports = JSON.parse(meta.exports||'["",""]')
|
||||||
var deal = (feature && feature.display) || "table"
|
var deal = (feature && feature.display) || "table"
|
||||||
kit.classList.add(field, feature.style)
|
kit.classList.add(field, meta.group, name, feature.style)
|
||||||
|
|
||||||
var history = []
|
var history = []
|
||||||
var run = function(event, cmds, cbs) {
|
var run = function(event, cmds, cbs) {
|
||||||
|
@ -48,9 +48,9 @@ kit = toolkit = {
|
|||||||
// HTML节点操作
|
// HTML节点操作
|
||||||
classList: {
|
classList: {
|
||||||
add: function(obj) {
|
add: function(obj) {
|
||||||
var list = obj.className.split(" ")
|
var list = obj.className? obj.className.split(" "): []
|
||||||
for (var i = 1; i < arguments.length; i++) {
|
for (var i = 1; i < arguments.length; i++) {
|
||||||
list.push(arguments[i])
|
arguments[i] && list.push(arguments[i])
|
||||||
}
|
}
|
||||||
return obj.className = list.join(" ")
|
return obj.className = list.join(" ")
|
||||||
},
|
},
|
||||||
@ -650,6 +650,7 @@ kit = toolkit = {
|
|||||||
return Math.sqrt(Math.pow(x1-x0, 2)+Math.pow(y1-y0, 2))
|
return Math.sqrt(Math.pow(x1-x0, 2)+Math.pow(y1-y0, 2))
|
||||||
},
|
},
|
||||||
format_date: function(arg) {
|
format_date: function(arg) {
|
||||||
|
arg = arg || new Date()
|
||||||
var date = arg.getDate()
|
var date = arg.getDate()
|
||||||
if (date < 10) {
|
if (date < 10) {
|
||||||
date = "0"+date
|
date = "0"+date
|
||||||
|
Loading…
x
Reference in New Issue
Block a user