1
0
forked from x/volcanos
This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-01-20 21:14:32 +08:00
parent a833ce5fc6
commit e76809d434
4 changed files with 27 additions and 14 deletions

View File

@ -298,7 +298,12 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
if (can.base.beginWith(item.value, nfs.PS, ice.HTTP)) { item.value = can.page.Format(html.A, item.value, item.value.split("?")[0]) } if (can.base.beginWith(item.value, nfs.PS, ice.HTTP)) { item.value = can.page.Format(html.A, item.value, item.value.split("?")[0]) }
if (keys[item.name]) { return can.Status(item.name, item.value) } keys[item.name] = item if (keys[item.name]) { return can.Status(item.name, item.value) } keys[item.name] = item
msg && item.name == cli.COST && (item.value = msg.Option(ice.MSG_COST)||item.value) msg && item.name == cli.COST && (item.value = msg.Option(ice.MSG_COST)||item.value)
msg && item.name == "msg" && (item.value = can.base.Size(item.value||msg._xhr.responseText.length)) msg && item.name == "msg" && (item.value = can.base.Size(item.value||msg._xhr? msg._xhr.responseText.length: 0))
if (item.name == mdb.COUNT && item.value == "0x0") {
var list = can.page.Select(can, can._output, "tbody>tr")
var _list = can.page.Select(can, list[0], "td")
item.value = list.length+"x"+_list.length
}
can.page.Append(can, status, [{view: html.ITEM, list: [ can.page.Append(can, status, [{view: html.ITEM, list: [
{text: [can.page.Color(can.user.trans(can, item.name, null, html.INPUT)), html.LABEL]}, {text: [": ", html.LABEL]}, {text: [(item.value == undefined? "": (item.value+"").trim())+"", html.SPAN, item.name]}, {text: [can.page.Color(can.user.trans(can, item.name, null, html.INPUT)), html.LABEL]}, {text: [": ", html.LABEL]}, {text: [(item.value == undefined? "": (item.value+"").trim())+"", html.SPAN, item.name]},
], onclick: item.onclick||function(event) { ], onclick: item.onclick||function(event) {

View File

@ -144,6 +144,7 @@ fieldset>div.action div.item.select:not(.cmds) { border-radius:var(--button-radi
fieldset>div.action div.item.select.cmds { border-bottom:var(--notice-bg-color) solid 2px; height:var(--action-height); } fieldset>div.action div.item.select.cmds { border-bottom:var(--notice-bg-color) solid 2px; height:var(--action-height); }
fieldset>div.output { width:100%; } fieldset>div.output { width:100%; }
fieldset>div.status { width:100%; } fieldset>div.status { width:100%; }
fieldset.rich>div.output>table.content { font-family:var(--code-font-family); }
fieldset.input>legend { display:none; } fieldset.input>legend { display:none; }
fieldset.input.key div.action { display:none; } fieldset.input.key div.action { display:none; }
fieldset.input.key div.output table.content { width:100%; } fieldset.input.key div.output table.content { width:100%; }

View File

@ -60,7 +60,8 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb) { can.page.requireModules
}, },
_resize: function(can, term, size) { can.runAction(can.request({}, size, term._item), web.RESIZE, [], function(msg) { _resize: function(can, term, size) { can.runAction(can.request({}, size, term._item), web.RESIZE, [], function(msg) {
if (msg.IsErr()) { can.misc.Warn(msg.Result()) } if (msg.IsErr()) { can.misc.Warn(msg.Result()) }
can.onexport.term(can, term) }) }, can.onexport.term(can, term)
}) },
_input: function(can, term, data) { _input: function(can, term, data) {
can.runAction(can.request({}, {rows: term.rows, cols: term.cols}, term._item), html.INPUT, [btoa(data)], function(msg) { can.runAction(can.request({}, {rows: term.rows, cols: term.cols}, term._item), html.INPUT, [btoa(data)], function(msg) {
if (msg.IsErr()) { can.misc.Warn(msg.Result()) } if (msg.IsErr()) { can.misc.Warn(msg.Result()) }
@ -162,8 +163,14 @@ Volcanos(chat.ONACTION, {
}) })
Volcanos(chat.ONEXPORT, {list: [mdb.TIME, mdb.HASH, mdb.TYPE, mdb.NAME, "rows", "cols", "cursorY", "cursorX"], Volcanos(chat.ONEXPORT, {list: [mdb.TIME, mdb.HASH, mdb.TYPE, mdb.NAME, "rows", "cols", "cursorY", "cursorX"],
term: function(can, term) { item = term._item term: function(can, term) { item = term._item
can.core.List(can.onexport.list, function(key) { can.Status(key, can.base.getValid(item[key], term[key], term.buffer.active[key], "")+"") }) can.core.List(can.onexport.list, function(key) {
can.core.List([mdb.TIME, mdb.HASH, mdb.TYPE, mdb.NAME], function(key) { can.Status(key, item[key]||"") }) if (key == mdb.TIME && !item[key]) { return }
can.Status(key, can.base.getValid(item[key], term[key], term.buffer.active[key], "")+"")
})
can.core.List([mdb.TIME, mdb.HASH, mdb.TYPE, mdb.NAME], function(key) {
if (key == mdb.TIME && !item[key]) { return }
can.Status(key, item[key]||"")
})
}, },
sess: function(can) { return can.page.Select(can, can._action, html.DIV_TABS, function(target) { function show(target) { sess: function(can) { return can.page.Select(can, can._action, html.DIV_TABS, function(target) { function show(target) {
var name = can.page.SelectOne(can, target._tabs, html.SPAN_NAME).innerText var name = can.page.SelectOne(can, target._tabs, html.SPAN_NAME).innerText
@ -172,10 +179,5 @@ Volcanos(chat.ONEXPORT, {list: [mdb.TIME, mdb.HASH, mdb.TYPE, mdb.NAME, "rows",
} else { var item = target._term._item; return {type: item.type, name: name, text: item.text, hash: item.hash} } } else { var item = target._term._item; return {type: item.type, name: name, text: item.text, hash: item.hash} }
} return show(target._output) }) }, } return show(target._output) }) },
title: function(can, term, title) { can.page.Modify(can, can.page.SelectOne(can, term._output._tabs, html.SPAN_NAME), title), can.Status(mdb.NAME, title), can.sup.onexport.title(can.sup, title) }, title: function(can, term, title) { can.page.Modify(can, can.page.SelectOne(can, term._output._tabs, html.SPAN_NAME), title), can.Status(mdb.NAME, title), can.sup.onexport.title(can.sup, title) },
recover: function(can) {
can.core.Item(can.db, function(hash, term) {
term.selectAll(), can.onexport.session(can, RECOVER_STORE+hash, can.base.trimSuffix(term.getSelection(), lex.NL)+lex.NL)
})
},
}) })
})() })()

View File

@ -24,15 +24,17 @@ Volcanos(chat.ONIMPORT, {
_hold: function(can, msg, arg) { can.user.toast(can, arg||ice.SUCCESS) }, _hold: function(can, msg, arg) { can.user.toast(can, arg||ice.SUCCESS) },
_back: function(can) { can.onimport.back({}, can) }, _back: function(can) { can.onimport.back({}, can) },
_rich: function(can, msg) { var sub = can.sub _rich: function(can, msg) { var sub = can.sub
function _rich() { if (sub._rich_list.length == 0) { return } if (sub._rich_running) { return } sub._rich_running = true function _rich() {
if (sub._rich_list.length == 0) { return } if (sub._rich_running) { return } sub._rich_running = true
var msg = sub._rich_list.shift(), list = msg.detail.slice(1) var msg = sub._rich_list.shift(), list = msg.detail.slice(1)
if (!sub._rich._table) { if (!sub._rich._table) {
for (var i = 1; i < msg.detail.length; i += 2) { msg.Push(msg.detail[i], msg.detail[i+1]) } for (var i = 1; i < msg.detail.length; i += 2) { msg.Push(msg.detail[i], msg.detail[i+1]) }
sub._rich._table = can.page.SelectOne(can, can.onappend.table(sub._rich, msg), html.TBODY) sub._rich._table = can.page.SelectOne(can, can.onappend.table(sub._rich, msg), html.TBODY)
} else { var list = [] } else { var list = []
for (var i = 1; i < msg.detail.length; i += 2) { list.push(msg.detail[i+1]) } for (var i = 1; i < msg.detail.length; i += 2) { list.push(can.page.Color(msg.detail[i+1])) }
var tr = can.page.Append(can, sub._rich._table, [{td: list}]).tr; sub._rich._output.scrollTop += 100000 var tr = can.page.Append(can, sub._rich._table, [{td: list}]).tr; sub._rich._output.scrollTop += 100000
can.onmotion.delayOnce(can, function() { can.onmotion.select(can, tr.parentNode, html.TR, tr) }, 500) can.onmotion.delayOnce(can, function() { can.onmotion.select(can, tr.parentNode, html.TR, tr) }, 500)
sub._rich.onappend._status(sub._rich, msg.Option(ice.MSG_STATUS), null, msg)
} can.core.Timer(msg.Option(cli.DELAY)||0, function() { sub._rich_running = false, _rich() }) } can.core.Timer(msg.Option(cli.DELAY)||0, function() { sub._rich_running = false, _rich() })
} }
if (sub._rich) { if (sub._rich) {
@ -41,7 +43,7 @@ Volcanos(chat.ONIMPORT, {
(sub._rich_list = sub._rich_list||[]).push(msg); if (sub._rich_list.length > 1) { return } (sub._rich_list = sub._rich_list||[]).push(msg); if (sub._rich_list.length > 1) { return }
} }
var height = can.onexport.outputHeight(can) var height = can.onexport.outputHeight(can)
can.onappend.plugin(can, {index: "can._filter", title: "table.js", height: height}, function(sub) { can.onappend.plugin(can, {title: msg.Option(ice.MSG_TITLE)||"table.js", index: "can._filter", height: height, style: "rich"}, function(sub) {
sub.onexport.output = function() { can.sub._rich = sub.sub, _rich(), can.onmotion.scrollIntoView(can, sub._target) } sub.onexport.output = function() { can.sub._rich = sub.sub, _rich(), can.onmotion.scrollIntoView(can, sub._target) }
}); return }); return
}, },
@ -50,9 +52,12 @@ Volcanos(chat.ONIMPORT, {
if (msg.Option(ctx.DISPLAY)) { if (msg.Option(ctx.DISPLAY)) {
function _grow() { if (can.sub._grow_list.length == 0) { return } if (can.sub._grow_running) { return } can.sub._grow_running = true function _grow() { if (can.sub._grow_list.length == 0) { return } if (can.sub._grow_running) { return } can.sub._grow_running = true
var msg = can.sub._grow_list.shift(), list = [], text = msg.detail[1]; for (var i = 0; i < text.length; i++) { list.push(text[i]) } var msg = can.sub._grow_list.shift(), list = [], text = msg.detail[1]; for (var i = 0; i < text.length; i++) { list.push(text[i]) }
can.core.Next(list, function(text, next) { can.core.Next(list, function(text, next) { sub._grow._size = (sub._grow._size||0)+text.length
text && text.match(/\n/g) && (sub._grow._count = (sub._grow._count||0)+text.match(/\n/g).length)
can.sub._grow.onimport.grow(can.sub._grow, msg, "only", text) can.sub._grow.onimport.grow(can.sub._grow, msg, "only", text)
can.core.Timer(msg.Option(cli.DELAY)||0, next) can.core.Timer(msg.Option(cli.DELAY)||0, next)
sub._grow.onappend._status(sub._grow, msg.Option(ice.MSG_STATUS), null, msg)
sub._grow.Status(mdb.COUNT, sub._grow._count), sub._grow.Status("msg", can.base.Size(sub._grow._size))
}, function() { can.sub._grow_running = false, _grow() }) }, function() { can.sub._grow_running = false, _grow() })
} }
if (can.sub._grow) { if (can.sub._grow) {
@ -61,7 +66,7 @@ Volcanos(chat.ONIMPORT, {
(can.sub._grow_list = can.sub._grow_list||[]).push(msg); if (can.sub._grow_list.length > 1) { return } (can.sub._grow_list = can.sub._grow_list||[]).push(msg); if (can.sub._grow_list.length > 1) { return }
} }
var height = can.onexport.outputHeight(can) var height = can.onexport.outputHeight(can)
can.onappend.plugin(can, {index: "can._filter", title: msg.Option(ctx.DISPLAY).split(nfs.PS).pop(), display: msg.Option(ctx.DISPLAY), height: height}, function(sub) { can.onappend.plugin(can, {title: msg.Option(ice.MSG_TITLE)||msg.Option(ctx.DISPLAY).split(nfs.PS).pop(), index: "can._filter", display: msg.Option(ctx.DISPLAY), height: height}, function(sub) {
sub.onexport.output = function() { can.onmotion.scrollIntoView(can, sub._target), can.sub._grow = sub.sub, _grow() } sub.onexport.output = function() { can.onmotion.scrollIntoView(can, sub._target), can.sub._grow = sub.sub, _grow() }
}); return }); return
} }