diff --git a/src/contexts/cli/cli.go b/src/contexts/cli/cli.go index 653727c6..c02250b7 100644 --- a/src/contexts/cli/cli.go +++ b/src/contexts/cli/cli.go @@ -707,18 +707,18 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心", 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) { - if m.Has("cmd") { - m.Log("fino", "what %v", m.Meta["cmd"]) + if m.Has("cmd") { // TODO 这是个漏洞 m.Cmdy(m.Meta["cmd"]) return } show := map[int]string{0: "周日", 1: "周一", 2: "周二", 3: "周三", 4: "周四", 5: "周五", 6: "周六"} + space := m.Options("space") format, format_time := "", "" if m.Has("format") { 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")) n := kit.Int(kit.Select("1", m.Option("count"))) if m.Has("nature") { diff --git a/src/contexts/cli/version.go b/src/contexts/cli/version.go index 95c75c90..1b599bb9 100644 --- a/src/contexts/cli/version.go +++ b/src/contexts/cli/version.go @@ -4,5 +4,5 @@ var version = struct { host string self int }{ - "2019-09-19 19:02:39", "centos", 562, + "2019-09-20 16:49:11", "centos", 563, } diff --git a/src/contexts/nfs/nfs.go b/src/contexts/nfs/nfs.go index 6756ae99..68d603b3 100644 --- a/src/contexts/nfs/nfs.go +++ b/src/contexts/nfs/nfs.go @@ -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) { 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) { m.Echo(string(b)) } diff --git a/src/plugin/love/index.css b/src/plugin/love/index.css index e60a8f8f..7d94b715 100644 --- a/src/plugin/love/index.css +++ b/src/plugin/love/index.css @@ -1,2 +1,4 @@ -fieldset.item.demo div.output { + +fieldset.item.love.date table td.today { + border:solid 2px red; } diff --git a/src/plugin/love/index.js b/src/plugin/love/index.js index cca761e7..bb87657c 100644 --- a/src/plugin/love/index.js +++ b/src/plugin/love/index.js @@ -2,17 +2,14 @@ show: function(event) { 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) { - item.parentNode.style.backgroundColor = "red" + kit.classList.add(item.parentNode, "select") item.parentNode.title = value[option.where.value] }) })}) }, show_after: function(msg) { - var now = kit.format_date(new Date()) - kit.Selector(output, ".s"+now.split(" ")[0].split("-").join(""), function(item) { - item.parentNode.style.backgroundColor = "red" - item.innerText = "TODAY" - item.parentNode.title = "today" + kit.Selector(output, ".s"+ kit.format_date().split(" ")[0].split("-").join(""), function(item) { + kit.classList.add(item.parentNode, "today") }) }, }}} diff --git a/src/plugin/love/index.shy b/src/plugin/love/index.shy index 81509c18..d1abdcfa 100644 --- a/src/plugin/love/index.shy +++ b/src/plugin/love/index.shy @@ -16,7 +16,7 @@ fun meet "第一眼" private \ copy ssh.data insert _ when _ where __ end -kit date "日历" "index.js" protected "cli.date" _ nature _ \ +kit date "日历" "index.js" "index.css" protected "cli.date" _ nature _ \ \ space true format '%s' "s20060102" \ text "2019-07-08" name "起始时间" \ text "date" name "截止时间" \ @@ -26,3 +26,16 @@ kit date "日历" "index.js" protected "cli.date" _ nature _ \ button "查看" action auto \ 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 + diff --git a/usr/librarys/example.js b/usr/librarys/example.js index 001d2175..9c86096d 100644 --- a/usr/librarys/example.js +++ b/usr/librarys/example.js @@ -75,16 +75,14 @@ function Meta(target, obj) { var text = JSON.parse(line.text) case "plugin": - if (!text.name) { - return {} - } + if (!text.name) {return {}} + var id = "plugin"+this.ID() list.push({view: ["item", "fieldset", "", "field"], data: {id: id, Run: cb}, list: [ {text: [text.name+"("+text.help+")", "legend"]}, {view: ["option", "form", "", "option"], list: [{type: "input", style: {"display": "none"}}]}, {view: ["output", "div", "", "output"]}, - {script: ""+id+".Script="+(text.init||"{}")}, - {styles: text.view}, + text.view?{styles: text.view}:null, text.init?{script: ""+id+".Script = "+text.init}:null, ]}) break } @@ -699,7 +697,7 @@ function Plugin(page, pane, field, runs) { var display = JSON.parse(meta.display||'{}') var exports = JSON.parse(meta.exports||'["",""]') var deal = (feature && feature.display) || "table" - kit.classList.add(field, feature.style) + kit.classList.add(field, meta.group, name, feature.style) var history = [] var run = function(event, cmds, cbs) { diff --git a/usr/librarys/toolkit.js b/usr/librarys/toolkit.js index 57dddb65..e1505164 100644 --- a/usr/librarys/toolkit.js +++ b/usr/librarys/toolkit.js @@ -48,9 +48,9 @@ kit = toolkit = { // HTML节点操作 classList: { add: function(obj) { - var list = obj.className.split(" ") + var list = obj.className? obj.className.split(" "): [] for (var i = 1; i < arguments.length; i++) { - list.push(arguments[i]) + arguments[i] && list.push(arguments[i]) } return obj.className = list.join(" ") }, @@ -650,6 +650,7 @@ kit = toolkit = { return Math.sqrt(Math.pow(x1-x0, 2)+Math.pow(y1-y0, 2)) }, format_date: function(arg) { + arg = arg || new Date() var date = arg.getDate() if (date < 10) { date = "0"+date