1
0
forked from x/icebergs
This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-05-20 20:52:40 +08:00
parent 0bfb8673a5
commit f7b4edde23
5 changed files with 52 additions and 35 deletions

View File

@ -90,6 +90,9 @@ func _serve_static(msg *ice.Message, w http.ResponseWriter, r *http.Request) boo
if strings.HasPrefix(r.URL.Path, "/v/") { if strings.HasPrefix(r.URL.Path, "/v/") {
return Render(msg, ice.RENDER_DOWNLOAD, path.Join(ice.USR_VOLCANOS, strings.TrimPrefix(r.URL.Path, nfs.V))) return Render(msg, ice.RENDER_DOWNLOAD, path.Join(ice.USR_VOLCANOS, strings.TrimPrefix(r.URL.Path, nfs.V)))
} else if kit.HasPrefix(r.URL.Path, "/p/") { } else if kit.HasPrefix(r.URL.Path, "/p/") {
if kit.Contains(r.URL.String(), "render=replace") {
return false
}
p := strings.TrimPrefix(r.URL.Path, "/p/") p := strings.TrimPrefix(r.URL.Path, "/p/")
return (!ispod && kit.HasPrefix(p, nfs.SRC) || kit.HasPrefix(p, ice.USR_ICEBERGS, ice.USR_ICONS)) && nfs.Exists(msg, p) && Render(msg, ice.RENDER_DOWNLOAD, p) return (!ispod && kit.HasPrefix(p, nfs.SRC) || kit.HasPrefix(p, ice.USR_ICEBERGS, ice.USR_ICONS)) && nfs.Exists(msg, p) && Render(msg, ice.RENDER_DOWNLOAD, p)
} else if kit.HasPrefix(r.URL.Path, "/m/") { } else if kit.HasPrefix(r.URL.Path, "/m/") {

View File

@ -1,11 +1,15 @@
body { --web-flows-done:lightgreen; --web-flows-fail:var(--danger-bg-color); } body { --web-flows-done:lightgreen; --web-flows-fail:var(--danger-bg-color); }
fieldset.web.flows>div.output>div.layout>div.layout>div.content svg line.fail { stroke:var(--web-flows-fail); } $content svg line.fail { stroke:var(--web-flows-fail); }
fieldset.web.flows>div.output>div.layout>div.layout>div.content svg line.done { stroke:var(--web-flows-done); } $content svg line.done { stroke:var(--web-flows-done); }
fieldset.web.flows>div.output>div.layout>div.layout>div.content svg line.select { stroke:var(--notice-bg-color); } $content svg line.select { stroke:var(--notice-bg-color); }
fieldset.web.flows>div.output>div.layout>div.layout>div.content svg rect.fail { stroke:var(--web-flows-fail); } $content svg rect.fail { stroke:var(--web-flows-fail); }
fieldset.web.flows>div.output>div.layout>div.layout>div.content svg rect.done { stroke:var(--web-flows-done); } $content svg rect.done { stroke:var(--web-flows-done); }
fieldset.web.flows>div.output>div.layout>div.layout>div.content svg rect.select { stroke:var(--notice-bg-color); } $content svg rect.select { stroke:var(--notice-bg-color); }
fieldset.web.flows>div.output>div.layout>div.layout>div.content svg text { dominant-baseline:middle; } $content svg text { dominant-baseline:middle; }
fieldset.web.flows>div.output>div.layout>div.layout>div.content svg text.fail { stroke:var(--web-flows-fail); fill:var(--web-flows-fail); } $content svg text.fail { stroke:var(--web-flows-fail); fill:var(--web-flows-fail); }
fieldset.web.flows>div.output>div.layout>div.layout>div.content svg text.done { stroke:var(--web-flows-done); fill:var(--web-flows-done); } $content svg text.done { stroke:var(--web-flows-done); fill:var(--web-flows-done); }
fieldset.web.flows>div.output>div.layout>div.layout>div.content svg text.select { stroke:var(--notice-bg-color); fill:var(--notice-bg-color); } $content svg text.select { stroke:var(--notice-bg-color); fill:var(--notice-bg-color); }
$content fieldset.can._action { position:absolute; bottom:var(--action-height); }
$content fieldset.can._action>legend { display:none; }
$content fieldset.can._action>div.status { display:none; }
$content fieldset.can._action>div.action { display:contents; }

View File

@ -29,6 +29,7 @@ func init() {
m.PushAction(mdb.PLUGIN, mdb.DELETE) m.PushAction(mdb.PLUGIN, mdb.DELETE)
} }
m.Display("") m.Display("")
m.DisplayCSS("")
}}, }},
}) })
} }

View File

@ -26,10 +26,16 @@ Volcanos(chat.ONIMPORT, {
// can.onappend._status(can, can.base.Obj(msg.Option(ice.MSG_STATUS))) // can.onappend._status(can, can.base.Obj(msg.Option(ice.MSG_STATUS)))
can.onappend.plugin(can, {index: web.WIKI_DRAW, style: html.OUTPUT, display: "/plugin/local/wiki/draw.js", height: can.ui.content.offsetHeight, width: can.ui.content.offsetWidth}, function(sub) { can.onappend.plugin(can, {index: web.WIKI_DRAW, style: html.OUTPUT, display: "/plugin/local/wiki/draw.js", height: can.ui.content.offsetHeight, width: can.ui.content.offsetWidth}, function(sub) {
sub.run = function(event, cmds, cb) { cb(can.request(event)) } sub.run = function(event, cmds, cb) { cb(can.request(event)) }
sub.onexport.output = function(_sub, _msg) { sub.onexport.output = function(_sub, _msg) { value._content_plugin = sub, can.onimport._toolkit(can, value) }
sub.Action(svg.GO, "manual"), sub.Action(ice.MODE, html.RESIZE), can.onmotion.hidden(can, sub._action) }, can.ui.content||can._output)
value._content_plugin = sub, can.onimport.layout(can), can.onimport._flows(can, _sub, value) },
} _toolkit: function(can, value) {
can.onappend.plugin(can, {index: "can._action", width: can.ui.content.offsetWidth/2}, function(sub) {
sub.Conf("space", can.ConfSpace()), sub.Conf("index", can.ConfIndex()+":"+value.zone)
sub.run = function(event, cmds, cb) { cb(can.request(event)) }
sub.onexport.output = function(_sub) {
_sub.onaction._select = function(event, _sub) { can.onimport._flows(can, value) }
sub.onappend._action(_sub, can.onaction._toolkit), value._toolkit_plugin = sub, can.onimport._flows(can, value) }
}, can.ui.content||can._output) }, can.ui.content||can._output)
}, },
_profile: function(can, item) { can.onexport.hash(can, can.db.value.zone, item.hash) _profile: function(can, item) { can.onexport.hash(can, can.db.value.zone, item.hash)
@ -41,10 +47,13 @@ Volcanos(chat.ONIMPORT, {
sub.onaction._close = function() { can.onmotion.hidden(can, can.ui.profile), can.onimport.layout(can) } sub.onaction._close = function() { can.onmotion.hidden(can, can.ui.profile), can.onimport.layout(can) }
}, can.ui.profile) }, can.ui.profile)
}, },
_flows: async function(can, sub, value) { _flows: async function(can, value) {
var margin = can.onexport.margin(can), height = can.onexport.height(can), width = can.onexport.width(can) can.onimport.layout(can)
var matrix = {}, horizon = can.Action("direct") == "horizon"; can.onmotion.clear(can, sub.ui.svg) var sub = value._content_plugin.sub
async function sleep() { return new Promise(resolve => { setTimeout(resolve, can.Action("delay")) }) } var _sub = value._toolkit_plugin.sub
var margin = can.onexport.margin(_sub), height = can.onexport.height(_sub), width = can.onexport.width(_sub)
var matrix = {}, horizon = value._toolkit_plugin.Action("direct") == "horizon"; can.onmotion.clear(can, sub.ui.svg)
async function sleep() { return new Promise(resolve => { setTimeout(resolve, _sub.Action("delay")) }) }
async function show(item, main) { var prev = "from", from = "prev"; if (horizon) { var prev = "prev", from = "from" } async function show(item, main) { var prev = "from", from = "prev"; if (horizon) { var prev = "prev", from = "from" }
while (matrix[can.core.Keys(item.x, item.y)]) { while (matrix[can.core.Keys(item.x, item.y)]) {
if (horizon && main || !horizon && !main) { item.y++ if (horizon && main || !horizon && !main) { item.y++
@ -62,7 +71,7 @@ Volcanos(chat.ONIMPORT, {
if (item.from || item.prev) { item._line = sub.onimport.draw(sub, {shape: svg.LINE, points: if (item.from || item.prev) { item._line = sub.onimport.draw(sub, {shape: svg.LINE, points:
horizon && item.from || !horizon && !item.from? [{x: item.x*width+width/2, y: item.y*height-margin}, {x: item.x*width+width/2, y: item.y*height+margin}]: horizon && item.from || !horizon && !item.from? [{x: item.x*width+width/2, y: item.y*height-margin}, {x: item.x*width+width/2, y: item.y*height+margin}]:
[{x: item.x*width-margin, y: item.y*height+height/2}, {x: item.x*width+margin, y: item.y*height+height/2}] [{x: item.x*width-margin, y: item.y*height+height/2}, {x: item.x*width+margin, y: item.y*height+height/2}]
}) } can.onimport._block(can, sub, item, item.x*width, item.y*height), await sleep() }) } can.onimport._block(can, value, item, item.x*width, item.y*height), await sleep()
var next = 0, to = 1; if (horizon) { var next = 1, to = 0 } var next = 0, to = 1; if (horizon) { var next = 1, to = 0 }
if (main) { if (main) {
var _item = item.to; if (_item) { _item.x = item.x+to, _item.y = item.y+next, await show(_item) } var _item = item.to; if (_item) { _item.x = item.x+to, _item.y = item.y+next, await show(_item) }
@ -73,26 +82,33 @@ Volcanos(chat.ONIMPORT, {
} }
} value._root.x = 0, value._root.y = 0, await show(value._root, true) } value._root.x = 0, value._root.y = 0, await show(value._root, true)
}, },
_block: function(can, sub, item, x, y) { _block: function(can, value, item, x, y) {
var margin = can.onexport.margin(can), height = can.onexport.height(can), width = can.onexport.width(can) var sub = value._content_plugin.sub
var _sub = value._toolkit_plugin.sub
var margin = can.onexport.margin(_sub), height = can.onexport.height(_sub), width = can.onexport.width(_sub)
var rect = sub.onimport.draw(sub, {shape: svg.RECT, points: [{x: x+margin, y: y+margin}, {x: x+width-margin, y: y+height-margin}]}) var rect = sub.onimport.draw(sub, {shape: svg.RECT, points: [{x: x+margin, y: y+margin}, {x: x+width-margin, y: y+height-margin}]})
var text = sub.onimport.draw(sub, {shape: svg.TEXT, points: [{x: x+width/2, y: y+height/2}], style: {inner: item.name||item.index.split(nfs.PT).pop()}}) var text = sub.onimport.draw(sub, {shape: svg.TEXT, points: [{x: x+width/2, y: y+height/2}], style: {inner: item.name||item.index.split(nfs.PT).pop()}})
item._rect = rect, item._text = text, can.core.ItemCB(can.ondetail, function(key, cb) { text[key] = rect[key] = function(event) { cb(event, can, sub, item) } }) item._rect = rect, item._text = text, can.core.ItemCB(can.ondetail, function(key, cb) { text[key] = rect[key] = function(event) { cb(event, can, sub, item) } })
if (item.status) { item._line && item._line.Value(html.CLASS, item.status), rect.Value(html.CLASS, item.status), text.Value(html.CLASS, item.status) } if (item.status) { item._line && item._line.Value(html.CLASS, item.status), rect.Value(html.CLASS, item.status), text.Value(html.CLASS, item.status) }
if (can.db.value.zone == can.db.hash[0] && item.hash == can.db.hash[1] && can.onexport.session(can, "profile.show") != ice.FALSE) { can.onmotion.delay(can, function() { can.onimport._profile(can, item) }) } if (can.db.value.zone == can.db.hash[0] && item.hash == can.db.hash[1] && can.onexport.session(can, "profile.show") != ice.FALSE) { can.onmotion.delay(can, function() { can.onimport._profile(can, item) }) }
}, },
}, [""]) layout: function(can) {
can.ui.layout(can.ConfHeight(), can.ConfWidth(), 0, function(height, width) {
var sub = can.db.value && can.db.value._toolkit_plugin
if (sub) { sub.onimport.size(sub, html.ACTION_HEIGHT, width/2, false), can.page.style(can, sub._target, html.LEFT, width/4) }
})
},
})
Volcanos(chat.ONACTION, { Volcanos(chat.ONACTION, {
/* _toolkit: [
list: ["create", "play", "prev", "next", "prev", "next",
["travel", "deep", "wide"], ["travel", "deep", "wide"],
["direct", "vertical", "horizon"], ["direct", "vertical", "horizon"],
[html.MARGIN, 10, 20, 40, 60], [html.MARGIN, 10, 20, 40, 60],
[html.HEIGHT, 80, 100, 120, 140, 200], [html.HEIGHT, 60, 80, 100, 120, 140, 200],
[html.WIDTH, 200, 240, 280, 400], [html.WIDTH, 200, 240, 280, 400],
["delay", 100, 200, 500, 1000], ["delay", 30, 100, 200, 500, 1000],
], _trans: {play: "播放", prev: "上一步", next: "下一步"}, ], _trans: {play: "播放", prev: "上一步", next: "下一步"},
*/
travel: function() {}, delay: function() {}, travel: function() {}, delay: function() {},
play: function(event, can) { var list = can.onexport.travel(can, can.db.value._root, true) play: function(event, can) { var list = can.onexport.travel(can, can.db.value._root, true)
can.core.List(list, function(item) { item._line && item._line.Value(html.CLASS, ""), item._rect.Value(html.CLASS, ""), item._text.Value(html.CLASS, "") }) can.core.List(list, function(item) { item._line && item._line.Value(html.CLASS, ""), item._rect.Value(html.CLASS, ""), item._text.Value(html.CLASS, "") })
@ -111,13 +127,6 @@ Volcanos(chat.ONACTION, {
can.core.List(list, function(item, index) { if (item == can.db.current) { next = list[index+1] } }), can.db.current = next can.core.List(list, function(item, index) { if (item == can.db.current) { next = list[index+1] } }), can.db.current = next
} can.ondetail._select(event, can, can.db.current) } can.ondetail._select(event, can, can.db.current)
}, },
show: function(event, can) { can.onmotion.toggle(can, can.ui.profile), can.onimport.layout(can) },
exec: function(event, can) { can.onmotion.toggle(can, can.ui.display), can.onimport.layout(can) },
clear: function(event, can) { if (can.onmotion.clearFloat(can)) { return }
if (can.page.isDisplay(can.ui.profile)) { return can.onmotion.hidden(can, can.ui.profile), can.onimport.layout(can) }
if (can.page.isDisplay(can.ui.display)) { return can.onmotion.hidden(can, can.ui.display), can.onimport.layout(can) }
can.onmotion.toggle(can, can.ui.project), can.onimport.layout(can)
},
plugin: function(event, can, msg) { can.ondetail._select(event, can, can.db.list[msg.Option(mdb.HASH)]) }, plugin: function(event, can, msg) { can.ondetail._select(event, can, can.db.list[msg.Option(mdb.HASH)]) },
}) })
Volcanos(chat.ONDETAIL, { Volcanos(chat.ONDETAIL, {

View File

@ -16,7 +16,7 @@ Volcanos(chat.ONIMPORT, {
]}]}, {view: [wiki.CONTENT, html.DIV, value.description]}, ]}]}, {view: [wiki.CONTENT, html.DIV, value.description]},
{view: html.ACTION, inner: value.action, _init: function(target) { can.onappend.mores(can, target, value, 5) }}, {view: html.ACTION, inner: value.action, _init: function(target) { can.onappend.mores(can, target, value, 5) }},
]} ]}
})), can.onappend.board(can, msg), can.onimport.layout(can), can.user.isWindows && can.onappend.scroll(can, can._output) })), can.onappend.board(can, msg), can.onimport.layout(can), can.user.isWindows && can.onappend.scroll(can)
}, },
layout: function(can) { can.onlayout.expand(can, can._output, can.user.isMobile && !can.user.isLandscape()? can.ConfWidth(): 320) }, layout: function(can) { can.onlayout.expand(can, can._output, can.user.isMobile && !can.user.isLandscape()? can.ConfWidth(): 320) },
}, [""]) }, [""])