forked from x/volcanos
add some
This commit is contained in:
parent
bbd9ed606b
commit
8f3c12ee99
48
frame.js
48
frame.js
@ -1,4 +1,5 @@
|
||||
Volcanos(chat.ONENGINE, {_init: function(can, meta, list, cb, target) {
|
||||
Volcanos(chat.ONENGINE, {
|
||||
_init: function(can, meta, list, cb, target) {
|
||||
can.Option = function() {}, can.run = function(event, cmds, cb) { var msg = can.request(event); cmds = cmds||[]; return (can.onengine[cmds[0]]||can.onengine._remote)(event, can, msg, can, cmds, cb) }
|
||||
can.core.Next(list, function(item, next) { item.type = chat.PANEL
|
||||
can.onappend._init(can, item, item.list, function(sub) { can[item.name] = sub, sub.db = {}, sub.ui = {}, sub.db._boot = can.misc._time()
|
||||
@ -70,7 +71,8 @@ Volcanos(chat.ONENGINE, {_init: function(can, meta, list, cb, target) {
|
||||
return can.core.List(can.onengine.listen.meta[name], function(cb) { can.core.CallFunc(cb, {event: msg._event, msg: msg}) }).length, msg
|
||||
},
|
||||
})
|
||||
Volcanos(chat.ONDAEMON, {_init: function(can, name, type, cbs) { if (can.user.isLocalFile) { return }
|
||||
Volcanos(chat.ONDAEMON, {
|
||||
_init: function(can, name, type, cbs) { if (can.user.isLocalFile) { return }
|
||||
return can.misc.WSS(can, {type: type||web.PORTAL, name: name||can.misc.Search(can, cli.DAEMON)||""}, function(event, msg, cmd, arg, cb) {
|
||||
if (cbs && can.core.CallFunc(cbs, {event: event, msg: msg, cmd: cmd, arg: arg, cb: cb})) { return }
|
||||
var sub = can.ondaemon._list[can.core.Keys(msg[ice.MSG_TARGET])]||can;
|
||||
@ -134,7 +136,8 @@ Volcanos(chat.ONDAEMON, {_init: function(can, name, type, cbs) { if (can.user.is
|
||||
}), can.ondaemon._online(can, 30000)
|
||||
}, delay) },
|
||||
})
|
||||
Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
Volcanos(chat.ONAPPEND, {
|
||||
_init: function(can, meta, list, cb, target, field) {
|
||||
meta.index && (meta.name = meta.index), meta.name = can.core.Split(meta.name||"", "\t .\n").pop()||can.Conf(mdb.NAME)
|
||||
field = field||can.onappend.field(can, meta.type, meta, target)._target
|
||||
meta.style == html.OUTPUT && can.onappend.style(can, html.OUTPUT, field)
|
||||
@ -277,7 +280,8 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
run(event, item.name||item.value)
|
||||
}, item._init = item._init||function(target) { item.action && can.onappend.figure(sub, item, target, function(_sub, value) { can.Update() })
|
||||
if (item.type == html.BUTTON && can.page.isIconInput(can, item.name)) { can.onappend.icons(can, target, item.name) }
|
||||
}), item), "", action)
|
||||
}), item),
|
||||
"", action)
|
||||
})
|
||||
var _can = can._fields? can.sup: can
|
||||
can.isCmdMode() || can.base.beginWith(can.ConfIndex(), "can.", "web.chat.macos.") ||
|
||||
@ -295,7 +299,8 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
title: key == "_space"? "": can.user.trans(can, key), onclick: function(event) {
|
||||
can.onengine.signal(can, "onevent", can.request(event, {_type: html.ACTION, action: key}))
|
||||
var cb = _can.onaction[value]; cb && _can.onaction[value](event, _can, value, _can.sub)
|
||||
}}
|
||||
}
|
||||
}
|
||||
}).concat(can.Conf("_plugin_action")||[])
|
||||
); return meta
|
||||
},
|
||||
@ -330,14 +335,17 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
sub._trans = can.base.Copy(can.base.Copy(sub._trans||{}, can._trans), can.core.Value(sub, [chat.ONACTION, chat._TRANS]))
|
||||
if (sub.onimport && can.base.isArray(sub.onimport.list) && sub.onimport.list.length > 0) {
|
||||
can.onmotion.clear(can, can._option), can.onappend._option(can, {inputs: can.page.inputs(can, sub.onimport.list, html.TEXT) })
|
||||
}
|
||||
can.page.ClassList.del(can, sub._fields, html.FORM), delete(can._status._cache), delete(can._status._cache_key)
|
||||
sub._output.className = html.OUTPUT
|
||||
} can.onmotion.toggle(can, can._action, true), delete(can._status._cache), delete(can._status._cache_key)
|
||||
// can.page.ClassList.del(can, sub._fields, html.FORM)
|
||||
// sub._output.className = html.OUTPUT
|
||||
// can.onappend.style(can, sub._args.style, can._output)
|
||||
// can.isCmdMode() && can.onappend.style(can, html.OUTPUT)
|
||||
// sub.isCmdMode() && sub.onexport.title(sub, sub.ConfIndex())
|
||||
can.onmotion.toggle(can, can._action, true)
|
||||
can.onexport._output(sub, msg), sub.Mode() != ice.MSG_RESULT && can.onmotion.clear(can, output)
|
||||
can._output_old = can._output, can._output = sub._output = sub._target = output = can.page.insertBefore(can, [html.OUTPUT], can._status)
|
||||
can.page.style(can, can._output, "visibility", "hidden")
|
||||
can.page.style(can, can._output, "position", "fixed")
|
||||
if (sub.Mode() == ice.MSG_RESULT) { can._output.innerHTML = can._output_old.innerHTML }
|
||||
can.onexport._output(sub, msg)
|
||||
can.core.CallFunc([sub, chat.ONIMPORT, chat._INIT], {can: sub, msg: msg, cb: function(msg) {
|
||||
if (action !== false) { can.onkeymap._build(sub)
|
||||
var list = can.base.Obj(msg.Option(ice.MSG_ACTION)||can.Conf(ice.MSG_ACTION), [])||[]
|
||||
@ -352,7 +360,10 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
can.onimport.size(can, can.ConfHeight(), can.ConfWidth(), can.Conf("_auto"), can.Mode())
|
||||
can.isCmdMode() && can.page.style(can, can._output, html.HEIGHT, sub.ConfHeight())
|
||||
can.onexport.output(sub, msg); if (can.Conf("_output")) { can.Conf("_output")(sub, msg) }
|
||||
} msg.Defer(), can.base.isFunc(cb) && cb(msg), can.page.style(can, can._target, "visibility", ""), can.page.style(can, can._output, "visibility", "")
|
||||
} msg.Defer(), can.base.isFunc(cb) && cb(msg), can.page.style(can, can._target, "visibility", ""),
|
||||
can._output.scrollTop = can._output_old.scrollTop, can._output.scrollLeft = can._output_old.scrollLeft
|
||||
can.page.style(can, can._output, "visibility", ""), can.page.Remove(can, can._output_old)
|
||||
can.page.style(can, can._output, "position", "")
|
||||
}, target: output}), msg.Defer()
|
||||
})
|
||||
},
|
||||
@ -490,12 +501,14 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
}
|
||||
},
|
||||
_filter: function(can) {
|
||||
can.page.insertBefore(can, can.onappend.filter(can, can._action, can.ui.content||can._output).parentNode,
|
||||
(can.page.SelectOne(can, can._action, "div.item._space")||{}).nextSibling, can._action)
|
||||
can.page.insertBefore(can, can.onappend.filter(can, can._action, can.ui.content||can._output).parentNode, (can.page.SelectOne(can, can._action, "div.item._space")||{}).nextSibling, can._action)
|
||||
},
|
||||
filter: function(can, target, output) { output = output||can.ui.content||target
|
||||
return can.onappend.input(can, {type: html.TEXT, name: web.FILTER, icon: icon.SEARCH, placeholder: "search in n items", onkeydown: function() {}, onkeyup: function(event) {
|
||||
var value = event.currentTarget? event.currentTarget.value: ""
|
||||
if (can.sub && can.sub.onaction && can.sub.onaction.filter && can.sub.onaction.filter(event, can.sub, value)) {
|
||||
return
|
||||
}
|
||||
if (event.key == code.ENTER) {
|
||||
can.page.Select(can, output, html.DIV_ITEM+":not(.hide)", function(target) { target.click() })
|
||||
} else if (event.key == code.ESCAPE) { event.currentTarget.value = "", event.currentTarget.blur()
|
||||
@ -915,7 +928,8 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
})
|
||||
},
|
||||
})
|
||||
Volcanos(chat.ONLAYOUT, {_init: function(can, target) { target = target||can._root._target; var height = can.page.height(), width = can.page.width()
|
||||
Volcanos(chat.ONLAYOUT, {
|
||||
_init: function(can, target) { target = target||can._root._target; var height = can.page.height(), width = can.page.width()
|
||||
can.page.SelectChild(can, target, can.page.Keys(html.FIELDSET_HEAD, html.FIELDSET_FOOT), function(field) { height -= field.offsetHeight })
|
||||
can.page.SelectChild(can, target, html.FIELDSET_LEFT, function(field) {
|
||||
can.page.styleHeight(can, field, height)
|
||||
@ -974,7 +988,8 @@ Volcanos(chat.ONLAYOUT, {_init: function(can, target) { target = target||can._ro
|
||||
return layout
|
||||
},
|
||||
})
|
||||
Volcanos(chat.ONMOTION, {_init: function(can, target) {
|
||||
Volcanos(chat.ONMOTION, {
|
||||
_init: function(can, target) {
|
||||
target.onclick = function(event) {
|
||||
if (can.page.tagis(event.target, html.SELECT, html.INPUT, html.TEXTAREA)) { return }
|
||||
if (can.page.tagis(event.target, html.A) && can.user.isWebview) { return event.shiftKey? window.outopen(event.target.href): can.user.open(event.target.href) }
|
||||
@ -1067,8 +1082,7 @@ Volcanos(chat.ONMOTION, {_init: function(can, target) {
|
||||
}
|
||||
}).length == 0)
|
||||
}) },
|
||||
tableFilter: function(can, target, value) {
|
||||
can.page.Select(can, target, html.TR, function(tr, index) {
|
||||
tableFilter: function(can, target, value) { can.page.Select(can, target, html.TR, function(tr, index) {
|
||||
index > 0 && can.page.ClassList.set(can, tr, html.HIDDEN, can.page.Select(can, tr, html.TD, function(td) { if (td.innerText.toLowerCase().indexOf(value.toLowerCase()) > -1) { return td } }) == 0)
|
||||
}) },
|
||||
delayResize: function(can, target, key) {
|
||||
|
@ -369,3 +369,4 @@ Volcanos("misc", {
|
||||
},
|
||||
_signal: function(args) { this._list.push(args) }, _list: [], _skip: navigator && navigator.userAgent.indexOf("Chrome") > -1? 3: 3,
|
||||
})
|
||||
|
42
lib/page.js
42
lib/page.js
@ -103,16 +103,17 @@ Volcanos("page", {
|
||||
name && (data.name = name); var node = can.page.Create(can, type, data)
|
||||
value[type] = value[name] = value[can.core.Split(data.className)[0]] = node, value._target = value._target||node, value.first = value.first||node, value.last = node
|
||||
item.list && can.page.Append(can, node, item.list, value), target && target.appendChild && target.appendChild(node), can.base.isFunc(item._init) && item._init(node, value)
|
||||
}); return value
|
||||
},
|
||||
}); return value },
|
||||
Appends: function(can, target, key, value) { return target.innerHTML = "", can.page.Append(can, target, key, value) },
|
||||
AppendData: function(can, target, prefix, key, value, cb) { var open = can.page.unicode.opens, close = can.page.unicode.closes
|
||||
function short(value, length) {
|
||||
if (length == undefined) {
|
||||
value.indexOf(lex.NL) > -1 && (value = value.trim().split(lex.NL)[0]+can.page.unicode.inner)
|
||||
return can.page.trans(can, value)
|
||||
} else { if (length > 5) {
|
||||
return can.page.unicode.inner }
|
||||
} else {
|
||||
if (length > 5) {
|
||||
return can.page.unicode.inner
|
||||
}
|
||||
} return value
|
||||
}
|
||||
function show(value, deep) { deep = deep == undefined? 2: 0; switch (typeof value) {
|
||||
@ -188,7 +189,8 @@ Volcanos("page", {
|
||||
{type: "colgroup", list: can.core.List(list, function(key) { if (key[0] != "_") {
|
||||
try { var value = can.Option(key) } catch (e) {}
|
||||
if (value == undefined) { return {view: [key, "col"]} } return {view: [[key, "option"], "col"]}
|
||||
} }) }, {type: html.THEAD}, {type: html.TBODY}]}])
|
||||
} }) }, {type: html.THEAD}, {type: html.TBODY},
|
||||
]}])
|
||||
can.page.Append(can, ui.thead, [{type: html.TR, data: {dataset: {index: -1}}, list: can.core.List(list, function(key) {
|
||||
if (key[0] != "_") { return {type: html.TH, list: [{text: can.user.trans(can, key, null, html.INPUT)}, {icon: "bi bi-sort-down-alt"}, {icon: "bi bi-sort-up"}]} }
|
||||
}) }])
|
||||
@ -239,6 +241,36 @@ Volcanos("page", {
|
||||
var list = ["<"+type]; for (var i = 2; i < arg.length; i += 2) { list.push(lex.SP+arg[i]+mdb.EQ+arg[i+1]) }
|
||||
return list.concat(">", arg[1], "</", type, ">").join("")
|
||||
} },
|
||||
ColorList: [
|
||||
"#8085e9",
|
||||
"#95a2ff",
|
||||
"#73abf5",
|
||||
"#3cb9fc",
|
||||
"#0082fc",
|
||||
"#87e885",
|
||||
"#90ed7d",
|
||||
"#22ed7c",
|
||||
"#05f8d6",
|
||||
"#cb9bff",
|
||||
"#bf19ff",
|
||||
"#f47a75",
|
||||
"#fa8080",
|
||||
"#f7a35c",
|
||||
"#ffc076",
|
||||
"#f9e264",
|
||||
"#fae768",
|
||||
"#5f45ff",
|
||||
"#02cdff",
|
||||
"#0090ff",
|
||||
"#854cff",
|
||||
"#09b0d3",
|
||||
"#1d27c9",
|
||||
"#765005",
|
||||
"#314976",
|
||||
"#009db2",
|
||||
"#024b51",
|
||||
"#0780cf",
|
||||
],
|
||||
Color: function(text) { if (typeof text != code.STRING) { return "" } text = text.replace(/\\n/g, "<br>")
|
||||
if (text.indexOf(ice.HTTP) == 0 && text.length > 10) { var ls = text.split(lex.SP); text = "<a href='"+ls[0]+"' target='_blank'>"+decodeURI(ls[0])+"</a>"+ls.slice(1).join(lex.SP) }
|
||||
if (text.indexOf("export ctx_dev=") == 0 && text.length > 10) { return "<div class='story' data-type='spark' data-name='shell'><div>"+"<span>"+text+"</span>"+"</div></div>" }
|
||||
|
@ -155,14 +155,13 @@ Volcanos("user", {
|
||||
var _events = event._events||event
|
||||
function click(event, button, index) { can.misc.Event(event, can, function() { can.request(event, {action: button}), can.onkeymap.prevent(event), event._events = _events;
|
||||
can.onengine.signal(can, "onevent", can.request(event, {_type: html.ACTION}));
|
||||
(can.base.isFunc(cb)? cb(event, button, meta, carte, index):
|
||||
meta[button]? can.core.CallFunc([meta, button], {event: event, can: can, msg: msg, button: button}):
|
||||
can.Update(event, [ctx.ACTION, button])) || can.onmotion.clearCarte(can)
|
||||
(can.base.isFunc(cb)? cb(event, button, meta, carte, index): meta[button]? can.core.CallFunc([meta, button], {event: event, can: can, msg: msg, button: button}): can.Update(event, [ctx.ACTION, button])) || can.onmotion.clearCarte(can)
|
||||
}) }
|
||||
var isinput = can.page.tagis(event.target, html.INPUT)
|
||||
var ui = can.page.Append(can, document.body, [{view: [[chat.CARTE,
|
||||
can.Conf(ctx.INDEX)||can.ConfIndex(), msg.Option(ctx.ACTION), meta._style||msg.Option("_style"),
|
||||
chat.FLOAT]], list: can.core.List(list, function(item, index) {
|
||||
chat.FLOAT,
|
||||
]], list: can.core.List(list, function(item, index) {
|
||||
if (typeof item == code.FUNCTION) { item = item(can); if (!item) { return } }
|
||||
if (item === "") { return {type: html.HR} }
|
||||
if (item == web.FILTER) { return {
|
||||
|
@ -1,5 +1,6 @@
|
||||
(function() { const ALL = "all", TABS = "tabs", TABVIEW = "tabview", VERTICAL = "vertical", HORIZON = "horizon", GRID = "grid", FREE = "free", FLOW = "flow", PAGE = "page", CAN_LAYOUT = "can.layout"
|
||||
Volcanos(chat.ONIMPORT, {_init: function(can, msg) { var river = can.Conf(chat.RIVER), storm = can.Conf(chat.STORM), list = can.db.list
|
||||
Volcanos(chat.ONIMPORT, {
|
||||
_init: function(can, msg) { var river = can.Conf(chat.RIVER), storm = can.Conf(chat.STORM), list = can.db.list
|
||||
var _select; can.onmotion.clear(can), can.onaction.layout(can, list[3])
|
||||
can.core.Next(msg.Table(), function(item, next, index) { item.type = chat.PLUGIN, item.mode = can.Mode(); if (item.deleted == ice.TRUE) { return next() }
|
||||
if (msg.Length() == 1) { item.height = can.ConfHeight()-can.Conf(html.MARGIN_Y), can.base.isIn(item.index, web.CHAT_MACOS_DESKTOP, web.CHAT_MESSAGE, web.WIKI_PORTAL) && (item.style = html.OUTPUT) }
|
||||
@ -37,7 +38,8 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg) { var river = can.Conf(chat.R
|
||||
can.onmotion.hidden(can, can._header_tabs = can.page.Append(can, target, ["_tabs"])._target)
|
||||
},
|
||||
})
|
||||
Volcanos(chat.ONACTION, {_init: function(can, target) { can.db.list = can.misc.SearchHash(can)
|
||||
Volcanos(chat.ONACTION, {
|
||||
_init: function(can, target) { can.db.list = can.misc.SearchHash(can)
|
||||
can.db.list.length == 0 && can.misc.Search(can, chat.RIVER) && can.misc.Search(can, chat.STORM) && (can.db.list = [can.misc.Search(can, chat.RIVER), can.misc.Search(can, chat.STORM)])
|
||||
can.Conf(html.MARGIN_X, 2*html.PLUGIN_PADDING+2*html.PLUGIN_MARGIN), can.Conf(html.MARGIN_Y, 2*html.PLUGIN_PADDING+2*html.PLUGIN_MARGIN+html.ACTION_HEIGHT)
|
||||
can.core.List(["ontouchstart", "ontouchmove", "ontouchend"], function(item) {
|
||||
@ -157,7 +159,8 @@ Volcanos(chat.ONEXPORT, {
|
||||
msg.Push(kit.Dict(ice.CTX, ice.CAN, ice.CMD, ctx.COMMAND, mdb.TYPE, ice.CAN, mdb.NAME, name||command.name, mdb.TEXT, command.help, ctx.CONTEXT, ice.CAN, ctx.COMMAND, name, ctx.INDEX, can.core.Keys(ice.CAN, name)), fields)
|
||||
}) }
|
||||
})
|
||||
Volcanos(chat.ONENGINE, {_engine: function(event, sup, msg, can, cmds, cb) {
|
||||
Volcanos(chat.ONENGINE, {
|
||||
_engine: function(event, sup, msg, can, cmds, cb) {
|
||||
var storm = can.core.Value(can._root, can.core.Keys(chat.RIVER, cmds[0], chat.STORM, cmds[1])); if (!storm || cmds.length != 2) { return false }
|
||||
if (storm.index) {
|
||||
can.runAction(event, ctx.COMMAND, [].concat(can.core.List(storm.index, function(item) {
|
||||
@ -176,7 +179,8 @@ Volcanos(chat.ONENGINE, {_engine: function(event, sup, msg, can, cmds, cb) {
|
||||
msg.Push(ctx.ARGS, item.args||"[]").Push(ctx.STYLE, item.style||"").Push(ctx.DISPLAY, item.display||"")
|
||||
msg.Push(web.SPACE, item.space||"").Push("_ismain", ice.TRUE)
|
||||
}), can.base.isFunc(cb) && cb(msg) } return true
|
||||
}})
|
||||
},
|
||||
})
|
||||
Volcanos(chat.ONKEYMAP, {
|
||||
_mode: {
|
||||
plugin: {
|
||||
|
@ -1,5 +1,6 @@
|
||||
(function() { var NTIP = "ntip", NLOG = "nlog", NCMD = "ncmd", NKEY = "nkey"
|
||||
Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can._wss = can.ondaemon._init(can)
|
||||
Volcanos(chat.ONIMPORT, {
|
||||
_init: function(can, msg, target) { can._wss = can.ondaemon._init(can)
|
||||
can.Conf(cli.BEGIN, can.base.Time(null, "%H:%M:%S"))
|
||||
if (!can.user.isMobile && !can.misc.isDebug(can)) { can.onmotion.hidden(can); return }
|
||||
can.Conf(nfs.VERSION, can.base.trimPrefix(window._version, "?_v=").split("&")[0])
|
||||
@ -31,7 +32,8 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can._wss = can.onda
|
||||
switch (event.target.value) {
|
||||
case web.CLEAR:
|
||||
case cli.CLOSE: break
|
||||
default: var list = can.core.Split(event.target.value, lex.SP)
|
||||
default:
|
||||
var list = can.core.Split(event.target.value, lex.SP)
|
||||
can.onexport._float(can, "cli", {index: "can.console", display: "/plugin/local/code/xterm.js"}, list, function(sub) { can.getActionSize(function(left) { can.page.style(can, sub._target, html.LEFT, left+html.PLUGIN_MARGIN, html.RIGHT, "") }) })
|
||||
}
|
||||
}}, "", target, [chat.TITLE]) },
|
||||
@ -193,4 +195,5 @@ Volcanos(chat.ONPLUGIN, {
|
||||
daemon: can.misc.sessionStorage(can, "can.daemon"),
|
||||
})).Display("/plugin/story/json.js")
|
||||
}),
|
||||
}) })()
|
||||
})
|
||||
})()
|
||||
|
@ -1,11 +1,13 @@
|
||||
Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) {
|
||||
Volcanos(chat.ONIMPORT, {
|
||||
_init: function(can, msg, target) {
|
||||
can.onimport._title(can, msg, target), can.onimport._state(can, msg, target), can.onimport._search(can, msg, target)
|
||||
can.onimport._avatar(can, msg, target), can.onimport._background(can, msg, target)
|
||||
},
|
||||
_title: function(can, msg, target) { can.core.List(can.base.getValid(can.Conf(chat.TITLE)||msg.result, [
|
||||
decodeURIComponent(can.misc.Search(can, ice.POD)||location.host)]), function(item) {
|
||||
_title: function(can, msg, target) {
|
||||
can.core.List(can.base.getValid(can.Conf(chat.TITLE)||msg.result, [decodeURIComponent(can.misc.Search(can, ice.POD)||location.host),]), function(item) {
|
||||
can.page.Append(can, target, [{view: [[html.ITEM, chat.TITLE, html.FLEX]], list: [{img: can.misc.ResourceFavicon(can)}, {text: item}], title: "返回主页", onclick: function(event) { can.onaction.title(event, can) }}])
|
||||
}) },
|
||||
})
|
||||
},
|
||||
_state: function(can, msg, target) { can.core.List(can.base.Obj(can.Conf(chat.STATE)||msg.Option(chat.STATE), [cli.QRCODE, chat.THEME, aaa.LANGUAGE, aaa.USERNICK, aaa.AVATAR, mdb.TIME]).reverse(), function(item) {
|
||||
if (can.user.isMobile && can.base.isIn(item, cli.QRCODE, chat.THEME, aaa.LANGUAGE, mdb.TIME)) { return }
|
||||
can.page.Append(can, target, [{view: [[html.ITEM, chat.STATE, item], "", can.Conf(item)||msg.Option(item)||""], onclick: function(event) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
(function() { const CAN_RIVER = "can.river", CAN_STORM = "can.storm"
|
||||
Volcanos(chat.ONIMPORT, {_init: function(can, msg) { can.onimport._main(can, msg), can.onappend.style(can, html.FLEX, can._action)
|
||||
Volcanos(chat.ONIMPORT, {
|
||||
_init: function(can, msg) { can.onimport._main(can, msg), can.onappend.style(can, html.FLEX, can._action)
|
||||
var select; can.page.Appends(can, can._output, msg.Table(function(item, index) {
|
||||
return can.onimport._river(can, item, function(target) { (index == 0 || item.hash == can._main_river) && (select = target) })
|
||||
})), select && select.click(), can.onimport._menu(can, msg)
|
||||
@ -17,7 +18,8 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg) { can.onimport._main(can, msg
|
||||
} },
|
||||
_menu: function(can, msg) { can.user.isMobile || can.user.mod.isPod? can.onmotion.hidden(can, can._action): can.onappend._action(can, can.onaction.list, can._action) },
|
||||
})
|
||||
Volcanos(chat.ONACTION, {list: [mdb.CREATE, web.SHARE, web.REFRESH], _init: function(can) {
|
||||
Volcanos(chat.ONACTION, {list: [mdb.CREATE, web.SHARE, web.REFRESH],
|
||||
_init: function(can) {
|
||||
can.db.storm_list = {}, can.onmotion.hidden(can)
|
||||
var next = can.page.unicode.next, prev = can.page.unicode.prev
|
||||
can._prev = can.page.Append(can, can._target, [{view: [[html.TOGGLE, mdb.PREV], "", prev], onclick: function(event) {
|
||||
@ -123,7 +125,8 @@ Volcanos(chat.ONDETAIL, {
|
||||
{name: mdb.TEXT, value: "hello", _trans: "简介"},
|
||||
], function(args) { can.run({}, [river, chat.STORM, ctx.ACTION, mdb.CREATE].concat(args), function(msg) { can.misc.Search(can, {river: river, storm: msg.Result()}) }) }) },
|
||||
})
|
||||
Volcanos(chat.ONEXPORT, {width: function(can) { return can._target.offsetWidth },
|
||||
Volcanos(chat.ONEXPORT, {
|
||||
width: function(can) { return can._target.offsetWidth },
|
||||
storm: function(can, msg, arg) { can.core.Item(can._root.river, function(river, value) { can.core.Item(value.storm, function(storm, item) { if (arg[1] != "" && storm.indexOf(arg[1]) == -1 && item.name.indexOf(arg[1]) == -1) { return }
|
||||
msg.Push({ctx: ice.CAN, cmd: can._name, type: river, name: storm, text: shy("跳转", function(event) { can.onaction.action(event, can, river, storm) })})
|
||||
}) }) },
|
||||
|
@ -1,4 +1,5 @@
|
||||
Volcanos(chat.ONIMPORT, {_init: function(can, msg) { can.onmotion.clear(can, can.ui.content)
|
||||
Volcanos(chat.ONIMPORT, {
|
||||
_init: function(can, msg) { can.onmotion.clear(can, can.ui.content)
|
||||
var table = can.onappend.table(can, msg, function(value, key, index, data) { return {text: [can.base.isFunc(value) && value.help || value, html.TD], onclick: function(event) {
|
||||
can.page.tagis(event.target, html.A) || can.onaction[can.db.type == mdb.FOREACH || event.ctrlKey? mdb.PLUGIN: mdb.SELECT](event, can, data)
|
||||
}} }, can.ui.content, msg.append); can.onmotion.story.auto(can), can.onimport._size(can)
|
||||
@ -6,7 +7,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg) { can.onmotion.clear(can, can
|
||||
can.onmotion.focus(can, can.ui.filter), msg.Length() == 1 && can.ui.profile.innerHTML == "" && can.page.Select(can, table, html.TD)[0].click()
|
||||
},
|
||||
_size: function(can) { can.ui && can.ui.content && can.getActionSize(function(left, top, width, height) {
|
||||
can.page.style(can, can._target, {left: left||0, top: top||0, width: width}),
|
||||
can.page.style(can, can._target, {left: left||0, top: top||0, width: width})
|
||||
can.page.style(can, can._output, html.MAX_HEIGHT, height -= 2*10+(can.user.isMobile? 2: 1)*html.ACTION_HEIGHT+can.onexport.statusHeight(can))
|
||||
can.core.List([can.ui.content, can.ui.display], function(target) { can.page.style(can, target, html.MAX_WIDTH, can.ConfWidth(width-2*10)) })
|
||||
can.ConfHeight(can.base.Min(height-can.ui.content.offsetHeight-can.ui.display.offsetHeight, height/2))
|
||||
|
@ -543,7 +543,37 @@ Volcanos(chat.ONEXPORT, {
|
||||
text: function(can, line) { return can.core.Value(can.page.SelectOne(can, line, "td.text"), "innerText") },
|
||||
size: function(can, size, full) { if (size > 1) { return size } if (size > 0) { return size*full } },
|
||||
keys: function(can, path, file) { return [path||can.Option(nfs.PATH), file||can.Option(nfs.FILE)].join(nfs.DF) },
|
||||
content: function(can) { return can.page.Select(can, can.current&&can.current.content||can.ui.content, "td.text", function(item) { return item.innerText.trimEnd() }).join(lex.NL) },
|
||||
content: function(can) {
|
||||
var parse = can.onexport.parse(can)
|
||||
var deep = 0
|
||||
return can.page.Select(can, can.current&&can.current.content||can.ui.content, "td.text", function(item) { var text = item.innerText.trimEnd()
|
||||
if (parse == "js" && !can.base.beginWith(text, "(")) { var list = []
|
||||
for (var i = 0; i < text.length; i++) {
|
||||
if (text[i] == "{") {
|
||||
list.push(text[i])
|
||||
} else if (text[i] == "}") {
|
||||
if (list[list.length-1] == "{") { list.pop() } else { list.push(text[i]) }
|
||||
}
|
||||
if (text[i] == "(") {
|
||||
list.push(text[i])
|
||||
} else if (text[i] == ")") {
|
||||
if (list[list.length-1] == "(") { list.pop() } else { list.push(text[i]) }
|
||||
}
|
||||
if (text[i] == "[") {
|
||||
list.push(text[i])
|
||||
} else if (text[i] == "]") {
|
||||
if (list[list.length-1] == "[") { list.pop() } else { list.push(text[i]) }
|
||||
}
|
||||
}
|
||||
if (list.indexOf("}") > -1) { deep-- } else if (list.indexOf("]") > -1) { deep-- } else if (list.indexOf(")") > -1) { deep-- }
|
||||
if (deep < 0) { deep = 0 }
|
||||
text = "\t".repeat(deep < 0? 0: deep)+text.trimStart()
|
||||
can.base.beginWith(text, "+") && (text = "\t"+text)
|
||||
if (list.indexOf("{") > -1) { deep++ } else if (list.indexOf("[") > -1) { deep++ } else if (list.indexOf("(") > -1) { deep++ }
|
||||
}
|
||||
return text
|
||||
}).join(lex.NL)
|
||||
},
|
||||
position: function(can, index, total) { total = total||can.ui.content._max; return (parseInt(index))+nfs.PS+parseInt(total)+" = "+parseInt((index)*100/total)+"%" },
|
||||
selection: function(can, str) { var s = document.getSelection().toString(), begin = str.indexOf(s), end = begin+s.length
|
||||
for (var i = begin; i >= 0; i--) { if (str[i].match(/[a-zA-Z0-9_.]/)) { s = str.slice(i, end) } else { break } } return s
|
||||
|
@ -72,10 +72,16 @@ Volcanos(chat.ONACTION, {_trans: {input: {main: "程序", top: "顶域"}},
|
||||
if (can.base.beginWith(text, "import ")) { count++; return }
|
||||
if (block == "import") { count++ }
|
||||
}); return count }
|
||||
if (can.onexport.parse(can) == nfs.GO) { var line = can.onaction.selectLine(can); can.onmotion.clear(can, can.ui.content), can.ui.content._max = 0
|
||||
if (can.onexport.parse(can) == nfs.GO) {
|
||||
var line = can.onaction.selectLine(can); can.onmotion.clear(can, can.ui.content), can.ui.content._max = 0
|
||||
can.core.List(msg.Result().split(lex.NL), function(text) { can.onaction.appendLine(can, text) })
|
||||
can.onaction.selectLine(can, line+imports(msg.Result())-imports(msg.Option(nfs.CONTENT)))
|
||||
}
|
||||
if (can.onexport.parse(can) == nfs.JS) {
|
||||
var line = can.onaction.selectLine(can); can.onmotion.clear(can, can.ui.content), can.ui.content._max = 0
|
||||
can.core.List(msg.Option("content").split(lex.NL), function(text) { can.onaction.appendLine(can, text) })
|
||||
can.onaction.selectLine(can, line)
|
||||
}
|
||||
},
|
||||
trash: function(event, can, button) { var msg = can.request(event), p = msg.Option(nfs.PATH)+msg.Option(nfs.FILE)
|
||||
can.onaction._run(event, can, button, [p], function(msg) { can.ui.zone.source.refresh() })
|
||||
|
@ -1,4 +1,5 @@
|
||||
Volcanos(chat.ONIMPORT, {_init: function(can, msg) {
|
||||
Volcanos(chat.ONIMPORT, {
|
||||
_init: function(can, msg) {
|
||||
can.isCmdMode() || can.onmotion.hidden(can, can._action)
|
||||
can.OptionPath = function(value) { return can.Option(nfs.PATH, value) }
|
||||
can.OptionPid = function(value) { return can.Option(svg.PID, value) }
|
||||
@ -74,9 +75,9 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg) {
|
||||
return meta._init && meta._init(target), target
|
||||
},
|
||||
layout: function(can) {
|
||||
can.ui.svg && can.page.style(can, can.ui.svg, html.MIN_HEIGHT, can.ConfHeight(), html.MIN_WIDTH, can.ConfWidth())
|
||||
can.ui.svg && can.page.style(can, can.ui.svg, html.MIN_HEIGHT, can.ConfHeight()-4, html.MIN_WIDTH, can.ConfWidth())
|
||||
can.ui.layout && can.ui.layout(can.ConfHeight(), can.ConfWidth(), 0, function(height, width) {
|
||||
can.page.style(can, can.ui.svg, html.MIN_HEIGHT, height, html.MIN_WIDTH, width)
|
||||
can.page.style(can, can.ui.svg, html.MIN_HEIGHT, height-4, html.MIN_WIDTH, width)
|
||||
})
|
||||
},
|
||||
})
|
||||
|
@ -1,5 +1,6 @@
|
||||
Volcanos(chat.ONIMPORT, {
|
||||
_process: function(can, msg) { if (msg.IsErr()) { can.onappend.style(can, "warn", can.user.toastFailure(can, msg.Result())._target) }
|
||||
_process: function(can, msg) {
|
||||
if (msg.IsErr()) { can.onappend.style(can, "warn", can.user.toastFailure(can, msg.Result())._target) }
|
||||
if (can.onimport[msg.OptionProcess()]) { return can.core.CallFunc([can.onimport, msg.OptionProcess()], {can: can, sub: can.sub, msg: msg, arg: msg.Option("_arg")}), true } },
|
||||
_location: function(can, msg, arg) { can.user.jumps(arg) },
|
||||
_replace: function(can, msg, arg) { location.replace(arg) },
|
||||
@ -130,7 +131,8 @@ Volcanos(chat.ONIMPORT, {
|
||||
can.page.SelectArgs(can, can._action, "", function(target) { target.value = his[i++]||"" }); break
|
||||
} can.Update(event) },
|
||||
})
|
||||
Volcanos(chat.ONACTION, {list: ["刷新数据",
|
||||
Volcanos(chat.ONACTION, {
|
||||
list: ["刷新数据",
|
||||
function(can) { if (!can.user.isMobile) { return "刷新界面" } },
|
||||
function(can) { if (!can.user.isMobile && !can.isCmdMode()) { return "切换浮动" } },
|
||||
function(can) { if (!can.user.isMobile && !can.isCmdMode()) { return "切换全屏" } },
|
||||
@ -161,14 +163,15 @@ Volcanos(chat.ONACTION, {list: ["刷新数据",
|
||||
],
|
||||
_engine: function(event, can, button) { can.Update(event, [ctx.ACTION, button].concat(can.Input())) },
|
||||
_switch: function(can, sub, mode, save, load) {
|
||||
if (can.page.ClassList.neg(can, can._target, mode)) {
|
||||
(can._mode_list = can._mode_list||[]).push(kit.Dict(
|
||||
if (can.page.ClassList.neg(can, can._target, mode)) { can._mode_list = can._mode_list||[]
|
||||
can._mode_list.push(kit.Dict(
|
||||
html.HEIGHT, can.ConfHeight(), html.WIDTH, can.ConfWidth(), ice.MODE, can.Mode()||"",
|
||||
html.ACTION, can.page.isDisplay(can._action), html.STATUS, can.page.isDisplay(can._status),
|
||||
html.OUTPUT, can.base.Copy({}, can._output.style, html.HEIGHT, html.WIDTH, html.MAX_HEIGHT, html.MAX_WIDTH),
|
||||
ctx.STYLE, can.base.Copy({}, can._target.style, html.LEFT, html.TOP, html.RIGHT, html.BOTTOM), save()
|
||||
)), can.onimport.size(can, can.ConfHeight(), can.ConfWidth(), false, mode)
|
||||
} else { var back = (can._mode_list = can._mode_list||[]).pop(); if (!back) { return }
|
||||
} else {
|
||||
var back = (can._mode_list = can._mode_list||[]).pop(); if (!back) { return }
|
||||
can.onmotion.toggle(can, can._action, back.action), can.onmotion.toggle(can, can._status, back.status)
|
||||
can.onimport.size(can, back.height, back.width, false, back.mode), can.page.style(can, can._target, back.style), load && load(back)
|
||||
}
|
||||
@ -176,9 +179,8 @@ Volcanos(chat.ONACTION, {list: ["刷新数据",
|
||||
"刷新数据": function(event, can) { can.Update(event, can.Input()), can.user.toastSuccess(can) },
|
||||
"刷新界面": function(event, can) { var sub = can.sub; sub.onlayout._init(sub, sub.ConfHeight(), sub.ConfWidth()), can.user.toastSuccess(can) },
|
||||
"切换浮动": function(event, can, button, sub) {
|
||||
can.onaction._switch(can, sub, chat.FLOAT, function() {
|
||||
can.onmotion.float(can)
|
||||
}) },
|
||||
can.onaction._switch(can, sub, chat.FLOAT, function() { can.onmotion.float(can) })
|
||||
},
|
||||
"切换全屏": function(event, can, button, sub) { can.onaction._switch(can, sub, chat.FULL, function() {
|
||||
can.page.style(can, can._target, html.LEFT, "", html.TOP, can.onexport.marginTop(), html.BOTTOM, "")
|
||||
can.ConfHeight(can.page.height()-can.onexport.marginTop()-can.onexport.marginBottom(can)), can.ConfWidth(can.page.width())
|
||||
|
@ -1,4 +1,5 @@
|
||||
Volcanos(chat.ONIMPORT, {_init: function(can, msg, target, cb) {
|
||||
Volcanos(chat.ONIMPORT, {
|
||||
_init: function(can, msg, target, cb) {
|
||||
if (msg.index && msg.meta && msg.list) { return cb && cb(msg), can.sup.onimport._field(can.sup, msg) }
|
||||
if (can.isCmdMode() && can.Conf(ctx.STYLE) == html.FORM) { can.onappend.style(can, html.OUTPUT) }
|
||||
if (can.Mode() == html.ZONE) { return can.onimport._vimer_zone(can, msg, target), cb && cb(msg) }
|
||||
|
3
proto.js
3
proto.js
@ -13,7 +13,8 @@ var Volcanos = shy({iceberg: "", volcano: "", frame: chat.FRAME_JS, _cache: {},
|
||||
cb = can||function(can) { can.require([can.frame], function() { can.onengine._init(can, can.Conf(Config), panels, Config._init||meta._init, can._target) }, function(can, key, sub) { can[key] = sub }) }
|
||||
can = Config, can._follow = name, can._target = Config.target||meta.target, can._height = Config.height||meta._height, can._width = Config.width||meta._width, _can_name = ""
|
||||
}
|
||||
can = kit.proto(can||{}, kit.proto({_name: name, _path: _can_name, _load: function(name, cbs) { var cache = meta.cache[name]||[]
|
||||
can = kit.proto(can||{}, kit.proto({_name: name, _path: _can_name,
|
||||
_load: function(name, cbs) { var cache = meta.cache[name]||[]
|
||||
for (list.reverse(); list.length > 0; list) { var sub = list.pop(); sub != can && cache.push(sub), sub._path = sub._path||name } meta.cache[name] = cache
|
||||
cache.forEach(function(sub) { var name = sub._name
|
||||
if (typeof cbs == code.FUNCTION && cbs(can, name, sub)) { return }
|
||||
|
Loading…
x
Reference in New Issue
Block a user