1
0
forked from x/volcanos
This commit is contained in:
IT 老营长 @云轩领航-创始人 2022-01-09 13:41:35 +08:00
parent fb41d101a0
commit 0d3dd49fb7
14 changed files with 242 additions and 303 deletions

View File

@ -31,14 +31,14 @@ Volcanos("onengine", {help: "搜索引擎", list: [], _init: function(can, meta,
return can.core.CallFunc(fun, {
"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,
}, mod)
},
_engine: function(event, can, msg, panel, cmds, cb) { return false },
_remote: function(event, can, msg, panel, cmds, cb) {
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))
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)
}),
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.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.STRING:
switch (item) {
case "list":
case "back": return {type: type = html.BUTTON, name: item}
case "name": return {type: type = html.TEXT, name: item}
case "text": return {type: type = html.TEXTAREA, name: item}
case mdb.LIST:
case cli.BACK: return {type: type = html.BUTTON, name: item}
case mdb.NAME: return {type: type = html.TEXT, name: item}
case mdb.TEXT: return {type: type = html.TEXTAREA, name: item}
default: return {type: type, name: item}
}
}
@ -88,15 +88,15 @@ Volcanos("ondaemon", {help: "推荐引擎", list: [], _init: function(can, name)
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 }
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.List(msg.Option(ice.MSG_FIELDS).split(ice.FS), function(item) {
msg.Push(item, kit.Dict(
"ctx", "onengine", "cmd", "command",
"type", "can", "name", name, "text", command.help,
"context", "can", "command", name,
ice.CTX, "onengine", ice.CMD, "command",
mdb.TYPE, "can", mdb.NAME, name, mdb.TEXT, command.help,
ctx.CONTEXT, "can", ctx.COMMAND, name,
)[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}))
},
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) {
@ -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)
}
if (key == "hash" && can.user.mod.isDiv) {
if (key == mdb.HASH && can.user.mod.isDiv) {
can.user.jumps("/chat/div/"+value)
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.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.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) {
if (event.target.tagName == "INPUT") { return }
if (event.key == "Escape") { ui.close(); return }
if (event.key == " ") { input.focus(), event.stopPropagation(), event.preventDefault() }
if (event.key == lang.ESCAPE) { ui.close(); return }
if (event.key == ice.SP) { input.focus(), event.stopPropagation(), event.preventDefault() }
}}))
}, onkeydown: function(event) {
can.onkeypop.input(event, can)
if (event.key != "Enter") { return }
if (event.key != lang.ENTER) { return }
event.target.setSelectionRange(0, -1)
can.page.Select(can, ui.output, html.TR, function(tr, index) { if (index == 0) { return }
@ -510,13 +510,13 @@ Volcanos("onlayout", {help: "页面布局", list: [], _init: function(can, targe
{type: html.TR, list: [{type: html.TR, list: [
{view: [chat.CONTENT, html.TD], list: [
{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
}},
{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
}},
{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
}},
]},
@ -540,7 +540,7 @@ Volcanos("onmotion", {help: "动态特效", list: [], _init: function(can, targe
story: {
_hash: {
spark: function(can, meta, target) {
if (meta[mdb.NAME] == "inner") {
if (meta[mdb.NAME] == html.INNER) {
target.title = "点击复制", target.onclick = function(event) {
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,
}, onkeydown: function(event) {
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)
break
case "Escape": target.innerHTML = back; break
case lang.ESCAPE: target.innerHTML = back; break
default: can.onkeypop.input(event, can)
}
}, _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,
}, onkeydown: function(event) {
switch (event.key) {
case "Enter":
case html.ENTER:
if (event.ctrlKey) {
target.innerHTML = event.target.value
event.target.value == back || cb(event, event.target.value, back)
}
break
case "Escape": target.innerHTML = back; break
case html.ESCAPE: target.innerHTML = back; break
default: can.onkeypop.input(event, can)
}
}, _init: function(target) {

View File

@ -16,51 +16,45 @@ Volcanos("base", {help: "数据类型",
for (var k in from) { to[k] = from[k] }
return to
}
var list = []; for (var i = 2; i < arguments.length; i++) {
list.push(arguments[i])
}
for (var i = 0; i < list.length; i++) {
to[list[i]] = from[list[i]]
for (var i = 2; i < arguments.length; i++) {
var k = arguments[i]; to[k] = from[k]
}
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 == lang.OBJECT) {
if (to.length != from.length) { return false }
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) {
if (!self(to[k], from[k])) { return false }
if (!call(to[k], from[k])) { return false }
}
return true
}
return to === from
},
Ext: function(file) {
return (file.split(ice.PT).pop().split(ice.PT).pop()).toLowerCase()
Ext: function(path) {
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++) {
res += (arguments[i][0]==ice.PS || res=="" || res[res.length-1]==ice.PS? "": ice.PS) + arguments[i].trim()
}
return res
},
Args: function(obj) {var res = [];
Args: function(obj) { var res = []
for (var k in obj) {
res.push(encodeURIComponent(k)+"="+encodeURIComponent(obj[k]))
}
return res.join("&")
},
MergeURL: function(str) { var args = {}
var arg = str.split("?")[1]||""
arg && arg.split("&").forEach(function(item) {
var ls = item.split("=")
args[decodeURIComponent(ls[0])] = decodeURIComponent(ls[1])
MergeURL: function(url) {
var args = {}; (url.split("?")[1]||"").split("&").forEach(function(item) {
var ls = item.split("="); args[decodeURIComponent(ls[0])] = decodeURIComponent(ls[1])
})
for (var i = 1; i < arguments.length; i++) {
switch (typeof arguments[i]) {
@ -83,10 +77,10 @@ Volcanos("base", {help: "数据类型",
var list = []; for (var k in args) {
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}
var list = str.split("?"); res["origin"] = list[0]
ParseURL: function(url) { var res = {link: url}
var list = url.split("?"); res["origin"] = list[0]
list[1] && list[1].split("&").forEach(function(item) {
var ls = item.split("="); res[decodeURIComponent(ls[0])] = decodeURIComponent(ls[1])
})
@ -95,7 +89,7 @@ Volcanos("base", {help: "数据类型",
ParseJSON: function(str) { var res
if (typeof str == lang.OBJECT) { return str }
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]
ls[1] && ls[1].split("&").forEach(function(item) { var ls = item.split("=")
res[decodeURIComponent(ls[0])] = decodeURIComponent(ls[1])
@ -104,9 +98,9 @@ Volcanos("base", {help: "数据类型",
}
try { res = JSON.parse(str)
res.text = res.text||str
res.type = res.type||"json"
res.type = res.type||nfs.JSON
} catch (e) {
res = {type: "text", text: str}
res = {type: mdb.TEXT, text: str}
}
return res
},
@ -207,7 +201,7 @@ Volcanos("base", {help: "数据类型",
isString: function(val) { return typeof val == lang.STRING },
isObject: function(val) { return typeof val == lang.OBJECT },
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 },
isCallback: function(key, value) { return key.indexOf("on") == 0 && typeof value == lang.FUNCTION },
isUndefined: function(val) { return val == undefined },

View File

@ -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 }
var soos = _list("\\") // 转义
var seps = _list(arg[0]||"\t ,;\n") // 空白
var subs = _list(arg[1]||"{[(.:)]}") // 分隔
var sups = _list(arg[2]||"'\"`") // 引用
var space = _list(arg[0]||"\t ,;\n") // 空白
var block = _list(arg[1]||"{[(.:)]}") // 分隔
var quote = _list(arg[2]||"'\"`") // 引用
var trans = _list(arg[3]||"\\") // 转义
var res = [], begin = 0; function push(obj) {
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++) {
if (soos[str[i]]) { // 转义符
begin == -1 && (begin = i++)
} else if (seps[str[i]]) { // 空白符
if (space[str[i]]) { // 空白符
if (s) { continue }
begin > -1 && push(str.slice(begin, i))
opt.detail && push({type: "space", text: str.slice(i, i+1)})
} else if (subs[str[i]]) { // 分隔符
} else if (block[str[i]]) { // 分隔符
if (s) { continue }
begin > -1 && push(str.slice(begin, i))
push(str.slice(i, i+1))
} else if (sups[str[i]]) { // 引用符
} else if (quote[str[i]]) { // 引用符
if (s == "") {
s = str[i], begin = i+1
} else if (s == str[i]) {
@ -68,6 +65,9 @@ Volcanos("core", {help: "数据结构",
s = "", begin = -1
}
} else if (trans[str[i]]) { // 转义符
begin == -1 && (begin = i++)
} else { // 普通符
begin == -1 && (begin = i)
}
@ -78,7 +78,7 @@ Volcanos("core", {help: "数据结构",
return res
}),
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):
@ -88,16 +88,14 @@ Volcanos("core", {help: "数据结构",
// 解析参数
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 }
var arg = msg&&msg.Option&&msg.Option(item) || event&&!(event instanceof Event)&&event[item] ||
args[item] || can&&can.Conf&&can.Conf(item) || args[index] || cmds[index] || null
var arg = args[item] || msg&&msg.Option&&msg.Option(item) || can&&can.Conf&&can.Conf(item) ||
event&&!(event instanceof Event)&&event[item] || args[index] || cmds[index] || null
if (item == "cb") { echo = true }
list.push(arg)
})
// 执行调用
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}]) }
return res
}),
@ -105,14 +103,10 @@ Volcanos("core", {help: "数据结构",
List: shy("迭代器", function(list, cb, interval, cbs) {
if (typeof list == lang.STRING) { // 默认序列
list = [list]
} else if (typeof list == lang.NUMBER) { // 等差序列
} else if (typeof list == lang.NUMBER) { // 等差序列 [end cb interval]|[begin end interval]
var begin = 0, end = list, step = typeof interval == lang.NUMBER? interval: 1
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||[]
@ -139,9 +133,13 @@ Volcanos("core", {help: "数据结构",
switch (typeof list) {
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]
}
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) },
Timer3s: function(cb) { this.Timer(3000, cb) },
Timer: shy("定时器, value, [1,2,3,4], {interval, length}", function(interval, cb, cbs) {
var timer = {stop: false}; function loop(i) {
timer.stop || i >= interval.length && interval.length >= 0 || cb(timer, interval.interval||interval[i], i, interval)?

View File

@ -1,8 +1,9 @@
Volcanos("misc", {help: "通信协议", Message: function(event, can) { var msg = {}
var proto = {_event: event, _can: can,
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]]) {
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 (msg.Option(ice.MSG_HANDLE) == ice.TRUE) { return }
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
},
@ -80,7 +81,7 @@ Volcanos("misc", {help: "通信协议", Message: function(event, can) { var msg
};
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
xhr.open(msg._method||"POST", url), xhr.onreadystatechange = function() {
if (xhr.readyState != 4) { return }
@ -88,15 +89,18 @@ Volcanos("misc", {help: "通信协议", Message: function(event, can) { var msg
try { // 解析响应
var res = JSON.parse(xhr.responseText)
} 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) { // 上传文件
var data = new FormData(); can.core.Items(form, function(value, index, key) {
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) {
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) }
},
Run: function(event, can, dataset, cmds, cb) {
@ -140,7 +144,7 @@ Volcanos("misc", {help: "通信协议", Message: function(event, can) { var msg
try { // 解析命令
var data = JSON.parse(event.data)
} catch (e) {
var data = {"detail": [event.data]}
var data = {detail: [event.data]}
}
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]) }
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() {
var args = [this._time(), this.FileLine(2, 3), "warn"]
for (var i in arguments) { args.push(arguments[i]) }

View File

@ -47,17 +47,16 @@ Volcanos("page", {help: "用户界面", ClassList: {
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) {
var size = {
"width": true, "max-width": true, "min-width": 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] = "") }
var size = {
"width": true, "max-width": true, "min-width": true,
"height": true, "max-height": true, "min-height": true,
"margin-top": true, "margin-left": true, "font-size": true,
"left": true, "right": true, "top": true, "bottom": true,
"margin-top": true, "margin-left": true,
"font-size": true,
"height": true, "max-height": true, "min-height": true,
"width": true, "max-width": true, "min-width": true,
}
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) {
switch (key) {
case "type": break
case "name": break
case "data": break
case "list": break
case "inner": data.innerHTML = item.inner; break
case "click": data.onclick = item.click; break
case mdb.TYPE: break
case mdb.NAME: break
case mdb.DATA: break
case mdb.LIST: break
case html.INNER: data.innerHTML = item.inner; break
case html.CLICK: data.onclick = item.click; break
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)
list.length > 0 && list[0] && can.page.ClassList.add(can, data, list[0])
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]} })
}
// 语言转换
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"
data.placeholder = can.user.trans(can, (data.placeholder||data.name||"").split(ice.PT).pop())

View File

@ -69,8 +69,8 @@ Volcanos("user", {help: "用户操作", agent: {
"edit": "编辑", "save": "保存", "copy": "复制", "show": "显示", "hide": "隐藏",
"project": "项目", "profile": "详情", "actions": "参数",
"start": "启动", "stop": "停止",
"open": "打开", "close": "关闭",
"start": "启动", "stop": "停止",
"begin": "开始", "end": "结束",
"clear": "清空", "refresh": "刷新",
"submit": "提交", "cancel": "取消",
@ -93,7 +93,7 @@ Volcanos("user", {help: "用户操作", agent: {
{view: "duration", title: "点击关闭", onclick: function() { action.close() }},
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}},
]},
] }])
@ -105,7 +105,7 @@ Volcanos("user", {help: "用户操作", agent: {
}, function() { action.close() }), _target: ui._target, ui: ui,
}); 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,
time: can.base.Time(), fileline: can.misc.FileLine(2, 2),
}))
@ -134,9 +134,8 @@ Volcanos("user", {help: "用户操作", agent: {
return true
},
"扫码": 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") {
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()
}
if (cmd == ice.MSG_SESSID) {
@ -146,7 +145,7 @@ Volcanos("user", {help: "用户操作", agent: {
})
},
"授权": 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") {
return location.href = arg[1]
}
@ -156,10 +155,8 @@ Volcanos("user", {help: "用户操作", agent: {
can.search(event, msg[ice.MSG_DETAIL]||[], function(msg) { msg.Reply() })
})
},
"飞书": function() {
location.href = "/chat/lark/sso"
},
}[button]() }, can.base.Obj(method, ["登录", "扫码", "飞书"]))
"飞书": function() { location.href = "/chat/lark/sso" },
}[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}})
},
@ -173,7 +170,7 @@ Volcanos("user", {help: "用户操作", agent: {
if (text.indexOf("<svg") != 0) {
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() {
var canvas = document.createElement("canvas")
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) {
// can.page.Remove(can, ui._target)
}, 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.base.isFunc(cb) && cb(event, item, meta, index)
}, onmouseenter: function(event) {
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)
carte._float && can.page.Remove(can, carte._float._target), carte._float = sub
can.onlayout.figure(event, can, sub._target, true)
@ -280,8 +277,8 @@ Volcanos("user", {help: "用户操作", agent: {
},
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: [
{view: "action"}, {view: "output", list: [{view: "progress"}]},
{view: "status", list: [{view: "show"}, {view: "cost"}, {view: "size"}]},
{view: html.ACTION}, {view: html.OUTPUT, list: [{view: "progress"}]},
{view: html.STATUS, list: [{view: html.SHOW}, {view: "cost"}, {view: "size"}]},
]}]); can.onlayout.figure(event, can, ui._target)
var action = can.onappend._action(can, [

View File

@ -10,8 +10,10 @@ h1, h2, h3 {
clear:both;
}
h1:hover, h2:hover, h3:hover {
background:green;
cursor:pointer;
background:green; cursor:pointer;
}
div.hide {
display:none;
}
div.item {
cursor:pointer;
@ -20,74 +22,58 @@ div.code {
background-color:#343a3445; color:white;
font-size:14px; font-family:monospace;
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;
overflow:auto; clear:both;
}
div.hidden {
display:none;
clear:both; overflow:auto;
}
div.story {
text-align:left;
}
p.story[data-type=brief] {
font-family:cursive;
font-weight:bolder;
font-size:20px;
text-align:left; white-space:pre;
}
div.story[data-type=spark] {
background-color:#2169a9a6; color:white;
font-size:14px; font-family:monospace;
box-shadow:4px 4px 10px 1px #626bd0;
padding:4px 10px; margin:10px 0px;
margin:10px 0px; padding:4px 10px;
border-left:solid 4px blue;
font-family:monospace;
white-space:pre;
cursor:copy;
}
div.story[data-type=spark] span:hover {
box-shadow: 4px 4px 10px 1px #29318e;
background-color:#c10c8a;
cursor:copy;
}
p.story[data-type=brief] {
font-size:20px; font-family:cursive; font-weight:bolder;
}
.hidden {
display:none;
}
select {
height:25px; font-size:14px;
box-shadow: 4px 4px 10px 1px #626bd0;
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;
}
option {
font-family:monospace;
}
textarea {
width:400px; height:60px;
background-color:cyan;
width:400px; height:60px;
}
input[type=button] {
background-color:black; color:cyan;
font-family:monospace;
letter-spacing:4px;
padding-left:10px;
cursor:pointer;
font-family:monospace;
}
input[type=button]:hover {
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] {
width:82px; height:21px; font-size:16px;
box-shadow:4px 4px 10px 1px #626bd0;
background-color:cyan; color:black;
box-shadow:4px 4px 10px 1px #626bd0;
height:21px; width:82px;
font-size:16px;
padding:0 4px;
}
input[type=text]:hover {
@ -116,20 +102,33 @@ input[name=cmd]:hover {
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 {
position:relative;
}
table.layout div.toggle>div {
display: table-cell;
vertical-align: middle;
height:95px;
color:white;
height:95px;
}
table.layout div.toggle {
position:absolute; top:20%;
background:#e1aeae45;
height:100px;
height:100px; top:20%;
position:absolute;
}
table.layout div.toggle.display>div {
height:20px; width:100px;
@ -155,24 +154,10 @@ table.layout div.toggle.profile {
border-top-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 {
border:0; white-space:pre;
font-size:14px; font-family:monospace;
border:0; white-space:pre;
overflow: auto;
}
table.content tr {
@ -343,14 +328,6 @@ fieldset.plugin {
fieldset.plugin>div.status {
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 {
margin:0; padding:0;
}
@ -366,6 +343,14 @@ fieldset.output>div.action {
fieldset.output>div.status {
display:none;
}
fieldset.story>legend {
display:block;
padding:2px 20px;
letter-spacing:4px;
}
fieldset.story>div.status {
border-top:1px solid darkcyan;
}
fieldset.float {
background-color:#023531cf;
margin:0px; padding:0px;
@ -377,10 +362,10 @@ fieldset.float>legend {
fieldset.float table {
color:white;
}
body>fieldset.input {
position:fixed; top:32px;
background-color:#0d4142a6;
position:fixed;
position:fixed; top:32px;
}
body>fieldset.input div.output {
max-height:400px;
@ -405,8 +390,8 @@ body>fieldset.input.date table td:hover {
body>div.toast {
background:#0e3369b3; color:yellow;
position:fixed;
padding:5px; overflow:auto;
position:fixed;
}
body>div.toast a {
color:yellow;
@ -513,24 +498,13 @@ body>div.upload input[type=file] {
}
body.white {
/* background-color:rgba(68,92,106,0.7); */
background-color:rgba(5,34,56,0.75);
/* background-color:#052238bf; */
color:white;
background-color:rgba(5,34,56,0.75); color:white;
}
body.white select {
background-color:#99CC66; color:white;
border-radius:10px 10px 10px 10px;
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] {
background-color:#FF9900; color:white;
border:2px solid #FF9900;
@ -540,11 +514,13 @@ body.white input[type=button]:hover {
background-color:#FFCC33;
border:2px solid #FFCC33;
}
body.white td>input[type=button][name=remove] {
background-color:red;
body.white input[type=text] {
background-color:white; color:black;
border:2px solid #14a58e;
border-radius:6px;
}
body.white td>input[type=button][name=create] {
background-color:blue;
body.white input[type=text]:hover {
background-color:cyan;
}
body.white input[name=cmd] {
background-color:black; color:white;
@ -575,6 +551,12 @@ body.white table input[type=button][value=停止] {
body.white table input[type=button][value=启动] {
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 {
/* background-color:honeydew; */
@ -582,7 +564,6 @@ body.white fieldset>div.legend {
body.white fieldset>div.status>div.item>label {
font-size:10px; color:#cefbfbe0;
}
body.white fieldset.Action {
color:black;
}

View File

@ -1,8 +1,7 @@
<!DOCTYPE html>
<head>
<meta name="viewport" content="width=device-width,initial-scale=0.8,user-scalable=no">
<meta charset="utf-8">
<title>volcanos</title>
<meta charset="utf-8"><title>volcanos</title>
<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/index.css">

View File

@ -2,8 +2,7 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg)
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
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.inputs = can.base.Obj(item.inputs||item.list)
item.feature = can.base.Obj(item.feature||item.meta), item.inputs = can.base.Obj(item.inputs||item.list)
can.onappend.plugin(can, item, function(sub, meta, skip) {
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.user.isMobile && can.onimport._menu(can, msg)
})
can.onmotion.float.auto(can, can._output, chat.CARTE)
},
_plugin: function(can, river, storm, sub, meta) {
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.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.onmotion.select(can, can._output, "fieldset.plugin", sub._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||{}
meta.id && (sub._option.dataset.id = meta.id)
sub._target.Meta = meta
},
_menu: function(can, msg) {
if (can.user.mod.isPod||can.user.isMobile) { return }
_menu: function(can, msg) { if (can.user.mod.isPod||can.user.isMobile) { return }
can._menu && can.page.Remove(can, can._menu)
can._menu = can.search({}, ["Header.onimport.menu", ctx.ACTION].concat(
can.base.Obj(msg.Option("menus"), [
// ["布局", "默认布局", "流动布局", "网格布局", "标签布局", "自由布局"],
["help", "tutor", "manual", "service", "devops", "refer"],
])
), 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) {
var list = can._root.river
var river = list[cmds[0]]
var list = can._root.river; var river = list[cmds[0]]
var storm = river && river.storm[cmds[1]]
if (!storm || cmds.length != 2) { return false }
@ -77,12 +69,12 @@ Volcanos("onengine", {help: "解析引擎", list: [], _engine: function(event, p
can.run(event, cmds, cb) // 命令详情
} else { // 命令列表
can.core.List(storm.list, function(value) {
msg.Push("name", value.name||"")
msg.Push("help", value.help||"")
msg.Push("inputs", JSON.stringify(value.inputs))
msg.Push("feature", JSON.stringify(value.feature))
msg.Push("index", value.index||"")
msg.Push("args", value.args||"[]")
msg.Push(mdb.NAME, value.name||"")
msg.Push(mdb.HELP, value.help||"")
msg.Push(ctx.INPUTS, JSON.stringify(value.inputs))
msg.Push(ctx.FEATURE, JSON.stringify(value.feature))
msg.Push(ctx.INDEX, value.index||"")
msg.Push(ctx.ARGS, value.args||"[]")
msg.Push("_action", value._action||"")
}), 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.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)
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)
@ -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 }
var trans = {

View File

@ -44,27 +44,25 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
}}, "", 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()
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) {
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) {
can.base.isFunc(cb) && cb(msg)
},
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}) },
onremote: function(can, msg) { can.core.CallFunc(can.onimport.ncmd, {can: can, msg: msg}) },
oncommandfocus: function(can) {
can.page.Select(can, can._output, "div.cmd input", function(target) {
target.focus()
})
can.page.Select(can, can._output, "div.cmd input", function(target) { target.focus() })
},
_cmd: function(can) {

View File

@ -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}))
}
}}, "", 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 }
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) },
onsearchfocus: function(can) {
can.page.Select(can, can._output, "div.search input", function(target) {
target.focus()
})
can.page.Select(can, can._output, "div.search input", function(target) { target.focus() })
},
title: function(event, can) {

View File

@ -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) }
},
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) {
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),
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)
},
})

View File

@ -175,14 +175,14 @@ Volcanos("onaction", {help: "组件交互", list: [
_filter: function(event, can, key, value) { var count = 0
if (value == "all") {
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 {
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.ClassList.del(can, item, "hidden"), count++
can.page.ClassList.del(can, item, "hide"), count++
})
}
can.Action(key, value), can.Status("count", count)

112
proto.js
View File

@ -1,23 +1,4 @@
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 = {}
for (var i = 0; i < arguments.length; i += 2) {
res[arguments[i]] = arguments[i+1]
@ -29,18 +10,11 @@ var ice = {
POD: "pod", CTX: "ctx", CMD: "cmd", ARG: "arg", OPT: "opt",
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",
COPY: "copy", SHOW: "show", HIDE: "hide", MODE: "mode", SHIP: "ship",
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",
AUTO: "auto", HELP: "help", HTTP: "http",
VIEW: "view", MODE: "mode", SHIP: "ship",
COPY: "copy", SHOW: "show", HIDE: "hide",
MSG_DETAIL: "detail",
MSG_OPTION: "option",
@ -52,13 +26,23 @@ var ice = {
MSG_SOURCE: "_source",
MSG_TARGET: "_target",
MSG_HANDLE: "_handle",
MSG_DAEMON: "_daemon",
MSG_UPLOAD: "_upload",
MSG_DAEMON: "_daemon",
MSG_ACTION: "_action",
MSG_STATUS: "_status",
MSG_DISPLAY: "_display",
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",
MSG_PREFIX: "_prefix",
@ -68,13 +52,15 @@ var ice = {
var ctx = {
CONTEXT: "context", COMMAND: "command", ACTION: "action", CONFIG: "config",
INPUTS: "inputs", FEATURE: "feature",
INDEX: "index", ARGS: "args",
}
var cli = {
START: "start", STOP: "stop",
OPEN: "open", CLOSE: "close",
START: "start", STOP: "stop",
DONE: "done", ERROR: "error",
CLEAR: "clear", REFRESH: "refresh",
BACK: "back",
RED: "red", GREEN: "green", BLUE: "blue",
YELLOW: "yellow", CYAN: "cyan", PURPLE: "purple", MAGENTA: "magenta",
@ -95,31 +81,16 @@ var mdb = {
META: "meta", HASH: "hash", LIST: "list",
ID: "id",
KEY: "key",
TIME: "time",
ZONE: "zone",
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",
ID: "id", KEY: "key", TIME: "time", ZONE: "zone", 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", EXTRA: "extra", EXPIRE: "expire",
}
var ssh = {
SCRIPT: "script",
}
var nfs = {
HTML: "html", CSS: "css", JS: "js", GO: "go", SH: "sh", CSV: "csv", JSON: "json",
PATH: "path", FILE: "file", LINE: "line",
DIR: "dir", CAT: "cat", TRASH: "trash",
DIR_ROOT: "dir_root",
@ -138,9 +109,10 @@ var wiki = {
FIELD: "field", SHELL: "shell", LOCAL: "local", PARSE: "parse",
}
var chat = {
LIB: "lib", PAGE: "page", PANEL: "panel", PLUGIN: "plugin", STORY: "story", FLOAT: "float", CONTEXTS: "contexts",
CARTE: "carte", INPUT: "input", OUTPUT: "output",
OPTION: "option", ACTION: "action", OUTPUT: "output", STATUS: "status",
LIB: "lib", PAGE: "page", PANEL: "panel", PLUGIN: "plugin", OUTPUT: "output",
TOAST: "toast", CARTE: "carte", INPUT: "input", UPLOAD: "upload",
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",
TITLE: "title", TOPIC: "topic", BLACK: "black", WHITE: "white", PRINT: "print",
@ -151,7 +123,8 @@ var chat = {
AGENT: "agent", CHECK: "check", GRANT: "grant",
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",
SCROLL: "scroll", LEFT: "left", TOP: "top", RIGHT: "right", BOTTOM: "bottom",
@ -202,22 +175,19 @@ var html = {
UPLOAD: "upload", USERNAME: "username", PASSWORD: "password",
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",
TABLE: "table", TR: "tr", TH: "th", TD: "td", BR: "br",
IFRAME: "iframe",
SCROLL: "scroll", HEIGHT: "height", WIDTH: "width", LEFT: "left", TOP: "top", RIGHT: "right", BOTTOM: "bottom",
A: "a", LABEL: "label", INNER: "inner", TITLE: "title",
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",
LIST: "list", ITEM: "item", MENU: "menu", NODE: "node",
SUBMIT: "submit", CANCEL: "cancel",
WSS: "wss", SVG: "svg",
SCROLL: "scroll", HEIGHT: "height", WIDTH: "width", LEFT: "left", TOP: "top", RIGHT: "right", BOTTOM: "bottom",
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 = {
STRING: "string", NUMBER: "number",
@ -327,7 +297,7 @@ var Volcanos = shy("火山架", {iceberg: "/chat/", volcano: "/frame.js", args:
} else if (libs[i] == "") {
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]
}
}
@ -336,12 +306,12 @@ var Volcanos = shy("火山架", {iceberg: "/chat/", volcano: "/frame.js", args:
})
Volcanos.meta._load = function(url, cb) {
switch (url.split("?")[0].split(ice.PT).pop().toLowerCase()) {
case "css":
case nfs.CSS:
var item = document.createElement(mdb.LINK)
item.rel = "stylesheet", item.type = "text/css"
item.onload = cb, item.href = url
return (document.head||document.body).appendChild(item), item
case "js":
case nfs.JS:
var item = document.createElement(ssh.SCRIPT)
item.onload = cb, item.onerror = cb, item.src = url
return document.body.appendChild(item), item
@ -349,7 +319,7 @@ Volcanos.meta._load = function(url, cb) {
}
function cmd(tool) {
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},
]})
}