diff --git a/src/contexts/cli/version.go b/src/contexts/cli/version.go
index 42728eba..b7d141a4 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-23 20:04:21", "centos", 596,
+ "2019-09-24 11:15:57", "centos", 602,
}
diff --git a/src/contexts/web/web.go b/src/contexts/web/web.go
index 71ee9f73..4c4449ed 100644
--- a/src/contexts/web/web.go
+++ b/src/contexts/web/web.go
@@ -1188,11 +1188,10 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
for _, v := range list {
if p, ok := m.Confv("wss", []string{v, "channel"}).(chan *ctx.Message); ok {
- if arg[1] == "sync" {
- m.Meta["detail"] = arg[2:]
- p <- m
- m.CallBack(true, func(msg *ctx.Message) *ctx.Message {
- if data, ok := m.Optionv("data").(map[string]interface{}); ok {
+ if msg := m.Spawn(); arg[1] == "sync" {
+ p <- msg.Add("detail", arg[2], arg[3:])
+ msg.CallBack(true, func(msg *ctx.Message) *ctx.Message {
+ if data, ok := msg.Optionv("data").(map[string]interface{}); ok {
if len(list) == 1 && data["append"] != nil {
for _, k := range kit.Trans(data["append"]) {
m.Push(k, kit.Trans(data[k]))
@@ -1216,8 +1215,7 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
}, "skip")
m.Table()
} else {
- m.Meta["detail"] = arg[1:]
- p <- m
+ p <- msg.Add("detail", arg[1], arg[2:])
}
}
}
diff --git a/src/plugin/context/index.shy b/src/plugin/context/index.shy
index 2ab5848b..e0a4c1f2 100644
--- a/src/plugin/context/index.shy
+++ b/src/plugin/context/index.shy
@@ -3,7 +3,7 @@ kit project "项目" private \
select "" values plugin values review values submit values trend values stats values stat values init action auto \
text "" name see imports plugin_see action auto \
button "执行" \
- button "返回" click Last \
+ button "返回" cb Last \
exports see name see
kit compile "编译" private \
@@ -43,14 +43,14 @@ kit cmd "命令" private "ssh._route" _ context _ command __ \
text "cli" name ctx imports plugin_ctx \
text "date" name cmd imports plugin_cmd \
button "执行" \
- button "返回" click Last \
+ button "返回" cb Last \
exports cmd cmd
kit dir "目录" private "ssh._route" _ "nfs.dir" _ time size line path \
text "" name pod imports plugin_pod action auto \
text "usr/script" name dir imports plugin_dir action auto view long \
button "浏览" action auto \
- button "返回" click Last \
+ button "返回" cb Last \
feature display "editor" \
exports dir "" dir
diff --git a/src/plugin/favor/index.shy b/src/plugin/favor/index.shy
index 81fad7b3..13fb78f6 100644
--- a/src/plugin/favor/index.shy
+++ b/src/plugin/favor/index.shy
@@ -9,9 +9,9 @@ end
kit macro "脚本宏" "macro.js" public \
text "" name mac imports plugin_mac action auto \
button "查看" \
- button "全部" click "all" \
- button "录制" click "Record" \
- button "运行" click "Replay" \
+ button "全部" cb "all" \
+ button "录制" cb "Record" \
+ button "运行" cb "Replay" \
exports mac name
kit sys "命令行" public "ssh._route" _ "nfs.source" \
diff --git a/src/plugin/love/index.shy b/src/plugin/love/index.shy
index c75f9016..38bcd8c2 100644
--- a/src/plugin/love/index.shy
+++ b/src/plugin/love/index.shy
@@ -20,7 +20,7 @@ kit date "日历" "index.js" "index.css" protected "cli.date" _ nature _ \
text "when" name "when" \
text "where" name "where" \
button "查看" action auto \
- button "显示" click show
+ button "显示" cb show
fun delay "以后告诉你" protected \
text "delay" name table imports plugin_table \
@@ -52,7 +52,7 @@ fun wss "推送" private \
text "" name wss imports plugin_wss \
text "" name cmd view long \
button "推送" \
- button "返回" click Last \
+ button "返回" cb Last \
exports wss key
if $2 == ""
@@ -63,8 +63,8 @@ fun wss "推送" private \
end
kit pos "位置" private \
- button "查看" click getLocation \
- button "显示" click openLocation \
+ button "查看" cb getLocation \
+ button "显示" cb openLocation \
text "0.0062" name x \
text "0.0014" name y \
text "当前位置" name pos \
diff --git a/src/plugin/mind/index.shy b/src/plugin/mind/index.shy
index d08b0481..c2a83a4c 100644
--- a/src/plugin/mind/index.shy
+++ b/src/plugin/mind/index.shy
@@ -2,6 +2,6 @@ kit xls "表格" "index.js" "index.css" private \
text "" name title imports plugin_xls_id action auto \
text "" name content \
button "执行" \
- button "返回" click Last \
+ button "返回" cb Last \
feature style "mind" \
exports xls_id id
diff --git a/src/plugin/storage/index.shy b/src/plugin/storage/index.shy
index 76f438a9..5cd16ab8 100644
--- a/src/plugin/storage/index.shy
+++ b/src/plugin/storage/index.shy
@@ -15,7 +15,7 @@ fun note "记事本" public \
text "" name you imports plugin_you action auto \
text "" name tip imports plugin_tip view long action auto \
button "查看" action auto \
- button "返回" click Last \
+ button "返回" cb Last \
exports tip file tip \
feature display inner
@@ -30,7 +30,7 @@ kit data "数据库" public "ssh.data" show \
text "" name table imports plugin_table action auto view long \
text "" name index action auto \
button "查看" action auto \
- button "返回" click Last \
+ button "返回" cb Last \
exports table table
kit save "导出" private "ssh.data" export \
@@ -44,6 +44,6 @@ kit load "导入" private "ssh.data" import \
kit push "上传" private "web./download/" \
upfile "" name upload \
- button "上传" click upload \
+ button "上传" cb upload \
button "查看"
diff --git a/src/plugin/tmux/index.shy b/src/plugin/tmux/index.shy
index eda98050..90d53e28 100644
--- a/src/plugin/tmux/index.shy
+++ b/src/plugin/tmux/index.shy
@@ -3,7 +3,7 @@ kit buffer "粘贴板" public buf \
text "0" name index imports plugin_tmux_bindex action auto \
text "" name txt action auto \
button "查看" action auto \
- button "返回" click Last \
+ button "返回" cb Last \
exports tmux_bindex cur
kit session "会话" private mux \
diff --git a/usr/librarys/chat.js b/usr/librarys/chat.js
index 27f6c901..952c7c74 100644
--- a/usr/librarys/chat.js
+++ b/usr/librarys/chat.js
@@ -288,7 +288,12 @@ var page = Page({check: true,
], 0)
},
Core: function(event, line, args, cbs) {
- var msg = (event.msg = line || {})
+ var msg = event.msg || {}, res
+ function result(res) {
+ res != null && res != undefined && !msg.result && (msg.result = kit.Trans(res))
+ return true
+ }
+
var plugin = event.Plugin || page.plugin && page.plugin.Plugin || {}, engine = {
share: function(args) {
typeof cbs == "function" && cbs(ctx.Share({"group": option.dataset.group, "name": option.dataset.name, "cmds": [
@@ -297,11 +302,38 @@ var page = Page({check: true,
return true
},
wss: function(id) {
- return page.wssid = id
+ return id && (page.wssid = id)
},
- pwd: function(args) {
+ pwd: function(name, value) {
+ name && kit.Selector(page.action, "fieldset.item."+name, function(item) {
+ item.Plugin.Select()
+ })
+ if (value) {return engine.set(value)}
return [river, storm, page.plugin && page.plugin.Meta.name, page.input && page.input.name, page.input && page.input.value]
},
+ set: function(value, name) {
+ try {
+ if (value == undefined) {
+ msg.append = ["name", "value"]
+ msg.name = [], msg.value = []
+ return kit.Selector(page.plugin, ".args", function(item) {
+ msg.name.push(item.name)
+ msg.value.push(item.value)
+ return item.name+":"+item.value
+ })
+
+ } else if (name == undefined) {
+ kit.Selector(page.plugin, "input[type=button]", function(item) {
+ if (item.value == value) {item.click(); return value}
+ }).length > 0 || (page.action.Pane.Action[value]?
+ page.action.Pane.Action[value](event, value): (page.input.value = value))
+ } else {
+ page.plugin.Plugin.Inputs[name].value = value
+ }
+ } catch (e) {
+ engine._cmd("_cmd", [value, name])
+ }
+ },
dir: function(rid, sid, pid, uid) {
if (!rid) {
return kit.Selector(page.river, "div.output>div.item>div.text>span", function(item) {
@@ -315,6 +347,8 @@ var page = Page({check: true,
}
if (!pid) {
return kit.Selector(page.action, "fieldset.item>legend", function(item) {
+ msg.push("name", item.parentNode.Meta.name)
+ msg.push("help", item.parentNode.Meta.help)
return item.innerText
})
}
@@ -362,12 +396,8 @@ var page = Page({check: true,
_split: function(str) {return str.trim().split(" ")},
_cmd: function(arg) {
var args = typeof arg[1] == "string"? engine._split(arg[1]): arg[1];
- var res = null
page.script("record", args)
- function result(res) {
- res != null && res != undefined && !msg.result && (msg.result = [res])
- return true
- }
+ kit.Log(["cmd"].concat(args))
if (typeof engine[args[0]] == "function") {
return result(kit._call(engine[args[0]], args.slice(1)))
@@ -402,7 +432,7 @@ var page = Page({check: true,
})
},
}
- if (args.length > 0 && engine[args[0]] && engine[args[0]](args)) {typeof cbs == "function" && cbs(line); return}
+ if (args.length > 0 && engine[args[0]] && engine[args[0]](args)) {typeof cbs == "function" && cbs(); return}
event.shiftKey? engine._msg(): engine._run()
},
Show: function() {var pane = field.Pane
@@ -430,23 +460,29 @@ var page = Page({check: true,
},
Action: {
"聊天": function(event, value) {
+ page.which.set(value)
page.onlayout(event, page.conf.layout)
},
"办公": function(event, value) {
+ page.which.set(value)
page.onlayout(event, page.conf.layout)
page.onlayout(event, {river: 0, action:300})
},
"工作": function(event, value) {
+ page.which.set(value)
page.onlayout(event, page.conf.layout)
page.onlayout(event, {river:0, action:-1})
},
"最高": function(event, value) {
+ page.which.set(value)
page.onlayout(event, {action: -1})
},
"最宽": function(event, value) {
+ page.which.set(value)
page.onlayout(event, {river:0, storm:0})
},
"最大": function(event, value) {
+ page.which.set(value)
page.onlayout(event, {header:0, footer:0, river:0, storm:0, action: -1})
},
@@ -492,7 +528,7 @@ var page = Page({check: true,
page.plugin && page.plugin.Plugin.Delete()
},
"加参": function(event, value) {
- page.plugin && page.plugin.Plugin.Append({className: "args temp"})
+ page.plugin && page.plugin.Plugin.Appends()
},
"减参": function(event, value) {
page.plugin && page.plugin.Plugin.Remove()
diff --git a/usr/librarys/context.js b/usr/librarys/context.js
index ca8ce234..f0ef5be2 100644
--- a/usr/librarys/context.js
+++ b/usr/librarys/context.js
@@ -5,6 +5,8 @@ ctx = context = {__proto__: kit,
option[k] = dataset[k].split(",")
}
+ kit.Log(["run"].concat(option.group).concat(option.name).concat(option.cmds))
+
var event = window.event
this.POST("", option, function(msg) {
msg[0] && (msg = msg[0])
@@ -237,23 +239,30 @@ ctx = context = {__proto__: kit,
page.ontoast("wss open")
}
s.onmessage = function(event) {
- var msg = JSON.parse(event.data)
-
try {
var msg = JSON.parse(event.data||'{}')
} catch (e) {
var msg = {"result": [event.data]}
}
- msg.event = event, msg.reply = function(res) {
- res = res || msg, res.event = undefined
+ event.msg = msg, msg.event = event, msg.reply = function(res) {
+ msg.result = (msg.result||[]).concat(kit.Trans(res))
kit.Log(["wss", "detail"].concat(msg.detail))
- kit.Log(["wss", "result"].concat(res.result))
- s.send(JSON.stringify(res))
+ kit.Log(["wss", "result"].concat(msg.result))
+ delete(msg.event), s.send(JSON.stringify(msg))
+ }
+ msg.push = function(key, value) {
+ msg.append || (msg.append = [])
+ msg[key]? msg[key].push(value): (msg[key] = [value], msg.append.push(key))
+ return msg
}
- kit.Log(msg)
- typeof cb == "function" && cb(msg)
+ try {
+ kit.Log("wss", "msg", msg)
+ typeof cb == "function" && cb(msg)
+ } catch (e) {
+ msg.reply(kit.Log("err", e))
+ }
}
s.onerror = function(event) {
kit.Log(event)
diff --git a/usr/librarys/example.js b/usr/librarys/example.js
index ead9ccc2..c660420d 100644
--- a/usr/librarys/example.js
+++ b/usr/librarys/example.js
@@ -36,7 +36,7 @@ function Meta(target, obj) {
if (value == data && !force) {return value}
old_value = data, data = value
- meta && kit.Log(meta, value, old_value)
+ meta && kit.Log("key", meta, value, old_value)
for (var i = 0; i < list.length; i++) {
list[i](value, old_value)
}
@@ -130,86 +130,52 @@ function Page(page) {
var script = {}, record = ""
page = Meta(document.body, page, {__proto__: ctx,
onload: function() {
- var sessid = ctx.Cookie("sessid")
- if (page.check && !sessid) {
+ if (page.check && !ctx.Cookie("sessid")) {
+ // 用户登录
document.querySelectorAll("body>fieldset.Login").forEach(function(field) {
page.Pane(page, field)
- })
+ }), page.login.Pane.Dialog(1, 1)
} else {
+ // 登录成功
document.querySelectorAll("body>fieldset").forEach(function(field) {
page.Pane(page, field)
- }), page.init(page)
- }
-
- if (page.check) {
- kit.device.isWeiXin? page.login.Pane.Run(["weixin"], function(msg) {
- page.Include([
- "https://res.wx.qq.com/open/js/jweixin-1.4.0.js",
- // "/static/librarys/weixin.js",
- ], function(event) {
- wx.error(function(res){})
- wx.ready(function(){
- page.getLocation = function(cb) {
- wx.getLocation({success: function (res) {
- cb(res)
- }})
- }
- page.openLocation = function(latitude, longitude, name) {
- wx.openLocation({latitude: parseFloat(latitude), longitude: parseFloat(longitude), name:name||"here"})
- }
- wx.getLocation({success: function (res) {
- page.footer.Pane.State("site", parseInt(res.latitude*10000)+","+parseInt(res.longitude*10000))
- }})
- })
- wx.config({
- appId: msg.appid[0],
- nonceStr: msg.nonce[0],
- timestamp: msg.timestamp[0],
- signature: msg.signature[0],
- jsApiList: [
- "scanQRCode",
- "chooseImage",
- "closeWindow",
- "openAddress",
- "getNetworkType",
- "getLocation",
- "openLocation",
- ]
- })
- })
- }): sessid? page.login.Pane.Run([], function(msg) {
+ }), page.init(page), page.check && page.login.Pane.Run([], function(msg) {
msg.result && msg.result[0]? page.header.Pane.State("user", msg.nickname[0])
:page.login.Pane.Dialog(1, 1)
- }): page.login.Pane.Dialog(1, 1)
+ })
}
+
+ // 微信接口
+ kit.device.isWeiXin && page.login.Pane.Run(["weixin"], function(msg) {
+ msg.appid[0] && page.Include(["https://res.wx.qq.com/open/js/jweixin-1.4.0.js"], function(event) {
+ wx.error(function(res){})
+ wx.ready(function(){
+ page.scanQRCode = function(cb) {
+
+ }
+ page.getLocation = function(cb) {
+ wx.getLocation({success: cb})
+ }
+ page.openLocation = function(latitude, longitude, name) {
+ wx.openLocation({latitude: parseFloat(latitude), longitude: parseFloat(longitude), name:name||"here"})
+ }
+ }), wx.config({jsApiList: ["closeWindow", "scanQRCode", "getLocation", "openLocation"],
+ appId: msg.appid[0], nonceStr: msg.nonce[0], timestamp: msg.timestamp[0], signature: msg.signature[0]})
+ })
+ })
+
+ // 事件回调
window.onresize = function(event) {
page.onlayout && page.onlayout(event)
-
}, document.body.onkeydown = function(event) {
if (page.localMap && page.localMap(event)) {return}
page.oncontrol && page.oncontrol(event, document.body, "control")
- if (kit.isWindows && event.ctrlKey) {
- // event.stopPropagation()
- // event.preventDefault()
- }
-
}, document.body.onkeyup = function(event) {
- if (kit.isWindows && event.ctrlKey) {
- // event.stopPropagation()
- // event.preventDefault()
- }
-
}, document.body.oncontextmenu = function(event) {
- event.stopPropagation()
- event.preventDefault()
-
}, document.body.onmousewheel = function(event) {
-
}, document.body.onmousedown = function(event) {
-
}, document.body.onmouseup = function(event) {
-
}
},
ontoast: function(text, title, duration) {
@@ -261,8 +227,7 @@ function Page(page) {
}
ticker()
}, 10): setTimeout(function(){toast.style.display = "none"}, args.duration||3000)
- page.toast = toast
- return true
+ return page.toast = toast
},
oninput: function(event, local) {
var target = event.target
@@ -440,11 +405,8 @@ function Page(page) {
},
WSS: function(cb, onerror, onclose) {
return page.socket || (page.socket = ctx.WSS(cb || (function(m) {
-
if (m.detail) {
- page.action.Pane.Core(event, m, ["_cmd", m.detail], function(msg) {
- m.reply(msg)
- })
+ page.action.Pane.Core(event, m, ["_cmd", m.detail], m.reply)
} else {
page.ontoast(m.result.join(""))
}
@@ -566,6 +528,7 @@ function Page(page) {
},
Pane: Pane,
})
+ page.which = page.Sync("layout")
return window.onload = page.onload, page
}
function Pane(page, field) {
@@ -756,6 +719,11 @@ function Plugin(page, pane, field, runs) {
}
var plugin = Meta(field, (field.Script && field.Script.init || function() {
})(run, field, option, output)||{}, {
+ Inputs: {},
+ Appends: function() {
+ var name = "args"+kit.Selector(option, "input.args.temp").length
+ plugin.Append({type: "text", name: name, className: "args temp"}).focus()
+ },
Append: function(item, name, value) {
kit.Item(plugin.onaction, function(k, cb) {
item[k] == undefined && (item[k] = typeof cb == "function"? function(event) {
@@ -768,8 +736,8 @@ function Plugin(page, pane, field, runs) {
break
}
- (item.title || item.name) && (item.title = item.title || item.name)
- item.title && (item.placeholder = item.title)
+ !item.title && item.name && (item.title = item.name)
+ !item.placeholder && item.title && (item.placeholder = item.title)
name = item.name || "input"
var input = {type: "input", name: name, data: item}
@@ -810,6 +778,8 @@ function Plugin(page, pane, field, runs) {
var td = output.querySelector("td")
td && td.click()
})
+ item.which = plugin.Sync(item.name)
+ plugin.Inputs[item.name] = ui[name]
return action.target
},
Remove: function() {
@@ -824,6 +794,7 @@ function Plugin(page, pane, field, runs) {
page.plugin && (kit.classList.del(page.plugin, "select"))
page.plugin = field, kit.classList.add(field, "select")
!silent && (option.querySelectorAll("input")[1].focus())
+ name && pane.which.set(name)
},
Reveal: function(msg) {
return msg.append && msg.append[0]? ["table", JSON.stringify(ctx.Tables(msg))]: ["code", msg.result? msg.result.join(""): ""]
@@ -839,7 +810,6 @@ function Plugin(page, pane, field, runs) {
}).field.Plugin
},
Last: function() {
- console.log(meta)
var list = history.pop()
list? (list.target.value = list.value): inputs.map(function(item) {
option[item.name].value = item.value
@@ -951,7 +921,10 @@ function Plugin(page, pane, field, runs) {
}).join("\n"), type = ".csv"
!text && (text = plugin.msg.result.join(""), type = ".txt")
- page.ontoast({text:''+name+type+'', width: 200})
+ page.ontoast({text:''+name+type+'', title: "下载中...", width: 200})
+ kit.Selector(page.toast, "a", function(item) {
+ item.click()
+ })
},
show_after: function(msg) {},
upload: function(event) {
@@ -1017,15 +990,17 @@ function Plugin(page, pane, field, runs) {
onaction: {
onfocus: function(event, action, type, name, item) {
page.input = event.target, plugin.Select(true)
+ plugin.which.set(name)
},
onblur: function(event, action, type, name, item) {
+ item.which.set(action.target.value)
// page.input = undefined
},
onclick: function(event, action, type, name, item) {
switch (type) {
case "button":
- action[item.click]? action[item.click](event, item, option, field):
- plugin[item.click]? plugin[item.click](event, item, option, field): plugin.Check()
+ action[item.cb]? action[item.cb](event, item, option, field):
+ plugin[item.cb]? plugin[item.cb](event, item, option, field): plugin.Check()
break
case "text":
if (event.ctrlKey) {
@@ -1093,7 +1068,7 @@ function Plugin(page, pane, field, runs) {
page.action.scrollTo(0, field.offsetTop)
break
case "b":
- plugin.Append({className: "args temp", type: "text"}).focus()
+ plugin.Appends()
break
case "m":
plugin.Clone().Select()
@@ -1104,6 +1079,7 @@ function Plugin(page, pane, field, runs) {
return true
})
if (item.type != "textarea" && event.key == "Enter") {
+ item.which.set(action.target.value)
history.push({target: action.target, value: action.target.value});
plugin.Check(action.target)
}
@@ -1111,6 +1087,7 @@ function Plugin(page, pane, field, runs) {
},
exports: JSON.parse(meta.exports||'["",""]'),
})
+ plugin.which = plugin.Sync("input")
inputs.map(function(item) {plugin.Append(item)})
return page[field.id] = pane[field.id] = pane[name] = field, field.Plugin = plugin
diff --git a/usr/librarys/toolkit.js b/usr/librarys/toolkit.js
index c9e77750..b289392a 100644
--- a/usr/librarys/toolkit.js
+++ b/usr/librarys/toolkit.js
@@ -19,18 +19,7 @@ kit = toolkit = {__proto__: document,
reload: function() {
location.reload()
},
- // 操作日志
- Log: function() {
- var args = []
- for (var i = 0; i < arguments.length; i++) {
- args.push(arguments[i])
- }
- console.log(arguments.length == 1? args[0]: args)
- return args
- },
- Delay: function(time, cb) {
- return setTimeout(cb, time)
- },
+ // 日志调试
History: {dir: [], pod: [], ctx: [], cmd: [], txt: [], key: [], lay: [],
add: function(type, data) {
var list = this[type] || []
@@ -44,6 +33,26 @@ kit = toolkit = {__proto__: document,
return index == undefined? this[type]: this[type][(index+len)%len]
},
},
+ Debug: function(key) {
+ if (kit.debug[key]) {debugger}
+ }, debug: {"why": true},
+ Log: function(type, arg) {
+ var args = [kit.time()]
+ if (arg == undefined) {
+ args = args.concat(kit.Trans(type))
+ } else {
+ for (var i = 0; i < arguments.length; i++) {
+ args.push(arguments[i])
+ }
+ }
+
+ !kit.hide[args[1]] && console.log(args)
+ kit.Debug(args[1])
+ return args.slice(1)
+ }, hide: {"wss": false},
+ Delay: function(time, cb) {
+ return setTimeout(cb, time)
+ },
// HTML节点操作
classList: {
@@ -676,6 +685,38 @@ kit = toolkit = {__proto__: document,
Format: function(objs) {
return JSON.stringify(objs)
},
+ Trans: function(arg) {
+ var res = []
+ if (arg != undefined && arg != null) {
+ switch (typeof arg) {
+ case "string":
+ res.push(arg)
+ break
+ case "object":
+ if (arg.length > 0) {
+ for (var i = 0; i < arg.length; i++) {
+ res.push(arg[i])
+ }
+ } else {
+ for (var k in arg) {
+ res.push(k)
+ res.push(arg[k])
+ }
+ }
+ break
+ default:
+ res.push(arg)
+ }
+ }
+ for (var i = res.length - 1; i > -1; i--) {
+ if (res[i] == undefined) {
+ res.pop()
+ } else {
+ break
+ }
+ }
+ return res
+ },
time: function(t, fmt) {
var now = t? new Date(t): new Date()
fmt = fmt || "%y-%m-%d %H:%M:%S"