mirror of
https://shylinux.com/x/volcanos
synced 2025-04-25 16:58:06 +08:00
add toast hash
This commit is contained in:
parent
dfc0a9bd01
commit
72b70b97d1
37
index.css
37
index.css
@ -169,7 +169,6 @@ div.project div.zone>div.item span.icon.refresh { margin-top:-2px; }
|
||||
div.project div.zone:hover>div.item span.icon { display:block; }
|
||||
div.project div.zone>div.list>div.zone>div.item { text-align:left; padding-left:var(--button-padding); transition:all .5s; }
|
||||
div.project div.zone>div.list>div.zone>div.item:hover { margin-left:var(--button-margin); transition:all .3s; }
|
||||
div.item img { height:var(--header-height); width:var(--header-height); }
|
||||
div.item>i.bi-chevron-down { float:right; transition:all .5s; }
|
||||
div.item.open>i.bi-chevron-down { rotate:-180deg; transition:all .3s; }
|
||||
div.item.text.trans input:not([type=button]) { transition:all 1s; }
|
||||
@ -212,20 +211,26 @@ fieldset.input.float table.content th { padding:var(--input-padding); }
|
||||
fieldset.input.float table.content td { padding:var(--input-padding); }
|
||||
/* float */
|
||||
body div.float { padding:var(--plugin-padding); }
|
||||
body>div.toast 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; }
|
||||
body>div.toast div.delete { color:var(--notice-bg-color); float:right; cursor:pointer; }
|
||||
body>div.toast div.delete:hover { background-color:var(--hover-bg-color); color:var(--hover-fg-color); }
|
||||
body>div.toast div.duration { color:var(--disable-fg-color); float:right; }
|
||||
body>div.toast div.content { color:var(--notice-bg-color); white-space:pre-line; text-align:center; padding:var(--input-padding); margin-bottom:var(--button-margin); min-height:28px; display:block; }
|
||||
body>div.toast div.progress { border:var(--box-notice); margin-left:0px; height:20px; clear:both; }
|
||||
body>div.toast div.progress div.current { background-color:var(--progress-bg-color); height:18px; }
|
||||
body>div.toast div.action:not(.hide) { width:100%; display:block; display:flex; flex-direction:row-reverse; gap:10px; }
|
||||
body>div.toast div.action>div.item { float:right; }
|
||||
body>div.toast div.action>div.item i { display:none; }
|
||||
body>div.toast div.action>div.item span { display:none; }
|
||||
body>div.toast div.action>div.item input { padding:0 20px; }
|
||||
body>div.toast div.action>div.item.danger input { border:var(--danger-bg-color) solid 1px; }
|
||||
body>div.toast div.action>div.item.notice input { border:var(--notice-bg-color) solid 1px; }
|
||||
fieldset.Action>div.toast {
|
||||
height:fit-content; width:fit-content; position:absolute; bottom:var(--action-height); right:0; z-index:10;
|
||||
}
|
||||
fieldset.Action>div.toast>div.toast {
|
||||
margin:var(--plugin-margin); position:static;
|
||||
}
|
||||
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; }
|
||||
div.toast.float div.delete:hover { background-color:var(--hover-bg-color); color:var(--hover-fg-color); }
|
||||
div.toast.float div.duration { color:var(--disable-fg-color); float:right; }
|
||||
div.toast.float div.content { color:var(--notice-bg-color); white-space:pre-line; text-align:center; padding:var(--input-padding); margin-bottom:var(--button-margin); min-height:28px; display:block; }
|
||||
div.toast.float div.progress { border:var(--box-notice); margin-left:0px; height:20px; clear:both; }
|
||||
div.toast.float div.progress div.current { background-color:var(--progress-bg-color); height:18px; }
|
||||
div.toast.float div.action:not(.hide) { width:100%; display:block; display:flex; flex-direction:row-reverse; gap:10px; }
|
||||
div.toast.float div.action>div.item { float:right; }
|
||||
div.toast.float div.action>div.item i { display:none; }
|
||||
div.toast.float div.action>div.item span { display:none; }
|
||||
div.toast.float div.action>div.item input { padding:0 20px; }
|
||||
div.toast.float div.action>div.item.danger input { border:var(--danger-bg-color) solid 1px; }
|
||||
div.toast.float div.action>div.item.notice input { border:var(--notice-bg-color) solid 1px; }
|
||||
body>div.carte { padding:0; }
|
||||
body>div.carte input[name=filter] { margin:var(--input-margin); width:calc(100% - 10px); position:sticky; top:var(--input-margin); }
|
||||
body>div.carte div.item { white-space:pre; padding:var(--button-padding); }
|
||||
@ -776,7 +781,7 @@ div.project::-webkit-scrollbar { width:0 !important; height:0 !important; }
|
||||
div.content::-webkit-scrollbar { width:0 !important; height:0 !important; }
|
||||
div.status::-webkit-scrollbar { width:0 !important; height:0 !important; }
|
||||
div.toggle::-webkit-scrollbar { width:0 !important; height:0 !important; }
|
||||
body>div.toast div.title::-webkit-scrollbar { width:0 !important; height:0 !important; }
|
||||
div.toast.float div.title::-webkit-scrollbar { width:0 !important; height:0 !important; }
|
||||
body>div.carte::-webkit-scrollbar { width:0 !important; height:0 !important; }
|
||||
fieldset.word>div.output::-webkit-scrollbar { width:0 !important; height:0 !important; }
|
||||
fieldset.dream>div.output::-webkit-scrollbar { width:0 !important; height:0 !important; }
|
||||
|
11
lib/core.js
11
lib/core.js
@ -89,12 +89,17 @@ Volcanos("core", {
|
||||
list = res
|
||||
} return list
|
||||
},
|
||||
Next: function(list, cb, cbs) {
|
||||
Next: function(list, cb, cbs, data) {
|
||||
switch (typeof list) {
|
||||
case code.OBJECT: if (list == null) { list = []; break } if (list.length == undefined) { var ls = []; for (var k in list) { ls.push(k) } list = ls } break
|
||||
case code.OBJECT:
|
||||
if (list == null) { list = []; break } if (list.length == undefined) { var ls = []; for (var k in list) { ls.push(k) } list = ls } break
|
||||
default: if (list == undefined) { list = []; break } list = [list]
|
||||
}
|
||||
function next(i) { i < list.length? typeof cb == code.FUNCTION && cb(list[i], function() { next(i+1) }, i, list): typeof cbs == code.FUNCTION && cbs(list) }
|
||||
function next(i) {
|
||||
data = (i < list.length?
|
||||
typeof cb == code.FUNCTION && cb(list[i], function(_data) { data = _data||data, next(i+1) }, i, list, data):
|
||||
typeof cbs == code.FUNCTION && cbs(list))||data
|
||||
}
|
||||
return next(0), list
|
||||
},
|
||||
Item: function(obj, cb) { var list = [], keys = []
|
||||
|
15
lib/user.js
15
lib/user.js
@ -83,12 +83,13 @@ 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, caller) {
|
||||
toast: function(can, content, title, duration, progress, hash) {
|
||||
content = {"success": "✅ success", "failure": "❌ failure", "process": "🕑 process"}[content]||content
|
||||
var meta = can.base.isObject(content)? content: {content: content, duration: duration, progress: progress, caller: caller}
|
||||
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||[""]
|
||||
var ui = can.page.Append(can, document.body, [{view: [[chat.TOAST, meta.style, chat.FLOAT]], style: {left: (window.innerWidth-width)/2, width: width, top: can.page.height()/2}, list: [
|
||||
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: [
|
||||
{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() }},
|
||||
@ -110,7 +111,13 @@ Volcanos("user", {
|
||||
}); 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) })
|
||||
} return can._toast && (can._toast.close(), delete(can._toast)), can._toast = action
|
||||
}
|
||||
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
|
||||
},
|
||||
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)) },
|
||||
|
@ -37,6 +37,7 @@ Volcanos(chat.ONACTION, {_init: function(can, target) { can.db.list = can.misc.S
|
||||
can.core.List(["ontouchstart", "ontouchmove", "ontouchend"], function(item) {
|
||||
can.onengine.listen(can, item, function(event, msg) { can.onaction[item](event, can), can.onengine.signal(can, chat.ONACTION_TOUCH, msg) }, target)
|
||||
})
|
||||
can._toast = can.page.Append(can, can._target, ["toast"])._target
|
||||
},
|
||||
onsize: function(can, msg, height, width) { can.Conf({height: can.base.Min(height, 240), width: width}) },
|
||||
onlogin: function(can, msg) {
|
||||
|
1
proto.js
1
proto.js
@ -43,6 +43,7 @@ var Volcanos = shy({iceberg: "", volcano: "", frame: chat.FRAME_JS, _cache: {},
|
||||
var msg = event._msg||can.misc.Message(event, can); event._msg = msg
|
||||
function set(key, value) {
|
||||
if (key == "_method") { return msg._method = value }
|
||||
if (key == "action" && value.indexOf("<input") == 0) { return }
|
||||
if (typeof value == code.FUNCTION) { return msg[key] = value }
|
||||
value == "" || msg.Option(key) || msg.Option(key, value)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user