mirror of
https://shylinux.com/x/volcanos
synced 2025-04-25 08:48:06 +08:00
opt frame.js
This commit is contained in:
parent
bcc185bd3e
commit
d107762a55
445
frame.js
445
frame.js
@ -21,37 +21,6 @@ Volcanos(chat.ONENGINE, {_init: function(can, meta, list, cb, target) {
|
||||
hover: "#212121", border: "gray", label: "silver", text: "white", warn: "red", notice: "blue"}),
|
||||
can.onappend.topic(can, "light", {topic: "white", plugin: "aliceblue", legend: "lavender", input: "white", output: "white", table: "aliceblue",
|
||||
hover: "aliceblue", border: "transparent", label: "black", text: "black", warn: "red", notice: "blue"})
|
||||
can.onappend.icon(can, {
|
||||
close: {
|
||||
16: [-82, -158],
|
||||
18: [-93, -177],
|
||||
20: [-103, -197],
|
||||
24: [-123, -236],
|
||||
},
|
||||
create: {
|
||||
16: [-27, -158],
|
||||
18: [-30, -177],
|
||||
20: [-33, -197],
|
||||
},
|
||||
refresh: {
|
||||
16: [-194, -241],
|
||||
18: [-218, -271],
|
||||
20: [-242, -301],
|
||||
24: [-291, -362],
|
||||
},
|
||||
back: {
|
||||
16: [-27, -185],
|
||||
18: [-30, -208],
|
||||
20: [-33, -232],
|
||||
24: [-40, 278],
|
||||
},
|
||||
open: {
|
||||
16: [-27, -158],
|
||||
18: [-30, -177],
|
||||
20: [-30, -177],
|
||||
24: [-40, -236],
|
||||
},
|
||||
})
|
||||
},
|
||||
_search: function(event, can, msg, panel, cmds, cb) {
|
||||
var sub, mod = can, fun = can, key = ""; can.core.List(cmds[1].split(ice.PT), function(value) { fun && (sub = mod, mod = fun, fun = mod[value], key = value) })
|
||||
@ -140,24 +109,17 @@ Volcanos(chat.ONDAEMON, {_init: function(can, name) { if (can.user.isLocalFile)
|
||||
exit: function(can, msg, sub) { can.user.close() },
|
||||
})
|
||||
Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
meta.name = (meta.name||"").split(ice.SP)[0].split(ice.PT).pop()
|
||||
meta.name = can.core.Split(meta.name||"", "\t .\n").pop()
|
||||
field = field||can.onappend.field(can, meta.type, meta, target)._target
|
||||
var legend = can.page.Select(can, field, html.LEGEND)[0]
|
||||
var option = can.page.Select(can, field, html.FORM_OPTION)[0]
|
||||
var action = can.page.Select(can, field, html.DIV_ACTION)[0]
|
||||
var output = can.page.Select(can, field, html.DIV_OUTPUT)[0]
|
||||
var status = can.page.Select(can, field, html.DIV_STATUS)[0]
|
||||
|
||||
if (meta.type != chat.PANEL) {
|
||||
can.page.Append(can, option, [{view: "icon s18 close", onclick: function(event) { sub.onaction.close(event, sub) }}])
|
||||
can.page.Append(can, option, [{view: "icon s18 back", onclick: function(event) { sub.onimport._back(sub) }}])
|
||||
can.page.Append(can, option, [{view: "icon s18 refresh", onclick: function(event) { sub.Update(event) }}])
|
||||
}
|
||||
|
||||
var legend = can.page.SelectOne(can, field, html.LEGEND)
|
||||
var option = can.page.SelectOne(can, field, html.FORM_OPTION)
|
||||
var action = can.page.SelectOne(can, field, html.DIV_ACTION)
|
||||
var output = can.page.SelectOne(can, field, html.DIV_OUTPUT)
|
||||
var status = can.page.SelectOne(can, field, html.DIV_STATUS)
|
||||
meta.type != chat.PANEL && meta.type != html.INPUT && can.page.Append(can, option, [{view: [[html.ITEM, html.ICON], html.DIV, "\u2715"], onclick: function(event) { sub.onaction.close(event, sub) }}])
|
||||
var sub = Volcanos(meta.name, {_root: can._root||can, _follow: can.core.Keys(can._follow, meta.name), _target: field,
|
||||
_legend: legend, _option: option, _action: action, _output: output, _status: status, _history: [], _inputs: {}, _outputs: [],
|
||||
Status: function(key, value) {
|
||||
if (can.base.isObject(key)) { return can.core.Item(key, sub.Status), key }
|
||||
Status: function(key, value) { if (can.base.isObject(key)) { return can.core.Item(key, sub.Status), key }
|
||||
can.page.Select(can, status, [[[html.DIV, key], html.SPAN]], function(target) {
|
||||
if (can.base.beginWith(value, ice.PS, ice.HTTP)) { value = can.page.Format(html.A, value) }
|
||||
return can.base.isUndefined(value)? (value = target.innerHTML): (target.innerHTML = value)
|
||||
@ -174,27 +136,18 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
can.onappend._init(can, meta, list, function(sub) { can.base.isFunc(cb) && cb(sub, true), can.onmotion.delay(can, sub.Focus) }, target)
|
||||
},
|
||||
}, list, function(sub) { sub.Conf(meta), meta.feature = can.base.Obj(meta.feature, {})
|
||||
can.page.ClassList.add(can, field, meta.index? meta.index.split(ice.PT).pop(): meta.name)
|
||||
var style = can.base.getValid(meta.style||meta.feature.style); switch (typeof style) {
|
||||
case lang.STRING: can.page.ClassList.add(can, field, style); break
|
||||
case lang.OBJECT: can.page.style(can, sub._target, style); break
|
||||
} sub.Mode() != meta.type && can.page.ClassList.add(can, field, sub.Mode())
|
||||
|
||||
can.onappend.style(sub, meta.index? meta.index.split(ice.PT).pop(): meta.name), can.onappend.style(sub, meta.style), can.onappend.style(sub, sub.Mode())
|
||||
sub._trans = can.base.Copy(sub._trans||{}, can.core.Value(sub, [chat.ONACTION, chat._TRANS]))
|
||||
can.core.Item(meta.feature, function(key, cb) { cb.help && sub.user.trans(sub, kit.Dict(key, cb.help)) })
|
||||
meta.inputs && sub.onappend._option(sub, meta, sub._option, meta.msg)
|
||||
if (meta.msg) { can.onmotion.delay(can, function() { var msg = sub.request(); msg.Copy(can.base.Obj(meta.msg))
|
||||
meta.msg && can.onmotion.delay(can, function() { var msg = sub.request(); msg.Copy(can.base.Obj(meta.msg))
|
||||
sub.onappend._output(sub, msg, meta.display||msg.Option(ice.MSG_DISPLAY)||meta.feature.display)
|
||||
}) }
|
||||
if (can._root && can._root.name == "popup") { can.onmotion.hidden(can, sub._action) }
|
||||
|
||||
can.core.Value(sub._legend, "onclick", function(event) {
|
||||
}), meta.inputs && sub.onappend._option(sub, meta, sub._option, meta.msg)
|
||||
sub._legend.onclick = function(event) {
|
||||
can.user.carte(event, sub, sub.onaction, sub.onaction.list.concat([[ctx.ACTION].concat(can.core.Item(meta.feature._trans))]), function(event, button, meta) {
|
||||
var _sub = can.core.Value(sub, chat._OUTPUTS_CURRENT)
|
||||
var cb = can.core.Value(_sub, [chat.ONACTION, button]); if (can.base.isFunc(cb)) { return cb(event, _sub, button) }
|
||||
var cb = meta[button]||meta[chat._ENGINE]; if (can.base.isFunc(cb)) { return cb(event, sub, button, _sub) }
|
||||
if (can.request(event).RunAction(event, can.core.Value(sub, chat._OUTPUTS_CURRENT), [ctx.ACTION, button])) { return }
|
||||
can.request(event).RunAction(event, sub, [ctx.ACTION, button]) || sub.runAction(event, button)
|
||||
})
|
||||
}), can.base.isFunc(cb) && cb(sub)
|
||||
}, can.base.isFunc(cb) && cb(sub)
|
||||
}); return sub
|
||||
},
|
||||
_option: function(can, meta, option, skip) { meta = meta||{}; var index = -1, args = can.base.Obj(meta.args||meta.arg||meta.opt, []), opts = can.base.Obj(meta.opts, {})
|
||||
@ -208,31 +161,29 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
sub.run = function(event, cmds, cb, silent) { var msg = can.request(event, kit.Dict(chat._TOAST, ice.PROCESS))
|
||||
msg.RunAction(event, sub, cmds) || msg.RunAction(event, can.core.Value(can, chat._OUTPUTS_CURRENT), cmds) || can.Update(event, can.Input(cmds, !silent), cb, silent)
|
||||
}, can._inputs[item.name] = sub, sub.sup = can
|
||||
|
||||
can.core.ItemCB(sub.onaction, function(key, cb) { sub._target[key] = function(event) { cb(can.request(event)._event, sub) } })
|
||||
can.core.ItemCB(item, function(key, cb) { sub._target[key] = function(event) { cb(can.request(event)._event, sub) } })
|
||||
skip? next(): can.core.CallFunc([sub.onaction, chat._INIT], {can: sub, meta: item, cb: next, target: sub._target});
|
||||
(item.action||can.core.Value(meta, [ctx.FEATURE, ctx.INPUTS])) && can.onappend.figure(sub, item, sub._target, function(_sub, value) {
|
||||
sub._target.value = value, can.onmotion.focus(can, sub._target), can.onmotion.delay(can, function() { can.Update() })
|
||||
can.onmotion.focus(can, sub._target, value), can.onmotion.delay(can, function() { can.Update() })
|
||||
})
|
||||
})
|
||||
}
|
||||
can.core.Next((can.user.isMobile? [{type: html.BUTTON, name: cli.CLOSE}]: []).concat(can.base.getValid(can.core.Value(can, [chat.ONIMPORT, mdb.LIST]), can.base.Obj(meta.inputs, []))||[]), add)
|
||||
} can.core.Next(can.base.getValid(can.core.Value(can, [chat.ONIMPORT, mdb.LIST]), can.base.Obj(meta.inputs, []))||[], add)
|
||||
},
|
||||
_action: function(can, list, action, meta) { meta = meta||can.onaction||{}, action = action||can._action, can.onmotion.clear(can, action)
|
||||
function what(msg) {
|
||||
function run(event, button) { var cb = meta[button]||meta[chat._ENGINE]; cb? can.core.CallFunc(cb, {event: event, can: can, button: button}): can.run(event, [ctx.ACTION, button].concat(can.sup.Input()), function(msg) {
|
||||
if (can.core.CallFunc([can, chat.ONIMPORT, ice.MSG_PROCESS], {can: can, msg: msg})) { return }
|
||||
}
|
||||
}) }
|
||||
return can.core.List(can.page.inputs(can, can.base.getValid(can.base.Obj(list), can.core.Value(can, [chat.ONACTION, mdb.LIST]), meta != can.onaction? can.core.Item(meta): [])||[]), function(item) {
|
||||
can.base.isUndefined(item) || can.onappend.input(can, item == ""? /* 空白 */ {type: html.HR}:
|
||||
can.base.isString(item)? /* 按键 */ {type: html.BUTTON, name: item, value: can.user.trans(can, item, meta._trans), onclick: function(event) {
|
||||
var cb = meta[item]||meta[chat._ENGINE]; cb? can.core.CallFunc(cb, {event: event, can: can, button: item}): can.run(event, [ctx.ACTION, item].concat(can.sup.Input()), what)
|
||||
can.base.isUndefined(item) || can.onappend.input(can, item == ""? /* 1.空白 */ {type: html.BR}:
|
||||
can.base.isString(item)? /* 2.按键 */ {type: html.BUTTON, name: item, value: can.user.trans(can, item, meta._trans), onclick: function(event) {
|
||||
run(event, item)
|
||||
}, onkeydown: function(event) { if (event.key == lang.ENTER) { target.click() }}}:
|
||||
item.length > 0? /* 列表 */ {type: html.SELECT, name: item[0], values: item.slice(1), onchange: function(event) { var button = item[event.target.selectedIndex+1]
|
||||
item.length > 0? /* 3.列表 */ {type: html.SELECT, name: item[0], values: item.slice(1), onchange: function(event) { var button = item[event.target.selectedIndex+1]
|
||||
meta[item[0]]? can.core.CallFunc(meta[item[0]], [event, can, item[0], button]): meta[button] && can.core.CallFunc(meta[button], [event, can, button])
|
||||
}}: /* 其它 */ (item.onclick = item.onclick||function(event) { if (item.type != html.BUTTON) { return }
|
||||
var cb = meta[item.name]||meta[chat._ENGINE]; cb? can.core.CallFunc(cb, {event: event, can: can, button: item.name}): can.run(event, [ctx.ACTION, item.name].concat((can.sup||can).Input()))
|
||||
}, (item.type == html.BUTTON && (item.value = item.value||can.user.trans(can, item.name, meta._trans))), item), "", action)
|
||||
}}: /* 4.其它 */(item.type == html.BUTTON && (item.value = item.value||can.user.trans(can, item.name, meta._trans), item.onclick = item.onclick||function(event) {
|
||||
run(event, item.name)
|
||||
}), item), "", action)
|
||||
}), meta
|
||||
},
|
||||
_output0: function(can, meta, event, cmds, cb, silent) { var msg = can.request(event); if (msg.RunAction(event, can, cmds)) { return }
|
||||
@ -247,25 +198,22 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
})
|
||||
},
|
||||
_output: function(can, msg, display, output, action, cb) { display = display||chat.PLUGIN_TABLE_JS, output = output||can._output
|
||||
Volcanos(display, {_root: can._root, _follow: can.core.Keys(can._follow, display), _target: output, _fields: can._target,
|
||||
Volcanos(display, {_root: can._root, _follow: can.core.Keys(can._follow, display), _fields: can._target, _target: output,
|
||||
_legend: can._legend, _option: can._option, _action: can._action, _output: output, _status: can._status,
|
||||
Update: can.Update, Option: can.Option, Action: can.Action, Status: can.Status,
|
||||
}, [display, chat.PLUGIN_TABLE_JS], function(sub) { sub.Conf(can.Conf())
|
||||
sub.run = function(event, cmds, cb, silent) {
|
||||
can.request(event).RunAction(event, sub, cmds) || can.Update(event, can.Input(cmds, !silent), cb, silent)
|
||||
}, can._outputs && can._outputs.push(sub), sub.sup = can
|
||||
|
||||
sub._index = can._index, sub._msg = msg, sub.Conf(sub._args = can.base.ParseURL(display))
|
||||
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.core.CallFunc([sub, chat.ONIMPORT, chat._INIT], {can: sub, msg: msg, cb: function(msg) {
|
||||
can.onmotion.clear(can, can._action), can.user.isMobile && can.ConfHeight() > can.ConfWidth() && can.onmotion.hidden(can, can._action)
|
||||
action === false || sub.onappend._action(sub, can.Conf(ice.MSG_ACTION)||msg.Option(ice.MSG_ACTION), action||can._action)
|
||||
action === false || can.onmotion.clear(can, can._action), sub.onappend._action(sub, can.Conf(ice.MSG_ACTION)||msg.Option(ice.MSG_ACTION), action||can._action)
|
||||
action === false || sub.onappend._status(sub, sub.onexport&&sub.onexport.list||msg.Option(ice.MSG_STATUS)), can.user.isMobile || sub.onappend.tools(sub, msg)
|
||||
can.core.List([chat.FLOAT, chat.FULL, chat.CMD], function(mode) { can.page.ClassList.has(can, can._target, mode) && sub.onlayout[mode](sub) })
|
||||
can.user.isMobile && can.isCmdMode() && can.page.style(can, can._output, html.MAX_HEIGHT, can.ConfHeight())
|
||||
can.onmotion.story.auto(can, can._output), can.onaction._output(can, msg), can.base.isFunc(cb) && cb(msg)
|
||||
}, target: output})
|
||||
})
|
||||
@ -279,135 +227,21 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
})
|
||||
},
|
||||
|
||||
style: function(can, style, target) { can.page.ClassList.add(can, target||can._fields||can._target, style) },
|
||||
field: function(can, type, item, target) { type = type||html.STORY, item = item||{}
|
||||
var name = (item.nick||item.name||"").split(ice.SP)[0], title = !item.help || item.help == name || can.user.language(can) == "en"? name: name+"("+item.help.split(ice.SP)[0]+")"
|
||||
return can.page.Append(can, target||can._output, [{view: [can.base.join([type||"", item.name||"", item.pos||""]), html.FIELDSET], list: [
|
||||
(name||title)&&{text: [name == "word"? item.help.split(ice.SP)[0]: title, html.LEGEND]}, {view: [html.OPTION, html.FORM]}, html.ACTION, html.OUTPUT, html.STATUS,
|
||||
]}])
|
||||
},
|
||||
input: function(can, item, value, target, style) {
|
||||
var input = can.page.input(can, can.base.Copy({}, item), value)
|
||||
if (item.type == html.SELECT && item.value) { input._init = function(target) { target.value = value||item.value } }
|
||||
if (item.type == html.TEXT) { input.onkeydown = item.onkeydown||function(event) {
|
||||
can.onkeymap.input(event, can), can.onkeymap.selectOutput(event, can), event.key == lang.ENTER && can.onkeymap.prevent(event)
|
||||
} }
|
||||
if (item.range) { input._init = function(target) { can.onappend.figure(can, item, target, function(sub, value, old) {
|
||||
target.value = value, can.core.CallFunc([can.onaction, item.name], [event, can, item.name])
|
||||
}) } }
|
||||
var br = input.type == html.TEXTAREA? [{type: html.BR, style: {clear: html.BOTH}}]: []
|
||||
var title = can.Conf(can.core.Keys(ctx.FEATURE, chat.TITLE, item.name))||""; title && (input.title = title)
|
||||
if (item.type == html.ICON) { return can.page.Append(can, target, [input]) }
|
||||
return can.page.Append(can, target, ([{view: can.base.join(style||[html.ITEM, item.type]), list: [input]}]).concat(br))[item.name]
|
||||
},
|
||||
table: function(can, msg, cb, target, sort) { if (msg.Length() == 0) { return } var meta = can.base.Obj(msg.Option(mdb.META))
|
||||
var table = can.page.AppendTable(can, msg, target||can._output, msg.append, cb||function(value, key, index, line, array) {
|
||||
if (msg.append.length == 2 && msg.append[0] == mdb.KEY && msg.append[1] == mdb.VALUE) { if (key == mdb.VALUE) { key = line.key }
|
||||
line = {}, can.core.List(array, function(item) { line[item.key] = item.value })
|
||||
} function run(event, cmd, arg) {
|
||||
return can.run(can.request(event, line, can.Option()), [ctx.ACTION, cmd].concat(arg))
|
||||
}
|
||||
return {text: [value, html.TD], onclick: function(event) { var target = event.target
|
||||
if (can.page.tagis(target, html.INPUT) && target.type == html.BUTTON) { can.request(event, {height: can.ConfHeight()-4-table.offsetHeight, width: can.ConfWidth()})
|
||||
meta && meta[target.name]? can.user.input(can.request(event, {action: target.name}), can, meta[target.name], function(args) { run(event, target.name, args) }): run(event, target.name)
|
||||
} else { can.sup.onimport.change(event, can.sup, key, event.target.innerText) || can.sup.onexport.record(can.sup, value, key, line) }
|
||||
}, ondblclick: function(event) { if ([mdb.KEY, mdb.HASH, mdb.ID].indexOf(key) > -1) { return }
|
||||
var item = can.core.List(can.Conf([ctx.FEATURE, mdb.INSERT]), function(item) { if (item.name == key) { return item } })[0]||{name: key, value: value}
|
||||
item.run = function(event, cmds, cb) { can.run(can.request(event, line), cmds, cb, true) }
|
||||
can.onmotion.modifys(can, event.target, function(event, value, old) { run(event, mdb.MODIFY, [key, value]) }, item)
|
||||
}}
|
||||
}); table && can.page.styleClass(can, table, chat.CONTENT), msg.append && msg.append[msg.append.length-1] == ctx.ACTION && can.page.ClassList.add(can, table, ctx.ACTION)
|
||||
return sort && can.page.RangeTable(can, table, can.core.List(sort, function(key) {
|
||||
return can.page.Select(can, table, html.TH, function(th, index) { if (th.innerHTML == key) { return index } })[0]
|
||||
})), table
|
||||
},
|
||||
board: function(can, text, target) { text && text.Result && (text = text.Result()); if (!text) { return }
|
||||
var code = can.page.Append(can, target||can._output, [{text: [can.page.Color(text), html.DIV, html.CODE]}]).code
|
||||
can.page.Select(can, code, html.INPUT_BUTTON, function(target) {
|
||||
target.onclick = function(event) { can.run(can.request(event, can.Option()), [ctx.ACTION, target.name]) }
|
||||
}); return code.scrollBy && code.scrollBy(0, 10000), code
|
||||
},
|
||||
tools: function(can, msg, cb, target) { can.onimport.tool(can, can.base.Obj(msg.Option(ice.MSG_TOOLKIT), []), cb, target) },
|
||||
tabview: function(can, meta, list, target) { var ui = can.page.Append(can, target, [html.ACTION, html.OUTPUT])
|
||||
can.core.List(can.base.getValid(list, can.core.Item(meta)), function(name, index) {
|
||||
ui[name] = can.page.Append(can, ui.action, [{text: name, onclick: function(event) {
|
||||
if (can.onmotion.cache(can, function() { return name }, ui.output)) { return } meta[name](ui.output)
|
||||
}, _init: function(target) { index == 0 && can.onmotion.delay(can, function() { target.click() }) }}])._target
|
||||
}); return ui._target = target, ui
|
||||
},
|
||||
|
||||
_plugin: function(can, value, meta, cb, target, field) { can.base.Copy(meta, value, true)
|
||||
meta.name = meta.name||value&&value.meta&&value.meta.name||""
|
||||
meta.type = meta.type||chat.STORY, meta.height = meta.height||can.ConfHeight(), meta.width = meta.width||can.ConfWidth()
|
||||
meta.args = can.base.getValid(can.base.Obj(meta.args), can.base.Obj(meta.arg), can.base.Obj(value.args), can.base.Obj(value.arg))||[]
|
||||
meta.inputs = can.base.getValid(meta.inputs, can.base.Obj(value.list))||[], meta.feature = can.base.getValid(meta.feature, can.base.Obj(value.meta))||{}
|
||||
can.onappend._init(can, meta, [chat.PLUGIN_STATE_JS], function(sub, skip) {
|
||||
sub.run = function(event, cmds, cb) { can.runActionCommand(event, sub._index, cmds, cb) }
|
||||
sub._index = value.index||meta.index, can.base.isFunc(cb) && cb(sub, meta, skip)
|
||||
}, target||can._output, field)
|
||||
},
|
||||
plugin: function(can, meta, cb, target, field) { meta = meta||{}, meta.index = meta.index||can.core.Keys(meta.ctx, meta.cmd)||ice.CAN_PLUGIN
|
||||
var res = {}; function _cb(sub, meta, skip) { kit.proto(res, sub), cb && cb(sub, meta, skip) }
|
||||
if (meta.inputs && meta.inputs.length > 0 || meta.meta) { can.onappend._plugin(can, {meta: meta.meta, list: meta.list}, meta, _cb, target, field); return res }
|
||||
var value = can.onengine.plugin(can, meta.index); if (value) { can.onappend._plugin(can, value, meta, function(sub, meta, skip) {
|
||||
_cb(sub, meta, skip), can.onmotion.delay(can, function() { value.meta && value.meta._init && value.meta._init(sub, meta) })
|
||||
}, target, field); return res }
|
||||
// can.runAction(can.request({}, meta), ctx.COMMAND, [meta.index], function(msg) { msg.Table(function(value) { can.onappend._plugin(can, value, meta, _cb, target, field) })}); return res
|
||||
can.runAction({}, ctx.COMMAND, [meta.index], function(msg) { msg.Table(function(value) { can.onappend._plugin(can, value, meta, _cb, target, field) })}); return res
|
||||
},
|
||||
_float: function(can, index, args) {
|
||||
can.onappend.plugin(can, {mode: chat.FLOAT, index: index, args: args}, function(sub) {
|
||||
can.getActionSize(function(left, top, width, height) { sub.onimport.size(sub, sub.ConfHeight(height/2), sub.ConfWidth(width), true)
|
||||
can.onmotion.move(can, sub._target, {left: left||0, top: (top||0)+height/4}) // , can.onmotion.delay(can, function() { sub.Focus() })
|
||||
}), sub.onaction.close = function() { can.page.Remove(can, sub._target) }
|
||||
}, can._root._target)
|
||||
},
|
||||
figure: function(can, meta, target, cb) { if (meta.action == ice.AUTO || meta.type == html.BUTTON || meta.type == html.SELECT) { return }
|
||||
var input = meta.action||mdb.KEY, path = chat.PLUGIN_INPUT+input+nfs._JS; can.require([path], function(can) {
|
||||
function _cb(sub, value, old) { if (value == old) { return } can.base.isFunc(cb)? cb(sub, value, old): target.value = value||"", can.onmotion.delay(can, function() { can.onmotion.focus(can, target) }) }
|
||||
can.core.ItemCB(can.onfigure[input], function(key, on) { var last = target[key]||function(){}; target[key] = function(event) {
|
||||
can.core.CallFunc(on, {event: event, can: can, meta: meta, cb: _cb, target: target, sub: target._can, last: last, cbs: function(cb) {
|
||||
function show() { var sub = target._can
|
||||
can.base.isFunc(cb) && cb(target._can, _cb), can.onlayout.figure(event, can, target._can._target), can.onmotion.toggle(can, target._can._target, true)
|
||||
} if (target._can) { return show() }
|
||||
can.onappend._init(can, {type: html.INPUT, name: input, pos: chat.FLOAT, mode: meta.mode}, [path], function(sub) { sub.Conf(meta)
|
||||
sub.run = function(event, cmds, cb) { var msg = sub.request(event)
|
||||
if (meta.range) { for (var i = meta.range[0]; i < meta.range[1]; i += meta.range[2]||1) { msg.Push(mdb.VALUE, i) } cb(msg); return }
|
||||
(meta.run||can.run)(sub.request(event, can.Option()), cmds, cb, true)
|
||||
}, target._can = sub, can.base.Copy(sub, can.onfigure[input], true), sub._name = sub._path = path
|
||||
sub.hidden = function() { return sub._target.style.display == html.NONE }, sub.close = function() { can.page.Remove(can, sub._target), delete(target._can) }
|
||||
can.onmotion.delay(can, function() { can.page.style(sub, sub._target, meta.style), show(), can.base.isFunc(meta._init) && meta._init(sub, sub._target) })
|
||||
}, can._root._target)
|
||||
}})
|
||||
} }), can.onfigure[input]._init && can.onfigure[input]._init(can, meta, target, _cb)
|
||||
})
|
||||
},
|
||||
icon: function(can, list) {
|
||||
var text = can.core.Item(list, function(key, list) { return can.core.Item(list, function(size, value) {
|
||||
return `div.icon.s${size}.${key} {
|
||||
background:url(/publish/icon/full.jpg); background-size:${size*20}px; width:${size}px; height:${size}px;
|
||||
background-repeat: no-repeat; background-position-x:${value[0]}px; background-position-y:${value[1]}px; }`
|
||||
}).join(ice.NL) }).join(ice.NL)
|
||||
can.page.Append(can, document.head, ctx.STYLE, {"innerText": text}) //, console.log(html.ICON, text)
|
||||
},
|
||||
topic: function(can, topic, color, style, list) { const SOLID = " solid 1px", GLASS = "transparent"
|
||||
const INPUT_STYLE = "input-style", INPUT_HOVER_STYLE = "input-hover-style", OUTPUT_STYLE = "output-style", GLASS_STYLE = "glass-style"
|
||||
topic: function(can, topic, color, style, list) { const SOLID = " solid 1px", RADIUS = "border-radius", GLASS = "transparent"
|
||||
const LEGEND_STYLE = "legend-style", INPUT_STYLE = "input-style", INPUT_HOVER_STYLE = "input-hover-style", OUTPUT_STYLE = "output-style", GLASS_STYLE = "glass-style"
|
||||
const TABLE_HEAD_STYLE = "table-head-style", TABLE_HEAD_HOVER_STYLE = "table-head-hover-style", TABLE_ROW_HOVER_STYLE = "table-row-hover-style", TABLE_CELL_HOVER_STYLE = "table-cell-hover-style"
|
||||
const ITEM_HOVER_STYLE = "item-hover-style", CARTE_ITEM_HOVER_STYLE = "carte-item-hover-style", CARTE_ITEM_STYLE = "carte-item-style"
|
||||
const PANEL_STYLE = "panel-style", PLUGIN_STYLE = "plugin-style"
|
||||
const LEGEND_STYLE = "legend-style"
|
||||
function _bg(color) { var res = {"background-color": color}, arg = arguments; for (var i = 1; i < arg.length; i += 2) { res[arg[i]] = arg[i+1] } return res }
|
||||
function _fg(color) { var res = {"color": color}, arg = arguments; for (var i = 1; i < arg.length; i += 2) { res[arg[i]] = arg[i+1] } return res }
|
||||
function _b_r(size) { return {"border-radius": size} }
|
||||
style = style||kit.Dict(
|
||||
LEGEND_STYLE, _bg(color.legend),
|
||||
INPUT_STYLE, _bg(color.input, html.COLOR, color.label, "border-radius", "5px", "outline", html.NONE, "box-shadow", html.NONE),
|
||||
style = style||kit.Dict(LEGEND_STYLE, _bg(color.legend),
|
||||
INPUT_STYLE, _bg(color.input, html.COLOR, color.label, RADIUS, "5px", "outline", html.NONE, "box-shadow", html.NONE),
|
||||
INPUT_HOVER_STYLE, _fg(color.text), OUTPUT_STYLE, _bg(color.output), GLASS_STYLE, _bg(GLASS),
|
||||
TABLE_HEAD_STYLE, _bg(color.table, html.COLOR, color.label), TABLE_HEAD_HOVER_STYLE, _bg(color.table, html.COLOR, text),
|
||||
TABLE_HEAD_STYLE, _bg(color.table, html.COLOR, color.label), TABLE_HEAD_HOVER_STYLE, _bg(color.table, html.COLOR, color.text),
|
||||
TABLE_ROW_HOVER_STYLE, _bg(color.table), TABLE_CELL_HOVER_STYLE, _bg(color.hover), ITEM_HOVER_STYLE, _bg(color.hover, html.COLOR, color.text), CARTE_ITEM_HOVER_STYLE, _bg(color.input, html.COLOR, color.text),
|
||||
PANEL_STYLE, _bg(color.topic, html.COLOR, color.label), PLUGIN_STYLE, _bg(color.plugin, "border-radius", "10px"),
|
||||
), list = list||[
|
||||
{type: "", style: _fg(color.label)},
|
||||
PANEL_STYLE, _bg(color.topic, html.COLOR, color.label), PLUGIN_STYLE, _bg(color.plugin, RADIUS, "10px"),
|
||||
), list = list||[{type: "", style: _fg(color.label)},
|
||||
{type: html.LEGEND, style: [INPUT_STYLE, TABLE_HEAD_STYLE, LEGEND_STYLE]}, {type: html.LEGEND, style: [INPUT_HOVER_STYLE]},
|
||||
{type: html.SELECT, style: [INPUT_STYLE]}, {type: html.SELECT, style: [INPUT_HOVER_STYLE]},
|
||||
{type: html.INPUT, style: [INPUT_STYLE]}, {type: html.INPUT, style: [INPUT_HOVER_STYLE]},
|
||||
@ -420,14 +254,13 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
{type: html.DIV_OUTPUT, style: [OUTPUT_STYLE]}, {type: html.DIV_STATUS, style: _fg(color.label)},
|
||||
{type: html.DIV_ITEM, name: [html.SELECT], style: [ITEM_HOVER_STYLE]}, {type: html.DIV_ITEM, style: [ITEM_HOVER_STYLE]},
|
||||
{type: html.DIV_TABS, list: [{type: html.DIV, style: _bg(color.plugin)}]},
|
||||
{type: html.DIV_TABS, list: [{type: html.DIV, name: [html.SELECT], style: [OUTPUT_STYLE]}]},
|
||||
{type: html.DIV_TABS, list: [{type: html.DIV, name: [html.HOVER], style: [OUTPUT_STYLE]}]},
|
||||
{type: html.DIV_TABS, list: [{type: html.DIV, name: [html.HOVER], style: _fg(color.text)}]},
|
||||
{type: html.DIV_TABS, list: [{type: html.DIV, name: [html.SELECT], style: [OUTPUT_STYLE]}]},
|
||||
{type: html.DIV_PATH, style: [OUTPUT_STYLE]}, {type: html.DIV_CODE, style: {border: color.border+SOLID}},
|
||||
{type: html.DIV_PATH, list: [{type: html.SPAN, style: [ITEM_HOVER_STYLE]}]},
|
||||
{type: "div.zone>div.name", style: [TABLE_HEAD_STYLE]}, {type: "div.zone>div.name", style: [TABLE_HEAD_HOVER_STYLE]},
|
||||
{type: "div.zone>div.list>div.zone>div.name", style: [TABLE_HEAD_STYLE]},
|
||||
{type: "div.zone>div.list>div.zone>div.name", style: [TABLE_HEAD_HOVER_STYLE]},
|
||||
{type: "div.zone>div.item", style: [TABLE_HEAD_STYLE]}, {type: "div.zone>div.item", style: [TABLE_HEAD_HOVER_STYLE]},
|
||||
{type: "div.zone>div.list>div.zone>div.item", style: [TABLE_HEAD_STYLE]}, {type: "div.zone>div.list>div.zone>div.item", style: [TABLE_HEAD_HOVER_STYLE]},
|
||||
{type: "div.zone div.item>div.name", name: [html.HOVER], style: _fg(color.text)},
|
||||
{type: "tr.line.select", style: [ITEM_HOVER_STYLE]}, {type: "tr.line", style: [ITEM_HOVER_STYLE]}, {type: "tr.line>td.line", style: [OUTPUT_STYLE]},
|
||||
{type: html.TABLE_LAYOUT, list: [{type: html.DIV_TOGGLE, style: [ITEM_HOVER_STYLE]}]},
|
||||
@ -456,86 +289,118 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
return (item.style? (pre+ice.SP+type+" { "+(can.base.isArray(item.style)? can.core.List(item.style, function(item) {
|
||||
return can.core.Item(style[item], function(key, value) { return key&&value? key+": "+value: undefined }).join("; ")
|
||||
}).join("; "): can.core.Item(can.base.Obj(item.style), function(key, value) { return key+": "+value }).join("; "))+" }"): "")+(item.list? render(pre+ice.SP+type, item.list): "")
|
||||
}).join(ice.NL) }
|
||||
var text = render("body."+topic, list); can.page.Append(can, document.head, "style", {"innerText": text}) //, console.log("topic", topic, text)
|
||||
}).join(ice.NL) } can.page.Append(can, document.head, "style", {"innerText": render("body."+topic, list)})
|
||||
},
|
||||
style: function(can, style, target) { target = target||can._fields||can._target; switch (typeof style) {
|
||||
case lang.STRING: can.page.ClassList.add(can, target, style); break
|
||||
case lang.OBJECT: can.page.style(can, target, style); break
|
||||
} },
|
||||
field: function(can, type, item, target) { type = type||html.STORY, item = item||{}
|
||||
var name = can.core.Split(item.nick||item.name||"")[0], title = !item.help || item.help == name || can.user.language(can) == "en"? name: name+"("+can.core.Split(item.help)[0]+")"
|
||||
return can.page.Append(can, target||can._output, [{view: [can.base.join([type||"", item.name||"", item.pos||""]), html.FIELDSET], list: [
|
||||
(name||title)&&{text: [name == "word"? item.help.split(ice.SP)[0]: title, html.LEGEND]}, {view: [html.OPTION, html.FORM]}, html.ACTION, html.OUTPUT, html.STATUS,
|
||||
]}])
|
||||
},
|
||||
input: function(can, item, value, target, style) { if (item.type == html.BR || item.type == html.HR) { return can.page.Append(can, target, [item]) }
|
||||
var input = can.page.input(can, can.base.Copy({}, item), value), title = can.Conf(can.core.Keys(ctx.FEATURE, chat.TITLE, item.name))||""; title && (input.title = title)
|
||||
if (item.type == html.SELECT && item.value) { input._init = function(target) { target.value = value||item.value } }
|
||||
if (item.type == html.TEXT) { input.onkeydown = item.onkeydown||function(event) {
|
||||
can.onkeymap.input(event, can), can.onkeymap.selectOutput(event, can), event.key == lang.ENTER && can.onkeymap.prevent(event)
|
||||
} }
|
||||
if (item.range) { input._init = function(target) { can.onappend.figure(can, item, target, function(sub, value, old) {
|
||||
target.value = value, can.core.CallFunc([can.onaction, item.name], [event, can, item.name])
|
||||
}) } }
|
||||
return can.page.Append(can, target, ([{view: can.base.join(style||[html.ITEM, item.type]), list: [input]}]).concat(input.type == html.TEXTAREA? [{type: html.BR}]: []))[item.name]
|
||||
},
|
||||
table: function(can, msg, cb, target, sort) { if (!msg || msg.Length() == 0) { return } var meta = can.base.Obj(msg.Option(mdb.META))
|
||||
var table = can.page.AppendTable(can, msg, target||can._output, msg.append, cb||function(value, key, index, line, array) {
|
||||
if (msg.append.length == 2 && msg.append[0] == mdb.KEY && msg.append[1] == mdb.VALUE) { if (key == mdb.VALUE) { key = line.key }
|
||||
line = {}, can.core.List(array, function(item) { line[item.key] = item.value })
|
||||
} function run(event, cmd, arg) { return can.run(can.request(event, line, can.Option()), [ctx.ACTION, cmd].concat(arg)) }
|
||||
return {text: [value, html.TD], onclick: function(event) { var target = event.target
|
||||
if (can.page.tagis(target, html.INPUT) && target.type == html.BUTTON) { can.request(event, {height: can.ConfHeight()-4-table.offsetHeight, width: can.ConfWidth()})
|
||||
meta && meta[target.name]? can.user.input(can.request(event, {action: target.name}), can, meta[target.name], function(args) { run(event, target.name, args) }): run(event, target.name)
|
||||
} else { can.sup.onimport.change(event, can.sup, key, event.target.innerText) || can.sup.onexport.record(can.sup, value, key, line) }
|
||||
}, ondblclick: function(event) { if ([mdb.KEY, mdb.HASH, mdb.ID].indexOf(key) > -1) { return }
|
||||
var item = can.core.List(can.Conf([ctx.FEATURE, mdb.INSERT]), function(item) { if (item.name == key) { return item } })[0]||{name: key, value: value}
|
||||
item.run = function(event, cmds, cb) { can.run(can.request(event, line), cmds, cb, true) }
|
||||
can.onmotion.modifys(can, event.target, function(event, value, old) { run(event, mdb.MODIFY, [key, value]) }, item)
|
||||
}}
|
||||
}); table && can.page.styleClass(can, table, chat.CONTENT), msg.append && msg.append[msg.append.length-1] == ctx.ACTION && can.page.ClassList.add(can, table, ctx.ACTION)
|
||||
return sort && can.page.RangeTable(can, table, can.core.List(sort, function(key) { return can.page.Select(can, table, html.TH, function(th, index) { if (th.innerHTML == key) { return index } })[0] })), table
|
||||
},
|
||||
board: function(can, text, target) { text && text.Result && (text = text.Result()); if (!text) { return }
|
||||
var code = can.page.Append(can, target||can._output, [{text: [can.page.Color(text), html.DIV, html.CODE]}]).code
|
||||
can.page.Select(can, code, html.INPUT_BUTTON, function(target) { target.onclick = function(event) { can.run(can.request(event, can.Option()), [ctx.ACTION, target.name]) } })
|
||||
return code.scrollBy && code.scrollBy(0, 10000), code
|
||||
},
|
||||
tools: function(can, msg, cb, target) { can.onimport.tool(can, can.base.Obj(msg.Option(ice.MSG_TOOLKIT), []), cb, target) },
|
||||
layout: function(can, target, type, list) { const FLOW = "flow", FLEX = "flex"
|
||||
switch (type||ice.AUTO) {
|
||||
case FLOW:
|
||||
case FLEX:
|
||||
case ice.AUTO: var count = 0, ui = {size: {}}; type = type == "" || type == ice.AUTO? FLEX: type
|
||||
function append(target, type, list) { can.page.ClassList.add(can, target, [html.LAYOUT, type]), can.core.List(list, function(item) {
|
||||
if (can.base.isArray(item)) {
|
||||
append(can.page.Append(can, target, [{}])._target, type==FLOW? FLEX: FLOW, item)
|
||||
} else if (can.base.isObject(item)) { item._index = count++, ui.size[item._index] = item.height||item.width
|
||||
item.layout = function(width, height) { item.width = width, item.height = height }
|
||||
can.onappend.plugin(can, item, function(sub) {
|
||||
item.layout = function(width, height) { sub.onimport.size(sub, height, width) }
|
||||
}, target, ui[item._index] = can.onappend.field(can, item.type, item, target)._target)
|
||||
} else if (can.base.isString(item)) {
|
||||
if (can.base.isString(item)) {
|
||||
ui[item] = can.page.Append(can, target, [item])._target
|
||||
} else if (can.base.isArray(item)) {
|
||||
append(can.page.Append(can, target, [html.LAYOUT])._target, type==FLOW? FLEX: FLOW, item)
|
||||
} else if (can.base.isObject(item)) {
|
||||
if (item.index) {
|
||||
item._index = count++, ui.size[item._index] = item.height||item.width
|
||||
item.layout = function(width, height) { item.width = width, item.height = height }
|
||||
can.onappend.plugin(can, item, function(sub) { item.layout = function(width, height) { sub.onimport.size(sub, height, width) }
|
||||
can._plugins = can.misc.concat(can, can._plugins, [sub])
|
||||
}, target, ui[item._index] = can.onappend.field(can, item.type, {name: item.index, help: item.help}, target)._target)
|
||||
} else {
|
||||
can.page.Append(can, target, [item])
|
||||
}
|
||||
}
|
||||
}); return list }
|
||||
function calc(item, size, total) { return !ui.size[item]? size: ui.size[item] < 1? total*ui.size[item]: ui.size[item] }
|
||||
var defer = []; function layout(type, list, width, height) { var _width = width, _height = height; can.core.List(list, function(item) {
|
||||
if (item == html.CONTENT) {
|
||||
return defer.push(function() { can.page.style(can, ui[item], html.HEIGHT, height, html.WIDTH, width) })
|
||||
} else {
|
||||
if (can.base.isObject(item)) { var meta = item; item = (item._index)+"" }
|
||||
function calc(item, size, total) {
|
||||
if (!ui.size[item]) {
|
||||
return size
|
||||
} else if (ui.size[item] < 1){
|
||||
return total*ui.size[item]
|
||||
} else {
|
||||
return ui.size[item]
|
||||
}
|
||||
}
|
||||
if (!can.page.isDisplay(ui[item])){
|
||||
|
||||
} else if (type == FLOW) {
|
||||
can.page.style(can, ui[item], html.WIDTH, width)
|
||||
if (can.base.isObject(meta)) { meta.layout(width, calc(item, ui[item].offsetHeight, height)) }
|
||||
height -= calc(item, ui[item].offsetHeight, height)
|
||||
} else { var w = calc(item, ui[item].offsetWidth||_width/list.length, _width), h = height
|
||||
if (can.base.isObject(meta)) { h = "", meta.layout(w = _width/list.length, h) }
|
||||
can.page.style(can, ui[item], html.HEIGHT, h, html.WIDTH, w)
|
||||
width -= w
|
||||
}
|
||||
if (item == html.CONTENT) { return defer.push(function() { can.page.style(can, ui[item], html.HEIGHT, height, html.WIDTH, width) }) }
|
||||
if (!can.page.isDisplay(ui[item])) { return }
|
||||
if (can.base.isObject(item)) { var meta = item; item = (item._index)+"" }
|
||||
if (type == FLOW) { var h = calc(item, ui[item].offsetHeight, height)
|
||||
if (can.base.isObject(meta)) { meta.layout(width, h) }
|
||||
can.page.style(can, ui[item], html.WIDTH, width), height -= h
|
||||
} else { var w = calc(item, ui[item].offsetWidth||_width/list.length, _width), h = height
|
||||
if (can.base.isObject(meta)) { h = "", meta.layout(w = _width/list.length, h) }
|
||||
can.page.style(can, ui[item], html.HEIGHT, h, html.WIDTH, w), width -= w
|
||||
}
|
||||
}), can.core.List(list, function(item) { if (can.base.isArray(item)) { layout(type == FLOW? FLEX: FLOW, item, width, height) } }) }
|
||||
list = append(target, type, list||[html.PROJECT, [[html.CONTENT, html.PROFILE], html.DISPLAY]])
|
||||
ui.layout = function(width, height, delay) { can.onmotion.delay(can, function() { defer = [], layout(type, list, width, height), defer.forEach(function(cb) { cb() }) }, delay||0) }
|
||||
ui.layout = function(width, height, delay) { can.onmotion.delay(can, function() { defer = [], layout(type, ui.list, width, height), defer.forEach(function(cb) { cb() }) }, delay||0) }
|
||||
ui.list = append(target, type, list||[html.PROJECT, [[html.CONTENT, html.PROFILE], html.DISPLAY]])
|
||||
return ui
|
||||
case "tabs-box":
|
||||
can.page.ClassList.add(can, target, "layout tabs box")
|
||||
can.onappend.style(can, target, [html.LAYOUT, html.TABS, "box"])
|
||||
can.core.List(list, function(item) {
|
||||
var ui = can.page.Append(can, target, [{view: "tabs", inner: item.name, onclick: function() {
|
||||
var ui = can.page.Append(can, target, [{view: html.TABS, inner: item.name, onclick: function() {
|
||||
can.onmotion.toggle(can, ui.list)
|
||||
}}, {view: "list", list: item.list}])
|
||||
}}, {view: html.LIST, list: item.list}])
|
||||
})
|
||||
break
|
||||
case "tabs-top":
|
||||
can.page.ClassList.add(can, target, "layout tabs top")
|
||||
var ui = can.page.Append(can, target, ["tabs", "list"])
|
||||
can.onappend.style(can, target, [html.LAYOUT, html.TABS, html.TOP])
|
||||
var ui = can.page.Append(can, target, [html.TABS, html.LIST])
|
||||
break
|
||||
case "tabs-left":
|
||||
can.page.ClassList.add(can, target, "layout tabs left")
|
||||
var ui = can.page.Append(can, target, ["tabs", "list"])
|
||||
can.onappend.style(can, target, [html.LAYOUT, html.TABS, html.LEFT])
|
||||
var ui = can.page.Append(can, target, [html.TABS, html.LIST])
|
||||
break
|
||||
case "tabs-right":
|
||||
can.page.ClassList.add(can, target, "layout tabs right")
|
||||
var ui = can.page.Append(can, target, ["list", "tabs"])
|
||||
can.onappend.style(can, target, [html.LAYOUT, html.TABS, html.RIGHT])
|
||||
var ui = can.page.Append(can, target, [html.LIST, html.TABS])
|
||||
break
|
||||
case "tabs-bottom":
|
||||
can.page.ClassList.add(can, target, "layout tabs bottom")
|
||||
var ui = can.page.Append(can, target, ["list", "tabs"])
|
||||
can.onappend.style(can, target, [html.LAYOUT, html.TABS, html.BOTTOM])
|
||||
var ui = can.page.Append(can, target, [html.LIST, html.TABS])
|
||||
break
|
||||
}
|
||||
ui.append = function(item, carte) {
|
||||
var tabs = can.page.Append(can, ui.tabs, [{type: html.DIV, inner: item.name, onclick: function(event) {
|
||||
can.onmotion.select(can, ui.tabs, html.DIV, tabs), can.onmotion.select(can, ui.list, html.DIV, view)
|
||||
}, onmouseenter: function(event) {
|
||||
// can.user.carte(event, can, carte.meta, carte.list, carte)
|
||||
}}])._target
|
||||
var view = can.page.Append(can, ui.list, [{type: html.DIV, list: item.list}])._target
|
||||
if (ui.tabs.childElementCount == 1) { tabs.click() }
|
||||
@ -543,18 +408,68 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
close: function() {
|
||||
if (can.page.ClassList.has(can, tabs, html.SELECT)) {
|
||||
(tabs.nextSibling||tabs.previousSibling).click()
|
||||
}
|
||||
can.page.Remove(can, tabs), can.page.Remove(can, view)
|
||||
} can.page.Remove(can, tabs), can.page.Remove(can, view)
|
||||
},
|
||||
}
|
||||
}
|
||||
can.core.List(list, function(item) {
|
||||
var view = ui.append(item, shy({
|
||||
"close": function() { view.close() },
|
||||
close: function() { view.close() },
|
||||
}))
|
||||
})
|
||||
return ui
|
||||
},
|
||||
tabview: function(can, meta, list, target) { var ui = can.page.Append(can, target, [html.ACTION, html.OUTPUT])
|
||||
can.core.List(can.base.getValid(list, can.core.Item(meta)), function(name, index) {
|
||||
ui[name] = can.page.Append(can, ui.action, [{text: name, onclick: function(event) {
|
||||
if (can.onmotion.cache(can, function() { return name }, ui.output)) { return } meta[name](ui.output)
|
||||
}, _init: function(target) { index == 0 && can.onmotion.delay(can, function() { target.click() }) }}])._target
|
||||
}); return ui._target = target, ui
|
||||
},
|
||||
|
||||
plugin: function(can, meta, cb, target, field) { meta = meta||{}, meta.index = meta.index||can.core.Keys(meta.ctx, meta.cmd)||ice.CAN_PLUGIN
|
||||
var res = {}; function _cb(sub, meta, skip) { kit.proto(res, sub), cb && cb(sub, meta, skip) }
|
||||
if (meta.inputs && meta.inputs.length > 0 || meta.meta) { can.onappend._plugin(can, {meta: meta.meta, list: meta.list}, meta, _cb, target, field); return res }
|
||||
var value = can.onengine.plugin(can, meta.index); if (value) { can.onappend._plugin(can, value, meta, function(sub, meta, skip) {
|
||||
_cb(sub, meta, skip), can.onmotion.delay(can, function() { value.meta && value.meta._init && value.meta._init(sub, meta) })
|
||||
}, target, field); return res }
|
||||
can.runAction({}, ctx.COMMAND, [meta.index], function(msg) { msg.Table(function(value) { can.onappend._plugin(can, value, meta, _cb, target, field) })}); return res
|
||||
},
|
||||
_plugin: function(can, value, meta, cb, target, field) { can.base.Copy(meta, value, true)
|
||||
meta.name = meta.name||value&&value.meta&&value.meta.name||""
|
||||
meta.type = meta.type||chat.STORY, meta.height = meta.height||can.ConfHeight(), meta.width = meta.width||can.ConfWidth()
|
||||
meta.args = can.base.getValid(can.base.Obj(meta.args), can.base.Obj(meta.arg), can.base.Obj(value.args), can.base.Obj(value.arg))||[]
|
||||
meta.inputs = can.base.getValid(meta.inputs, can.base.Obj(value.list))||[], meta.feature = can.base.getValid(meta.feature, can.base.Obj(value.meta))||{}
|
||||
can.onappend._init(can, meta, [chat.PLUGIN_STATE_JS], function(sub, skip) {
|
||||
sub.run = function(event, cmds, cb) { can.runActionCommand(event, sub._index, cmds, cb) }
|
||||
sub._index = value.index||meta.index, can.base.isFunc(cb) && cb(sub, meta, skip)
|
||||
}, target||can._output, field)
|
||||
},
|
||||
_float: function(can, index, args) {
|
||||
can.onappend.plugin(can, {mode: chat.FLOAT, index: index, args: args}, function(sub) {
|
||||
can.getActionSize(function(left, top, width, height) { sub.onimport.size(sub, sub.ConfHeight(height/2), sub.ConfWidth(width), true)
|
||||
can.onmotion.move(can, sub._target, {left: left||0, top: (top||0)+height/4})
|
||||
}), sub.onaction.close = function() { can.page.Remove(can, sub._target) }
|
||||
}, can._root._target)
|
||||
},
|
||||
figure: function(can, meta, target, cb) { if (meta.action == ice.AUTO || meta.type == html.BUTTON || meta.type == html.SELECT) { return }
|
||||
var input = meta.action||mdb.KEY, path = chat.PLUGIN_INPUT+input+nfs._JS; can.require([path], function(can) {
|
||||
function _cb(sub, value, old) { if (value == old) { return } can.base.isFunc(cb)? cb(sub, value, old): can.onmotion.delay(can, function() { can.onmotion.focus(can, target, value||"") }) }
|
||||
can.core.ItemCB(can.onfigure[input], function(key, on) { var last = target[key]||function(){}; target[key] = function(event) {
|
||||
can.core.CallFunc(on, {event: event, can: can, meta: meta, cb: _cb, target: target, sub: target._can, last: last, cbs: function(cb) {
|
||||
function show() { var sub = target._can; can.base.isFunc(cb) && cb(target._can, _cb), can.onlayout.figure(event, can, target._can._target), can.onmotion.toggle(can, target._can._target, true) }
|
||||
target._can? show(): can.onappend._init(can, {type: html.INPUT, name: input, pos: chat.FLOAT, mode: meta.mode}, [path], function(sub) { sub.Conf(meta)
|
||||
sub.run = function(event, cmds, cb) { var msg = sub.request(event)
|
||||
if (meta.range) { for (var i = meta.range[0]; i < meta.range[1]; i += meta.range[2]||1) { msg.Push(mdb.VALUE, i) } cb(msg); return }
|
||||
(meta.run||can.run)(sub.request(event, can.Option()), cmds, cb, true)
|
||||
}, target._can = sub, can.base.Copy(sub, can.onfigure[input], true), sub._name = sub._path = path
|
||||
sub.hidden = function() { return sub._target.style.display == html.NONE }, sub.close = function() { can.page.Remove(can, sub._target), delete(target._can) }
|
||||
can.onmotion.delay(can, function() { can.page.style(sub, sub._target, meta.style), show(), can.base.isFunc(meta._init) && meta._init(sub, sub._target) })
|
||||
}, can._root._target)
|
||||
}})
|
||||
} }), can.onfigure[input]._init && can.onfigure[input]._init(can, meta, target, _cb)
|
||||
})
|
||||
},
|
||||
})
|
||||
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 })
|
||||
@ -724,7 +639,9 @@ Volcanos(chat.ONMOTION, {_init: function(can, target) {
|
||||
share: function(event, can, input, args) { var _args = args
|
||||
return can.user.input(event, can, input, function(args) { can.onengine.signal(can, chat.ONSHARE, can.request(event, {args: [mdb.TYPE, chat.FIELD].concat(_args||[], args||[])})) })
|
||||
},
|
||||
focus: function(can, target) { if (!target) { return } target.focus(), target.setSelectionRange && target.setSelectionRange(0, target.value.length) },
|
||||
focus: function(can, target, value) { if (!target) { return } if (!can.base.isUndefined(value)) { target.value = value }
|
||||
target.focus(), target.setSelectionRange && target.setSelectionRange(0, target.value.length)
|
||||
},
|
||||
copy: function(can, target, cb) { target.title = "点击复制", target.onclick = function(event) { can.user.copy(event, can, target.innerText), can.base.isFunc(cb) && cb(event) } },
|
||||
|
||||
move: function(can, target, layout, cb) { var begin; layout = layout||{}
|
||||
@ -851,15 +768,17 @@ Volcanos(chat.ONKEYMAP, {_init: function(can, target) { target = target||documen
|
||||
selectCtrlN: function(event, can, target, key, cb) { if (!event.ctrlKey || event.key < "0" || event.key > "9") { return }
|
||||
return can.page.Select(can, target, key, function(target, index) { if (index+1 == event.key) { return cb? cb(target): target.click() } })[0]
|
||||
},
|
||||
selectItems: function(event, can, target, name) { name = name||event.target.value
|
||||
selectItems: function(event, can, target, name) { name = (name||event.target.value).toLowerCase()
|
||||
can.page.Select(can, target, html.DIV_ITEM, function(item) {
|
||||
can.page.ClassList.set(can, item, html.HIDE, item.innerText.indexOf(name) == -1)
|
||||
if (!can.page.ClassList.set(can, item, html.HIDE, item.innerText.toLowerCase().indexOf(name) == -1)) {
|
||||
for (item = item.parentNode; item != target; item = item.parentNode) {
|
||||
can.page.ClassList.del(can, item, html.HIDE), can.page.ClassList.del(can, item.previousSibling, html.HIDE)
|
||||
}
|
||||
}
|
||||
}), can.onkeymap.selectCtrlN(event, can, target, html.DIV_ITEM+":not(.hide)", function(target) {
|
||||
target.click(), can.onmotion.focus(can, event.target)
|
||||
})
|
||||
if (event.key == lang.ENTER) { can.onmotion.focus(can, event.target)
|
||||
can.page.Select(can, target, html.DIV_ITEM+":not(.hide)")[0].click()
|
||||
}
|
||||
if (event.key == lang.ENTER) { can.page.Select(can, target, html.DIV_ITEM+":not(.hide)")[0].click(), can.onmotion.focus(can, event.target) }
|
||||
if (event.key == lang.ESCAPE) { event.target.blur() }
|
||||
},
|
||||
selectInputs: function(event, can, cb, target) { if (can.page.ismodkey(event)) { return } if (event.key == lang.ESCAPE) { return target.blur() }
|
||||
|
36
index.css
36
index.css
@ -29,12 +29,12 @@ div.project div.item { padding:2px 10px; }
|
||||
div.project div.item>div.name { padding-left:20px; }
|
||||
div.project div.switch { margin-top:2px; width:12px; float:left; rotate:90deg; }
|
||||
div.project div.switch.open { translate:3px -3px; rotate:180deg; }
|
||||
div.project div.zone>div.name { background-color:steelblue; color:white; text-align:center; padding:3px; clear:both; position:relative; }
|
||||
div.project div.zone>div.name>div.icon { margin-left:3px; display:none; float:right; }
|
||||
div.project div.zone>div.item { background-color:steelblue; color:white; text-align:center; padding:3px; clear:both; position:relative; }
|
||||
div.project div.zone>div.item>div.icon { margin-left:3px; display:none; float:right; }
|
||||
div.project div.zone:hover>div.name>div.icon { display:block; }
|
||||
div.project div.zone>div.list>div.zone:hover>div.name>div.icon { top:3px; }
|
||||
div.project div.zone>div.list>div.zone>div.name { text-align:left; padding-left:20px; }
|
||||
div.project div.zone>div.list>div.zone>div.name:hover { margin-left:10px; transition:all 0.3s; }
|
||||
div.project div.zone>div.list>div.zone>div.item { text-align:left; padding-left:20px; }
|
||||
div.project div.zone>div.list>div.zone>div.item:hover { margin-left:10px; transition:all 0.3s; }
|
||||
div.project div.zone>div.list { min-width:200px; overflow:auto; }
|
||||
div.project div.zone>div.action>div.item { float:right; clear:none; }
|
||||
div.project div.zone>div.action>div.item input[type=text] { margin-right:-10px; }
|
||||
@ -93,7 +93,7 @@ body>div.toast div.progress { border:green solid 1px; margin-left:-2px; height:2
|
||||
body>div.toast div.progress div.current { background-color:red; height:18px; }
|
||||
body>div.toast div.action { display:block; }
|
||||
body>div.carte { padding:0; }
|
||||
body>div.carte input[name=filter] { margin-left:5px; width:calc(100% - 10px); position:sticky; top:0; }
|
||||
body>div.carte input[name=filter] { margin:5px; width:calc(100% - 10px); position:sticky; top:0; }
|
||||
body>div.carte div.item { padding:5px 10px; }
|
||||
body>div.input td { padding:5px; }
|
||||
body>div.input select { width:200px; }
|
||||
@ -115,6 +115,16 @@ table.content, div.project, div.item, div.code, div.story[data-type=spark], svg
|
||||
div.action>div.tabs { padding:5px; height:31px; }
|
||||
div.status>div.item { padding:5px; height:30px; }
|
||||
div.status>div.item>label { font-size:0.6rem; }
|
||||
fieldset div.tabs span.icon { margin-left:10px; visibility:hidden; }
|
||||
fieldset div.tabs span.icon:hover { background-color: aliceblue; }
|
||||
fieldset div.tabs>div:hover span.icon { visibility:visible; }
|
||||
fieldset div.tabs>div.select span.icon { visibility:visible; }
|
||||
fieldset form.option div.icon { font-size:26px; margin-right:5px; display:none; }
|
||||
fieldset form.option div.icon:hover { background-color:white; }
|
||||
fieldset.float form.option>div.icon { display:block; }
|
||||
fieldset.full form.option>div.icon { display:block; }
|
||||
fieldset.plug form.option>div.icon { margin-left:5px; }
|
||||
div.tabs { position:relative; }
|
||||
/* display */
|
||||
form.option, div.action { display:contents; }
|
||||
form.option>div.item>label, div.action>div.item>label, .hidden, .hide { display:none; }
|
||||
@ -126,11 +136,7 @@ fieldset.plugin:not(.float):not(.full):not(.cmd) { padding:10px; margin:10px; }
|
||||
fieldset.plugin:not(.float):not(.full):not(.cmd)>legend { float:none; }
|
||||
fieldset.auto, fieldset.full, fieldset.float, div.float { position:fixed; z-index:10; }
|
||||
div.code { position:sticky; left:0; }
|
||||
form.option>div.icon { margin:5px; display:none; float:left; cursor:pointer; }
|
||||
fieldset.float:not(.input) form.option>div.icon { display:block; }
|
||||
fieldset.full form.option>div.icon { display:block; }
|
||||
fieldset.plug form.option>div.icon { display:block; margin-left:5px; }
|
||||
fieldset:not(.panel):not(.input) form.option>div.icon.refresh { display:block; margin-right:5px; }
|
||||
hr { border-bottom:gray dashed 1px; margin:5px; }
|
||||
/* hover */
|
||||
legend:hover { background-color:skyblue; }
|
||||
select:hover { background-color:gray; color:cyan; }
|
||||
@ -140,11 +146,11 @@ table.content th:hover, table.content td:hover, table.content td.select { backgr
|
||||
div.story[data-type=spark] span:hover { background-color:deepskyblue; box-shadow:4px 4px 20px 4px #29318e; }
|
||||
div.carte div.item:hover { background-color:cornflowerblue; }
|
||||
select, input[type=text], textarea { box-shadow:4px 4px 20px 4px #626bd0; }
|
||||
legend, select, input[type=button], div.tabs, div.item, span.item, div.zone>div.name, th, td, h1, h2, h3 { cursor:pointer; }
|
||||
legend, select, input[type=button], div.tabs, div.item, span.item, div.zone>div.item, th, td, h1, h2, h3 { cursor:pointer; }
|
||||
div.title, div.story[data-type=spark] { cursor:copy; }
|
||||
/* topic */
|
||||
body.black a { color:yellow; }
|
||||
body.black div.project div.zone>div.list>div.zone>div.name { background-color:#09466fc2; }
|
||||
body.black div.project div.zone>div.list>div.zone>div.item { background-color:#09466fc2; }
|
||||
body.white { background-color:rgba(5,34,56,0.75); color:white; }
|
||||
body.white select { background-color:yellowgreen; color:white; }
|
||||
body.white input { background-color:white; }
|
||||
@ -160,7 +166,7 @@ body.white input[type=button][name=remove] { background-color:red; }
|
||||
body.white textarea { background-color:white; }
|
||||
body.white table.content th { background-color:skyblue; }
|
||||
body.white table.content.action td:last-child { background-color:skyblue; }
|
||||
body.white div.zone>div.list>div.zone>div.name { background-color:aliceblue; color:black; }
|
||||
body.white div.zone>div.list>div.zone>div.item { background-color:aliceblue; color:black; }
|
||||
body.white div.float { background-color:aliceblue; color:black; }
|
||||
body.white fieldset.panel.Search a { color:yellow; }
|
||||
body.white fieldset.panel.Action { color:black; }
|
||||
@ -172,7 +178,7 @@ body.white legend:hover { background-color:skyblue; }
|
||||
body.white select:hover { background-color:#99cc667d; }
|
||||
body.white input[name=cmd]:hover { background-color:white; color:black; }
|
||||
body.white input[type=button]:hover { background-color:#1b7acc8c; }
|
||||
body.white div.project div.zone>div.list>div.zone>div.name:hover { background-color:#4682b46b; }
|
||||
body.white div.project div.zone>div.list>div.zone>div.item:hover { background-color:#4682b46b; }
|
||||
body.white div.item:hover, body.white span.item:hover { background-color:#4682b46b; }
|
||||
body.white div.item.select { background-color:#4682b46b; }
|
||||
body.white table.content tr:hover { background-color:#4682b46b; }
|
||||
@ -199,7 +205,7 @@ body.print legend, body.print select, body.print input, body.print input[type=bu
|
||||
body.print div.item { background-color:white; }
|
||||
body.print div.carte div.item { background-color:snow; }
|
||||
body.print div.item.select { background-color:lightgray; }
|
||||
body.print div.zone>div.name { background-color:lightgray; color:black; }
|
||||
body.print div.zone>div.item { background-color:lightgray; color:black; }
|
||||
body.print table.content th { background-color:lightgray; }
|
||||
body.print table.content.action td:last-child { background-color:lightgray; }
|
||||
body.print table.content td.select { background-color:lightgray; }
|
||||
|
@ -158,11 +158,12 @@ Volcanos("page", {ClassList: {
|
||||
case html.USERNAME: // no break
|
||||
case html.PASSWORD: // no break
|
||||
case html.TEXT:
|
||||
item.className||can.page.ClassList.add(can, item, ctx.ARGS)
|
||||
item.name = item.name||item.type
|
||||
item.value = value||item.value||""
|
||||
item.placeholder = item.placeholder||item.name||item.type
|
||||
item.title = item.title||item.placeholder||item.name||item.type
|
||||
item.className || can.page.ClassList.add(can, item, ctx.ARGS); break
|
||||
break
|
||||
case html.SELECT: input.type = html.SELECT
|
||||
item.values = can.base.isString(item.values)? can.core.Split(item.values): item.values
|
||||
if (!item.values && item.value) { item.values = can.core.Split(item.value), item.value = item.values[0] }
|
||||
@ -175,7 +176,7 @@ Volcanos("page", {ClassList: {
|
||||
if (item.name == "refresh") { can.Update() } else {
|
||||
!can.sup && can.request(event).RunAction(event, can, [ctx.ACTION, item.name]) || can.runAction(event, item.name)
|
||||
}
|
||||
}}
|
||||
}}; break
|
||||
} return input
|
||||
},
|
||||
Format: function(type) { var args = arguments; switch (type) {
|
||||
@ -240,5 +241,5 @@ Volcanos("page", {ClassList: {
|
||||
height: function() { return window.innerHeight },
|
||||
width: function() { return window.innerWidth },
|
||||
ismodkey: function(event) { return [lang.META, lang.ALT, lang.CONTROL, lang.SHIFT].indexOf(event.key) > -1 },
|
||||
isDisplay: function(target) { return target && target.style.display != html.NONE },
|
||||
isDisplay: function(target) { return target && target.style.display != html.NONE && target.className.indexOf(html.HIDE) == -1 },
|
||||
})
|
||||
|
@ -46,6 +46,36 @@ fieldset.Action>div.project.toggle {
|
||||
border-top-right-radius:20px; border-bottom-right-radius:20px;
|
||||
}
|
||||
|
||||
/* flex */
|
||||
div.layout.tabs>div.tabs { display:flex; overflow:auto; }
|
||||
div.layout.tabs>div.tabs>div { padding:10px; height:32px; flex:1; }
|
||||
div.layout.tabs>div.tabs>div:hover { background-color:steelblue; }
|
||||
div.layout.tabs>div.list { width:100%; height:100%; flex:1; }
|
||||
div.layout.tabs>div.list>div { height:100%; display:none; }
|
||||
div.layout.tabs>div.list>div.select { display:block; }
|
||||
div.layout.tabs.left { display:flex; }
|
||||
div.layout.tabs.left>div.tabs { flex-direction:column; }
|
||||
div.layout.tabs.left>div.tabs>div { writing-mode:tb; }
|
||||
div.layout.tabs.right { display:flex; }
|
||||
div.layout.tabs.right>div.tabs { flex-direction:column; }
|
||||
div.layout.tabs.right>div.tabs>div { writing-mode:tb; }
|
||||
div.layout.tabs.box>div.list { height:unset; }
|
||||
div.layout.tabs.box>div.tabs { background-color:steelblue; text-align:center; padding:3px; display:block; }
|
||||
/* layout */
|
||||
table.layout { border-spacing:0; }
|
||||
table.layout td { vertical-align:top; }
|
||||
table.layout td.content div.toggle { background-color:#4682b46b; color:white; font-size:24px; position:absolute; }
|
||||
table.layout td.content div.toggle>div { display:table-cell; }
|
||||
table.layout td.content div.toggle.project { padding-top:50px; height:130px; width:15px; top:20%; left:0; border-top-right-radius:10px; border-bottom-right-radius:10px; }
|
||||
table.layout td.content div.toggle.profile { padding-top:50px; height:130px; width:15px; top:20%; right:0; border-top-left-radius:10px; border-bottom-left-radius:10px; }
|
||||
table.layout td.content div.toggle.display { margin-top:-15px; height:15px; width:130px; left:40%; border-top-left-radius:10px; border-top-right-radius:10px; }
|
||||
table.layout td.content div.toggle.display>div { text-align:center; width:130px; rotate:-90deg; translate:5px -5px; }
|
||||
body.mobile table.layout div.toggle { font-size:48px; }
|
||||
body.mobile table.layout td.content div.toggle.project { width:30px; padding-top:35px; }
|
||||
body.mobile table.layout td.content div.toggle.profile { width:30px; padding-top:35px; }
|
||||
body.mobile table.layout td.content div.toggle.display { margin-top:-30px; height:30px; }
|
||||
body.mobile table.layout td.content div.toggle.display>div { translate:5px -15px; }
|
||||
|
||||
div.head { background-color:#404040; color:white; padding:5px; height:42px; clear:both; }
|
||||
div.head div.username { float:right; margin-right:10px; }
|
||||
div.head div.username div.name { padding:10px; float:left; }
|
||||
|
@ -99,13 +99,10 @@ Volcanos(chat.ONACTION, {_init: function(can, target) {
|
||||
"refer", "参考手册",
|
||||
),
|
||||
onmain: function(can) { can.onimport._share(can, can.misc.Search(can, web.SHARE)) },
|
||||
onlogin: function(can) {
|
||||
can.ondaemon._init(can)
|
||||
if (!can.Conf(chat.TOOL) && !can.user.mod.isCmd) { return }
|
||||
can.onengine.signal(can, chat.ONACTION_CMD)
|
||||
onlogin: function(can) { can.ondaemon._init(can); if (!can.Conf(chat.TOOL) && !can.user.mod.isCmd) { return }
|
||||
can.onengine.signal(can, chat.ONACTION_CMD), window.onresize = function(event) { can.onaction.onresize(can), can.page.styleWidth(can, can._output, can.page.width()) }
|
||||
can._names = location.pathname, can.Conf(chat.TOOL)? can.onappend.layout(can, can._output, "flow", can.core.List(can.Conf(chat.TOOL), function(item, index, list) {
|
||||
if (list.length == 1) { item.height = window.innerHeight-2*html.ACTION_HEIGHT }
|
||||
item.type = chat.PLUGIN, item.mode = chat.CMD, item.opts = can.misc.Search(can); return item
|
||||
if (list.length == 1) { item.height = window.innerHeight-2*html.ACTION_HEIGHT } item.type = chat.PLUGIN, item.mode = chat.CMD, item.opts = can.misc.Search(can); return item
|
||||
})).layout(window.innerWidth, window.innerHeight): can.runAction(can.request(), ctx.COMMAND, [], function(msg) { can.core.Next(msg.Table(), function(item, next) {
|
||||
can.onimport._cmd(can, item, next)
|
||||
}) })
|
||||
@ -140,13 +137,17 @@ Volcanos(chat.ONACTION, {_init: function(can, target) {
|
||||
can.onmotion.select(can, can._header_tabs, html.DIV_TABS, index), can.onmotion.select(can, can._action, html.DIV_TABS, index)
|
||||
can.onmotion.select(can, can._output, html.FIELDSET_PLUGIN, index)
|
||||
} },
|
||||
onresize: function(can, height, width) { can.onlayout._init(can), can.onaction.layout(can, can.Conf(html.LAYOUT)), window.setsize && window.setsize(can.page.width(), can.page.height()) },
|
||||
onsize: function(can, msg, height, width) { can.Conf({height: height-can.Conf(html.MARGIN_Y), width: width-can.Conf(html.MARGIN_X)}) },
|
||||
onresize: function(can, height, width) {
|
||||
can.onlayout._init(can), can.onaction.layout(can, can.Conf(html.LAYOUT)), window.setsize && window.setsize(can.page.width(), can.page.height())
|
||||
},
|
||||
onsize: function(can, msg, height, width) {
|
||||
can.Conf({height: height-can.Conf(html.MARGIN_Y), width: width-can.Conf(html.MARGIN_X)})
|
||||
},
|
||||
onprint: function(can, msg) { can.page.styleHeight(can, can._target, "") },
|
||||
|
||||
layout: function(can, button, silent) { button = button||ice.AUTO; can.page.ClassList.del(can, can._target, can.Conf(html.LAYOUT))
|
||||
if (button == ice.AUTO) { button = "" } else { can.page.ClassList.add(can, can._target, can.Conf(html.LAYOUT, button)) }
|
||||
can.user.isMobile || can.Mode() || (can.onmotion.toggle(can, can._root.River._target, true), can.onmotion.toggle(can, can._root.Footer._target, true))
|
||||
can.user.isMobile || can.Mode() || (can._root.River && can.onmotion.toggle(can, can._root.River._target, true), can.onmotion.toggle(can, can._root.Footer._target, true))
|
||||
can.user.isMobile && can.Mode() && can.page.style(can, can._target, html.WIDTH, "", html.HEIGHT, "")
|
||||
can.onlayout._init(can), can._header_tabs && can.onmotion.hidden(can, can._header_tabs), can.Conf(chat.LAYOUT, button)
|
||||
var cb = can.onlayout[button]; can.base.isFunc(cb) && cb(can, silent) || can.onlayout._plugin(can, button)
|
||||
|
@ -5,6 +5,8 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) {
|
||||
can.onimport._background(can, msg, target)
|
||||
can.onimport._search(can, msg, target)
|
||||
// can.onimport._menus(can, msg, target)
|
||||
var themeMedia = window.matchMedia("(prefers-color-scheme: dark)")
|
||||
can.__topic = themeMedia.matches? html.DARK: html.LIGHT, themeMedia.addListener(function(event) { can.__topic = event.matches? html.DARK: html.LIGHT })
|
||||
},
|
||||
_title: function(can, msg, target) { if (can.user.isMobile) { return }
|
||||
can.core.List(can.base.getValid(can.Conf(chat.TITLE)||msg.result, ["shylinux.com/x/contexts"]), function(item) {
|
||||
@ -114,7 +116,9 @@ Volcanos(chat.ONACTION, {
|
||||
logout: function(event, can) { can.user.logout(can) },
|
||||
})
|
||||
Volcanos(chat.ONEXPORT, {height: function(can) { return can._target.offsetHeight },
|
||||
topic: function(can) { return can._topic || can.misc.Search(can, chat.TOPIC) || (can.base.isNight()? "dark": "light") },
|
||||
topic: function(can) {
|
||||
return can._topic || can.misc.Search(can, chat.TOPIC) || can.__topic || (can.base.isNight()? "dark": "light")
|
||||
},
|
||||
background: function(can) { return can.user.info.background == "void"? "": can.user.info.background },
|
||||
avatar: function(can) { return can.user.info.avatar == "void"? "": can.user.info.avatar },
|
||||
})
|
||||
|
@ -1,10 +1,8 @@
|
||||
Volcanos(chat.ONACTION, {
|
||||
_init: function(can, meta, target) { meta.type == html.BUTTON && meta.action == ice.AUTO && can.sup._delay_init == undefined && target.click() },
|
||||
run: function(event, can) { can.run(event) },
|
||||
run: function(event, can) { can.run(event) }, refresh: function(event, can) { can.run(event) },
|
||||
list: function(event, can) { can.sup.isSimpleMode() || can.run(event) },
|
||||
back: function(event, can) { can.sup.onimport._back(can.sup) },
|
||||
refresh: function(event, can) { can.run(event) },
|
||||
|
||||
onclick: function(event, can) { can.Conf(mdb.TYPE) == html.BUTTON && can.run(event, [ctx.ACTION, can.Conf(mdb.NAME)].concat(can.sup.Input())) },
|
||||
onchange: function(event, can) { can.Conf(mdb.TYPE) == html.SELECT && can.run(event) },
|
||||
onkeydown: function(event, can) { can.onkeymap.input(event, can, event.target)
|
||||
@ -12,8 +10,8 @@ Volcanos(chat.ONACTION, {
|
||||
if (event.key == lang.ENTER) { return can.run(event), can.onmotion.focus(can, event.target), can.onkeymap.prevent(event) }
|
||||
if (!event.ctrlKey) { return }
|
||||
switch (event.key) {
|
||||
case "b": can.CloneInput(); break
|
||||
case "m": can.CloneField(); break
|
||||
case "b": can.CloneInput(); break
|
||||
default: can.onkeymap.selectOutput(event, can.sup); return
|
||||
} can.onkeymap.prevent(event)
|
||||
},
|
||||
|
@ -12,15 +12,20 @@ fieldset.inner>div.output div.content td.text span.constant { color:magenta; }
|
||||
fieldset.inner>div.output div.content td.text span.string { color:magenta; }
|
||||
fieldset.inner>div.output div.content td.text span.object { color:cyan; }
|
||||
fieldset.inner>div.output>div.project { width:230px; }
|
||||
fieldset.inner>div.output>div.project>div.zone>div.name { letter-spacing:10px; }
|
||||
fieldset.inner>div.output>div.project>div.zone>div.item { letter-spacing:10px; }
|
||||
fieldset.inner>div.output>div.project>div.zone div.action>div.item { padding-right:0; width:100%; }
|
||||
fieldset.inner>div.output>div.project>div.zone div.action>div.item>input { width:100%; }
|
||||
fieldset.inner>div.output>div.layout.flow>div.tabs { display:none; }
|
||||
fieldset.inner>div.output>div.layout.flow>div.path { display:none; }
|
||||
fieldset.inner.cmd>div.output>div.layout.flow>div.tabs { height:38px; display:block; overflow:auto; }
|
||||
fieldset.inner.cmd>div.output>div.layout.flow>div.tabs>div { padding:10px 20px; height:38px; float:left; }
|
||||
fieldset.inner.cmd>div.output>div.layout.flow>div.tabs>div { padding:10px; height:38px; float:left; }
|
||||
fieldset.inner.cmd>div.output>div.layout.flow>div.tabs>div>span { font-style:italic; }
|
||||
fieldset.inner.cmd>div.output>div.layout.flow>div.tabs div.avatar { padding:0; height:38px; float:right; }
|
||||
fieldset.inner.cmd>div.output>div.layout.flow>div.tabs div.project.icon { font-size:32px; line-height:32px; padding:0 5px; }
|
||||
fieldset.inner.cmd>div.output>div.layout.flow>div.tabs div.create.icon { font-size:26px; line-height:32px; padding:2px 10px; }
|
||||
fieldset.inner.cmd>div.output>div.layout.flow>div.tabs div.avatar>img { height:38px; }
|
||||
fieldset.inner.cmd>div.output>div.layout.flow>div.tabs div.time { float:right; }
|
||||
fieldset.inner.cmd>div.output>div.layout.flow>div.path { padding:5px; display:block; }
|
||||
fieldset.inner.cmd>div.output>div.layout.flow>div.path { font-style:italic; padding:5px; display:block; }
|
||||
fieldset.inner.cmd>div.output>div.layout.flow>div.path span.func { margin-left:20px; }
|
||||
|
||||
body.black fieldset.inner>div.output div.content td.text span.comment { background-color:blue; color:cyan; }
|
||||
@ -58,10 +63,10 @@ body.dark fieldset.inner>div.output div.content td.text span.object { color:gold
|
||||
body.mobile fieldset.inner>form.option input[name=file] { width:90px; }
|
||||
body.mobile fieldset.word fieldset.inner>form.option input[type=text] { display:none; }
|
||||
|
||||
div.action>div div.icon { margin-left:10px; margin-top:1px; float:right; visibility:hidden; }
|
||||
div.action>div:hover div.icon { visibility:visible; } div.action>div.select div.icon { visibility:visible; }
|
||||
div.tabs>div div.icon { margin-left:10px; margin-top:1px; float:right; visibility:hidden; }
|
||||
div.tabs>div:hover div.icon { visibility:visible; } div.tabs>div.select div.icon { visibility:visible; }
|
||||
// div.action>div div.icon { margin-left:10px; margin-top:1px; float:right; visibility:hidden; }
|
||||
// div.action>div:hover div.icon { visibility:visible; } div.action>div.select div.icon { visibility:visible; }
|
||||
// div.tabs>div div.icon { margin-left:10px; margin-top:1px; float:right; visibility:hidden; }
|
||||
// div.tabs>div:hover div.icon { visibility:visible; } div.tabs>div.select div.icon { visibility:visible; }
|
||||
div.carte.path.float { font-size:14px; border-radius:0; } div.carte.path.float div.item { padding:5px; }
|
||||
div.path span.item { padding:5px; cursor:pointer; }
|
||||
tr.line>td.line { text-align:right; padding:0 10px; position:sticky; left:0; }
|
||||
|
@ -42,7 +42,13 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl
|
||||
})
|
||||
},
|
||||
_tabs: function(can) { if (!can.isCmdMode()) { return can.ui.tabs = can._action }
|
||||
can.page.Append(can, can.ui.tabs, [{view: [[mdb.TIME, html.SELECT]], _init: function(target) {
|
||||
can.user.isMobile && can.page.Append(can, can.ui.tabs, [{view: [[html.ICON, html.PROJECT], html.DIV, "\u2261"], onclick: function() {
|
||||
can.onmotion.toggle(can, can.ui.project), can.onimport.layout(can)
|
||||
}}])
|
||||
can.page.Append(can, can.ui.tabs, [{view: [[html.ICON, mdb.CREATE], html.DIV, "+"], onclick: function() {
|
||||
can.user.carte(event, can, can.onaction, can.onaction.list)
|
||||
}}])
|
||||
can.page.Append(can, can.ui.tabs, [{view: [mdb.TIME], _init: function(target) {
|
||||
can.core.Timer({interval: 100}, function() { can.page.Modify(can, target, can.user.time(can, null, "%y-%m-%d %H:%M:%S %w")) })
|
||||
can.onappend.figure(can, {action: "date", _hold: true}, target, function(sub, value) {})
|
||||
}}])
|
||||
@ -67,6 +73,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl
|
||||
})
|
||||
},
|
||||
_tabFunc: function(can, target) {
|
||||
can.db.tabFunc = can.db.tabFunc||{}; var last = can.db.tabFunc[can.Option(nfs.PATH)+can.Option(nfs.FILE)]||{}; can.db.tabFunc[can.Option(nfs.PATH)+can.Option(nfs.FILE)] = last
|
||||
function indent(text) { var indent = 0; for (var i = 0; i < text.length; i++) { switch (text[i]) {
|
||||
case ice.TB: indent+=4; break
|
||||
case ice.SP: indent++; break
|
||||
@ -75,13 +82,10 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl
|
||||
var carte, list = [{input: ["filter", function(event) {
|
||||
can.onkeymap.selectItems(event, can, carte._target)
|
||||
}], _init: function(target) { can.onmotion.delay(can, function() { target.focus() }) }}]
|
||||
|
||||
can.core.Item(last, function(key) { list.push(key) }), list.push("")
|
||||
var package = "", block = "", current = "", percent = ""
|
||||
can.page.Select(can, can.ui.content, "tr.line>td.text", function(item, index) {
|
||||
var text = item.innerText, _indent = indent(text)
|
||||
function push(item) { list.push(item)
|
||||
if (index < can.Option(nfs.LINE)) { current = list[list.length-1], percent = " = "+parseInt((index+1)*100/(can.max||1))+"%" }
|
||||
}
|
||||
can.page.Select(can, can.ui.content, "tr.line>td.text", function(item, index) { var text = item.innerText, _indent = indent(text)
|
||||
function push(item) { list.push(item); if (index < can.Option(nfs.LINE)) { current = list[list.length-1], percent = " = "+parseInt((index+1)*100/(can.max||1))+"%" } }
|
||||
if (can.parse == nfs.JS) {
|
||||
if (_indent == 0 && can.base.beginWith(text, "Volcanos")) {
|
||||
var ls = can.core.Split(text, "\t ({:}),"); block = can.base.trimPrefix(ls[1], "chat.").toLowerCase()
|
||||
@ -111,6 +115,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl
|
||||
}
|
||||
}); (can.parse == nfs.JS || can.parse == nfs.GO) && can.page.Append(can, target, [{view: [[html.ITEM, "func"], html.SPAN, (current||"function")+" / "+can.max+percent], onclick: function(event) {
|
||||
carte = can.user.carte(event, can, {_style: nfs.PATH}, list, function(ev, button) {
|
||||
last[button] = true
|
||||
can.onimport.tabview(can, can.Option(nfs.PATH), can.Option(nfs.FILE), can.core.Split(button, ice.DF)[1]), can.onmotion.clearFloat(can)
|
||||
})
|
||||
}}])
|
||||
@ -145,7 +150,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl
|
||||
var ls = can.file.split(ice.PS); if (ls.length > 4) { ls = [ls.slice(0, 2).join(ice.PS)+"/.../"+ls.slice(-2).join(ice.PS)] }
|
||||
can.Status(kit.Dict("文件", ls.join(ice.PS), "类型", can.parse)), can.onimport.layout(can)
|
||||
if (!skip) {
|
||||
can.onaction.selectLine(can, can.Option(nfs.LINE)), can.onaction.scrollIntoView(can)
|
||||
can.onaction.selectLine(can, can.Option(nfs.LINE), true)
|
||||
}
|
||||
can.base.isFunc(cb) && cb(), cb = null
|
||||
})
|
||||
@ -157,7 +162,10 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl
|
||||
msg._content != can.ui._content && can.page.Remove(can, msg._content), msg._profile != can.ui._profile && can.page.Remove(can, msg._profile)
|
||||
delete(can.ui._content._cache[key]), delete(can.ui._profile._cache[key]), delete(can.ui.display._cache[key])
|
||||
delete(can._cache_data[key]), delete(can.db.tabview[key])
|
||||
}, can.ui.tabs)
|
||||
}, can.ui.tabs).ondblclick = function(event) {
|
||||
can.onaction.clear(event, can)
|
||||
|
||||
}
|
||||
}
|
||||
if (can.db.tabview[key]) { return !can._msg._tab && !can.isSimpleMode()? load(can.db.tabview[key]): show() }
|
||||
isCommand()||isDream()? load(can.request({}, {index: file, line: line})): can.run({}, [path, file], load, true)
|
||||
@ -347,7 +355,7 @@ Volcanos(chat.ONACTION, {
|
||||
}}
|
||||
]}]); return ui.tr
|
||||
},
|
||||
selectLine: function(can, line) { if (!line) { return can.onexport.line(can, can.page.SelectOne(can, can.ui._content, "tr.select")) }
|
||||
selectLine: function(can, line, scroll) { if (!line) { return can.onexport.line(can, can.page.SelectOne(can, can.ui._content, "tr.select")) }
|
||||
can.page.Select(can, can.ui._content, "tr.line>td.line", function(td, index) { var tr = td.parentNode, n = parseInt(td.innerText)
|
||||
if (!can.page.ClassList.set(can, tr, html.SELECT, tr == line || n == line)) { return }
|
||||
line = tr, can.Status("行号", can.onexport.position(can, can.Option(nfs.LINE, n)))
|
||||
@ -360,7 +368,7 @@ Volcanos(chat.ONACTION, {
|
||||
}, prev: function() { return line.previousSibling }, next: function() { return line.nextSibling },
|
||||
line: line, text: function(text) { return text != undefined && can.onaction.modifyLine(can, line, text), item.innerText },
|
||||
}, can.onimport.history(can, {path: can.Option(nfs.PATH), file: can.Option(nfs.FILE), line: can.Option(nfs.LINE)})
|
||||
can.onexport.hash(can), can.onaction.scrollIntoView(can, 3), can.onengine.signal(can, "tabview.line.select")
|
||||
can.onexport.hash(can), scroll && can.onaction.scrollIntoView(can), can.onengine.signal(can, "tabview.line.select")
|
||||
})
|
||||
can.misc.localStorage(can, "web.code.inner:currentFile", can.Option(nfs.PATH)+ice.DF+can.Option(nfs.FILE)+ice.DF+can.onaction._getLineno(can, can.current.line))
|
||||
can.misc.localStorage(can, "web.code.inner:selectLine:"+can.Option(nfs.PATH)+can.Option(nfs.FILE), can.onaction._getLineno(can, can.current.line))
|
||||
@ -389,8 +397,11 @@ Volcanos(chat.ONACTION, {
|
||||
})
|
||||
}), can.runAction(can.request(event, {text: can.base.Format(list)}), button)
|
||||
},
|
||||
scrollIntoView: function(can, offset) { var scroll = can.current.scroll(), window = can.current.window(); offset = offset||window/2
|
||||
if (scroll < 3) { can.current.scroll(scroll-3) } else if (scroll > window-offset) { can.current.scroll(scroll-window+offset) }
|
||||
scrollIntoView: function(can, offset) { var window = can.current.window(); offset = offset||parseInt(window/4)+2
|
||||
var current = can.onaction._getLineno(can, can.current.line)
|
||||
// var to = current/window*can.ui.content.offsetHeight+(offset-current%window)*can.current.line.offsetHeight
|
||||
var to = parseInt(current/window)*can.ui.content.offsetHeight+(parseInt(current%window)-offset-1)*can.current.line.offsetHeight
|
||||
can.ui.content.scrollTo(0, to)
|
||||
},
|
||||
back: function(can) { can.db.history.pop(); var last = can.db.history.pop(); last && can.onimport.tabview(can, last.path, last.file, last.line) },
|
||||
clear: function(event, can) {
|
||||
@ -415,7 +426,7 @@ Volcanos(chat.ONACTION, {
|
||||
case "_open": return can.runAction(event, ls[0], ls[1])
|
||||
case ctx.INDEX:
|
||||
case web.DREAM: return can.onimport.tabview(can, can.Option(nfs.PATH), ls[1], ls[0])
|
||||
case nfs.LINE: return can.onaction.selectLine(can, parseInt(ls[1])), can.onaction.scrollIntoView(can)
|
||||
case nfs.LINE: return can.onaction.selectLine(can, parseInt(ls[1]), true)
|
||||
default: can.core.List(can.db.paths, function(path) { if (list[0].indexOf(path) == 0) { can.onimport.tabview(can, path, list[0].slice(path.length)) } })
|
||||
}
|
||||
})._target, html.LEFT, can.ui.project.offsetWidth+can.ui.content.offsetWidth/4-34, html.TOP, can.ui.content.offsetHeight/4, html.RIGHT, "")
|
||||
@ -428,7 +439,7 @@ Volcanos(chat.ONACTION, {
|
||||
var last = can.onaction._getLineno(can, can.current.line)
|
||||
function find(begin, text) { if (parseInt(text) > 0) { return can.onaction.selectLine(can, parseInt(text)) && meta.close() }
|
||||
for (begin; begin <= can.max; begin++) { if (can.onexport.text(can, can.onaction._getLine(can, begin)).indexOf(text) > -1) {
|
||||
return last = begin, can.onaction.selectLine(can, begin), can.onaction.scrollIntoView(can)
|
||||
return last = begin, can.onaction.selectLine(can, begin, true)
|
||||
} } last = 0, can.user.toast(can, "已经到最后一行")
|
||||
}
|
||||
function complete(target, button) {
|
||||
@ -436,8 +447,10 @@ Volcanos(chat.ONACTION, {
|
||||
if (event.ctrlKey) { meta.grep() } else { meta[button](), can.onmotion.delay(can, function() { target.focus() }) } return true
|
||||
}, run: function(event, cmds, cb) { var msg = can.request(event); can.core.List(can.core.Split(can.current.text(), "\t {([,:;=<>])}", {detail: true}), function(value) {
|
||||
if (can.base.isObject(value)) {
|
||||
if (value.type == lang.SPACE) { return }
|
||||
value.type == lang.STRING && msg.Push(mdb.VALUE, value.left+value.text+value.right), msg.Push(mdb.VALUE, value.text)
|
||||
} else {
|
||||
if (value.indexOf(ice.PT) > -1) { msg.Push(mdb.VALUE, value.split(ice.PT).pop()) }
|
||||
msg.Push(mdb.VALUE, value)
|
||||
}
|
||||
}), cb(msg) }}, target)
|
||||
|
@ -1,7 +1,4 @@
|
||||
fieldset.vimer>div.output div.project div.zone.create>div.action { display:none; }
|
||||
fieldset.vimer>div.output div.project div.zone.create>div.list div.item { padding:2px; float:left; clear:none; }
|
||||
fieldset.vimer>div.output div.project div.zone.create>div.list div.item input { letter-spacing:2px; }
|
||||
fieldset.vimer>div.output div.project div.zone.recent>div.list { min-width:200px; max-height:120px; }
|
||||
fieldset.vimer>div.output div.project div.zone.recent>div.list { max-height:200px; }
|
||||
fieldset.vimer>div.output div.project div.zone.repos>div.list { max-height:120px; }
|
||||
fieldset.vimer>div.output div.project div.zone.dream>div.list { max-height:120px; }
|
||||
fieldset.vimer>div.output div.project div.zone.dream div.item.stop { color:gray; }
|
||||
|
@ -22,15 +22,6 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) {
|
||||
]); can.ui.current = ui.current, can.ui.complete = ui.complete },
|
||||
}, [""])
|
||||
Volcanos(chat.ONFIGURE, {
|
||||
create: function(can, target, zone, path) {
|
||||
can.isCmdMode()? can.onappend._action(can, can.base.Obj(can._msg.Option(ice.MSG_ACTION)).concat(
|
||||
["首页", "官网" , "文档" , "git"], window.webview? ["浏览器", "录屏", "日志", "编辑器"]: []
|
||||
), target): can.onmotion.hidden(can, target.parentNode), can.onmotion.hidden(can, target)
|
||||
can.sup.onexport.link = function(can) { var args = can.Option()
|
||||
var meta = can.Conf(); args.cmd = meta.index||can.core.Keys(meta.ctx, meta.cmd)
|
||||
return can.misc.MergePodCmd(can, args, true)
|
||||
}
|
||||
},
|
||||
recent: function(can, target, zone, path) { var total = 0
|
||||
function show(msg, cb) { var list = {}; msg.Table(function(item) { var path = item.path+item.file
|
||||
if (!list[path]) { can.page.Append(can, target, cb(item, path)), zone._total(++total) } list[path] = item
|
||||
@ -90,6 +81,7 @@ Volcanos(chat.ONFIGURE, {
|
||||
}, function() {}, target) }), zone._total(msg.Length())
|
||||
}) } },
|
||||
dream: function(can, target, zone) { var call = arguments.callee
|
||||
zone._delay_show = function() {
|
||||
can.runAction({}, ice.RUN, [web.DREAM], function(msg) { can.onmotion.clear(can, target), msg.Table(function(item) {
|
||||
can.page.ClassList.add(can, can.onimport.item(can, item, function(event) { can.onimport.tabview(can, can.Option(nfs.PATH), item.name, web.DREAM) }, function(event) {
|
||||
return shy(kit.Dict(cli.START, [cli.OPEN, cli.STOP], cli.STOP, [cli.START, nfs.TRASH])[item.status], function(event, button) {
|
||||
@ -99,6 +91,7 @@ Volcanos(chat.ONFIGURE, {
|
||||
})
|
||||
}, target), item.status)
|
||||
}), zone._total(msg.Length()), can.user.toastSuccess(can) })
|
||||
}
|
||||
return shy(kit.Dict(
|
||||
web.REFRESH, function(event, can, button) { call(can, target, zone) },
|
||||
mdb.CREATE, function(event, can, button) { can.onaction.dream(event, can, web.DREAM) },
|
||||
@ -119,6 +112,7 @@ Volcanos(chat.ONFIGURE, {
|
||||
} },
|
||||
})
|
||||
Volcanos(chat.ONACTION, {
|
||||
list: ["autogen", "script", "save", "compile", "dream", "首页", "官网", "文档", "git"],
|
||||
_daemon: function(event, can, arg) { switch (arg[0]) {
|
||||
case web.DREAM: can.runAction({}, arg[0], arg.slice(1), function(msg) { can.onimport.tabview(can, can.Option(nfs.PATH), can.core.Keys(can.misc.Search(can, ice.POD), msg.Option(mdb.NAME)), web.DREAM) }); break
|
||||
case code.XTERM: can.runAction({}, arg[0], arg.slice(1), function(msg) { can.onimport.tabview(can, ctx.COMMAND, code.XTERM, msg.Result()) }); break
|
||||
@ -202,7 +196,7 @@ Volcanos(chat.ONACTION, {
|
||||
can.current.line.appendChild(target), can.page.style(can, target, html.LEFT, can.ui.current.offsetLeft, html.MARGIN_TOP, can.current.line.offsetHeight)
|
||||
can.runAction(can.request(event, {text: pre}, can.Option()), code.COMPLETE, [], function(msg) { can.page.Appends(can, target, [{view: ["prefix", html.DIV, pre]}])
|
||||
if (can.parse == nfs.JS) { var msg = can.request()
|
||||
var ls = can.core.Split(can.core.Split(pre, "\t (", " ").pop(), ice.PT)
|
||||
var ls = can.core.Split(can.core.Split(pre, "\t {(,:)}").pop(), ice.PT)
|
||||
var list = {can: can, msg: msg, target: target, window: window}
|
||||
can.core.ItemKeys(key == ""? list: can.core.Value(list, ls)||can.core.Value(window, ls)||window, function(k, v) {
|
||||
v && msg.Push(mdb.NAME, k).Push(mdb.TEXT, v.toString().split(ice.NL)[0])
|
||||
|
@ -74,14 +74,14 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl
|
||||
itemlist: function(can, list, cb, cbs, target) {
|
||||
return target._list = can.page.insertBefore(can, [{view: html.LIST, list: can.core.List(list, function(item) {
|
||||
return {view: [html.ITEM, html.DIV, item.name], onclick: function(event) {
|
||||
cb(event, item, event.target._list && can.onmotion.toggle(can, event.target._list))
|
||||
cb(event, item, event.target._list && can.page.ClassList.neg(can, event.target._list, "hide"))
|
||||
}, onmouseenter: function(event) { cbs(event, item) }}
|
||||
}) }], target.nextSibling, target.parentNode)
|
||||
},
|
||||
list: function(can, root, cb, target) { target = target||can._output
|
||||
can.core.List(root.list, function(item) {
|
||||
var ui = can.page.Append(can, target, [{view: [html.ITEM, html.DIV, item.meta.name], onclick: function(event) {
|
||||
can.base.isFunc(cb) && cb(event, item) || can.onmotion.toggle(can, ui.list)
|
||||
can.base.isFunc(cb) && cb(event, item) || can.page.ClassList.neg(can, ui.list, "hide")
|
||||
can.onmotion.select(can, target, html.DIV_ITEM, event.target)
|
||||
}}, {view: html.LIST}]); can.onimport.list(can, item, cb, ui.list)
|
||||
})
|
||||
@ -95,14 +95,14 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl
|
||||
(item._menu.meta[button]||item._menu)(event, can, button)
|
||||
})
|
||||
}}], onclick: function(event) { if (node[name].childElementCount == 2) { node[name].firstChild.click() }
|
||||
index < array.length - 1? can.page.ClassList.set(can, ui["switch"], "open", can.onmotion.toggle(can, node[name])): can.base.isFunc(cb) && cb(event, item)
|
||||
}}, {view: html.LIST, style: {display: html.NONE}, _init: function(list) { item.expand && can.page.style(can, list, html.DISPLAY, html.BLOCK) }}]); node[name] = ui.list
|
||||
index < array.length - 1? can.page.ClassList.set(can, ui["switch"], "open", can.page.ClassList.neg(can, node[name], "hide")): can.base.isFunc(cb) && cb(event, item)
|
||||
}}, {view: [[html.LIST, item.expand? "": html.HIDE]]}]); node[name] = ui.list
|
||||
})
|
||||
}); return node
|
||||
},
|
||||
zone: function(can, list, target) {
|
||||
return can.page.Append(can, target, can.core.List(list, function(zone) { can.base.isString(zone) && (zone = {name: zone}); return zone && {view: [[html.ZONE, zone.name]], list: [
|
||||
{view: html.NAME, inner: can.user.trans(can, zone.name), _init: function(target) {
|
||||
{view: html.ITEM, inner: can.user.trans(can, zone.name), _init: function(target) {
|
||||
zone._legend = target
|
||||
}, onclick: function() {
|
||||
if (zone._delay_show) { zone._delay_show(zone._target, zone), delete(zone._delay_show) }
|
||||
@ -114,12 +114,12 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl
|
||||
}},
|
||||
{view: html.ACTION, _init: function(target) { zone._action = target
|
||||
can.onappend._action(can, [{input: html.TEXT, placeholder: mdb.SEARCH, onkeyup: function(event) {
|
||||
can.page.Select(can, zone._target, html.DIV_LIST, function(item) { can.onmotion.toggle(can, item, true) })
|
||||
can.onkeymap.selectItems(event, can, zone._target)
|
||||
can.page.Select(can, zone._target, html.DIV_LIST, function(item) { can.onmotion.toggle(can, item, true) })
|
||||
event.target.value == "" && can.page.Select(can, zone._target, html.DIV_LIST, function(target) { can.page.ClassList.add(can, target, html.HIDE) })
|
||||
}, onfocus: function(event) { var target = event.target
|
||||
target.setSelectionRange && target.setSelectionRange(0, target.value.length)
|
||||
}, _init: function(target) { zone._search = target
|
||||
can.onmotion.delay(can, function() { can.page.styleWidth(can, target, can.core.Value(target.parentNode.parentNode, "parentNode.offsetWidth")-10) })
|
||||
}}], target, {})
|
||||
}},
|
||||
{view: html.LIST, _init: function(target) { can.ui[zone.name] = zone
|
||||
@ -133,7 +133,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl
|
||||
|
||||
tabs: function(can, list, cb, cbs, action, each) { action = action||can._action
|
||||
return can.page.Append(can, action, can.core.List(list, function(tabs) {
|
||||
return {view: html.TABS, list: [{text: [tabs.name, html.SPAN]}, {view: "close icon s16", onclick: function(event) {
|
||||
return {view: html.TABS, list: [{text: [tabs.name, html.SPAN]}, {text: ["\u2715", html.SPAN, html.ICON], onclick: function(event) {
|
||||
var item = event.target.parentNode, next = item.nextSibling||item.previousSibling; if (!next) { return }
|
||||
next.click(), can.onmotion.delay(can, function() { can.base.isFunc(cbs) && cbs(item._meta), can.page.Remove(can, item) }), can.onkeymap.prevent(event)
|
||||
}}], title: tabs.text, onclick: function(event) {
|
||||
|
3
proto.js
3
proto.js
@ -215,6 +215,7 @@ var html = {PLUGIN_MARGIN: 10, ACTION_HEIGHT: 31, ACTION_MARGIN: 200,
|
||||
HEIGHT: "height", WIDTH: "width", MIN_HEIGHT: "min-height", MAX_HEIGHT: "max-height", MIN_WIDTH: "min-width", MAX_WIDTH: "max-width", LEFT: "left", TOP: "top", RIGHT: "right", BOTTOM: "bottom",
|
||||
BACKGROUND_COLOR: "background-color", COLOR: "color", OPACITY: "opacity", TOGGLE: "toggle", SPEED: "speed", SIZE: "size",
|
||||
HOVER: "hover", HOVER_SELECT: "hover,select",
|
||||
LIGHT: "light", DARK: "dark",
|
||||
|
||||
PAGE: "page", TABS: "tabs", MENU: "menu", NODE: "node",
|
||||
ZONE: "zone", LIST: "list", ITEM: "item", NAME: "name", ICON: "icon",
|
||||
@ -241,7 +242,7 @@ function shy(help, meta, list, cb) { var arg = arguments, i = 0; function next(t
|
||||
}; var _can_name = "", _can_path = ""
|
||||
var Volcanos = shy({version: window._version||"", iceberg: "/chat/", volcano: "/frame.js", cache: {}, pack: {}, args: {}}, function(name, can, libs, cb) {
|
||||
var meta = arguments.callee.meta, list = arguments.callee.list; if (typeof name == lang.OBJECT) {
|
||||
if (name.length > 0) { return Volcanos({panels: [{name: chat.HEADER, pos: html.HIDE, state: [aaa.USERNICK]}, {name: chat.ACTION, pos: html.MAIN, tool: name}, {name: chat.FOOTER, pos: html.HIDE}]}) }
|
||||
if (name.length > 0) { return Volcanos({panels: [{name: chat.HEADER, pos: html.HIDE, state: [mdb.TIME, aaa.USERNICK]}, {name: chat.ACTION, pos: html.MAIN, tool: name}, {name: chat.FOOTER, pos: html.HIDE}]}) }
|
||||
var Config = name; name = Config.name||ice.CAN, _can_name = "", _can_path = ""
|
||||
meta.iceberg = Config.iceberg||meta.iceberg, meta.libs = Config.libs||chat.libs, panels = Config.panels||chat.panel_list
|
||||
libs = [], panels.forEach(function(p) { p && (libs = libs.concat(p.list = p.list||["/panel/"+p.name+nfs._JS, "/panel/"+p.name+nfs._CSS])) }), libs = libs.concat(Config.plugin||chat.plugin_list)
|
||||
|
Loading…
x
Reference in New Issue
Block a user