forked from x/volcanos
opt some
This commit is contained in:
parent
fb41d101a0
commit
0d3dd49fb7
54
frame.js
54
frame.js
@ -31,14 +31,14 @@ Volcanos("onengine", {help: "搜索引擎", list: [], _init: function(can, meta,
|
|||||||
|
|
||||||
return can.core.CallFunc(fun, {
|
return can.core.CallFunc(fun, {
|
||||||
"event": event, "can": sub, "msg": msg,
|
"event": event, "can": sub, "msg": msg,
|
||||||
"button": key, "cmd": key, "cmds": cmds.slice(2),
|
"button": key, "cmd": key, "arg": cmds.slice(2), "cmds": cmds.slice(2),
|
||||||
"list": cmds.slice(2), "cb": cb, "target": sub._target,
|
"list": cmds.slice(2), "cb": cb, "target": sub._target,
|
||||||
}, mod)
|
}, mod)
|
||||||
},
|
},
|
||||||
_engine: function(event, can, msg, panel, cmds, cb) { return false },
|
_engine: function(event, can, msg, panel, cmds, cb) { return false },
|
||||||
_remote: function(event, can, msg, panel, cmds, cb) {
|
_remote: function(event, can, msg, panel, cmds, cb) {
|
||||||
if (panel.onengine._engine(event, can, msg, panel, cmds, cb)) { return }
|
if (panel.onengine._engine(event, can, msg, panel, cmds, cb)) { return }
|
||||||
can.onengine.signal(can, "onremote", can.request({}, {_follow: panel._follow, _msg: msg, _cmds: cmds}))
|
can.onengine.signal(can, chat.ONREMOTE, can.request({}, {_follow: panel._follow, _msg: msg, _cmds: cmds}))
|
||||||
|
|
||||||
var key = can.core.Keys(panel._name, cmds.join(ice.FS))
|
var key = can.core.Keys(panel._name, cmds.join(ice.FS))
|
||||||
if (can.user.isLocalFile) { var msg = can.request(event); msg.Clear(ice.MSG_APPEND)
|
if (can.user.isLocalFile) { var msg = can.request(event); msg.Clear(ice.MSG_APPEND)
|
||||||
@ -58,7 +58,7 @@ Volcanos("onengine", {help: "搜索引擎", list: [], _init: function(can, meta,
|
|||||||
arguments.callee.meta[name] = (arguments.callee.meta[name]||[]).concat(cb)
|
arguments.callee.meta[name] = (arguments.callee.meta[name]||[]).concat(cb)
|
||||||
}),
|
}),
|
||||||
signal: shy("触发事件", function(can, name, msg) { msg = msg||can.request()
|
signal: shy("触发事件", function(can, name, msg) { msg = msg||can.request()
|
||||||
name == "onremote"? can.misc.Log("signal", name, msg.Option("_msg")): can.misc.Log("signal", name, msg)
|
name == chat.ONREMOTE? can.misc.Log("signal", name, msg.Option("_msg")): can.misc.Log("signal", name, msg)
|
||||||
can.core.List(can.onengine.listen.meta[name], function(cb) {
|
can.core.List(can.onengine.listen.meta[name], function(cb) {
|
||||||
can.core.CallFunc(cb, {msg: msg})
|
can.core.CallFunc(cb, {msg: msg})
|
||||||
})
|
})
|
||||||
@ -69,10 +69,10 @@ Volcanos("onengine", {help: "搜索引擎", list: [], _init: function(can, meta,
|
|||||||
case lang.OBJECT: return type = item.type||type, item
|
case lang.OBJECT: return type = item.type||type, item
|
||||||
case lang.STRING:
|
case lang.STRING:
|
||||||
switch (item) {
|
switch (item) {
|
||||||
case "list":
|
case mdb.LIST:
|
||||||
case "back": return {type: type = html.BUTTON, name: item}
|
case cli.BACK: return {type: type = html.BUTTON, name: item}
|
||||||
case "name": return {type: type = html.TEXT, name: item}
|
case mdb.NAME: return {type: type = html.TEXT, name: item}
|
||||||
case "text": return {type: type = html.TEXTAREA, name: item}
|
case mdb.TEXT: return {type: type = html.TEXTAREA, name: item}
|
||||||
default: return {type: type, name: item}
|
default: return {type: type, name: item}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -88,15 +88,15 @@ Volcanos("ondaemon", {help: "推荐引擎", list: [], _init: function(can, name)
|
|||||||
msg.Reply()
|
msg.Reply()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
can.onengine.listen(can, "onsearch", function(msg, word) { var meta = can.onengine.plugin.meta
|
can.onengine.listen(can, chat.ONSEARCH, function(msg, word) { var meta = can.onengine.plugin.meta
|
||||||
if (word[0] != "*" && word[0] != ctx.COMMAND) { return }
|
if (word[0] != "*" && word[0] != ctx.COMMAND) { return }
|
||||||
var list = word[1] == ""? meta: meta[word[1]]? kit.Dict(word[1], meta[word[1]]): {}
|
var list = word[1] == ""? meta: meta[word[1]]? kit.Dict(word[1], meta[word[1]]): {}
|
||||||
can.core.Item(list, function(name, command) { name = can.base.trimPrefix(name, "can.")
|
can.core.Item(list, function(name, command) { name = can.base.trimPrefix(name, "can.")
|
||||||
can.core.List(msg.Option(ice.MSG_FIELDS).split(ice.FS), function(item) {
|
can.core.List(msg.Option(ice.MSG_FIELDS).split(ice.FS), function(item) {
|
||||||
msg.Push(item, kit.Dict(
|
msg.Push(item, kit.Dict(
|
||||||
"ctx", "onengine", "cmd", "command",
|
ice.CTX, "onengine", ice.CMD, "command",
|
||||||
"type", "can", "name", name, "text", command.help,
|
mdb.TYPE, "can", mdb.NAME, name, mdb.TEXT, command.help,
|
||||||
"context", "can", "command", name,
|
ctx.CONTEXT, "can", ctx.COMMAND, name,
|
||||||
)[item]||"")
|
)[item]||"")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -113,7 +113,7 @@ Volcanos("ondaemon", {help: "推荐引擎", list: [], _init: function(can, name)
|
|||||||
can.onmotion.float.add(can, chat.FLOAT, can.core.CallFunc(can.user.toast, {can: can, msg: msg, cmds: arg}))
|
can.onmotion.float.add(can, chat.FLOAT, can.core.CallFunc(can.user.toast, {can: can, msg: msg, cmds: arg}))
|
||||||
},
|
},
|
||||||
confirm: function(can, msg, arg) {
|
confirm: function(can, msg, arg) {
|
||||||
if (can.user.confirm(arg[0])) { msg.Echo("true") }
|
if (can.user.confirm(arg[0])) { msg.Echo(ice.TRUE) }
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
Volcanos("onappend", {help: "渲染引擎", list: [], _init: function(can, meta, list, cb, target, field) {
|
Volcanos("onappend", {help: "渲染引擎", list: [], _init: function(can, meta, list, cb, target, field) {
|
||||||
@ -306,7 +306,7 @@ Volcanos("onappend", {help: "渲染引擎", list: [], _init: function(can, meta,
|
|||||||
return can.run(event, [ctx.ACTION, target.name], function(msg) { can.run() }, true)
|
return can.run(event, [ctx.ACTION, target.name], function(msg) { can.run() }, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key == "hash" && can.user.mod.isDiv) {
|
if (key == mdb.HASH && can.user.mod.isDiv) {
|
||||||
can.user.jumps("/chat/div/"+value)
|
can.user.jumps("/chat/div/"+value)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -391,19 +391,19 @@ Volcanos("onappend", {help: "渲染引擎", list: [], _init: function(can, meta,
|
|||||||
can.onmotion.float.auto(can, ui.output, chat.CARTE, chat.INPUT)
|
can.onmotion.float.auto(can, ui.output, chat.CARTE, chat.INPUT)
|
||||||
|
|
||||||
can.search({}, ["Action.onexport.size"], function(msg, top, left, width, height) {
|
can.search({}, ["Action.onexport.size"], function(msg, top, left, width, height) {
|
||||||
can.page.Modify(can, ui.output, {style: {"max-width": width, "max-height": height-28}})
|
can.page.Modify(can, ui.output, {style: {"max-height": height-28, "max-width": width}})
|
||||||
can.page.Modify(can, ui.first, {style: {top: top, left: left}})
|
can.page.Modify(can, ui.first, {style: {top: top, left: left}})
|
||||||
})
|
})
|
||||||
|
|
||||||
can.onappend._action(can, ["close", "refresh", {input: "text", placeholder: "filter", style: {position: ""}, _init: function(input) {
|
can.onappend._action(can, [cli.CLOSE, cli.REFRESH, {input: "text", placeholder: "filter", style: {position: ""}, _init: function(input) {
|
||||||
can.onengine.signal(can, "keymap.focus", can.request({}, {cb: function(event) {
|
can.onengine.signal(can, "keymap.focus", can.request({}, {cb: function(event) {
|
||||||
if (event.target.tagName == "INPUT") { return }
|
if (event.target.tagName == "INPUT") { return }
|
||||||
if (event.key == "Escape") { ui.close(); return }
|
if (event.key == lang.ESCAPE) { ui.close(); return }
|
||||||
if (event.key == " ") { input.focus(), event.stopPropagation(), event.preventDefault() }
|
if (event.key == ice.SP) { input.focus(), event.stopPropagation(), event.preventDefault() }
|
||||||
}}))
|
}}))
|
||||||
}, onkeydown: function(event) {
|
}, onkeydown: function(event) {
|
||||||
can.onkeypop.input(event, can)
|
can.onkeypop.input(event, can)
|
||||||
if (event.key != "Enter") { return }
|
if (event.key != lang.ENTER) { return }
|
||||||
event.target.setSelectionRange(0, -1)
|
event.target.setSelectionRange(0, -1)
|
||||||
|
|
||||||
can.page.Select(can, ui.output, html.TR, function(tr, index) { if (index == 0) { return }
|
can.page.Select(can, ui.output, html.TR, function(tr, index) { if (index == 0) { return }
|
||||||
@ -414,7 +414,7 @@ Volcanos("onappend", {help: "渲染引擎", list: [], _init: function(can, meta,
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}}], ui.action, { "close": ui.close,
|
}}], ui.action, {"close": ui.close,
|
||||||
"refresh": function(event) { ui.close(), can.toast.click() },
|
"refresh": function(event) { ui.close(), can.toast.click() },
|
||||||
})
|
})
|
||||||
can.onappend.table(can, msg, function(value, key, index, line, list) {
|
can.onappend.table(can, msg, function(value, key, index, line, list) {
|
||||||
@ -510,13 +510,13 @@ Volcanos("onlayout", {help: "页面布局", list: [], _init: function(can, targe
|
|||||||
{type: html.TR, list: [{type: html.TR, list: [
|
{type: html.TR, list: [{type: html.TR, list: [
|
||||||
{view: [chat.CONTENT, html.TD], list: [
|
{view: [chat.CONTENT, html.TD], list: [
|
||||||
{view: [chat.CONTENT]},
|
{view: [chat.CONTENT]},
|
||||||
{view: ["toggle project"], list: [{text: [gt, "div"]}], onclick: function(event) {
|
{view: ["toggle project"], list: [{text: [gt, html.DIV]}], onclick: function(event) {
|
||||||
event.target.innerHTML = can.onmotion.toggle(can, can.ui.project)? lt: gt
|
event.target.innerHTML = can.onmotion.toggle(can, can.ui.project)? lt: gt
|
||||||
}},
|
}},
|
||||||
{view: ["toggle profile"], list: [{text: [lt, "div"]}], onclick: function(event) {
|
{view: ["toggle profile"], list: [{text: [lt, html.DIV]}], onclick: function(event) {
|
||||||
event.target.innerHTML = can.onmotion.toggle(can, can.ui.profile)? gt: lt
|
event.target.innerHTML = can.onmotion.toggle(can, can.ui.profile)? gt: lt
|
||||||
}},
|
}},
|
||||||
{view: ["toggle display"], list: [{text: [down, "div"]}], onclick: function(event) {
|
{view: ["toggle display"], list: [{text: [down, html.DIV]}], onclick: function(event) {
|
||||||
event.target.innerHTML = can.onmotion.toggle(can, can.ui.display)? down: up
|
event.target.innerHTML = can.onmotion.toggle(can, can.ui.display)? down: up
|
||||||
}},
|
}},
|
||||||
]},
|
]},
|
||||||
@ -540,7 +540,7 @@ Volcanos("onmotion", {help: "动态特效", list: [], _init: function(can, targe
|
|||||||
story: {
|
story: {
|
||||||
_hash: {
|
_hash: {
|
||||||
spark: function(can, meta, target) {
|
spark: function(can, meta, target) {
|
||||||
if (meta[mdb.NAME] == "inner") {
|
if (meta[mdb.NAME] == html.INNER) {
|
||||||
target.title = "点击复制", target.onclick = function(event) {
|
target.title = "点击复制", target.onclick = function(event) {
|
||||||
can.user.copy(event, can, target.innerText)
|
can.user.copy(event, can, target.innerText)
|
||||||
}
|
}
|
||||||
@ -620,10 +620,10 @@ Volcanos("onmotion", {help: "动态特效", list: [], _init: function(can, targe
|
|||||||
width: target.offsetWidth > 400? 400: target.offsetWidth-20,
|
width: target.offsetWidth > 400? 400: target.offsetWidth-20,
|
||||||
}, onkeydown: function(event) {
|
}, onkeydown: function(event) {
|
||||||
switch (event.key) {
|
switch (event.key) {
|
||||||
case "Enter": target.innerHTML = event.target.value
|
case lang.ENTER: target.innerHTML = event.target.value
|
||||||
event.target.value == back || cb(event, event.target.value, back)
|
event.target.value == back || cb(event, event.target.value, back)
|
||||||
break
|
break
|
||||||
case "Escape": target.innerHTML = back; break
|
case lang.ESCAPE: target.innerHTML = back; break
|
||||||
default: can.onkeypop.input(event, can)
|
default: can.onkeypop.input(event, can)
|
||||||
}
|
}
|
||||||
}, _init: function(target) {
|
}, _init: function(target) {
|
||||||
@ -636,13 +636,13 @@ Volcanos("onmotion", {help: "动态特效", list: [], _init: function(can, targe
|
|||||||
width: target.offsetWidth > 400? 400: target.offsetWidth-20, height: target.offsetHeight < 60? 60: target.offsetHeight-20,
|
width: target.offsetWidth > 400? 400: target.offsetWidth-20, height: target.offsetHeight < 60? 60: target.offsetHeight-20,
|
||||||
}, onkeydown: function(event) {
|
}, onkeydown: function(event) {
|
||||||
switch (event.key) {
|
switch (event.key) {
|
||||||
case "Enter":
|
case html.ENTER:
|
||||||
if (event.ctrlKey) {
|
if (event.ctrlKey) {
|
||||||
target.innerHTML = event.target.value
|
target.innerHTML = event.target.value
|
||||||
event.target.value == back || cb(event, event.target.value, back)
|
event.target.value == back || cb(event, event.target.value, back)
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case "Escape": target.innerHTML = back; break
|
case html.ESCAPE: target.innerHTML = back; break
|
||||||
default: can.onkeypop.input(event, can)
|
default: can.onkeypop.input(event, can)
|
||||||
}
|
}
|
||||||
}, _init: function(target) {
|
}, _init: function(target) {
|
||||||
|
44
lib/base.js
44
lib/base.js
@ -16,51 +16,45 @@ Volcanos("base", {help: "数据类型",
|
|||||||
for (var k in from) { to[k] = from[k] }
|
for (var k in from) { to[k] = from[k] }
|
||||||
return to
|
return to
|
||||||
}
|
}
|
||||||
|
for (var i = 2; i < arguments.length; i++) {
|
||||||
var list = []; for (var i = 2; i < arguments.length; i++) {
|
var k = arguments[i]; to[k] = from[k]
|
||||||
list.push(arguments[i])
|
|
||||||
}
|
|
||||||
for (var i = 0; i < list.length; i++) {
|
|
||||||
to[list[i]] = from[list[i]]
|
|
||||||
}
|
}
|
||||||
return to
|
return to
|
||||||
},
|
},
|
||||||
Eq: function(to, from) { var self = arguments.callee
|
Eq: function(to, from) { var call = arguments.callee
|
||||||
if (typeof to != typeof from) { return false }
|
if (typeof to != typeof from) { return false }
|
||||||
|
|
||||||
if (typeof to == lang.OBJECT) {
|
if (typeof to == lang.OBJECT) {
|
||||||
if (to.length != from.length) { return false }
|
if (to.length != from.length) { return false }
|
||||||
for (var i = 0; i < to.length; i++) {
|
for (var i = 0; i < to.length; i++) {
|
||||||
if (!self(to[i], from[i])) { return false }
|
if (!call(to[i], from[i])) { return false }
|
||||||
}
|
}
|
||||||
for (var k in to) {
|
for (var k in to) {
|
||||||
if (!self(to[k], from[k])) { return false }
|
if (!call(to[k], from[k])) { return false }
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return to === from
|
return to === from
|
||||||
},
|
},
|
||||||
|
|
||||||
Ext: function(file) {
|
Ext: function(path) {
|
||||||
return (file.split(ice.PT).pop().split(ice.PT).pop()).toLowerCase()
|
return (path.split(ice.PS).pop().split(ice.PT).pop()).toLowerCase()
|
||||||
},
|
},
|
||||||
Path: function(str) { var res = ""
|
Path: function(path) { var res = ""
|
||||||
for (var i = 0; i < arguments.length; i++) {
|
for (var i = 0; i < arguments.length; i++) {
|
||||||
res += (arguments[i][0]==ice.PS || res=="" || res[res.length-1]==ice.PS? "": ice.PS) + arguments[i].trim()
|
res += (arguments[i][0]==ice.PS || res=="" || res[res.length-1]==ice.PS? "": ice.PS) + arguments[i].trim()
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
},
|
},
|
||||||
Args: function(obj) {var res = [];
|
Args: function(obj) { var res = []
|
||||||
for (var k in obj) {
|
for (var k in obj) {
|
||||||
res.push(encodeURIComponent(k)+"="+encodeURIComponent(obj[k]))
|
res.push(encodeURIComponent(k)+"="+encodeURIComponent(obj[k]))
|
||||||
}
|
}
|
||||||
return res.join("&")
|
return res.join("&")
|
||||||
},
|
},
|
||||||
MergeURL: function(str) { var args = {}
|
MergeURL: function(url) {
|
||||||
var arg = str.split("?")[1]||""
|
var args = {}; (url.split("?")[1]||"").split("&").forEach(function(item) {
|
||||||
arg && arg.split("&").forEach(function(item) {
|
var ls = item.split("="); args[decodeURIComponent(ls[0])] = decodeURIComponent(ls[1])
|
||||||
var ls = item.split("=")
|
|
||||||
args[decodeURIComponent(ls[0])] = decodeURIComponent(ls[1])
|
|
||||||
})
|
})
|
||||||
for (var i = 1; i < arguments.length; i++) {
|
for (var i = 1; i < arguments.length; i++) {
|
||||||
switch (typeof arguments[i]) {
|
switch (typeof arguments[i]) {
|
||||||
@ -83,10 +77,10 @@ Volcanos("base", {help: "数据类型",
|
|||||||
var list = []; for (var k in args) {
|
var list = []; for (var k in args) {
|
||||||
list.push(encodeURIComponent(k)+"="+encodeURIComponent(args[k]))
|
list.push(encodeURIComponent(k)+"="+encodeURIComponent(args[k]))
|
||||||
}
|
}
|
||||||
return str.split("?")[0]+(list.length>0? "?"+list.join("&"): "")
|
return url.split("?")[0]+(list.length>0? "?"+list.join("&"): "")
|
||||||
},
|
},
|
||||||
ParseURL: function(str) { var res = {link: str}
|
ParseURL: function(url) { var res = {link: url}
|
||||||
var list = str.split("?"); res["origin"] = list[0]
|
var list = url.split("?"); res["origin"] = list[0]
|
||||||
list[1] && list[1].split("&").forEach(function(item) {
|
list[1] && list[1].split("&").forEach(function(item) {
|
||||||
var ls = item.split("="); res[decodeURIComponent(ls[0])] = decodeURIComponent(ls[1])
|
var ls = item.split("="); res[decodeURIComponent(ls[0])] = decodeURIComponent(ls[1])
|
||||||
})
|
})
|
||||||
@ -95,7 +89,7 @@ Volcanos("base", {help: "数据类型",
|
|||||||
ParseJSON: function(str) { var res
|
ParseJSON: function(str) { var res
|
||||||
if (typeof str == lang.OBJECT) { return str }
|
if (typeof str == lang.OBJECT) { return str }
|
||||||
if (str.indexOf("http") == 0) { var ls = str.split("?")
|
if (str.indexOf("http") == 0) { var ls = str.split("?")
|
||||||
res = {type: "link", name: "", text: str}
|
res = {type: mdb.LINK, name: "", text: str}
|
||||||
res.name = ls[0].split("://").pop().split(ice.PS)[0]
|
res.name = ls[0].split("://").pop().split(ice.PS)[0]
|
||||||
ls[1] && ls[1].split("&").forEach(function(item) { var ls = item.split("=")
|
ls[1] && ls[1].split("&").forEach(function(item) { var ls = item.split("=")
|
||||||
res[decodeURIComponent(ls[0])] = decodeURIComponent(ls[1])
|
res[decodeURIComponent(ls[0])] = decodeURIComponent(ls[1])
|
||||||
@ -104,9 +98,9 @@ Volcanos("base", {help: "数据类型",
|
|||||||
}
|
}
|
||||||
try { res = JSON.parse(str)
|
try { res = JSON.parse(str)
|
||||||
res.text = res.text||str
|
res.text = res.text||str
|
||||||
res.type = res.type||"json"
|
res.type = res.type||nfs.JSON
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
res = {type: "text", text: str}
|
res = {type: mdb.TEXT, text: str}
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
},
|
},
|
||||||
@ -207,7 +201,7 @@ Volcanos("base", {help: "数据类型",
|
|||||||
isString: function(val) { return typeof val == lang.STRING },
|
isString: function(val) { return typeof val == lang.STRING },
|
||||||
isObject: function(val) { return typeof val == lang.OBJECT },
|
isObject: function(val) { return typeof val == lang.OBJECT },
|
||||||
isArray: function(val) { return typeof val == lang.OBJECT && val.length != undefined },
|
isArray: function(val) { return typeof val == lang.OBJECT && val.length != undefined },
|
||||||
isFunc: function(cb) { return typeof cb == lang.FUNCTION },
|
isFunc: function(val) { return typeof val == lang.FUNCTION },
|
||||||
isFunction: function(val) { return typeof val == lang.FUNCTION },
|
isFunction: function(val) { return typeof val == lang.FUNCTION },
|
||||||
isCallback: function(key, value) { return key.indexOf("on") == 0 && typeof value == lang.FUNCTION },
|
isCallback: function(key, value) { return key.indexOf("on") == 0 && typeof value == lang.FUNCTION },
|
||||||
isUndefined: function(val) { return val == undefined },
|
isUndefined: function(val) { return val == undefined },
|
||||||
|
47
lib/core.js
47
lib/core.js
@ -36,10 +36,10 @@ Volcanos("core", {help: "数据结构",
|
|||||||
|
|
||||||
// 字符定义
|
// 字符定义
|
||||||
function _list(str) { var res = {}; for (var i = 0; i < str.length; i++) { res[str[i]] = true }; return res }
|
function _list(str) { var res = {}; for (var i = 0; i < str.length; i++) { res[str[i]] = true }; return res }
|
||||||
var soos = _list("\\") // 转义符
|
var space = _list(arg[0]||"\t ,;\n") // 空白符
|
||||||
var seps = _list(arg[0]||"\t ,;\n") // 空白符
|
var block = _list(arg[1]||"{[(.:)]}") // 分隔符
|
||||||
var subs = _list(arg[1]||"{[(.:)]}") // 分隔符
|
var quote = _list(arg[2]||"'\"`") // 引用符
|
||||||
var sups = _list(arg[2]||"'\"`") // 引用符
|
var trans = _list(arg[3]||"\\") // 转义符
|
||||||
|
|
||||||
var res = [], begin = 0; function push(obj) {
|
var res = [], begin = 0; function push(obj) {
|
||||||
obj && res.push(typeof obj == lang.STRING || opt.detail? obj: obj.text), begin = -1
|
obj && res.push(typeof obj == lang.STRING || opt.detail? obj: obj.text), begin = -1
|
||||||
@ -47,20 +47,17 @@ Volcanos("core", {help: "数据结构",
|
|||||||
|
|
||||||
// 开始分词
|
// 开始分词
|
||||||
for (var s = "", i = 0; i < str.length; i++) {
|
for (var s = "", i = 0; i < str.length; i++) {
|
||||||
if (soos[str[i]]) { // 转义符
|
if (space[str[i]]) { // 空白符
|
||||||
begin == -1 && (begin = i++)
|
|
||||||
|
|
||||||
} else if (seps[str[i]]) { // 空白符
|
|
||||||
if (s) { continue }
|
if (s) { continue }
|
||||||
begin > -1 && push(str.slice(begin, i))
|
begin > -1 && push(str.slice(begin, i))
|
||||||
opt.detail && push({type: "space", text: str.slice(i, i+1)})
|
opt.detail && push({type: "space", text: str.slice(i, i+1)})
|
||||||
|
|
||||||
} else if (subs[str[i]]) { // 分隔符
|
} else if (block[str[i]]) { // 分隔符
|
||||||
if (s) { continue }
|
if (s) { continue }
|
||||||
begin > -1 && push(str.slice(begin, i))
|
begin > -1 && push(str.slice(begin, i))
|
||||||
push(str.slice(i, i+1))
|
push(str.slice(i, i+1))
|
||||||
|
|
||||||
} else if (sups[str[i]]) { // 引用符
|
} else if (quote[str[i]]) { // 引用符
|
||||||
if (s == "") {
|
if (s == "") {
|
||||||
s = str[i], begin = i+1
|
s = str[i], begin = i+1
|
||||||
} else if (s == str[i]) {
|
} else if (s == str[i]) {
|
||||||
@ -68,6 +65,9 @@ Volcanos("core", {help: "数据结构",
|
|||||||
s = "", begin = -1
|
s = "", begin = -1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else if (trans[str[i]]) { // 转义符
|
||||||
|
begin == -1 && (begin = i++)
|
||||||
|
|
||||||
} else { // 普通符
|
} else { // 普通符
|
||||||
begin == -1 && (begin = i)
|
begin == -1 && (begin = i)
|
||||||
}
|
}
|
||||||
@ -78,7 +78,7 @@ Volcanos("core", {help: "数据结构",
|
|||||||
return res
|
return res
|
||||||
}),
|
}),
|
||||||
CallFunc: shy("调用器", function(func, args, mod) { args = args||{}
|
CallFunc: shy("调用器", function(func, args, mod) { args = args||{}
|
||||||
var can = args["can"]||args[0], msg = args["msg"]||args[1], cmds = args["cmds"]||[]
|
var can = args["can"]||args[0], msg = args["msg"]||args[1], cmds = args["cmds"]||[], event = args["event"]||{}
|
||||||
|
|
||||||
// 查找调用
|
// 查找调用
|
||||||
func = typeof func == lang.FUNCTION? func: typeof func == lang.STRING? this.Value(mod||can, func):
|
func = typeof func == lang.FUNCTION? func: typeof func == lang.STRING? this.Value(mod||can, func):
|
||||||
@ -88,16 +88,14 @@ Volcanos("core", {help: "数据结构",
|
|||||||
// 解析参数
|
// 解析参数
|
||||||
var list = [], echo = false, cb = args["cb"]
|
var list = [], echo = false, cb = args["cb"]
|
||||||
this.List(func.toString().split(")")[0].split("(")[1].split(ice.FS), function(item, index) { item = item.trim(); if (item == "") { return }
|
this.List(func.toString().split(")")[0].split("(")[1].split(ice.FS), function(item, index) { item = item.trim(); if (item == "") { return }
|
||||||
var arg = msg&&msg.Option&&msg.Option(item) || event&&!(event instanceof Event)&&event[item] ||
|
var arg = args[item] || msg&&msg.Option&&msg.Option(item) || can&&can.Conf&&can.Conf(item) ||
|
||||||
args[item] || can&&can.Conf&&can.Conf(item) || args[index] || cmds[index] || null
|
event&&!(event instanceof Event)&&event[item] || args[index] || cmds[index] || null
|
||||||
if (item == "cb") { echo = true }
|
if (item == "cb") { echo = true }
|
||||||
list.push(arg)
|
list.push(arg)
|
||||||
})
|
})
|
||||||
|
|
||||||
// 执行调用
|
// 执行调用
|
||||||
var res = func.apply(mod||can, list)
|
var res = func.apply(mod||can, list)
|
||||||
|
|
||||||
// 执行回调
|
|
||||||
if (!echo && typeof cb == lang.FUNCTION) { res && msg && msg.Echo(res), arguments.callee.apply(this, [cb, {msg: msg, res: res}]) }
|
if (!echo && typeof cb == lang.FUNCTION) { res && msg && msg.Echo(res), arguments.callee.apply(this, [cb, {msg: msg, res: res}]) }
|
||||||
return res
|
return res
|
||||||
}),
|
}),
|
||||||
@ -105,17 +103,13 @@ Volcanos("core", {help: "数据结构",
|
|||||||
List: shy("迭代器", function(list, cb, interval, cbs) {
|
List: shy("迭代器", function(list, cb, interval, cbs) {
|
||||||
if (typeof list == lang.STRING) { // 默认序列
|
if (typeof list == lang.STRING) { // 默认序列
|
||||||
list = [list]
|
list = [list]
|
||||||
|
} else if (typeof list == lang.NUMBER) { // 等差序列 [end cb interval]|[begin end interval]
|
||||||
} else if (typeof list == lang.NUMBER) { // 等差序列
|
|
||||||
var begin = 0, end = list, step = typeof interval == lang.NUMBER? interval: 1
|
var begin = 0, end = list, step = typeof interval == lang.NUMBER? interval: 1
|
||||||
if (typeof cb == lang.NUMBER) { begin = list, end = cb, cb = null }
|
if (typeof cb == lang.NUMBER) { begin = list, end = cb, cb = null }
|
||||||
|
list = []; for (var i = begin; i < end; i += step) { list.push(i) }
|
||||||
list = []; for (var i = begin; i < end; i += step) {
|
|
||||||
list.push(i)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
list = list || []
|
list = list||[]
|
||||||
|
|
||||||
if (interval > 0) { // 时间序列
|
if (interval > 0) { // 时间序列
|
||||||
function loop(i) { if (i >= list.length) { return typeof cbs == lang.FUNCTION && cbs(list) }
|
function loop(i) { if (i >= list.length) { return typeof cbs == lang.FUNCTION && cbs(list) }
|
||||||
@ -139,9 +133,13 @@ Volcanos("core", {help: "数据结构",
|
|||||||
|
|
||||||
switch (typeof list) {
|
switch (typeof list) {
|
||||||
case undefined: list = []; break
|
case undefined: list = []; break
|
||||||
case lang.OBJECT: break
|
case lang.OBJECT:
|
||||||
|
if (list.length == undefined) {
|
||||||
|
var ls = []; for (var k in list) { ls.push(k) }
|
||||||
|
list = ls
|
||||||
|
}
|
||||||
|
break
|
||||||
default: list = [list]
|
default: list = [list]
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
list && list.length > 0 && typeof cb == lang.FUNCTION? next(0): typeof cbs == lang.FUNCTION && cbs(list)
|
list && list.length > 0 && typeof cb == lang.FUNCTION? next(0): typeof cbs == lang.FUNCTION && cbs(list)
|
||||||
@ -176,6 +174,7 @@ Volcanos("core", {help: "数据结构",
|
|||||||
}),
|
}),
|
||||||
|
|
||||||
Timer300ms: function(cb) { this.Timer(300, cb) },
|
Timer300ms: function(cb) { this.Timer(300, cb) },
|
||||||
|
Timer3s: function(cb) { this.Timer(3000, cb) },
|
||||||
Timer: shy("定时器, value, [1,2,3,4], {interval, length}", function(interval, cb, cbs) {
|
Timer: shy("定时器, value, [1,2,3,4], {interval, length}", function(interval, cb, cbs) {
|
||||||
var timer = {stop: false}; function loop(i) {
|
var timer = {stop: false}; function loop(i) {
|
||||||
timer.stop || i >= interval.length && interval.length >= 0 || cb(timer, interval.interval||interval[i], i, interval)?
|
timer.stop || i >= interval.length && interval.length >= 0 || cb(timer, interval.interval||interval[i], i, interval)?
|
||||||
|
25
lib/misc.js
25
lib/misc.js
@ -1,8 +1,9 @@
|
|||||||
Volcanos("misc", {help: "通信协议", Message: function(event, can) { var msg = {}
|
Volcanos("misc", {help: "通信协议", Message: function(event, can) { var msg = {}
|
||||||
var proto = {_event: event, _can: can,
|
var proto = {_event: event, _can: can,
|
||||||
RunAction: function(event, sub, cmds) { var msg = can.request(event)
|
RunAction: function(event, sub, cmds) { var msg = can.request(event)
|
||||||
if (msg.Option(ice.MSG_HANDLE) != ice.TRUE && cmds && cmds[0] == ctx.ACTION && sub && sub.onaction[cmds[1]]) {
|
if (msg.Option(ice.MSG_HANDLE) == ice.TRUE) { return }
|
||||||
return msg.Option(ice.MSG_HANDLE, ice.TRUE), can.core.CallFunc(sub.onaction[cmds[1]], {event: event, can: sub, msg: msg, cmd: cmds[1], button: cmds[1]}), true
|
if (cmds && cmds[0] == ctx.ACTION && sub && sub.onaction[cmds[1]]) {
|
||||||
|
return msg.Option(ice.MSG_HANDLE, ice.TRUE), can.core.CallFunc(sub.onaction[cmds[1]], {event: event, can: sub, msg: msg, button: cmds[1], cmd: cmds[1]}), true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
},
|
},
|
||||||
@ -80,7 +81,7 @@ Volcanos("misc", {help: "通信协议", Message: function(event, can) { var msg
|
|||||||
};
|
};
|
||||||
return can.misc.proto(msg, proto)
|
return can.misc.proto(msg, proto)
|
||||||
},
|
},
|
||||||
POST: function(can, msg, url, form, cb) {
|
POST: function(can, msg, url, form, cb) { // _method _accept _upload _progress
|
||||||
var xhr = new XMLHttpRequest(); msg._xhr = xhr
|
var xhr = new XMLHttpRequest(); msg._xhr = xhr
|
||||||
xhr.open(msg._method||"POST", url), xhr.onreadystatechange = function() {
|
xhr.open(msg._method||"POST", url), xhr.onreadystatechange = function() {
|
||||||
if (xhr.readyState != 4) { return }
|
if (xhr.readyState != 4) { return }
|
||||||
@ -88,15 +89,18 @@ Volcanos("misc", {help: "通信协议", Message: function(event, can) { var msg
|
|||||||
try { // 解析响应
|
try { // 解析响应
|
||||||
var res = JSON.parse(xhr.responseText)
|
var res = JSON.parse(xhr.responseText)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
var res = {"result": [xhr.responseText]}
|
var res = {result: [xhr.responseText]}
|
||||||
}
|
}
|
||||||
xhr.status == 200 && can.base.isFunc(cb) && cb(msg.Copy(res))
|
if (xhr.status == 200) {
|
||||||
|
return can.base.isFunc(cb) && cb(msg.Copy(res))
|
||||||
|
}
|
||||||
|
can.user.toast(can, res, xhr.status)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg._upload) { // 上传文件
|
if (msg._upload) { // 上传文件
|
||||||
var data = new FormData(); can.core.Items(form, function(value, index, key) {
|
var data = new FormData(); can.core.Items(form, function(value, index, key) {
|
||||||
data.append(key, value)
|
data.append(key, value)
|
||||||
}), data.append(html.UPLOAD, msg._upload), data.append(ice.MSG_UPLOAD, "some")
|
}), data.append(html.UPLOAD, msg._upload), data.append(ice.MSG_UPLOAD, "upload")
|
||||||
|
|
||||||
xhr.upload.onprogress = function(event) {
|
xhr.upload.onprogress = function(event) {
|
||||||
can.base.isFunc(msg._progress) && msg._progress(event, parseInt(event.loaded*100/event.total), event.total, event.loaded)
|
can.base.isFunc(msg._progress) && msg._progress(event, parseInt(event.loaded*100/event.total), event.total, event.loaded)
|
||||||
@ -107,7 +111,7 @@ Volcanos("misc", {help: "通信协议", Message: function(event, can) { var msg
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 发送请求
|
// 发送请求
|
||||||
xhr.setRequestHeader("Accept", "application/json")
|
xhr.setRequestHeader("Accept", msg._accept||"application/json")
|
||||||
try { xhr.send(data) } catch(e) { can.misc.Log(e) }
|
try { xhr.send(data) } catch(e) { can.misc.Log(e) }
|
||||||
},
|
},
|
||||||
Run: function(event, can, dataset, cmds, cb) {
|
Run: function(event, can, dataset, cmds, cb) {
|
||||||
@ -140,7 +144,7 @@ Volcanos("misc", {help: "通信协议", Message: function(event, can) { var msg
|
|||||||
try { // 解析命令
|
try { // 解析命令
|
||||||
var data = JSON.parse(event.data)
|
var data = JSON.parse(event.data)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
var data = {"detail": [event.data]}
|
var data = {detail: [event.data]}
|
||||||
}
|
}
|
||||||
|
|
||||||
var msg = can.request(event); msg.Reply = function() { // 回复命令
|
var msg = can.request(event); msg.Reply = function() { // 回复命令
|
||||||
@ -237,6 +241,11 @@ Volcanos("misc", {help: "通信协议", Message: function(event, can) { var msg
|
|||||||
for (var i in arguments) { args.push(arguments[i]) }
|
for (var i in arguments) { args.push(arguments[i]) }
|
||||||
console.log.apply(console, args)
|
console.log.apply(console, args)
|
||||||
},
|
},
|
||||||
|
Info: function() {
|
||||||
|
var args = [this._time(), this.FileLine(2, 3)]
|
||||||
|
for (var i in arguments) { args.push(arguments[i]) }
|
||||||
|
console.log.apply(console, args)
|
||||||
|
},
|
||||||
Warn: function() {
|
Warn: function() {
|
||||||
var args = [this._time(), this.FileLine(2, 3), "warn"]
|
var args = [this._time(), this.FileLine(2, 3), "warn"]
|
||||||
for (var i in arguments) { args.push(arguments[i]) }
|
for (var i in arguments) { args.push(arguments[i]) }
|
||||||
|
24
lib/page.js
24
lib/page.js
@ -47,17 +47,16 @@ Volcanos("page", {help: "用户界面", ClassList: {
|
|||||||
can.base.isString(value)? (target.innerHTML = value): can.core.Item(value, function(key, val) {
|
can.base.isString(value)? (target.innerHTML = value): can.core.Item(value, function(key, val) {
|
||||||
!can.base.isObject(val)? (target[key] = val): can.core.Item(val, function(k, v) {
|
!can.base.isObject(val)? (target[key] = val): can.core.Item(val, function(k, v) {
|
||||||
var size = {
|
var size = {
|
||||||
"width": true, "max-width": true, "min-width": true,
|
|
||||||
"height": true, "max-height": true, "min-height": true,
|
"height": true, "max-height": true, "min-height": true,
|
||||||
|
"width": true, "max-width": true, "min-width": true,
|
||||||
}
|
}
|
||||||
if (size[k] && parseInt(v) < 0) { return target[key] && (target[key][k] = "") }
|
if (size[k] && parseInt(v) < 0) { return target[key] && (target[key][k] = "") }
|
||||||
|
|
||||||
var size = {
|
var size = {
|
||||||
"width": true, "max-width": true, "min-width": true,
|
"margin-top": true, "margin-left": true, "font-size": true,
|
||||||
"height": true, "max-height": true, "min-height": true,
|
|
||||||
"left": true, "right": true, "top": true, "bottom": true,
|
"left": true, "right": true, "top": true, "bottom": true,
|
||||||
"margin-top": true, "margin-left": true,
|
"height": true, "max-height": true, "min-height": true,
|
||||||
"font-size": true,
|
"width": true, "max-width": true, "min-width": true,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (size[k] && v && (can.base.isNumber(v) || v.indexOf && v.indexOf("px") == -1)) {
|
if (size[k] && v && (can.base.isNumber(v) || v.indexOf && v.indexOf("px") == -1)) {
|
||||||
@ -88,16 +87,18 @@ Volcanos("page", {help: "用户界面", ClassList: {
|
|||||||
// 数据调整
|
// 数据调整
|
||||||
can.core.Item(item, function(key, value) {
|
can.core.Item(item, function(key, value) {
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case "type": break
|
case mdb.TYPE: break
|
||||||
case "name": break
|
case mdb.NAME: break
|
||||||
case "data": break
|
case mdb.DATA: break
|
||||||
case "list": break
|
case mdb.LIST: break
|
||||||
case "inner": data.innerHTML = item.inner; break
|
case html.INNER: data.innerHTML = item.inner; break
|
||||||
case "click": data.onclick = item.click; break
|
case html.CLICK: data.onclick = item.click; break
|
||||||
default: data[key] = item[key]
|
default: data[key] = item[key]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 基本类型: view text button select input username password
|
||||||
|
// 基本类型: img row th td
|
||||||
if (item.view) { var list = can.core.List(item.view)
|
if (item.view) { var list = can.core.List(item.view)
|
||||||
list.length > 0 && list[0] && can.page.ClassList.add(can, data, list[0])
|
list.length > 0 && list[0] && can.page.ClassList.add(can, data, list[0])
|
||||||
type = list[1]||html.DIV
|
type = list[1]||html.DIV
|
||||||
@ -165,6 +166,7 @@ Volcanos("page", {help: "用户界面", ClassList: {
|
|||||||
item.list = item.td.map(function(text) { return {text: [text, html.TD]} })
|
item.list = item.td.map(function(text) { return {text: [text, html.TD]} })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 语言转换
|
||||||
if (type == html.INPUT) { data.type == html.BUTTON && (data.value = can.user.trans(can, data.value))
|
if (type == html.INPUT) { data.type == html.BUTTON && (data.value = can.user.trans(can, data.value))
|
||||||
if (data.type == html.TEXT||data.type == html.PASSWORD||!data.type) { data.autocomplete = data.autocomplete||"off"
|
if (data.type == html.TEXT||data.type == html.PASSWORD||!data.type) { data.autocomplete = data.autocomplete||"off"
|
||||||
data.placeholder = can.user.trans(can, (data.placeholder||data.name||"").split(ice.PT).pop())
|
data.placeholder = can.user.trans(can, (data.placeholder||data.name||"").split(ice.PT).pop())
|
||||||
|
27
lib/user.js
27
lib/user.js
@ -69,8 +69,8 @@ Volcanos("user", {help: "用户操作", agent: {
|
|||||||
"edit": "编辑", "save": "保存", "copy": "复制", "show": "显示", "hide": "隐藏",
|
"edit": "编辑", "save": "保存", "copy": "复制", "show": "显示", "hide": "隐藏",
|
||||||
"project": "项目", "profile": "详情", "actions": "参数",
|
"project": "项目", "profile": "详情", "actions": "参数",
|
||||||
|
|
||||||
"start": "启动", "stop": "停止",
|
|
||||||
"open": "打开", "close": "关闭",
|
"open": "打开", "close": "关闭",
|
||||||
|
"start": "启动", "stop": "停止",
|
||||||
"begin": "开始", "end": "结束",
|
"begin": "开始", "end": "结束",
|
||||||
"clear": "清空", "refresh": "刷新",
|
"clear": "清空", "refresh": "刷新",
|
||||||
"submit": "提交", "cancel": "取消",
|
"submit": "提交", "cancel": "取消",
|
||||||
@ -93,7 +93,7 @@ Volcanos("user", {help: "用户操作", agent: {
|
|||||||
{view: "duration", title: "点击关闭", onclick: function() { action.close() }},
|
{view: "duration", title: "点击关闭", onclick: function() { action.close() }},
|
||||||
can.base.isObject(meta.content)? meta.content: {text: [meta.content||"执行成功", html.DIV, "content"]},
|
can.base.isObject(meta.content)? meta.content: {text: [meta.content||"执行成功", html.DIV, "content"]},
|
||||||
|
|
||||||
{view: "action"}, meta.progress != undefined && {view: "progress", style: {width: width}, list: [
|
{view: chat.ACTION}, meta.progress != undefined && {view: "progress", style: {width: width}, list: [
|
||||||
{view: "current", style: {width: (meta.progress||0)/100*width}},
|
{view: "current", style: {width: (meta.progress||0)/100*width}},
|
||||||
]},
|
]},
|
||||||
] }])
|
] }])
|
||||||
@ -105,7 +105,7 @@ Volcanos("user", {help: "用户操作", agent: {
|
|||||||
}, function() { action.close() }), _target: ui._target, ui: ui,
|
}, function() { action.close() }), _target: ui._target, ui: ui,
|
||||||
}); can.onmotion.story.auto(can, ui._target)
|
}); can.onmotion.story.auto(can, ui._target)
|
||||||
|
|
||||||
can.onengine.signal(can, "ontoast", can.request({}, {
|
can.onengine.signal(can, chat.ONTOAST, can.request({}, {
|
||||||
title: meta.title, content: meta.content,
|
title: meta.title, content: meta.content,
|
||||||
time: can.base.Time(), fileline: can.misc.FileLine(2, 2),
|
time: can.base.Time(), fileline: can.misc.FileLine(2, 2),
|
||||||
}))
|
}))
|
||||||
@ -134,9 +134,8 @@ Volcanos("user", {help: "用户操作", agent: {
|
|||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
"扫码": function() {
|
"扫码": function() {
|
||||||
can.misc.WSS(can, {type: "chrome", cmd: "pwd"}, function(event, msg, cmd, arg) { if (!msg) { return }
|
can.misc.WSS(can, {type: html.CHROME, cmd: "pwd"}, function(event, msg, cmd, arg) { if (!msg) { return }
|
||||||
if (cmd == "pwd") {
|
if (cmd == "pwd") {
|
||||||
can.page.Append(can, document.body, [{type: "iframe", src: arg[1], height: 400, width: window.innerWidth-4}])
|
|
||||||
return can.user.toast(can, arg[2], arg[1], -1), msg.Reply()
|
return can.user.toast(can, arg[2], arg[1], -1), msg.Reply()
|
||||||
}
|
}
|
||||||
if (cmd == ice.MSG_SESSID) {
|
if (cmd == ice.MSG_SESSID) {
|
||||||
@ -146,7 +145,7 @@ Volcanos("user", {help: "用户操作", agent: {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
"授权": function() {
|
"授权": function() {
|
||||||
can.misc.WSS(can, {type: "chrome", cmd: "sso", "user.web": location.href}, function(event, msg, cmd, arg) { if (!msg) { return }
|
can.misc.WSS(can, {type: html.CHROME, cmd: "sso", "user.web": location.href}, function(event, msg, cmd, arg) { if (!msg) { return }
|
||||||
if (cmd == "pwd") {
|
if (cmd == "pwd") {
|
||||||
return location.href = arg[1]
|
return location.href = arg[1]
|
||||||
}
|
}
|
||||||
@ -156,10 +155,8 @@ Volcanos("user", {help: "用户操作", agent: {
|
|||||||
can.search(event, msg[ice.MSG_DETAIL]||[], function(msg) { msg.Reply() })
|
can.search(event, msg[ice.MSG_DETAIL]||[], function(msg) { msg.Reply() })
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
"飞书": function() {
|
"飞书": function() { location.href = "/chat/lark/sso" },
|
||||||
location.href = "/chat/lark/sso"
|
}[button]() }, can.base.Obj(method, ["登录", "扫码", "授权"]))
|
||||||
},
|
|
||||||
}[button]() }, can.base.Obj(method, ["登录", "扫码", "飞书"]))
|
|
||||||
|
|
||||||
can.page.Modify(can, ui._target, {className: "input login", style: {left: (window.innerWidth-ui._target.offsetWidth)/2, top: window.innerHeight/6}})
|
can.page.Modify(can, ui._target, {className: "input login", style: {left: (window.innerWidth-ui._target.offsetWidth)/2, top: window.innerHeight/6}})
|
||||||
},
|
},
|
||||||
@ -173,7 +170,7 @@ Volcanos("user", {help: "用户操作", agent: {
|
|||||||
if (text.indexOf("<svg") != 0) {
|
if (text.indexOf("<svg") != 0) {
|
||||||
text = '<svg xmlns="http://www.w3.org/2000/svg">'+text+"</svg>"
|
text = '<svg xmlns="http://www.w3.org/2000/svg">'+text+"</svg>"
|
||||||
}
|
}
|
||||||
var img = document.createElement("img")
|
var img = document.createElement(html.IMG)
|
||||||
img.onload = function() {
|
img.onload = function() {
|
||||||
var canvas = document.createElement("canvas")
|
var canvas = document.createElement("canvas")
|
||||||
canvas.height = height, canvas.width = width
|
canvas.height = height, canvas.width = width
|
||||||
@ -202,12 +199,12 @@ Volcanos("user", {help: "用户操作", agent: {
|
|||||||
var ui = can.page.Append(can, document.body, [{view: chat.CARTE, style: {left: 0, top: 0}, onmouseleave: function(event) {
|
var ui = can.page.Append(can, document.body, [{view: chat.CARTE, style: {left: 0, top: 0}, onmouseleave: function(event) {
|
||||||
// can.page.Remove(can, ui._target)
|
// can.page.Remove(can, ui._target)
|
||||||
}, list: can.core.List(list, function(item, index) {
|
}, list: can.core.List(list, function(item, index) {
|
||||||
return can.base.isString(item)? {view: "item", list: [{text: can.user.trans(can, item), click: function(event) {
|
return can.base.isString(item)? {view: html.ITEM, list: [{text: can.user.trans(can, item), click: function(event) {
|
||||||
can.user.isMobile && can.page.Remove(can, ui._target)
|
can.user.isMobile && can.page.Remove(can, ui._target)
|
||||||
can.base.isFunc(cb) && cb(event, item, meta, index)
|
can.base.isFunc(cb) && cb(event, item, meta, index)
|
||||||
}, onmouseenter: function(event) {
|
}, onmouseenter: function(event) {
|
||||||
carte._float && can.page.Remove(can, carte._float._target)
|
carte._float && can.page.Remove(can, carte._float._target)
|
||||||
} }] }: {view: "item", list: [{text: can.user.trans(can, item[0])}], onmouseenter: function(event) {
|
} }] }: {view: html.ITEM, list: [{text: can.user.trans(can, item[0])}], onmouseenter: function(event) {
|
||||||
var sub = can.user.carte(event, can, meta, item.slice(1), cb, carte)
|
var sub = can.user.carte(event, can, meta, item.slice(1), cb, carte)
|
||||||
carte._float && can.page.Remove(can, carte._float._target), carte._float = sub
|
carte._float && can.page.Remove(can, carte._float._target), carte._float = sub
|
||||||
can.onlayout.figure(event, can, sub._target, true)
|
can.onlayout.figure(event, can, sub._target, true)
|
||||||
@ -280,8 +277,8 @@ Volcanos("user", {help: "用户操作", agent: {
|
|||||||
},
|
},
|
||||||
upload: function(event, can) { var begin = new Date()
|
upload: function(event, can) { var begin = new Date()
|
||||||
var ui = can.page.Append(can, document.body, [{view: html.UPLOAD, style: {left: 0, top: 0}, list: [
|
var ui = can.page.Append(can, document.body, [{view: html.UPLOAD, style: {left: 0, top: 0}, list: [
|
||||||
{view: "action"}, {view: "output", list: [{view: "progress"}]},
|
{view: html.ACTION}, {view: html.OUTPUT, list: [{view: "progress"}]},
|
||||||
{view: "status", list: [{view: "show"}, {view: "cost"}, {view: "size"}]},
|
{view: html.STATUS, list: [{view: html.SHOW}, {view: "cost"}, {view: "size"}]},
|
||||||
]}]); can.onlayout.figure(event, can, ui._target)
|
]}]); can.onlayout.figure(event, can, ui._target)
|
||||||
|
|
||||||
var action = can.onappend._action(can, [
|
var action = can.onappend._action(can, [
|
||||||
|
143
page/index.css
143
page/index.css
@ -10,8 +10,10 @@ h1, h2, h3 {
|
|||||||
clear:both;
|
clear:both;
|
||||||
}
|
}
|
||||||
h1:hover, h2:hover, h3:hover {
|
h1:hover, h2:hover, h3:hover {
|
||||||
background:green;
|
background:green; cursor:pointer;
|
||||||
cursor:pointer;
|
}
|
||||||
|
div.hide {
|
||||||
|
display:none;
|
||||||
}
|
}
|
||||||
div.item {
|
div.item {
|
||||||
cursor:pointer;
|
cursor:pointer;
|
||||||
@ -20,74 +22,58 @@ div.code {
|
|||||||
background-color:#343a3445; color:white;
|
background-color:#343a3445; color:white;
|
||||||
font-size:14px; font-family:monospace;
|
font-size:14px; font-family:monospace;
|
||||||
box-shadow: 4px 4px 20px 4px #626bd0;
|
box-shadow: 4px 4px 20px 4px #626bd0;
|
||||||
padding:10px; border:solid 3px green;
|
border:solid 3px green; padding:10px;
|
||||||
text-align:left; white-space:pre;
|
text-align:left; white-space:pre;
|
||||||
overflow:auto; clear:both;
|
clear:both; overflow:auto;
|
||||||
}
|
|
||||||
div.hidden {
|
|
||||||
display:none;
|
|
||||||
}
|
}
|
||||||
div.story {
|
div.story {
|
||||||
text-align:left;
|
text-align:left; white-space:pre;
|
||||||
}
|
|
||||||
p.story[data-type=brief] {
|
|
||||||
font-family:cursive;
|
|
||||||
font-weight:bolder;
|
|
||||||
font-size:20px;
|
|
||||||
}
|
}
|
||||||
div.story[data-type=spark] {
|
div.story[data-type=spark] {
|
||||||
background-color:#2169a9a6; color:white;
|
background-color:#2169a9a6; color:white;
|
||||||
|
font-size:14px; font-family:monospace;
|
||||||
box-shadow:4px 4px 10px 1px #626bd0;
|
box-shadow:4px 4px 10px 1px #626bd0;
|
||||||
padding:4px 10px; margin:10px 0px;
|
margin:10px 0px; padding:4px 10px;
|
||||||
border-left:solid 4px blue;
|
border-left:solid 4px blue;
|
||||||
font-family:monospace;
|
|
||||||
white-space:pre;
|
|
||||||
cursor:copy;
|
cursor:copy;
|
||||||
}
|
}
|
||||||
div.story[data-type=spark] span:hover {
|
div.story[data-type=spark] span:hover {
|
||||||
box-shadow: 4px 4px 10px 1px #29318e;
|
box-shadow: 4px 4px 10px 1px #29318e;
|
||||||
background-color:#c10c8a;
|
background-color:#c10c8a;
|
||||||
cursor:copy;
|
}
|
||||||
|
p.story[data-type=brief] {
|
||||||
|
font-size:20px; font-family:cursive; font-weight:bolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hidden {
|
|
||||||
display:none;
|
|
||||||
}
|
|
||||||
select {
|
select {
|
||||||
height:25px; font-size:14px;
|
|
||||||
box-shadow: 4px 4px 10px 1px #626bd0;
|
|
||||||
background-color:black; color:cyan;
|
background-color:black; color:cyan;
|
||||||
padding:0 10px;
|
font-size:14px; font-family:monospace;
|
||||||
|
box-shadow: 4px 4px 10px 1px #626bd0;
|
||||||
|
height:25px; padding:0 10px;
|
||||||
cursor:pointer;
|
cursor:pointer;
|
||||||
}
|
}
|
||||||
option {
|
option {
|
||||||
font-family:monospace;
|
font-family:monospace;
|
||||||
}
|
}
|
||||||
textarea {
|
textarea {
|
||||||
width:400px; height:60px;
|
|
||||||
background-color:cyan;
|
background-color:cyan;
|
||||||
|
width:400px; height:60px;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type=button] {
|
input[type=button] {
|
||||||
background-color:black; color:cyan;
|
background-color:black; color:cyan;
|
||||||
|
font-family:monospace;
|
||||||
letter-spacing:4px;
|
letter-spacing:4px;
|
||||||
padding-left:10px;
|
padding-left:10px;
|
||||||
cursor:pointer;
|
cursor:pointer;
|
||||||
font-family:monospace;
|
|
||||||
}
|
}
|
||||||
input[type=button]:hover {
|
input[type=button]:hover {
|
||||||
background-color:gray; color:cyan;
|
background-color:gray; color:cyan;
|
||||||
}
|
}
|
||||||
/* input[type=password] { */
|
|
||||||
/* width:82px; height:21px; font-size:16px; */
|
|
||||||
/* box-shadow: 4px 4px 10px 1px #626bd0; */
|
|
||||||
/* background-color:cyan; color:black; */
|
|
||||||
/* padding: 0 4px; */
|
|
||||||
/* } */
|
|
||||||
input[type=text] {
|
input[type=text] {
|
||||||
width:82px; height:21px; font-size:16px;
|
|
||||||
box-shadow:4px 4px 10px 1px #626bd0;
|
|
||||||
background-color:cyan; color:black;
|
background-color:cyan; color:black;
|
||||||
|
box-shadow:4px 4px 10px 1px #626bd0;
|
||||||
|
height:21px; width:82px;
|
||||||
|
font-size:16px;
|
||||||
padding:0 4px;
|
padding:0 4px;
|
||||||
}
|
}
|
||||||
input[type=text]:hover {
|
input[type=text]:hover {
|
||||||
@ -116,20 +102,33 @@ input[name=cmd]:hover {
|
|||||||
background-color:white; color:black;
|
background-color:white; color:black;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table.layout {
|
||||||
|
margin:0; border:0; padding:0;
|
||||||
|
border-spacing:0;
|
||||||
|
}
|
||||||
|
table.layout tr {
|
||||||
|
margin:0; border:0; padding:0;
|
||||||
|
}
|
||||||
|
table.layout th {
|
||||||
|
margin:0; border:0; padding:0;
|
||||||
|
}
|
||||||
|
table.layout td {
|
||||||
|
margin:0; border:0; padding:0;
|
||||||
|
vertical-align:top;
|
||||||
|
}
|
||||||
table.layout td.content {
|
table.layout td.content {
|
||||||
position:relative;
|
position:relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
table.layout div.toggle>div {
|
table.layout div.toggle>div {
|
||||||
display: table-cell;
|
display: table-cell;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
height:95px;
|
|
||||||
color:white;
|
color:white;
|
||||||
|
height:95px;
|
||||||
}
|
}
|
||||||
table.layout div.toggle {
|
table.layout div.toggle {
|
||||||
position:absolute; top:20%;
|
|
||||||
background:#e1aeae45;
|
background:#e1aeae45;
|
||||||
height:100px;
|
height:100px; top:20%;
|
||||||
|
position:absolute;
|
||||||
}
|
}
|
||||||
table.layout div.toggle.display>div {
|
table.layout div.toggle.display>div {
|
||||||
height:20px; width:100px;
|
height:20px; width:100px;
|
||||||
@ -155,24 +154,10 @@ table.layout div.toggle.profile {
|
|||||||
border-top-left-radius:10px;
|
border-top-left-radius:10px;
|
||||||
border-bottom-left-radius:10px;
|
border-bottom-left-radius:10px;
|
||||||
}
|
}
|
||||||
table.layout {
|
|
||||||
margin:0; border:0; padding:0;
|
|
||||||
border-spacing:0;
|
|
||||||
}
|
|
||||||
table.layout tr {
|
|
||||||
margin:0; border:0; padding:0;
|
|
||||||
}
|
|
||||||
table.layout td {
|
|
||||||
margin:0; border:0; padding:0;
|
|
||||||
vertical-align:top;
|
|
||||||
}
|
|
||||||
table.layout th {
|
|
||||||
margin:0; border:0; padding:0;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.content {
|
table.content {
|
||||||
border:0; white-space:pre;
|
|
||||||
font-size:14px; font-family:monospace;
|
font-size:14px; font-family:monospace;
|
||||||
|
border:0; white-space:pre;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
table.content tr {
|
table.content tr {
|
||||||
@ -343,14 +328,6 @@ fieldset.plugin {
|
|||||||
fieldset.plugin>div.status {
|
fieldset.plugin>div.status {
|
||||||
border-top:1px solid darkcyan;
|
border-top:1px solid darkcyan;
|
||||||
}
|
}
|
||||||
fieldset.story>legend {
|
|
||||||
display:block;
|
|
||||||
padding:2px 20px;
|
|
||||||
letter-spacing:4px;
|
|
||||||
}
|
|
||||||
fieldset.story>div.status {
|
|
||||||
border-top:1px solid darkcyan;
|
|
||||||
}
|
|
||||||
fieldset.output {
|
fieldset.output {
|
||||||
margin:0; padding:0;
|
margin:0; padding:0;
|
||||||
}
|
}
|
||||||
@ -366,6 +343,14 @@ fieldset.output>div.action {
|
|||||||
fieldset.output>div.status {
|
fieldset.output>div.status {
|
||||||
display:none;
|
display:none;
|
||||||
}
|
}
|
||||||
|
fieldset.story>legend {
|
||||||
|
display:block;
|
||||||
|
padding:2px 20px;
|
||||||
|
letter-spacing:4px;
|
||||||
|
}
|
||||||
|
fieldset.story>div.status {
|
||||||
|
border-top:1px solid darkcyan;
|
||||||
|
}
|
||||||
fieldset.float {
|
fieldset.float {
|
||||||
background-color:#023531cf;
|
background-color:#023531cf;
|
||||||
margin:0px; padding:0px;
|
margin:0px; padding:0px;
|
||||||
@ -377,10 +362,10 @@ fieldset.float>legend {
|
|||||||
fieldset.float table {
|
fieldset.float table {
|
||||||
color:white;
|
color:white;
|
||||||
}
|
}
|
||||||
|
|
||||||
body>fieldset.input {
|
body>fieldset.input {
|
||||||
position:fixed; top:32px;
|
|
||||||
background-color:#0d4142a6;
|
background-color:#0d4142a6;
|
||||||
position:fixed;
|
position:fixed; top:32px;
|
||||||
}
|
}
|
||||||
body>fieldset.input div.output {
|
body>fieldset.input div.output {
|
||||||
max-height:400px;
|
max-height:400px;
|
||||||
@ -405,8 +390,8 @@ body>fieldset.input.date table td:hover {
|
|||||||
|
|
||||||
body>div.toast {
|
body>div.toast {
|
||||||
background:#0e3369b3; color:yellow;
|
background:#0e3369b3; color:yellow;
|
||||||
position:fixed;
|
|
||||||
padding:5px; overflow:auto;
|
padding:5px; overflow:auto;
|
||||||
|
position:fixed;
|
||||||
}
|
}
|
||||||
body>div.toast a {
|
body>div.toast a {
|
||||||
color:yellow;
|
color:yellow;
|
||||||
@ -513,24 +498,13 @@ body>div.upload input[type=file] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
body.white {
|
body.white {
|
||||||
/* background-color:rgba(68,92,106,0.7); */
|
background-color:rgba(5,34,56,0.75); color:white;
|
||||||
background-color:rgba(5,34,56,0.75);
|
|
||||||
/* background-color:#052238bf; */
|
|
||||||
color:white;
|
|
||||||
}
|
}
|
||||||
body.white select {
|
body.white select {
|
||||||
background-color:#99CC66; color:white;
|
background-color:#99CC66; color:white;
|
||||||
border-radius:10px 10px 10px 10px;
|
border-radius:10px 10px 10px 10px;
|
||||||
border:2px solid #99CC66;
|
border:2px solid #99CC66;
|
||||||
}
|
}
|
||||||
body.white input[type=text] {
|
|
||||||
background-color:white; color:black;
|
|
||||||
border:2px solid #14a58e;
|
|
||||||
border-radius:6px;
|
|
||||||
}
|
|
||||||
body.white input[type=text]:hover {
|
|
||||||
background-color:cyan;
|
|
||||||
}
|
|
||||||
body.white input[type=button] {
|
body.white input[type=button] {
|
||||||
background-color:#FF9900; color:white;
|
background-color:#FF9900; color:white;
|
||||||
border:2px solid #FF9900;
|
border:2px solid #FF9900;
|
||||||
@ -540,11 +514,13 @@ body.white input[type=button]:hover {
|
|||||||
background-color:#FFCC33;
|
background-color:#FFCC33;
|
||||||
border:2px solid #FFCC33;
|
border:2px solid #FFCC33;
|
||||||
}
|
}
|
||||||
body.white td>input[type=button][name=remove] {
|
body.white input[type=text] {
|
||||||
background-color:red;
|
background-color:white; color:black;
|
||||||
|
border:2px solid #14a58e;
|
||||||
|
border-radius:6px;
|
||||||
}
|
}
|
||||||
body.white td>input[type=button][name=create] {
|
body.white input[type=text]:hover {
|
||||||
background-color:blue;
|
background-color:cyan;
|
||||||
}
|
}
|
||||||
body.white input[name=cmd] {
|
body.white input[name=cmd] {
|
||||||
background-color:black; color:white;
|
background-color:black; color:white;
|
||||||
@ -575,6 +551,12 @@ body.white table input[type=button][value=停止] {
|
|||||||
body.white table input[type=button][value=启动] {
|
body.white table input[type=button][value=启动] {
|
||||||
background:#52ce78;
|
background:#52ce78;
|
||||||
}
|
}
|
||||||
|
body.white td>input[type=button][name=create] {
|
||||||
|
background-color:blue;
|
||||||
|
}
|
||||||
|
body.white td>input[type=button][name=remove] {
|
||||||
|
background-color:red;
|
||||||
|
}
|
||||||
|
|
||||||
body.white fieldset>div.legend {
|
body.white fieldset>div.legend {
|
||||||
/* background-color:honeydew; */
|
/* background-color:honeydew; */
|
||||||
@ -582,7 +564,6 @@ body.white fieldset>div.legend {
|
|||||||
body.white fieldset>div.status>div.item>label {
|
body.white fieldset>div.status>div.item>label {
|
||||||
font-size:10px; color:#cefbfbe0;
|
font-size:10px; color:#cefbfbe0;
|
||||||
}
|
}
|
||||||
|
|
||||||
body.white fieldset.Action {
|
body.white fieldset.Action {
|
||||||
color:black;
|
color:black;
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<head>
|
<head>
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=0.8,user-scalable=no">
|
<meta name="viewport" content="width=device-width,initial-scale=0.8,user-scalable=no">
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8"><title>volcanos</title>
|
||||||
<title>volcanos</title>
|
|
||||||
<link rel="shortcut icon" type="image/ico" href="/favicon.ico">
|
<link rel="shortcut icon" type="image/ico" href="/favicon.ico">
|
||||||
<link rel="stylesheet" type="text/css" href="/page/cache.css">
|
<link rel="stylesheet" type="text/css" href="/page/cache.css">
|
||||||
<link rel="stylesheet" type="text/css" href="/page/index.css">
|
<link rel="stylesheet" type="text/css" href="/page/index.css">
|
||||||
|
@ -2,8 +2,7 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg)
|
|||||||
var river = can.Conf(chat.RIVER), storm = can.Conf(chat.STORM)
|
var river = can.Conf(chat.RIVER), storm = can.Conf(chat.STORM)
|
||||||
can.onmotion.clear(can), can.core.Next(msg.Table(), function(item, next) { item.type = chat.PLUGIN
|
can.onmotion.clear(can), can.core.Next(msg.Table(), function(item, next) { item.type = chat.PLUGIN
|
||||||
item.height = parseInt(can.Conf(html.HEIGHT))-40, item.width = parseInt(can.Conf(html.WIDTH))-40
|
item.height = parseInt(can.Conf(html.HEIGHT))-40, item.width = parseInt(can.Conf(html.WIDTH))-40
|
||||||
item.feature = can.base.Obj(item.feature||item.meta)
|
item.feature = can.base.Obj(item.feature||item.meta), item.inputs = can.base.Obj(item.inputs||item.list)
|
||||||
item.inputs = can.base.Obj(item.inputs||item.list)
|
|
||||||
|
|
||||||
can.onappend.plugin(can, item, function(sub, meta, skip) {
|
can.onappend.plugin(can, item, function(sub, meta, skip) {
|
||||||
can.onimport._plugin(can, river, storm, sub, meta), skip || next()
|
can.onimport._plugin(can, river, storm, sub, meta), skip || next()
|
||||||
@ -12,8 +11,6 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg)
|
|||||||
can.onaction.layout(can, can.misc.Search(can, chat.LAYOUT)||can.Conf(chat.LAYOUT))
|
can.onaction.layout(can, can.misc.Search(can, chat.LAYOUT)||can.Conf(chat.LAYOUT))
|
||||||
!can.user.isMobile && can.onimport._menu(can, msg)
|
!can.user.isMobile && can.onimport._menu(can, msg)
|
||||||
})
|
})
|
||||||
|
|
||||||
can.onmotion.float.auto(can, can._output, chat.CARTE)
|
|
||||||
},
|
},
|
||||||
_plugin: function(can, river, storm, sub, meta) {
|
_plugin: function(can, river, storm, sub, meta) {
|
||||||
sub.run = function(event, cmds, cb) { var msg = sub.request(event); cmds = cmds||[]
|
sub.run = function(event, cmds, cb) { var msg = sub.request(event); cmds = cmds||[]
|
||||||
@ -23,24 +20,20 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg)
|
|||||||
})
|
})
|
||||||
}, can._plugins = (can._plugins||[]).concat([sub])
|
}, can._plugins = (can._plugins||[]).concat([sub])
|
||||||
|
|
||||||
|
can.page.Modify(can, sub._output, {style: {"max-width": meta.width}})
|
||||||
can.page.Append(can, can._action, [{view: [html.ITEM, html.DIV, meta.name], onclick: function(event) {
|
can.page.Append(can, can._action, [{view: [html.ITEM, html.DIV, meta.name], onclick: function(event) {
|
||||||
can.onmotion.select(can, can._output, "fieldset.plugin", sub._target)
|
can.onmotion.select(can, can._output, "fieldset.plugin", sub._target)
|
||||||
can.onmotion.select(can, can._action, "div.item", event.target)
|
can.onmotion.select(can, can._action, "div.item", event.target)
|
||||||
}}])
|
}}])
|
||||||
|
|
||||||
can.page.Modify(can, sub._output, {style: {"max-width": meta.width}})
|
|
||||||
|
|
||||||
sub._option.dataset = sub._option.dataset||{}
|
sub._option.dataset = sub._option.dataset||{}
|
||||||
meta.id && (sub._option.dataset.id = meta.id)
|
meta.id && (sub._option.dataset.id = meta.id)
|
||||||
sub._target.Meta = meta
|
sub._target.Meta = meta
|
||||||
},
|
},
|
||||||
_menu: function(can, msg) {
|
_menu: function(can, msg) { if (can.user.mod.isPod||can.user.isMobile) { return }
|
||||||
if (can.user.mod.isPod||can.user.isMobile) { return }
|
|
||||||
|
|
||||||
can._menu && can.page.Remove(can, can._menu)
|
can._menu && can.page.Remove(can, can._menu)
|
||||||
can._menu = can.search({}, ["Header.onimport.menu", ctx.ACTION].concat(
|
can._menu = can.search({}, ["Header.onimport.menu", ctx.ACTION].concat(
|
||||||
can.base.Obj(msg.Option("menus"), [
|
can.base.Obj(msg.Option("menus"), [
|
||||||
// ["布局", "默认布局", "流动布局", "网格布局", "标签布局", "自由布局"],
|
|
||||||
["help", "tutor", "manual", "service", "devops", "refer"],
|
["help", "tutor", "manual", "service", "devops", "refer"],
|
||||||
])
|
])
|
||||||
), function(event, button, list) {
|
), function(event, button, list) {
|
||||||
@ -68,8 +61,7 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg)
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
Volcanos("onengine", {help: "解析引擎", list: [], _engine: function(event, page, msg, can, cmds, cb) {
|
Volcanos("onengine", {help: "解析引擎", list: [], _engine: function(event, page, msg, can, cmds, cb) {
|
||||||
var list = can._root.river
|
var list = can._root.river; var river = list[cmds[0]]
|
||||||
var river = list[cmds[0]]
|
|
||||||
var storm = river && river.storm[cmds[1]]
|
var storm = river && river.storm[cmds[1]]
|
||||||
if (!storm || cmds.length != 2) { return false }
|
if (!storm || cmds.length != 2) { return false }
|
||||||
|
|
||||||
@ -77,12 +69,12 @@ Volcanos("onengine", {help: "解析引擎", list: [], _engine: function(event, p
|
|||||||
can.run(event, cmds, cb) // 命令详情
|
can.run(event, cmds, cb) // 命令详情
|
||||||
} else { // 命令列表
|
} else { // 命令列表
|
||||||
can.core.List(storm.list, function(value) {
|
can.core.List(storm.list, function(value) {
|
||||||
msg.Push("name", value.name||"")
|
msg.Push(mdb.NAME, value.name||"")
|
||||||
msg.Push("help", value.help||"")
|
msg.Push(mdb.HELP, value.help||"")
|
||||||
msg.Push("inputs", JSON.stringify(value.inputs))
|
msg.Push(ctx.INPUTS, JSON.stringify(value.inputs))
|
||||||
msg.Push("feature", JSON.stringify(value.feature))
|
msg.Push(ctx.FEATURE, JSON.stringify(value.feature))
|
||||||
msg.Push("index", value.index||"")
|
msg.Push(ctx.INDEX, value.index||"")
|
||||||
msg.Push("args", value.args||"[]")
|
msg.Push(ctx.ARGS, value.args||"[]")
|
||||||
msg.Push("_action", value._action||"")
|
msg.Push("_action", value._action||"")
|
||||||
}), can.base.isFunc(cb) && cb(msg)
|
}), can.base.isFunc(cb) && cb(msg)
|
||||||
}
|
}
|
||||||
@ -99,10 +91,6 @@ Volcanos("onaction", {help: "交互操作", list: [], _init: function(can, msg,
|
|||||||
can.onimport._share(can, can.misc.Search(can, web.SHARE))
|
can.onimport._share(can, can.misc.Search(can, web.SHARE))
|
||||||
can.onkeypop._init(can)
|
can.onkeypop._init(can)
|
||||||
},
|
},
|
||||||
onsize: function(can, msg, width, height) { can.Conf({width: width, height: height}) },
|
|
||||||
onsearch: function(can, msg, word) {
|
|
||||||
if (word[0] == "*" || word[0] == mdb.PLUGIN) { can.onexport.plugin(can, msg, word) }
|
|
||||||
},
|
|
||||||
onstorm_select: function(can, msg, river, storm) { can.onlayout._init(can)
|
onstorm_select: function(can, msg, river, storm) { can.onlayout._init(can)
|
||||||
function key(name) { return can.core.Keys(can.Conf(chat.RIVER), can.Conf(chat.STORM), name) }
|
function key(name) { return can.core.Keys(can.Conf(chat.RIVER), can.Conf(chat.STORM), name) }
|
||||||
can.page.Cache(key(html.ACTION), can._action, can._output.scrollTop+1)
|
can.page.Cache(key(html.ACTION), can._action, can._output.scrollTop+1)
|
||||||
@ -121,6 +109,10 @@ Volcanos("onaction", {help: "交互操作", list: [], _init: function(can, msg,
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
onsearch: function(can, msg, word) {
|
||||||
|
if (word[0] == "*" || word[0] == mdb.PLUGIN) { can.onexport.plugin(can, msg, word) }
|
||||||
|
},
|
||||||
|
onsize: function(can, msg, width, height) { can.Conf({width: width, height: height}) },
|
||||||
|
|
||||||
layout: function(can, layout) { if (!layout) { return }
|
layout: function(can, layout) { if (!layout) { return }
|
||||||
var trans = {
|
var trans = {
|
||||||
|
@ -44,27 +44,25 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
|
|||||||
}}, "", target, "title cmd")
|
}}, "", target, "title cmd")
|
||||||
},
|
},
|
||||||
|
|
||||||
|
toast: function(can, msg, title, content, fileline, time) { can._toast = can._toast||can.request()
|
||||||
|
can.page.Modify(can, can.toast, [time.split(ice.SP).pop(), title, content].join(ice.SP))
|
||||||
|
can._toast.Push({time: time, fileline: fileline, title: title, content: content})
|
||||||
|
},
|
||||||
ncmd: function(can, msg, _follow, _cmds) { var NCMD = "ncmd"; can._cmds = can._cmds||can.request()
|
ncmd: function(can, msg, _follow, _cmds) { var NCMD = "ncmd"; can._cmds = can._cmds||can.request()
|
||||||
can._cmds.Push({time: can.base.Time(), follow: _follow, cmds: _cmds})
|
can._cmds.Push({time: can.base.Time(), follow: _follow, cmds: _cmds})
|
||||||
can.page.Select(can, can._output, can.core.Keys(html.SPAN, NCMD), function(item) {
|
can.page.Select(can, can._output, can.core.Keys(html.SPAN, NCMD), function(item) {
|
||||||
item.innerHTML = can.Conf(NCMD, parseInt(can.Conf(NCMD)||"0")+1+"")+""
|
item.innerHTML = can.Conf(NCMD, parseInt(can.Conf(NCMD)||"0")+1+"")+""
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
toast: function(can, msg, title, content, fileline, time) { can._toast = can._toast||can.request()
|
|
||||||
can.page.Modify(can, can.toast, [time.split(ice.SP).pop(), title, content].join(ice.SP))
|
|
||||||
can._toast.Push({time: time, fileline: fileline, title: title, content: content})
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
Volcanos("onaction", {help: "交互数据", list: [], _init: function(can, msg, list, cb, target) {
|
Volcanos("onaction", {help: "交互数据", list: [], _init: function(can, msg, list, cb, target) {
|
||||||
can.base.isFunc(cb) && cb(msg)
|
can.base.isFunc(cb) && cb(msg)
|
||||||
},
|
},
|
||||||
onlogin: function(can, msg) { can.run({}, [], function(msg) { can.onimport._init(can, msg, [], null, can._output) }) },
|
onlogin: function(can, msg) { can.run({}, [], function(msg) { can.onimport._init(can, msg, [], null, can._output) }) },
|
||||||
onremote: function(can, msg) { can.core.CallFunc(can.onimport.ncmd, {can: can, msg: msg}) },
|
|
||||||
ontoast: function(can, msg) { can.core.CallFunc(can.onimport.toast, {can: can, msg: msg}) },
|
ontoast: function(can, msg) { can.core.CallFunc(can.onimport.toast, {can: can, msg: msg}) },
|
||||||
|
onremote: function(can, msg) { can.core.CallFunc(can.onimport.ncmd, {can: can, msg: msg}) },
|
||||||
oncommandfocus: function(can) {
|
oncommandfocus: function(can) {
|
||||||
can.page.Select(can, can._output, "div.cmd input", function(target) {
|
can.page.Select(can, can._output, "div.cmd input", function(target) { target.focus() })
|
||||||
target.focus()
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_cmd: function(can) {
|
_cmd: function(can) {
|
||||||
|
@ -66,7 +66,7 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
|
|||||||
case lang.ENTER: can.onengine.signal(can, "onopensearch", can.request(event, {type: "*", word: event.target.value}))
|
case lang.ENTER: can.onengine.signal(can, "onopensearch", can.request(event, {type: "*", word: event.target.value}))
|
||||||
}
|
}
|
||||||
}}, "", target, "title search").parentNode
|
}}, "", target, "title search").parentNode
|
||||||
can.user.isMobile && can.page.Modify(can, ui, {style: {float: "right"}})
|
can.user.isMobile && can.page.Modify(can, ui, {style: {float: html.RIGHT}})
|
||||||
},
|
},
|
||||||
_background: function(can, msg) { if (can.user.isExtension || can.user.isLocalFile) { return }
|
_background: function(can, msg) { if (can.user.isExtension || can.user.isLocalFile) { return }
|
||||||
msg.Option(aaa.BACKGROUND) && can.onlayout.background(can, "/share/local/background", document.body)
|
msg.Option(aaa.BACKGROUND) && can.onlayout.background(can, "/share/local/background", document.body)
|
||||||
@ -168,9 +168,7 @@ Volcanos("onaction", {help: "交互数据", list: [], _init: function(can, meta,
|
|||||||
},
|
},
|
||||||
onstorm_select: function(can, msg, river, storm) { can.Conf(chat.RIVER, river), can.Conf(chat.STORM, storm) },
|
onstorm_select: function(can, msg, river, storm) { can.Conf(chat.RIVER, river), can.Conf(chat.STORM, storm) },
|
||||||
onsearchfocus: function(can) {
|
onsearchfocus: function(can) {
|
||||||
can.page.Select(can, can._output, "div.search input", function(target) {
|
can.page.Select(can, can._output, "div.search input", function(target) { target.focus() })
|
||||||
target.focus()
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
title: function(event, can) {
|
title: function(event, can) {
|
||||||
|
@ -90,7 +90,7 @@ Volcanos("onaction", {help: "控件交互", list: [], _init: function(can, msg,
|
|||||||
if (word[0] == "*" || word[0] == chat.STORM) { can.onexport.storm(can, msg, word) }
|
if (word[0] == "*" || word[0] == chat.STORM) { can.onexport.storm(can, msg, word) }
|
||||||
},
|
},
|
||||||
onstorm_select: function(can, msg, river, storm) { var args = {river: river, storm: storm}
|
onstorm_select: function(can, msg, river, storm) { var args = {river: river, storm: storm}
|
||||||
if (can.user.isExtension) { localStorage.setItem("args", JSON.stringify(args)) }
|
if (can.user.isExtension) { localStorage.setItem(ctx.ARGS, JSON.stringify(args)) }
|
||||||
},
|
},
|
||||||
onaction_touch: function(can, msg) {
|
onaction_touch: function(can, msg) {
|
||||||
can.onmotion.float.del(can, chat.CARTE)
|
can.onmotion.float.del(can, chat.CARTE)
|
||||||
@ -142,7 +142,7 @@ Volcanos("onaction", {help: "控件交互", list: [], _init: function(can, msg,
|
|||||||
var args = {river: can.Conf(chat.RIVER), storm: can.Conf(chat.STORM),
|
var args = {river: can.Conf(chat.RIVER), storm: can.Conf(chat.STORM),
|
||||||
topic: can.get("Header", "topic"), layout: can.get("Action", "layout"),
|
topic: can.get("Header", "topic"), layout: can.get("Action", "layout"),
|
||||||
}
|
}
|
||||||
if (can.user.isExtension) { localStorage.setItem("args", JSON.stringify(args)) }
|
if (can.user.isExtension) { localStorage.setItem(ctx.ARGS, JSON.stringify(args)) }
|
||||||
can.misc.Search(can, args)
|
can.misc.Search(can, args)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -175,14 +175,14 @@ Volcanos("onaction", {help: "组件交互", list: [
|
|||||||
_filter: function(event, can, key, value) { var count = 0
|
_filter: function(event, can, key, value) { var count = 0
|
||||||
if (value == "all") {
|
if (value == "all") {
|
||||||
can.page.Select(can, can.ui.content, "div.item", function(item) {
|
can.page.Select(can, can.ui.content, "div.item", function(item) {
|
||||||
can.page.ClassList.del(can, item, "hidden"), count++
|
can.page.ClassList.del(can, item, "hide"), count++
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
can.page.Select(can, can.ui.content, "div.item", function(item) {
|
can.page.Select(can, can.ui.content, "div.item", function(item) {
|
||||||
can.page.ClassList.add(can, item, "hidden")
|
can.page.ClassList.add(can, item, "hide")
|
||||||
})
|
})
|
||||||
can.page.Select(can, can.ui.content, "div."+value, function(item) {
|
can.page.Select(can, can.ui.content, "div."+value, function(item) {
|
||||||
can.page.ClassList.del(can, item, "hidden"), count++
|
can.page.ClassList.del(can, item, "hide"), count++
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
can.Action(key, value), can.Status("count", count)
|
can.Action(key, value), can.Status("count", count)
|
||||||
|
112
proto.js
112
proto.js
@ -1,23 +1,4 @@
|
|||||||
var kit = {
|
var kit = {
|
||||||
MDB_ID: "id",
|
|
||||||
MDB_KEY: "key",
|
|
||||||
MDB_TIME: "time",
|
|
||||||
MDB_ZONE: "zone",
|
|
||||||
MDB_TYPE: "type",
|
|
||||||
MDB_NAME: "name",
|
|
||||||
MDB_TEXT: "text",
|
|
||||||
|
|
||||||
MDB_INDEX: "index",
|
|
||||||
MDB_VALUE: "value",
|
|
||||||
MDB_COUNT: "count",
|
|
||||||
|
|
||||||
MDB_LINK: "link",
|
|
||||||
MDB_HELP: "help",
|
|
||||||
|
|
||||||
MDB_ARGS: "args",
|
|
||||||
|
|
||||||
MDB_HASH: "hash",
|
|
||||||
MDB_LIST: "list",
|
|
||||||
Dict: function() { var res = {}
|
Dict: function() { var res = {}
|
||||||
for (var i = 0; i < arguments.length; i += 2) {
|
for (var i = 0; i < arguments.length; i += 2) {
|
||||||
res[arguments[i]] = arguments[i+1]
|
res[arguments[i]] = arguments[i+1]
|
||||||
@ -29,18 +10,11 @@ var ice = {
|
|||||||
POD: "pod", CTX: "ctx", CMD: "cmd", ARG: "arg", OPT: "opt",
|
POD: "pod", CTX: "ctx", CMD: "cmd", ARG: "arg", OPT: "opt",
|
||||||
RUN: "run", RES: "res", ERR: "err",
|
RUN: "run", RES: "res", ERR: "err",
|
||||||
|
|
||||||
TRUE: "true", SUCCESS: "success", FAILURE: "failure", PROCESS: "process",
|
OK: "ok", TRUE: "true", FALSE: "false", SUCCESS: "success", FAILURE: "failure", PROCESS: "process",
|
||||||
|
|
||||||
AUTO: "auto", VIEW: "view",
|
AUTO: "auto", HELP: "help", HTTP: "http",
|
||||||
COPY: "copy", SHOW: "show", HIDE: "hide", MODE: "mode", SHIP: "ship",
|
VIEW: "view", MODE: "mode", SHIP: "ship",
|
||||||
|
COPY: "copy", SHOW: "show", HIDE: "hide",
|
||||||
MSG_USERNAME: "user.name",
|
|
||||||
MSG_USERNICK: "user.nick",
|
|
||||||
MSG_TITLE: "sess.title",
|
|
||||||
MSG_TOPIC: "sess.topic",
|
|
||||||
MSG_RIVER: "sess.river",
|
|
||||||
MSG_STORM: "sess.storm",
|
|
||||||
MSG_TOAST: "sess.toast",
|
|
||||||
|
|
||||||
MSG_DETAIL: "detail",
|
MSG_DETAIL: "detail",
|
||||||
MSG_OPTION: "option",
|
MSG_OPTION: "option",
|
||||||
@ -52,13 +26,23 @@ var ice = {
|
|||||||
MSG_SOURCE: "_source",
|
MSG_SOURCE: "_source",
|
||||||
MSG_TARGET: "_target",
|
MSG_TARGET: "_target",
|
||||||
MSG_HANDLE: "_handle",
|
MSG_HANDLE: "_handle",
|
||||||
MSG_DAEMON: "_daemon",
|
|
||||||
MSG_UPLOAD: "_upload",
|
MSG_UPLOAD: "_upload",
|
||||||
|
MSG_DAEMON: "_daemon",
|
||||||
MSG_ACTION: "_action",
|
MSG_ACTION: "_action",
|
||||||
MSG_STATUS: "_status",
|
MSG_STATUS: "_status",
|
||||||
|
|
||||||
MSG_DISPLAY: "_display",
|
MSG_DISPLAY: "_display",
|
||||||
MSG_PROCESS: "_process",
|
MSG_PROCESS: "_process",
|
||||||
|
|
||||||
|
MSG_USERNAME: "user.name",
|
||||||
|
MSG_USERNICK: "user.nick",
|
||||||
|
|
||||||
|
MSG_TITLE: "sess.title",
|
||||||
|
MSG_TOPIC: "sess.topic",
|
||||||
|
MSG_RIVER: "sess.river",
|
||||||
|
MSG_STORM: "sess.storm",
|
||||||
|
MSG_TOAST: "sess.toast",
|
||||||
|
|
||||||
PROCESS_AGAIN: "_again",
|
PROCESS_AGAIN: "_again",
|
||||||
MSG_PREFIX: "_prefix",
|
MSG_PREFIX: "_prefix",
|
||||||
|
|
||||||
@ -68,13 +52,15 @@ var ice = {
|
|||||||
|
|
||||||
var ctx = {
|
var ctx = {
|
||||||
CONTEXT: "context", COMMAND: "command", ACTION: "action", CONFIG: "config",
|
CONTEXT: "context", COMMAND: "command", ACTION: "action", CONFIG: "config",
|
||||||
|
INPUTS: "inputs", FEATURE: "feature",
|
||||||
INDEX: "index", ARGS: "args",
|
INDEX: "index", ARGS: "args",
|
||||||
}
|
}
|
||||||
var cli = {
|
var cli = {
|
||||||
START: "start", STOP: "stop",
|
|
||||||
OPEN: "open", CLOSE: "close",
|
OPEN: "open", CLOSE: "close",
|
||||||
|
START: "start", STOP: "stop",
|
||||||
DONE: "done", ERROR: "error",
|
DONE: "done", ERROR: "error",
|
||||||
CLEAR: "clear", REFRESH: "refresh",
|
CLEAR: "clear", REFRESH: "refresh",
|
||||||
|
BACK: "back",
|
||||||
|
|
||||||
RED: "red", GREEN: "green", BLUE: "blue",
|
RED: "red", GREEN: "green", BLUE: "blue",
|
||||||
YELLOW: "yellow", CYAN: "cyan", PURPLE: "purple", MAGENTA: "magenta",
|
YELLOW: "yellow", CYAN: "cyan", PURPLE: "purple", MAGENTA: "magenta",
|
||||||
@ -95,31 +81,16 @@ var mdb = {
|
|||||||
|
|
||||||
META: "meta", HASH: "hash", LIST: "list",
|
META: "meta", HASH: "hash", LIST: "list",
|
||||||
|
|
||||||
ID: "id",
|
ID: "id", KEY: "key", TIME: "time", ZONE: "zone", TYPE: "type", NAME: "name", TEXT: "text",
|
||||||
KEY: "key",
|
LINK: "link", SCAN: "scan", SHOW: "show", HELP: "help",
|
||||||
TIME: "time",
|
SHORT: "short", FIELD: "field", COUNT: "count", LIMIT: "limit",
|
||||||
ZONE: "zone",
|
INDEX: "index", VALUE: "value", EXTRA: "extra", EXPIRE: "expire",
|
||||||
TYPE: "type",
|
|
||||||
NAME: "name",
|
|
||||||
TEXT: "text",
|
|
||||||
|
|
||||||
LINK: "link",
|
|
||||||
SCAN: "scan",
|
|
||||||
SHOW: "show",
|
|
||||||
HELP: "help",
|
|
||||||
|
|
||||||
SHORT: "short",
|
|
||||||
FIELD: "field",
|
|
||||||
COUNT: "count",
|
|
||||||
LIMIT: "limit",
|
|
||||||
INDEX: "index",
|
|
||||||
VALUE: "value",
|
|
||||||
EXPIRE: "expire",
|
|
||||||
}
|
}
|
||||||
var ssh = {
|
var ssh = {
|
||||||
SCRIPT: "script",
|
SCRIPT: "script",
|
||||||
}
|
}
|
||||||
var nfs = {
|
var nfs = {
|
||||||
|
HTML: "html", CSS: "css", JS: "js", GO: "go", SH: "sh", CSV: "csv", JSON: "json",
|
||||||
PATH: "path", FILE: "file", LINE: "line",
|
PATH: "path", FILE: "file", LINE: "line",
|
||||||
DIR: "dir", CAT: "cat", TRASH: "trash",
|
DIR: "dir", CAT: "cat", TRASH: "trash",
|
||||||
DIR_ROOT: "dir_root",
|
DIR_ROOT: "dir_root",
|
||||||
@ -138,9 +109,10 @@ var wiki = {
|
|||||||
FIELD: "field", SHELL: "shell", LOCAL: "local", PARSE: "parse",
|
FIELD: "field", SHELL: "shell", LOCAL: "local", PARSE: "parse",
|
||||||
}
|
}
|
||||||
var chat = {
|
var chat = {
|
||||||
LIB: "lib", PAGE: "page", PANEL: "panel", PLUGIN: "plugin", STORY: "story", FLOAT: "float", CONTEXTS: "contexts",
|
LIB: "lib", PAGE: "page", PANEL: "panel", PLUGIN: "plugin", OUTPUT: "output",
|
||||||
CARTE: "carte", INPUT: "input", OUTPUT: "output",
|
TOAST: "toast", CARTE: "carte", INPUT: "input", UPLOAD: "upload",
|
||||||
OPTION: "option", ACTION: "action", OUTPUT: "output", STATUS: "status",
|
STORY: "story", FLOAT: "float", CONTEXTS: "contexts",
|
||||||
|
LEGNED: "legend", OPTION: "option", ACTION: "action", OUTPUT: "output", STATUS: "status",
|
||||||
LAYOUT: "layout", PROJECT: "project", CONTENT: "content", DISPLAY: "display", PROFILE: "profile",
|
LAYOUT: "layout", PROJECT: "project", CONTENT: "content", DISPLAY: "display", PROFILE: "profile",
|
||||||
|
|
||||||
TITLE: "title", TOPIC: "topic", BLACK: "black", WHITE: "white", PRINT: "print",
|
TITLE: "title", TOPIC: "topic", BLACK: "black", WHITE: "white", PRINT: "print",
|
||||||
@ -151,7 +123,8 @@ var chat = {
|
|||||||
AGENT: "agent", CHECK: "check", GRANT: "grant",
|
AGENT: "agent", CHECK: "check", GRANT: "grant",
|
||||||
STATE: "state", MENUS: "menus", TRANS: "trans",
|
STATE: "state", MENUS: "menus", TRANS: "trans",
|
||||||
|
|
||||||
ONMAIN: "onmain", ONSIZE: "onsize", ONLOGIN: "onlogin", ONSEARCH: "onsearch",
|
ONMAIN: "onmain", ONLOGIN: "onlogin", ONSEARCH: "onsearch",
|
||||||
|
ONSIZE: "onsize", ONTOAST: "ontoast", ONREMOTE: "onremote",
|
||||||
|
|
||||||
HEAD: "head", LEFT: "left", MAIN: "main", AUTO: "auto", HIDE: "hide", FOOT: "foot",
|
HEAD: "head", LEFT: "left", MAIN: "main", AUTO: "auto", HIDE: "hide", FOOT: "foot",
|
||||||
SCROLL: "scroll", LEFT: "left", TOP: "top", RIGHT: "right", BOTTOM: "bottom",
|
SCROLL: "scroll", LEFT: "left", TOP: "top", RIGHT: "right", BOTTOM: "bottom",
|
||||||
@ -202,22 +175,19 @@ var html = {
|
|||||||
|
|
||||||
UPLOAD: "upload", USERNAME: "username", PASSWORD: "password",
|
UPLOAD: "upload", USERNAME: "username", PASSWORD: "password",
|
||||||
INPUT: "input", INPUT_ARGS: ".args", TEXT: "text", TEXTAREA: "textarea", SELECT: "select", BUTTON: "button",
|
INPUT: "input", INPUT_ARGS: ".args", TEXT: "text", TEXTAREA: "textarea", SELECT: "select", BUTTON: "button",
|
||||||
FORM: "form", FILE: "file", SPACE: "space", CLICK: "click",
|
FORM: "form", FILE: "file", SPACE: "space", CLICK: "click", SUBMIT: "submit", CANCEL: "cancel",
|
||||||
DIV: "div", IMG: "img", CODE: "code", SPAN: "span", VIDEO: "video",
|
DIV: "div", IMG: "img", CODE: "code", SPAN: "span", VIDEO: "video",
|
||||||
TABLE: "table", TR: "tr", TH: "th", TD: "td", BR: "br",
|
TABLE: "table", TR: "tr", TH: "th", TD: "td", BR: "br",
|
||||||
IFRAME: "iframe",
|
A: "a", LABEL: "label", INNER: "inner", TITLE: "title",
|
||||||
|
|
||||||
SCROLL: "scroll", HEIGHT: "height", WIDTH: "width", LEFT: "left", TOP: "top", RIGHT: "right", BOTTOM: "bottom",
|
|
||||||
|
|
||||||
CLASS: "class", BLOCK: "block", NONE: "none",
|
CLASS: "class", BLOCK: "block", NONE: "none",
|
||||||
TITLE: "title", A: "a", LABEL: "label", INNER: "inner",
|
|
||||||
STROKE_WIDTH: "stroke-width", STROKE: "stroke", FILL: "fill", FONT_SIZE: "font-size", MONOSPACE: "monospace",
|
STROKE_WIDTH: "stroke-width", STROKE: "stroke", FILL: "fill", FONT_SIZE: "font-size", MONOSPACE: "monospace",
|
||||||
LIST: "list", ITEM: "item", MENU: "menu", NODE: "node",
|
SCROLL: "scroll", HEIGHT: "height", WIDTH: "width", LEFT: "left", TOP: "top", RIGHT: "right", BOTTOM: "bottom",
|
||||||
SUBMIT: "submit", CANCEL: "cancel",
|
|
||||||
WSS: "wss", SVG: "svg",
|
|
||||||
MAX_HEIGHT: "max-height", MAX_WIDTH: "max-width",
|
MAX_HEIGHT: "max-height", MAX_WIDTH: "max-width",
|
||||||
MAX_HEIGHT: "max-height",
|
|
||||||
CHROME: "chrome",
|
WSS: "wss", SVG: "svg", CANVAS: "canvas", IFRAME: "iframe", CHROME: "chrome",
|
||||||
|
LIST: "list", ITEM: "item", MENU: "menu", NODE: "node",
|
||||||
|
HIDE: "hide", SHOW: "show",
|
||||||
}
|
}
|
||||||
var lang = {
|
var lang = {
|
||||||
STRING: "string", NUMBER: "number",
|
STRING: "string", NUMBER: "number",
|
||||||
@ -327,7 +297,7 @@ var Volcanos = shy("火山架", {iceberg: "/chat/", volcano: "/frame.js", args:
|
|||||||
|
|
||||||
} else if (libs[i] == "") {
|
} else if (libs[i] == "") {
|
||||||
libs[i] = _can_path.replace(".js", ".css")
|
libs[i] = _can_path.replace(".js", ".css")
|
||||||
} else if (libs[i][0] != ice.PS && libs[i].indexOf("http") != 0) {
|
} else if (libs[i][0] != ice.PS && libs[i].indexOf(ice.HTTP) != 0) {
|
||||||
libs[i] = _can_path.slice(0, _can_path.lastIndexOf(ice.PS)+1)+libs[i]
|
libs[i] = _can_path.slice(0, _can_path.lastIndexOf(ice.PS)+1)+libs[i]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -336,12 +306,12 @@ var Volcanos = shy("火山架", {iceberg: "/chat/", volcano: "/frame.js", args:
|
|||||||
})
|
})
|
||||||
Volcanos.meta._load = function(url, cb) {
|
Volcanos.meta._load = function(url, cb) {
|
||||||
switch (url.split("?")[0].split(ice.PT).pop().toLowerCase()) {
|
switch (url.split("?")[0].split(ice.PT).pop().toLowerCase()) {
|
||||||
case "css":
|
case nfs.CSS:
|
||||||
var item = document.createElement(mdb.LINK)
|
var item = document.createElement(mdb.LINK)
|
||||||
item.rel = "stylesheet", item.type = "text/css"
|
item.rel = "stylesheet", item.type = "text/css"
|
||||||
item.onload = cb, item.href = url
|
item.onload = cb, item.href = url
|
||||||
return (document.head||document.body).appendChild(item), item
|
return (document.head||document.body).appendChild(item), item
|
||||||
case "js":
|
case nfs.JS:
|
||||||
var item = document.createElement(ssh.SCRIPT)
|
var item = document.createElement(ssh.SCRIPT)
|
||||||
item.onload = cb, item.onerror = cb, item.src = url
|
item.onload = cb, item.onerror = cb, item.src = url
|
||||||
return document.body.appendChild(item), item
|
return document.body.appendChild(item), item
|
||||||
@ -349,7 +319,7 @@ Volcanos.meta._load = function(url, cb) {
|
|||||||
}
|
}
|
||||||
function cmd(tool) {
|
function cmd(tool) {
|
||||||
Volcanos({name: "chat", panels: [
|
Volcanos({name: "chat", panels: [
|
||||||
{name: "Header", help: "标题栏", pos: "hidden", state: ["time", "usernick", "avatar"]},
|
{name: "Header", help: "标题栏", pos: "hide", state: ["time", "usernick", "avatar"]},
|
||||||
{name: "cmd", help: "工作台", pos: chat.MAIN, tool: tool},
|
{name: "cmd", help: "工作台", pos: chat.MAIN, tool: tool},
|
||||||
]})
|
]})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user