forked from x/volcanos
add some
This commit is contained in:
parent
bfe33df671
commit
89a3257202
3
frame.js
3
frame.js
@ -21,7 +21,8 @@ Volcanos(chat.ONENGINE, {_init: function(can, meta, list, cb, target) {
|
||||
if (panel.onengine._plugin(event, can, msg, panel, cmds, cb)) { return }
|
||||
if (panel.onengine._engine(event, can, msg, panel, cmds, cb)) { return }
|
||||
if (panel.onengine._static(event, can, msg, panel, cmds, cb)) { return }
|
||||
var toast, _toast = msg.Option(chat._TOAST); if (_toast) { can.onmotion.delay(can, function() { if (msg._can && msg._can._toast) { return } toast = toast||can.user.toastProcess(msg._can, _toast) }, 300) }
|
||||
var toast, _toast = msg.Option(chat._TOAST); if (_toast) { can.onmotion.delay(can, function() {
|
||||
if (sub.__toast || sub._toast) { return } toast = toast||can.user.toastProcess(sub, _toast) }, 30) }
|
||||
if (can.base.isUndefined(msg[ice.MSG_DAEMON])) {
|
||||
can.base.isUndefined(sub._daemon) && can.ondaemon._list[0] && (sub._daemon = can.ondaemon._list.push(sub)-1)
|
||||
if (sub._daemon) { msg.Option(ice.MSG_DAEMON, can.core.Keys(can.ondaemon._list[0], sub._daemon)) }
|
||||
|
@ -212,10 +212,12 @@ fieldset.input.float table.content td { padding:var(--input-padding); }
|
||||
/* float */
|
||||
body div.float { padding:var(--plugin-padding); }
|
||||
fieldset.Action>div.toast {
|
||||
height:fit-content; width:fit-content; position:absolute; bottom:var(--action-height); right:0; z-index:10;
|
||||
height:fit-content; width:fit-content; position:absolute; bottom:var(--footer-height); right:0; z-index:10;
|
||||
max-height:var(--float-height); overflow:auto;
|
||||
}
|
||||
fieldset.Action>div.toast>div.toast {
|
||||
margin:var(--plugin-margin); position:static;
|
||||
transition:all 1s;
|
||||
}
|
||||
div.toast.float div.title { color:var(--notice-bg-color); font-style:italic; white-space:pre; padding:0 var(--input-padding); max-width:300px; overflow:auto; float:left; cursor:copy; }
|
||||
div.toast.float div.delete { color:var(--notice-bg-color); float:right; cursor:pointer; }
|
||||
|
23
lib/user.js
23
lib/user.js
@ -83,13 +83,15 @@ Volcanos("user", {
|
||||
toastProcess: function(can, content, title, progress) { return can.user.toast(can, {content: "🕑 "+(content||ice.PROCESS), title: title, duration: -1, progress: progress, caller: 2}) },
|
||||
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: 30000, caller: 2}) },
|
||||
toast: function(can, content, title, duration, progress, hash) {
|
||||
toast: function(can, content, title, duration, progress, hash) { can = can._fields? can.sup: can
|
||||
content = {"success": "✅ success", "failure": "❌ failure", "process": "🕑 process"}[content]||content
|
||||
var meta = can.base.isObject(content)? content: {content: content, title: title, duration: duration, progress: progress, hash: hash}
|
||||
meta.title = meta.title||can.core.Keys(can.ConfSpace(), can.ConfIndex())||can._name.split(nfs.PS).slice(-2).join(nfs.PS)
|
||||
var width = meta.width||390; if (width < 0) { width = window.innerWidth + width } meta.action = meta.action||[""]
|
||||
// can.user.isChrome && (meta.hash = meta.hash||can._daemon),
|
||||
meta.hash && (meta.title += " "+meta.hash.slice(0, 6))
|
||||
var ui = can.page.Append(can, meta.hash? can._root.Action._toast: document.body, [{view: [[chat.TOAST, meta.style, chat.FLOAT]], style: {left: (window.innerWidth-width)/2, width: width, top: can.page.height()/2}, list: [
|
||||
// var ui = can.page.Append(can, meta.hash || meta.duration < 0? can._root.Action._toast: document.body, [{view: [[chat.TOAST, meta.style, chat.FLOAT]], style: {left: (window.innerWidth-width)/2, width: width, top: can.page.height()/2}, list: [
|
||||
var ui = can.page.Append(can, can._root.Action._toast, [{view: [[chat.TOAST, meta.style, chat.FLOAT]], style: {left: (window.innerWidth-width)/2, width: width, top: can.page.height()/2}, list: [
|
||||
{text: [meta.title||"", html.DIV, html.TITLE], title: "点击复制", onclick: function(event) { can.user.copy(event, can, meta.title) }},
|
||||
{view: ["delete", "", can.page.unicode.delete], title: "点击关闭", onclick: function() { action.close() }},
|
||||
{view: "duration", title: "点击关闭", onclick: function() { action.close() }},
|
||||
@ -103,21 +105,24 @@ Volcanos("user", {
|
||||
_trans: meta.action.meta? meta.action.meta._trans: {},
|
||||
_engine: function(event, button) { can.core.CallFunc(meta.action.meta? meta.action.meta[button]: meta.action, [event, button]) },
|
||||
open: function(event) { meta.content.indexOf(ice.HTTP) == 0 && can.user.open(meta.content), meta.title.indexOf(ice.HTTP) == 0 && can.user.open(meta.title) },
|
||||
close: function(event) { can.page.Remove(can, ui._target), action.timer.stop = true },
|
||||
cancel: function(event) { can.page.Remove(can, ui._target), action.timer.stop = true },
|
||||
close: function(event) { action.timer.stop = true, can.page.Remove(can, ui._target) },
|
||||
cancel: function(event) { action.timer.stop = true, can.page.Remove(can, ui._target) },
|
||||
timer: can.core.Timer({interval: 100, length: (meta.duration||1000)/100}, function(event, interval, index) {
|
||||
if (index > 30) { ui.duration.innerHTML = index/10+(index%10==0?".0":"")+"s..." }
|
||||
}, function() { action.close() }), _target: ui._target,
|
||||
}, function() { can.page.style(can, ui._target, "margin-right", "-400px")
|
||||
can.onmotion.delay(can, function() { can.page.Remove(can, ui._target) }, 1000)
|
||||
delete(can.__toast)
|
||||
}), _target: ui._target,
|
||||
}); can.onmotion.story.auto(can, ui._target), meta.resize && can.onmotion.delayResize(can, ui._target, meta.resize)
|
||||
if (meta.action && meta.action.length == 1 && meta.action[0] === "") {
|
||||
can.page.Select(can, action._target, html.DIV_ACTION, function(target) { can.onmotion.hidden(can, target) })
|
||||
}
|
||||
can._toast && (can._toast.close(), delete(can._toast))
|
||||
if (meta.hash) { var list = can._root.Action._toastList = can._root.Action._toastList||{}
|
||||
list[meta.hash] && can.page.insertBefore(can, action._target, list[meta.hash]._target)
|
||||
list[meta.hash] && (list[meta.hash].close(), delete(list[meta.hash]))
|
||||
return list[meta.hash] = action
|
||||
}
|
||||
return can._toast && (can._toast.close(), delete(can._toast)), can._toast = action
|
||||
list[meta.hash] && (can.page.Remove(can, list[meta.hash]._target), list[meta.hash].close(), delete(list[meta.hash])), list[meta.hash] = action
|
||||
can.__toast = action
|
||||
} else { can._toast = action } return action
|
||||
},
|
||||
space: function(can) { return can.Conf(web.SPACE)||can.Conf(ice.POD)||can.misc.Search(can, ice.POD) },
|
||||
template: function(can, file) { return can.base.MergeURL(can.base.Path(nfs.SRC_TEMPLATE, can.Conf(ctx.INDEX), file), ice.POD, can.user.space(can)) },
|
||||
|
@ -81,11 +81,11 @@ Volcanos(chat.ONACTION, {list: ["创建", "编译", "源码", "计划", "流程"
|
||||
trash: function(event, can, button) { can.onaction._run(event, can, button, [can.Option(nfs.PATH)+can.Option(nfs.FILE)], function() { can._msg._tab._close() }) },
|
||||
script: function(event, can, button) { can.onaction._runs(event, can, button) },
|
||||
module: function(event, can, button) { can.onaction._runs(can.request(event, {title: "创建模块"}), can, button) },
|
||||
compile: function(event, can, button) { var _toast = can.user.toastProcess(can, "编译中...")
|
||||
can.runAction(event, button, [], function(msg) { can.ui.search && can.ui.search.hidden(), _toast.close()
|
||||
compile: function(event, can, button) { var msg = can.request(event); msg.Option(chat._TOAST, "")
|
||||
can.runAction(event, button, [], function(msg) { can.ui.search && can.ui.search.hidden()
|
||||
if (msg.Length() > 0 || msg.Result()) { return can.onimport.exts(can, "inner/search.js", function(sub) { can.ui.search = sub, sub.select()
|
||||
can.onmotion.delay(can, function() { can.onappend._output(sub, msg, sub.Conf(ctx.DISPLAY)) })
|
||||
}) } var toast = can.user.toastProcess(can, "重启中..."); can.onmotion.delay(can, function() { toast.close(), can.user.toastSuccess(can) }, 3000)
|
||||
}) } var toast = can.user.toastProcess(can, cli.RESTART); can.onmotion.delay(can, function() { toast.close(), can.user.toastSuccess(can, cli.RESTART) }, 3000)
|
||||
})
|
||||
},
|
||||
"命令": function(event, can) { can.user.input(event, can, [{name: ctx.INDEX, need: "must"}, ctx.ARGS], function(list) { can.onimport.tabview(can, "", list[0]+(list[1]? mdb.FS+list[1]: ""), ctx.INDEX) }) },
|
||||
|
Loading…
x
Reference in New Issue
Block a user