mirror of
https://shylinux.com/x/volcanos
synced 2025-04-25 16:58:06 +08:00
add ctx.CmdAction
This commit is contained in:
parent
9706ddbc29
commit
c81f803764
2
const.js
2
const.js
@ -60,7 +60,7 @@ var ctx = {
|
||||
var mdb = {
|
||||
DICT: "dict", META: "meta", HASH: "hash", LIST: "list",
|
||||
ID: "id", KEY: "key", TIME: "time", ZONE: "zone", TYPE: "type", NAME: "name", TEXT: "text",
|
||||
DATA: "data", VIEW: "view", ICON: "icon", LINK: "link", SCAN: "scan", HELP: "help",
|
||||
DATA: "data", VIEW: "view", ICON: "icon", ICONS: "icons", LINK: "link", SCAN: "scan", HELP: "help",
|
||||
SHORT: "short", FIELD: "field", TOTAL: "total", COUNT: "count", LIMIT: "limit",
|
||||
INDEX: "index", VALUE: "value", EXTRA: "extra", ALIAS: "alias", EXPIRE: "expire",
|
||||
|
||||
|
37
frame.js
37
frame.js
@ -164,9 +164,9 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
CloneField: can.Clone, CloneInput: function() { can.onmotion.focus(can, add(item)._target) }, Input: can.Input, Option: can.Option, Action: can.Action, Status: can.Status,
|
||||
}, [item.display, chat.PLUGIN_INPUT_JS], function(sub) { sub.Conf(item)
|
||||
if (item.type == html.TEXT) { can.page.Append(can, sub._target.parentNode, [{text: [sub._target.value, html.SPAN, mdb.VALUE]}]) }
|
||||
if (item.type == html.BUTTON && can.base.isIn(item.name, mdb.CREATE, mdb.INSERT, mdb.PRUNES, mdb.PRUNE)) { can.onappend.style(can, "icons", sub._target.parentNode)
|
||||
can.page.Append(can, sub._target.parentNode, [{icon: item.name, onclick: function(event) { can.Update(event, [ctx.ACTION, item.name]) }}])
|
||||
}
|
||||
if (item.type == html.BUTTON && can.base.isIn(item.name, mdb.CREATE, mdb.INSERT, mdb.PRUNES, mdb.PRUNE)) {
|
||||
can.onappend.icons(can, sub._target, item.name)
|
||||
} item.type == html.BUTTON && can.onappend.icons(can, sub._target, can.Conf(["_icons", item.name]), item.name)
|
||||
sub.run = function(event, cmds, cb, silent) { var msg = can.requestAction(event, item.name)._caller()
|
||||
msg.RunAction(event, sub, cmds) || msg.RunAction(event, can.sub, cmds) || can.Update(event, can.Input(cmds, !silent), cb, silent)
|
||||
}, can._inputs = can._inputs||{}, can._inputs[item.name] = sub, sub.sup = can
|
||||
@ -192,9 +192,9 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
}) }}: /* 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.value)
|
||||
}, item._init = item._init||function(target) { item.action && can.onappend.figure(sub, item, target, function(_sub, value) { can.Update() })
|
||||
if (can.base.isIn(item.name, mdb.CREATE, mdb.INSERT)) { can.onappend.style(can, "icons", target.parentNode)
|
||||
can.page.Append(can, target.parentNode, [{icon: item.name, onclick: function(event) { can.Update(event, [ctx.ACTION, item.name]) }}])
|
||||
}
|
||||
if (item.type == html.BUTTON && can.base.isIn(item.name, mdb.CREATE, mdb.INSERT)) {
|
||||
can.onappend.icons(can, target, item.name)
|
||||
} item.type == html.BUTTON && can.onappend.icons(can, target, can.Conf(["_icons", item.name]), item.name)
|
||||
}), item), "", action)
|
||||
}), meta
|
||||
},
|
||||
@ -278,6 +278,9 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
item.style && can.onappend.style(can, item.style, target)
|
||||
}}])[item.name]; return _input
|
||||
},
|
||||
icons: function(can, target, icon, cb) { if (!icon) { return } can.onappend.style(can, "icons", target.parentNode)
|
||||
can.page.Append(can, target.parentNode, [{icon: icon, onclick: can.base.isFunc(cb)? cb: function(event) { can.Update(event, [ctx.ACTION, cb||icon]) }}])
|
||||
},
|
||||
mores: function(can, target, value, limit) {
|
||||
var list = can.page.Select(can, target, html.INPUT_BUTTON, function(target) {
|
||||
target.name == target.value && (target.value = can.user.trans(can, target.value))
|
||||
@ -285,19 +288,15 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
can.user.trans(can, kit.Dict(target.name, target.value))
|
||||
return {type: html.BUTTON, name: target.name, value: target.value, style: _style}
|
||||
})
|
||||
function run(event, button) { can.run(can.request(event, value, can.Option()), [ctx.ACTION, button]), can.onkeymap.prevent(event) }
|
||||
if (list.length <= limit) {
|
||||
target.onclick = function(event) { can.run(can.request(event, value), [ctx.ACTION, event.target.name]) }
|
||||
target.onclick = function(event) { run(event, event.target.name) }
|
||||
} else {
|
||||
can.page.Appends(can, target, can.core.List(list.slice(0, limit-1), function(item) {
|
||||
return {type: html.INPUT, data: {type: html.BUTTON}, name: item.name, value: item.value, className: item.style, onclick: function(event) {
|
||||
can.run(can.request(event, value), [ctx.ACTION, item.name])
|
||||
can.onkeymap.prevent(event)
|
||||
}}
|
||||
return {type: html.INPUT, data: {type: html.BUTTON}, name: item.name, value: item.value, className: item.style, onclick: function(event) { run(event, item.name) }}
|
||||
}))
|
||||
can.page.Append(can, target, [{type: html.INPUT, data: {type: html.BUTTON}, name: "more", value: can.user.trans(can, "more"), className: can.page.buttonStyle(can, "more"), onclick: function(event) {
|
||||
can.user.carte(event, can, {}, can.core.List(list.slice(limit-1), function(item) { return item.name }), function(event, button) {
|
||||
can.run(can.request(event, value), [ctx.ACTION, button])
|
||||
})
|
||||
can.user.carte(event, can, {}, can.core.List(list.slice(limit-1), function(item) { return item.name }), function(event, button) { run(event, button) })
|
||||
}}])
|
||||
}
|
||||
},
|
||||
@ -464,7 +463,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
sub.onmotion.float(sub), sub.onaction.close = function() { can.page.Remove(can, sub._target) }, cb && cb(sub)
|
||||
}, can._root._target) },
|
||||
figure: function(can, meta, target, cb) { if (meta.type == html.SELECT || meta.type == html.BUTTON) { return }
|
||||
var input = meta.action||(meta.name == mdb.ICON? mdb.ICON: mdb.KEY), path = chat.PLUGIN_INPUT+input+nfs._JS; can.require([path], function(can) {
|
||||
var input = meta.action||(meta.name == mdb.ICON? mdb.ICONS: mdb.KEY), path = chat.PLUGIN_INPUT+input+nfs._JS; can.require([path], function(can) {
|
||||
function _cb(sub, value, old) { if (value == old) { return } target.value = value, can.base.isFunc(cb) && cb(sub, value, old) }
|
||||
target.onkeydown = function() { if (event.key == code.ESCAPE && target._can) { return target._can.close(), target.blur() } else if (event.key == code.ENTER) { can.base.isFunc(cb) && cb(event, target.value) } }
|
||||
can.core.ItemCB(can.onfigure[input], function(key, on) { var last = target[key]||function() { }; target[key] = function(event) { can.misc.Event(event, can, function(msg) {
|
||||
@ -553,6 +552,14 @@ Volcanos(chat.ONMOTION, {_init: function(can, target) {
|
||||
},
|
||||
},
|
||||
scrollHold: function(can, cb, target) { target = target || can._output; var left = target.scrollLeft; cb(), target.scrollLeft = left },
|
||||
scrollIntoView: function(can, target) {
|
||||
var offset = target.offsetTop - target.parentNode.scrollTop
|
||||
can.core.Timer({interval: 10, length: offset/10}, function() {
|
||||
target.parentNode.scrollTop += 10
|
||||
}, function() {
|
||||
target.parentNode.scrollTop = target.offsetTop
|
||||
})
|
||||
},
|
||||
clearFloat: function(can) {
|
||||
var list = ["fieldset.input.float", "div.input.float", "div.carte.float"]; for (var i = 0; i < list.length; i++) {
|
||||
if (can.page.Select(can, document.body, list[i], function(target) { return target._close? target._close(): can.page.Remove(can, target) }).length > 0) { return true }
|
||||
|
@ -106,6 +106,7 @@ fieldset.input.date>div.output td span.lunar { font-size:8px; display:block; cle
|
||||
fieldset.input.date>div.output td span.lunar.term { color:green; }
|
||||
fieldset.input.date>div.output td span.lunar.fest { color:red; }
|
||||
fieldset.input.date>div.status { text-align:center; }
|
||||
fieldset.input.icon img { height:80px; width:80px; }
|
||||
/* float */
|
||||
body div.float { padding:5px; box-shadow:var(--box-shadow); }
|
||||
body>div.toast div.title { color:var(--notice-bg-color); float:left; }
|
||||
@ -127,7 +128,8 @@ body>div.input td { padding:10px; }
|
||||
body>div.input td:nth-child(2) { padding:10px 0;}
|
||||
body>div.input tr.icon td:last-child { position:relative; }
|
||||
body>div.input tr.icon td:last-child i:first-child { font-size:22px; position:absolute; left:15px; top:14px; }
|
||||
body>div.input tr.icon td:last-child input { padding-left:30px; }
|
||||
body>div.input tr.icon td:last-child img:first-child { height:28px; width:28px; left:12px; top:12px; position:absolute; }
|
||||
body>div.input tr.icon td:last-child input { padding-left:32px; }
|
||||
body>div.input td span.icon { margin-left:-20px; visibility:hidden; }
|
||||
body>div.input td:hover span.icon { visibility:visible; }
|
||||
body>div.input select { width:230px; }
|
||||
@ -181,6 +183,8 @@ div.project div.item>i:first-child { color:var(--panel-output-fg-color); }
|
||||
div.project div.item.text:hover>i:first-child { color:var(--plugin-fg-color); }
|
||||
div.action div.icon, div.action>div.item:not(.tabs)>span.icon { font-size:20px; line-height:32px; padding:0 5px; margin:0; height:32px; }
|
||||
div.action>div.item.icons>span.icon { font-size:30px; line-height:28px; }
|
||||
div.action>div.item.icons>i { font-size:21px; line-height:32px; padding:6px; }
|
||||
form.option>div.item.icons>i { font-size:21px; line-height:32px; padding:6px; }
|
||||
form.option div.icon, form.option span.icon { font-size:20px; line-height:32px; padding:0 5px; margin:0; height:32px; }
|
||||
form.option div.icon.refresh { font-size:28px; line-height:28px; }
|
||||
form.option div.icon.goback { font-size:28px; line-height:28px; }
|
||||
@ -447,6 +451,8 @@ fieldset.plug.dream.zone>div.output>div.item>span { line-height:32px; }
|
||||
fieldset.dream>div.output.card>div.item>div.title>img { height:48px; width:48px; float:left; }
|
||||
fieldset.dream>div.output.card>div.item>div.title>span { line-height:48px; margin-left:10px; }
|
||||
fieldset.inner.float>div.status { display:none; }
|
||||
fieldset.trans>div.output>fieldset{ margin:10px; }
|
||||
fieldset.trans>form.option>div.item>input { width:240px; }
|
||||
fieldset.inner>form.option input[name=path] { width:80px !important; }
|
||||
fieldset.inner>form.option input[name=file] { width:160px !important; }
|
||||
fieldset.inner>div.output>div.project div.item.modify { background-color:#00800036; }
|
||||
|
@ -66,7 +66,7 @@ Volcanos("user", {
|
||||
if (can.base.isFunc(text)) { text = text.name||"" } if (can.base.isString(list)) { return list }
|
||||
return list&&list[text] || can.user._trans[text] || can._trans&&can._trans[text] || can.Conf("trans."+text) || can.Conf("feature._trans."+text) || text
|
||||
}, _trans: {"_week_header": ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]},
|
||||
time: function(can, time, fmt) { var now = can.base.Date(time), list = can.user._trans["_week_header"]
|
||||
time: function(can, time, fmt) { var now = can.base.Date(time), list = can.user._trans["_week_header"]
|
||||
return fmt == "%W"? list: can.base.Time(time, (fmt||"%y-%m-%d %H:%M:%S").replace("%w", list[now.getDay()]))
|
||||
},
|
||||
toastConfirm: function(can, content, title, action) {
|
||||
@ -78,6 +78,7 @@ Volcanos("user", {
|
||||
toastSuccess: function(can, content, title) { return can.user.toast(can, {content: "✅ "+(content||ice.SUCCESS), title: title, caller: 2}) },
|
||||
toastFailure: function(can, content, title) { return can.user.toast(can, {content: "❌ "+(content||ice.FAILURE), title: title, duration: 10000, caller: 2}) },
|
||||
toast: function(can, content, title, duration, progress, caller) {
|
||||
content = {"success": "✅ success", "failure": "❌ failure", "process": "🕑 process"}[content]||content
|
||||
var meta = can.base.isObject(content)? content: {content: content, duration: duration, progress: progress, caller: caller}
|
||||
meta.title = meta.title||can.core.Keys(can.Conf(web.SPACE), can.Conf(ctx.INDEX))||can._name.split(nfs.PS).slice(-2).join(nfs.PS)
|
||||
var width = meta.width||400; if (width < 0) { width = window.innerWidth + width } meta.action = meta.action||[""]
|
||||
|
@ -55,13 +55,14 @@ Volcanos(chat.ONACTION, {_init: function(can) {
|
||||
can.user.info.language? can.require(["src/template/web.chat.header/language/"+can.user.info.language+".js"], cb, function(can, name, sub) { can.base.Copy(can.user._trans, sub._trans) }): cb && cb()
|
||||
}
|
||||
function show(msg) { var p = can.misc.Search(can, "redirect_uri")
|
||||
if (location.pathname == "/login" && p) { return location.replace(can.base.MergeURL(p, ice.MSG_SESSID, can.misc.CookieSessid(can))) }
|
||||
if (p && location.pathname == "/login") { return location.replace(can.base.MergeURL(p, ice.MSG_SESSID, can.misc.CookieSessid(can))) }
|
||||
can.user.info.usernick = can.Conf(aaa.USERNICK), can.user.info.userrole = msg.Option(ice.MSG_USERROLE), can.user.info.avatar = msg.Option(aaa.AVATAR), can.user.info.background = msg.Option(aaa.BACKGROUND)
|
||||
can.user.info.email = msg.Option(aaa.EMAIL), can.user.info.repos = msg.Option(nfs.REPOS)
|
||||
msg.Option(nfs.SCRIPT) && can.require(can.base.Obj(msg.Option(nfs.SCRIPT)), function(can) { can.onaction.source(can, msg) })
|
||||
lang(msg, function() { can.onmotion.clear(can), can.onimport._init(can, can.request(), can._output), can.onengine.signal(can, chat.ONLOGIN) })
|
||||
}
|
||||
can.run(can.request({}, {_method: web.GET}), [], function(msg) { lang(msg), can.page.requireModules(can, [msg.Option("icons")])
|
||||
can.run(can.request({}, {_method: web.GET}), [], function(msg) {
|
||||
lang(msg), can.page.requireModules(can, [msg.Option(mdb.ICONS)])
|
||||
can.require(can.core.List(msg["theme.list"], function(item) { return "src/template/web.chat.header/theme/"+item }))
|
||||
can.onaction._menus[1] = [chat.THEME, ice.AUTO].concat(can.core.List(msg["theme.list"], function(item) { return can.base.trimSuffix(item, ".css") }))
|
||||
can.onaction._menus[2] = [aaa.LANGUAGE, ice.AUTO].concat(can.core.List(msg["language.list"], function(item) { return can.base.trimSuffix(item, ".js") }))
|
||||
|
@ -30,7 +30,7 @@ Volcanos(chat.ONACTION, {list: [mdb.CREATE, web.SHARE, web.REFRESH], _init: func
|
||||
create: function(event, can) { can.user.input(can.request(event, {title: "创建群组"}), can, [
|
||||
{name: mdb.TYPE, values: [aaa.TECH, aaa.ROOT, aaa.TECH, aaa.VOID], _trans: "类型"},
|
||||
{name: mdb.NAME, value: "hi", _trans: "群名", need: "must"},
|
||||
{name: mdb.ICON, value: "", _trans: "图标", action: "icon"},
|
||||
{name: mdb.ICON, value: "", _trans: "图标"},
|
||||
{name: mdb.TEXT, value: "hello", _trans: "简介"},
|
||||
], function(args) {
|
||||
can.runAction(event, mdb.CREATE, args, function(msg) { can.misc.Search(can, {river: msg.Result()}) })
|
||||
|
@ -1,24 +1,21 @@
|
||||
Volcanos(chat.ONFIGURE, {icon: {
|
||||
_load: function(event, can, cb, target, name, value) {
|
||||
can.runAction(event, ctx.RUN, ["web.chat.icons"], function(msg) {
|
||||
can._show(can, msg, cb, target, name)
|
||||
})
|
||||
can.runAction(event, ctx.RUN, ["nfs.dir", "usr/icons/"], function(msg) { can._show(can, msg, cb, target, name) })
|
||||
},
|
||||
_show: function(can, msg, cb, target, name) { can.onmotion.clear(can)
|
||||
var table = can.page.Append(can, can._output, [{type: html.TABLE}])._target, tr
|
||||
msg.Table(function(value, index) { if (index%10 == 0) { tr = can.page.Append(can, table, [{type: html.TR}])._target }
|
||||
can.page.Append(can, tr, [{type: html.TD, inner: value.icon, title: value.name, onclick: function() {
|
||||
can.close(), can.base.isFunc(cb) && cb(can, value.name, target.value)
|
||||
target._icon.className = value.name
|
||||
msg.Table(function(value, index) { if (index%5 == 0) { tr = can.page.Append(can, table, [{type: html.TR}])._target }
|
||||
can.page.Append(can, tr, [{type: html.TD, title: value.path, list: [{img: can.misc.Resource(can, value.path)}], onclick: function() {
|
||||
can.close(), can.base.isFunc(cb) && cb(can, value.path, target.value)
|
||||
target._icon.src = can.misc.Resource(can, value.path)
|
||||
}}])
|
||||
}), can.onappend._status(can, [mdb.TOTAL]), can.Status(mdb.TOTAL, msg.Length())
|
||||
can.page.style(can, can._output, html.MAX_HEIGHT, can.page.height()/2, html.MIN_WIDTH, target.offsetWidth, html.MAX_WIDTH, can.page.width()/2)
|
||||
can.onlayout.figure({target: target}, can, can._target, false, 200)
|
||||
},
|
||||
onclick: function(event, can, meta, target, cbs) { can.onmotion.focus(can, target) },
|
||||
onfocus: function(event, can, meta, target, cbs) { cbs(function(sub, cb) { if (sub.Status(mdb.TOTAL) > 0) { return }
|
||||
target._icon = target._icon || can.page.insertBefore(can, [{type: "i"}], target)
|
||||
target._icon = target._icon || can.page.insertBefore(can, [{type: "img"}], target)
|
||||
meta.msg && meta.msg.Length() > 0? sub._show(sub, meta.msg, cb, target, meta.name): sub._load(event, sub, cb, target, meta.name, target.value)
|
||||
}) },
|
||||
onblur: function(event, can, sub, cb) { sub && can.onmotion.delay(can, sub.close, 300) },
|
||||
}})
|
||||
|
||||
|
22
plugin/input/icons.js
Normal file
22
plugin/input/icons.js
Normal file
@ -0,0 +1,22 @@
|
||||
Volcanos(chat.ONFIGURE, {icons: {
|
||||
_load: function(event, can, cb, target, name, value) {
|
||||
can.runAction(event, ctx.RUN, ["web.chat.icons"], function(msg) { can._show(can, msg, cb, target, name) })
|
||||
},
|
||||
_show: function(can, msg, cb, target, name) { can.onmotion.clear(can)
|
||||
var table = can.page.Append(can, can._output, [{type: html.TABLE}])._target, tr
|
||||
msg.Table(function(value, index) { if (index%10 == 0) { tr = can.page.Append(can, table, [{type: html.TR}])._target }
|
||||
can.page.Append(can, tr, [{type: html.TD, inner: value.icon, title: value.name, onclick: function() {
|
||||
can.close(), can.base.isFunc(cb) && cb(can, value.name, target.value)
|
||||
target._icon.className = value.name
|
||||
}}])
|
||||
}), can.onappend._status(can, [mdb.TOTAL]), can.Status(mdb.TOTAL, msg.Length())
|
||||
can.onlayout.figure({target: target}, can, can._target, false, 200)
|
||||
},
|
||||
onclick: function(event, can, meta, target, cbs) { can.onmotion.focus(can, target) },
|
||||
onfocus: function(event, can, meta, target, cbs) { cbs(function(sub, cb) { if (sub.Status(mdb.TOTAL) > 0) { return }
|
||||
target._icon = target._icon || can.page.insertBefore(can, [{type: "i"}], target)
|
||||
meta.msg && meta.msg.Length() > 0? sub._show(sub, meta.msg, cb, target, meta.name): sub._load(event, sub, cb, target, meta.name, target.value)
|
||||
}) },
|
||||
onblur: function(event, can, sub, cb) { sub && can.onmotion.delay(can, sub.close, 300) },
|
||||
}})
|
||||
|
@ -13,9 +13,8 @@ Volcanos(chat.ONFIGURE, {key: {
|
||||
var _cb = can.Conf("select"); if (_cb) { return _cb(target.value = value) } can.base.isFunc(cb) && cb(can, value, target.value)
|
||||
msg.Option(ice.MSG_PROCESS) == ice.PROCESS_AGAIN && can.onmotion.delay(can, function() { can._load(event, can, cb, target, name, value) })
|
||||
}}
|
||||
}), can.onappend._status(can, [mdb.TOTAL, mdb.INDEX]), can.Status(mdb.TOTAL, msg.Length())
|
||||
}), can.onappend._status(can, [mdb.TOTAL, mdb.INDEX]), can.Status(mdb.TOTAL, msg.Length()), can.onmotion.toggle(can, can._status, msg.Length() > 5)
|
||||
can.page.style(can, can._output, html.MAX_HEIGHT, can.page.height()/2, html.MIN_WIDTH, target.offsetWidth, html.MAX_WIDTH, can.Conf("style.width")||can.page.width()/2)
|
||||
can.onmotion.toggle(can, can._status, msg.Length() > 5)
|
||||
msg.append.length == 1 && can.page.ClassList.add(can, can._target, chat.SIMPLE), can.onlayout.figure({target: target}, can, can._target, false, 200)
|
||||
},
|
||||
onclick: function(event, can, meta, target, cbs) { can.onmotion.focus(can, target) },
|
||||
|
@ -1,5 +1,6 @@
|
||||
Volcanos(chat.ONIMPORT, {_init: function(can, msg) { can.db.current = msg.TableDetail()
|
||||
can.ui.target = can.page.Appends(can, can._output, [{type: html.IFRAME, src: can.db.current.link, height: can.ConfHeight(), width: can.ConfWidth()}])._target
|
||||
can.page.style(can, can._output, html.OVERFLOW, html.HIDDEN)
|
||||
},
|
||||
layout: function(can) {
|
||||
var item = can.db.current; can.sup.onexport.title(can, item.name||item.link.split(mdb.QS)[0])
|
||||
|
@ -1,33 +1,30 @@
|
||||
Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) {
|
||||
can.onmotion.clear(can)
|
||||
can.from = can.onimport._plugin(can, nfs.DIR, html.LEFT, "from", "to")
|
||||
can.to = can.onimport._plugin(can, nfs.DIR, html.RIGHT, "to", "from")
|
||||
Volcanos(chat.ONIMPORT, {_init: function(can, msg) { var height = 0.6
|
||||
can.from = can.onimport._plugin(can, nfs.DIR, html.LEFT, height, "from", "to")
|
||||
can.to = can.onimport._plugin(can, nfs.DIR, html.RIGHT, height, "to", "from")
|
||||
can.onmotion.delay(can, function() {
|
||||
can.from_trash = can.onimport._plugin(can, nfs.TRASH, html.LEFT, "from")
|
||||
can.to_trash = can.onimport._plugin(can, nfs.TRASH, html.RIGHT, "to")
|
||||
can.from_trash = can.onimport._plugin(can, nfs.TRASH, html.LEFT, 1-height, "from")
|
||||
can.to_trash = can.onimport._plugin(can, nfs.TRASH, html.RIGHT, 1-height, "to")
|
||||
}, 100)
|
||||
},
|
||||
_plugin: function(can, index, pos, from, to) {
|
||||
return can.onappend.plugin(can, {type: chat.STORY, index: index}, function(sub) {
|
||||
sub.onimport.size(sub, can.ConfHeight()/2, can.ConfWidth()/2, false)
|
||||
can.page.style(can, sub._target, {float: pos, clear: pos})
|
||||
sub._legend.innerHTML = can.Option(from)+lex.SP+index
|
||||
|
||||
sub.run = function(event, cmds, cb) {
|
||||
_plugin: function(can, index, pos, height, from, to) {
|
||||
return can.onappend.plugin(can, {type: chat.STORY, space: can.Option(from), index: index}, function(sub) {
|
||||
sub._legend.innerHTML = can.Option(from)+nfs.PT+index, can.page.style(can, sub._target, {float: pos, clear: pos})
|
||||
sub.onexport.output = function() { sub.onimport.size(sub, can.ConfHeight()*height-20, can.ConfWidth()/2-20, false) }
|
||||
sub.onimport.size(sub, can.ConfHeight()*height-20, can.ConfWidth()/2-20, false)
|
||||
sub.run = function(event, cmds, cb) { var msg = can.request(event); msg.Option("from", can.Option(from)), msg.Option("to", can.Option(to))
|
||||
if (can.onaction[cmds[1]]) { return can.onaction[cmds[1]](can, from, to, event, cmds, cb) }
|
||||
can.runActionCommand(sub.request(event, {_pod: can.Option(from)}), index, cmds, cb)
|
||||
if (!to) { can[from].Update() } else {}
|
||||
can.runActionCommand(event, index, cmds, function(msg) { cb && cb(msg)
|
||||
if (cmds[0] == ctx.ACTION) {
|
||||
if (!to) { can[from].Update() } else { can[from+"_trash"].Update() }
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
})
|
||||
Volcanos(chat.ONACTION, {
|
||||
send: function(can, from, to, event, cmds, cb) { var _from = can[from], _to = can[to]
|
||||
var path = can.request(event).Option(nfs.PATH)
|
||||
var msg = can.request(event, {_handle: ice.TRUE,
|
||||
from: can.Option(from), from_path: path,
|
||||
to: can.Option(to), to_path: _to.Option(nfs.PATH)+path.split(nfs.PS).pop(),
|
||||
})
|
||||
can.run(event, cmds, function() { _to.Update() }, true)
|
||||
send: function(can, from, to, event, cmds, cb) { var msg = can.request(event, {_handle: ice.TRUE})
|
||||
msg.Option("from_path", can[from].Option(nfs.PATH)), msg.Option("to_path", can[to].Option(nfs.PATH))
|
||||
can.run(event, cmds, function() { can[to].Update() })
|
||||
},
|
||||
})
|
||||
|
@ -13,7 +13,7 @@ Volcanos(chat.ONIMPORT, {
|
||||
_inner: function(can, sub, msg) { can.onappend.table(sub, msg), can.onappend.board(sub, msg), can.onmotion.story.auto(sub) },
|
||||
_field: function(can, msg, cb) { var height = can.onexport.outputHeight(can), width = can.ConfWidth()
|
||||
msg.Table(function(item) { can.onappend._plugin(can, item, {index: item.index, args: can.base.Obj(item.args||item.arg, []), height: height, width: width}, function(sub) {
|
||||
can.onmotion.delay(can, function() { sub._target.scrollIntoView() }, 300)
|
||||
can.onmotion.delay(can, function() { can.onmotion.scrollIntoView(can, sub._target) }, 300)
|
||||
sub.run = function(event, cmds, cb) { var index = msg.Option(ice.MSG_INDEX)
|
||||
can.run(event, (!index || index == can._index || index.indexOf("can.") == 0? msg[ice.MSG_PREFIX]||[]: [ice.RUN, index]).concat(cmds), cb, true)
|
||||
}, can.page.ClassList.has(can, sub._target, html.FLOAT)? can.onmotion.float(sub): sub.onimport.size(sub, height, width, true), cb && cb(sub)
|
||||
|
Loading…
x
Reference in New Issue
Block a user