diff --git a/frame.js b/frame.js index 36682580..4a2f0f6f 100644 --- a/frame.js +++ b/frame.js @@ -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 (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 == "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: [ {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) { diff --git a/index.css b/index.css index fb8692f1..6592db58 100644 --- a/index.css +++ b/index.css @@ -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.output { 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.key div.action { display:none; } fieldset.input.key div.output table.content { width:100%; } diff --git a/plugin/local/code/xterm.js b/plugin/local/code/xterm.js index 42e26ecb..de153735 100644 --- a/plugin/local/code/xterm.js +++ b/plugin/local/code/xterm.js @@ -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) { if (msg.IsErr()) { can.misc.Warn(msg.Result()) } - can.onexport.term(can, term) }) }, + can.onexport.term(can, term) + }) }, _input: function(can, term, data) { 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()) } @@ -162,8 +163,14 @@ Volcanos(chat.ONACTION, { }) Volcanos(chat.ONEXPORT, {list: [mdb.TIME, mdb.HASH, mdb.TYPE, mdb.NAME, "rows", "cols", "cursorY", "cursorX"], 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([mdb.TIME, mdb.HASH, mdb.TYPE, mdb.NAME], function(key) { can.Status(key, item[key]||"") }) + can.core.List(can.onexport.list, function(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) { 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} } } 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) }, - 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) - }) - }, }) })() diff --git a/plugin/state.js b/plugin/state.js index bb603c62..1e013dca 100644 --- a/plugin/state.js +++ b/plugin/state.js @@ -24,15 +24,17 @@ Volcanos(chat.ONIMPORT, { _hold: function(can, msg, arg) { can.user.toast(can, arg||ice.SUCCESS) }, _back: function(can) { can.onimport.back({}, can) }, _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) if (!sub._rich._table) { 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) } 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 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() }) } 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 } } 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) } }); return }, @@ -50,9 +52,12 @@ Volcanos(chat.ONIMPORT, { 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 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.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() }) } 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 } } 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() } }); return }