diff --git a/frame.js b/frame.js index 3fad4034..10b91b34 100644 --- a/frame.js +++ b/frame.js @@ -278,7 +278,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { {type: "tr.line.select", style: [ITEM_HOVER_STYLE]}, {type: "tr.line", style: [ITEM_HOVER_STYLE]}, {type: "tr.line>td.line", style: [OUTPUT_STYLE]}, {type: "tr.line.select>td.line", style: [ITEM_HOVER_STYLE]}, {type: "div.complete>table", style: [TABLE_HEAD_STYLE]}, - {type: html.TABLE_CONTENT, list: [{type: html.TR, style: [TABLE_ROW_HOVER_STYLE]}]}, + {type: html.TABLE_CONTENT, list: [{type: html.TR, style: [INPUT_HOVER_STYLE, TABLE_ROW_HOVER_STYLE]}]}, {type: html.TABLE_CONTENT, list: [{type: html.TH, style: [TABLE_HEAD_STYLE]}]}, {type: html.TABLE_CONTENT, name: [html.ACTION], list: [{type: html.TD+":last-child", style: [TABLE_HEAD_STYLE]}]}, {type: html.TABLE_CONTENT, list: [{type: html.TD, name: [html.SELECT], style: [TABLE_CELL_HOVER_STYLE]}]}, @@ -357,7 +357,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { }) } }); return code.scrollBy && code.scrollBy(0, 10000), code }, tools: function(can, msg, cb, target) { - can.onimport.tool(can, can.base.Obj(msg.Option(ice.MSG_TOOLKIT), []).concat(can.misc.Search(can, log.DEBUG) == ice.TRUE? ["can.debug"]: []), cb, target) + can.onimport.tool(can, can.base.Obj(msg.Option(ice.MSG_TOOLKIT), []), cb, target) }, layout: function(can, target, type, list) { const FLOW = html.FLOW, FLEX = html.FLEX var count = 0, ui = {size: {}}; type = type||FLEX @@ -427,7 +427,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { var input = meta.action||mdb.KEY, path = chat.PLUGIN_INPUT+input+nfs._JS; can.require([path], function(can) { function _cb(sub, value, old) { if (value == old) { return } can.base.isFunc(cb)? cb(sub, value, old): target.value = value } can.core.ItemCB(can.onfigure[input], function(key, on) { var last = target[key]||function(){}; target[key] = function(event) { can.misc.Event(event, can, function(msg) { - function show(sub, cb) { can.base.isFunc(cb) && cb(sub, _cb), can.onlayout.figure(event, can, sub._target), can.onmotion.toggle(can, sub._target, true) } + function show(sub, cb) { can.base.isFunc(cb) && cb(sub, _cb), can.onlayout.figure(event, can, sub._target, false, 0.75), can.onmotion.toggle(can, sub._target, true) } can.core.CallFunc(on, {event: event, can: can, meta: meta, cb: _cb, target: target, sub: target._can, last: last, cbs: function(cb) { target._can? show(target._can, cb): can.onappend._init(can, {type: html.INPUT, name: input, style: meta.name, mode: chat.FLOAT}, [path], function(sub) { sub.Conf(meta) sub.run = function(event, cmds, cb) { var msg = sub.request(event) @@ -455,18 +455,11 @@ Volcanos(chat.ONLAYOUT, {_init: function(can, target) { target = target||can._ro can.page.style(can, document.body, kit.Dict(html.OVERFLOW, html.HIDDEN)) }, background: function(can, url, target) { can.page.style(can, target||can._root._target, "background-image", url == "" || url == "void"? "": 'url("'+url+'")') }, - figure: function(event, can, target, right) { if (!event || !event.target) { return {} } target = target||can._fields||can._target + figure: function(event, can, target, right, max) { if (!event || !event.target) { return {} } target = target||can._fields||can._target var rect = event.target == document.body? {left: can.page.width()/2, top: can.page.height()/2, right: can.page.width()/2, bottom: can.page.height()/2}: event.target.getBoundingClientRect() var layout = right? {left: rect.right, top: rect.top}: {left: rect.left, top: rect.bottom} - if (right) { - for (var p = event.target; p && p != document.body; p = p.parentNode) { - var _right = p.clientLeft+p.clientWidth+10 - // if (_right < layout.left) { layout.left = _right } - var _right = p.offsetLeft+p.offsetWidth+10 - } - } can.getActionSize(function(left, top, width, height) { left = left||0, top = top||0, height = can.base.Max(height, can.page.height()-top) - can.page.style(can, target, html.MAX_HEIGHT, can.base.Max(top+height-layout.top, height/2)) + can.page.style(can, target, html.MAX_HEIGHT, can.base.Max(top+height-layout.top, height*(max||0.5))) if (layout.top+target.offsetHeight > top+height) { layout.top = top+height-target.offsetHeight } if (layout.left+target.offsetWidth > left+width) { layout.left = left+width-target.offsetWidth } }); return can.onmotion.move(can, target, layout), layout diff --git a/index.css b/index.css index 9a903d65..5c513371 100644 --- a/index.css +++ b/index.css @@ -199,8 +199,8 @@ body.light fieldset.panel:not(.main) { background-color:#4a566e; color:#d0d3da; body.light fieldset.panel:not(.main) label { color:#d0d3da; } body.light fieldset.panel:not(.main) input { background-color:#6b7488; color:white; border-radius:5px; } body.light fieldset.panel:not(.main) input::placeholder { background-color:#6b7488; color:#d0d3da; } -body.light fieldset.panel:not(.main) div.item.select { background-color:#2b3446; color:white; } -body.light fieldset.panel:not(.main) div.item:hover { background-color:#2b3446; color:white; } +body.light fieldset.panel:not(.main):not(.auto) div.item.select { background-color:#2b3446; color:white; } +body.light fieldset.panel:not(.main):not(.auto) div.item:hover { background-color:#2b3446; color:white; } body.light fieldset.panel:not(.main)>div.output { background-color:#4a566e; color:#d0d3da; } body.light fieldset.panel:not(.main)>div.output div.state:hover { background-color:#2b3446; color:white; } body.light fieldset.panel:not(.main)>div.output div.title:hover { background-color:#2b3446; color:white; } @@ -241,9 +241,10 @@ body.mobile table.content th { padding:6px; } body.mobile table.content { width:100%; } body.mobile fieldset:not(.panel):not(.input)>div.action { display:none; } body.mobile fieldset.plugin:not(.float):not(.full):not(.cmd) { margin:10px 0; } -body.mobile fieldset.Header { font-size:1.6rem; padding:0; height:3rem; width:100%; position:fixed; top:0; } +body.mobile fieldset.Header { padding:0; width:100%; position:fixed; top:0; } +body.mobile fieldset.Header>div.output { font-size:1.6rem; line-height:3rem; height:3rem; } body.mobile fieldset.Header div.output div.search { padding:0; height:3rem; width:100%; margin:0; } -body.mobile fieldset.Header div.output div.search>input { background-color:#21181838; color:white; height:53px; width:100%; } +body.mobile fieldset.Header div.output div.search>input { font-size:2.2rem; background-color:#21181838; color:white; height:53px; width:100%; } body.mobile fieldset.River { min-width:240px; position:fixed; top:3rem; z-index:10; } body.mobile fieldset.River>div.output { font-size:1.6rem; width:320px; } body.mobile fieldset.Action { margin-top:3rem; margin-bottom:3rem; } @@ -271,7 +272,9 @@ fieldset.draw td.content { position:relative; } fieldset.draw div.output div.content svg { background-color:#1b5b738c; } fieldset.draw.spide div.output div.toggle { display:none; } fieldset.draw.trend div.output div.toggle { display:none; } -fieldset.web.code.git.status div.output table.content { width:100%; } +fieldset.web.code.git.status>div.output table.content { width:100%; } +fieldset.web.code.inner.cmd>div.output { overflow:hidden; } +fieldset.web.chat.iframe>div.output { overflow:hidden; } fieldset.can.view { font-size:14px; } fieldset.can.data { font-size:14px; } body.mobile fieldset.plugin>legend { border:none; } diff --git a/lib/user.js b/lib/user.js index 78178815..83619eae 100644 --- a/lib/user.js +++ b/lib/user.js @@ -102,6 +102,7 @@ Volcanos("user", {info: {}, agent: { function click(event, button) { can.misc.Event(event, can, function(msg) { can.onkeymap.prevent(event) meta[button]? meta[button](event, can, button): can.base.isFunc(cb)? cb(event, button, meta, carte): can.onaction && can.onaction[button] && can.core.CallFunc([can.onaction, button], [event, can, button]) + parent || can.onmotion.clearCarte(can) // , can.onmotion.delay(can, function() { carte._sub || can.page.Remove(can, ui._target) }) }) } function remove_sub(carte) { carte._sub && can.page.Remove(can, carte._sub._target), delete(carte._sub) } diff --git a/panel/footer.js b/panel/footer.js index f7ce7bde..95da282b 100644 --- a/panel/footer.js +++ b/panel/footer.js @@ -19,7 +19,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.ui = {}, can.db case cli.CLOSE: close(); break default: close(); var list = can.core.Split(event.target.value, ice.SP) can.onexport._float(can, "cli", list[0], list.slice(1), function(sub) { can.ui.cli.close = function() { can.page.Remove(can, sub._target), delete(can.ui.cli) } - can.getActionSize(function(left) { can.page.style(can, sub._target, html.LEFT, left, html.RIGHT, "") }) + can.getActionSize(function(left) { can.page.style(can, sub._target, html.LEFT, left+10, html.RIGHT, "") }) }) } }}, "", target, [chat.TITLE]) }, diff --git a/panel/header.css b/panel/header.css index 26d61a56..cbe37ee9 100644 --- a/panel/header.css +++ b/panel/header.css @@ -4,6 +4,7 @@ fieldset.Header>div.output div:hover { background-color:#2e515f; } fieldset.Header>div.output div.menu { padding:5px; } fieldset.Header>div.output div.title { padding:5px; } fieldset.Header>div.output div.state { padding:5px; float:right; } +fieldset.Header>div.output div.state.time { margin-left:10px; } fieldset.Header>div.output div.state.avatar { padding:0; } fieldset.Header>div.output div.state.avatar>img { height:31px; } fieldset.Header>div.output div.search.title { padding:0; margin-left:20px; } diff --git a/panel/river.js b/panel/river.js index 68c3eaf3..84e428d6 100644 --- a/panel/river.js +++ b/panel/river.js @@ -14,7 +14,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg) { can.onmotion.clear(can), ca _storm: function(can, meta, river) { return {text: [meta.name, html.DIV, html.ITEM], _init: function(target) { can.ui.storm_list[can.core.Keys(river, meta.hash)] = target }, onclick: function(event) { can.onaction.action(event, can, river, meta.hash) }, oncontextmenu: function(event) { can.onaction.carte(event, can, can.ondetail._menu, river, meta.hash) }, } }, - _menu: function(can, msg) { can.user.mod.isPod || can.onappend._action(can, can.onaction.list, can._action) }, + _menu: function(can, msg) { can.user.isMobile || can.user.mod.isPod || can.onappend._action(can, can.onaction.list, can._action) }, }) Volcanos(chat.ONACTION, {list: [mdb.CREATE, web.REFRESH, web.SHARE], _init: function(can) { can.onmotion.hidden(can) }, onlogin: function(can, msg) { can.run({}, [], function(msg) { if (msg.Option(ice.MSG_RIVER)) { return can.page.Remove(can, can._target) } diff --git a/panel/search.css b/panel/search.css index 3f43d3d3..93879266 100644 --- a/panel/search.css +++ b/panel/search.css @@ -1,4 +1,3 @@ -fieldset.Search { background-color:#041a25bd; padding:10px; display:none; position:fixed; left:0; top:31px; } +fieldset.Search { background-color:#041a25bd; padding:10px; position:fixed; left:230px; top:31px; } fieldset.Search>div.action>div.item.filter>input { width:320px; } fieldset.Search>div.status { display:block; } -fieldset.Search.panel fieldset.story>form.option input[type=button][name=close] { display:block; } diff --git a/panel/search.js b/panel/search.js index 3cda19f9..b17bd70a 100644 --- a/panel/search.js +++ b/panel/search.js @@ -1,57 +1,52 @@ -Volcanos(chat.ONIMPORT, {_init: function(can, msg) { can.onmotion.clear(can, can.ui.content), can.list = msg.Table() - var table = can.onappend.table(can, msg, function(value, key, index, line) { - return {text: [key == mdb.TEXT && can.base.isFunc(line.text) && line.text.help || value, html.TD], onclick: function(event) { - can.page.tagis(event.target, html.A) || can.onaction[can.type == mdb.FOREACH || event.ctrlKey? mdb.PLUGIN: mdb.SELECT](event, can, index) - }} - }, can.ui.content, can.base.getValid(msg.Option(ice.MSG_FIELDS).split(ice.FS), msg.append)); can.onmotion.story.auto(can), can.onimport._size(can, msg) - can.onmotion.focus(can, can.ui.word), msg.Length() == 1 && can.ui.profile.innerHTML == "" && can.page.Select(can, table, html.TD)[0].click() +Volcanos(chat.ONIMPORT, {_init: function(can, msg) { can.onmotion.clear(can, can.ui.content) + var table = can.onappend.table(can, msg, function(value, key, index, data) { return {text: [can.base.isFunc(value) && value.help || value, html.TD], onclick: function(event) { + can.page.tagis(event.target, html.A) || can.onaction[can.db.type == mdb.FOREACH || event.ctrlKey? mdb.PLUGIN: mdb.SELECT](event, can, data) + }} }, can.ui.content, can.base.getValid(msg.Option(ice.MSG_FIELDS).split(ice.FS), msg.append)); can.onmotion.story.auto(can), can.onimport._size(can) + can.onmotion.toggle(can, can._status, can.db.type != mdb.FOREACH) && can.onappend._status(can, can.base.Obj(msg.Option(ice.MSG_STATUS), []).concat({name: mdb.SELECT, value: "0"})) + can.onmotion.focus(can, can.ui.filter), msg.Length() == 1 && can.ui.profile.innerHTML == "" && can.page.Select(can, table, html.TD)[0].click() }, - _size: function(can, msg) { - can.getActionSize(function(left, top, width, height) { can.page.style(can, can._target, {left: left||0, top: top||0, width: width}) - can.ConfHeight(can.base.Max(height-2*html.PLUGIN_MARGIN-2*html.ACTION_HEIGHT-can.ui.content.offsetHeight-can.ui.display.offsetHeight, 480)), can.ConfWidth(width-2*html.PLUGIN_MARGIN) - can.core.List([can.ui.content, can.ui.display], function(target) { can.page.style(can, target, html.MAX_WIDTH, can.ConfWidth()) }) - can.page.style(can, can._output, html.MAX_HEIGHT, height-2*html.PLUGIN_MARGIN-2*html.ACTION_HEIGHT+1) - }), can.onappend._status(can, can.base.Obj(msg.Option(ice.MSG_STATUS), []).concat({name: mdb.SELECT, value: "0"})) + _size: function(can) { can.getActionSize(function(left, top, width, height) { + can.page.style(can, can._target, {left: left||0, top: top||0, width: width}), can.page.style(can, can._output, html.MAX_HEIGHT, height -= 2*html.PLUGIN_MARGIN+html.ACTION_HEIGHT+can.onexport.statusHeight(can)-1) + can.core.List([can.ui.content, can.ui.display], function(target) { can.page.style(can, target, html.MAX_WIDTH, can.ConfWidth(width-2*html.PLUGIN_MARGIN)) }) + can.ConfHeight(can.base.Min(height-can.ui.content.offsetHeight-can.ui.display.offsetHeight+can.onexport.statusHeight(can), 320)) + }) }, + _input: function(can, msg, arg, fields) { if (can.base.contains(arg[1], ";")) { arg = can.core.Split(arg[1], "\t ;", "\t ;") } + can.run(can.request({}, {fields: fields.join(ice.FS)}, msg), arg, function(res) { can.db.type = arg[0] + res.Option(ice.ARG, arg), can.onengine.signal(can, chat.ONSEARCH, res), can.onimport._init(can, res) + }), can.onmotion.toggle(can, can._target, true) }, - _word: function(can, msg, arg, fields) { if (can.base.contains(arg[1], ";")) { var ls = can.core.Split(arg[1], "\t ;", "\t ;"); arg[0] = ls[0], arg[1] = ls[1] } - can.run(can.request({}, {fields: fields.join(ice.FS)}, msg), arg, function(res) { res.Option(ice.ARG, arg) - can.onengine.signal(can, chat.ONSEARCH, res), can.type = arg[0], can.onimport._init(can, res) - }), can.onmotion.show(can) - }, - select: function(can, msg, cmds, cb) { can.ui.word.value = cmds[1], can.input = function(event, word) { cmds[1] = word||cmds[1]; can.onimport._word(can, msg, cmds, fields) } - var fields = (cmds[2]||msg.Option(ice.MSG_FIELDS)||"ctx,cmd,type,name,text").split(ice.FS); can.page.Appends(can, can.ui.display, [{th: fields}]), can.onmotion.hidden(can, can.ui.display) - can.cb = function() { can.base.isFunc(cb) && cb(can.onexport.select(can)), can.onmotion.hide(can) }, can._plugins = [], can.onimport._word(can, msg, cmds, fields) + select: function(can, msg, cmds, cb) { can.ui.filter.value = cmds[1], can.ui.input = function(event, word) { cmds[1] = word||cmds[1]; can.onimport._input(can, msg, cmds, fields) } + var fields = (cmds[2]||msg.Option(ice.MSG_FIELDS)||"ctx,cmd,type,name,text").split(ice.FS); can.page.Appends(can, can.ui.display, [{th: fields}]), can.onmotion.hidden(can, can.ui.display), can.onmotion.clear(can, can.ui.profile) + can.ui.done = function() { can.base.isFunc(cb) && cb(can.onexport.select(can)), can.onmotion.hide(can) }, can.db = {}, can._plugins = [], can.onimport._input(can, msg, cmds, fields) }, }) Volcanos(chat.ONACTION, {_init: function(can) { can.onmotion.hidden(can) }, list: [cli.CLOSE, cli.CLEAR, cli.DONE], onlogin: function(can, msg) { can.ui = can.page.Append(can, can._output, [chat.CONTENT, {view: [[chat.DISPLAY, chat.CONTENT], html.TABLE]}, chat.PROFILE]) - can.onappend._action(can, (can.Conf(html.ACTION)||can.onaction.list).concat({type: html.TEXT, name: html.FILTER, _init: function(target) { can.ui.word = target }, onkeydown: function(event) { - if (event.key == lang.ENTER) { can.onkeymap.prevent(event) - if (event.shiftKey) { var first = can.page.Select(can, can.ui.content, html.TR)[1]; return can.onaction[can.type == mdb.FOREACH? mdb.PLUGIN: html.SELECT](event, can, first.dataset.index) } - return event.ctrlKey? can.onaction[cli.DONE](event, can): can.input(event, event.target.value) - } if (event.key == lang.ESCAPE) { return can.onmotion.hide(can) } - if (event.ctrlKey) { return event.key == "0"? can.onaction.clear(event, can): can.onkeymap.selectCtrlN(event, can, can.ui.content, [html.TBODY, html.TR], function(target) { target.firstChild.click() }) } - event.key.length == 1 && can.onmotion.delayOnce(can, function() { can.onmotion.tableFilter(can, can.ui.content, event.target.value+event.key) }, 300, can._delay_filter = can._delay_filter||[]) + can.onappend._action(can, (can.Conf(html.ACTION)||can.onaction.list).concat({type: html.TEXT, name: html.FILTER, _init: function(target) { can.ui.filter = target }, onkeydown: function(event) { + if (event.key == lang.ESCAPE) { return event.target.blur() } + if (event.key == lang.ENTER) { can.onkeymap.prevent(event); if (event.shiftKey) { return can.page.SelectOne(can, can.ui.content, [html.TBODY, html.TR, html.TD], function(target) { target.click() }) } + return event.ctrlKey? can.onaction.done(event, can): can.ui.input(event, event.target.value) + } if (event.ctrlKey) { return event.key == "0"? can.onaction.clear(event, can): can.onkeymap.selectCtrlN(event, can, can.ui.content, [html.TBODY, html.TR], function(target) { target.firstChild.click() }) } + event.key.length == 1 && can.onmotion.delayOnce(can, function() { can.onmotion.tableFilter(can, can.ui.content, event.target.value) }, 100, can._delay_filter = can._delay_filter||[]) }})) }, onopensearch: function(can, msg, type, word) { can.onimport.select(can, msg, [type||mdb.FOREACH, word||""]) }, close: function(event, can) { can.onmotion.hide(can) }, clear: function(event, can) { can.onmotion.clear(can, can.ui.profile) }, - done: function(event, can) { can.base.isFunc(can.cb) && can.cb() }, - plugin: function(event, can, index) { var line = can.list[index]; if (can.base.isFunc(line.text)) { return can.onmotion.hide(can), line.text(event) } - var cmd = line.cmd == ctx.COMMAND? can.core.Keys(line.type, line.name.split(ice.SP)[0]): can.core.Keys(line.ctx, line.cmd) - can.onappend.plugin(can, {index: cmd||msg.Option(mdb.INDEX), args: cmd == web.WIKI_WORD? [line.name]: []}, function(sub, meta) { can._plugins = (can._plugins||[]).concat(sub) - sub.onimport.size(sub, can.ConfHeight(), can.ConfWidth(), true) - can.onmotion.delay(can, function() { sub.Focus() }) + done: function(event, can) { can.base.isFunc(can.ui.done) && can.ui.done() }, + select: function(event, can, data) { if (can.base.isFunc(data.text)) { return can.onmotion.hide(can), data.text(event) } + var fields = can.page.Select(can, can.ui.display, html.TH, function(item) { return item.innerText }); can.onmotion.toggle(can, can.ui.display, true) + var ui = can.page.Append(can, can.ui.display, [{td: can.core.List(fields, function(item) { return data[item] }), onclick: function(event) { + can.page.Remove(can, ui.target), can.Status(mdb.SELECT, can.page.Select(can, can.ui.display, [html.TBODY, html.TR]).length) + }}])._target; can.Status(mdb.SELECT, can.page.Select(can, can.ui.display, [html.TBODY, html.TR]).length) + }, + plugin: function(event, can, data) { if (can.base.isFunc(data.text)) { return can.onmotion.hide(can), data.text(event) } + var cmd = data.cmd == ctx.COMMAND? can.core.Keys(data.type, data.name.split(ice.SP)[0]): can.core.Keys(data.ctx, data.cmd) + can.onappend.plugin(can, {index: cmd||msg.Option(mdb.INDEX), args: cmd == web.WIKI_WORD? [data.name]: []}, function(sub) { can._plugins = (can._plugins||[]).concat(sub) + sub.onimport.size(sub, can.ConfHeight(), can.ConfWidth(), true), sub.Focus() }, can.ui.profile) }, - select: function(event, can, index) { var line = can.list[index]; if (can.base.isFunc(line.text)) { return can.onmotion.hide(can), line.text(event) } - var fields = can.page.Select(can, can.ui.display, html.TH, function(item) { return item.innerText }); can.onmotion.toggle(can, can.ui.display, true) - can.page.Append(can, can.ui.display, [{td: can.core.List(fields, function(item) { return line[item] }), data: {index: index}, onclick: function(event) { - can.page.Remove(can, event.target.parentNode), can.Status(mdb.SELECT, can.page.Select(can, can.ui.display, html.TR).length-1) - }}]), can.Status(mdb.SELECT, can.page.Select(can, can.ui.display, html.TR).length-1) - }, }) -Volcanos(chat.ONEXPORT, { +Volcanos(chat.ONEXPORT, {statusHeight: function(can) { return can.db.type == mdb.FOREACH? html.ACTION_HEIGHT: 0 }, select: function(can) { return can.page.Select(can, can.ui.display, html.TR, function(tr) { return can.page.Select(can, tr, html.TD, function(td) { return td.innerHTML }) }).slice(1) }, }) diff --git a/plugin/local/chat/iframe.js b/plugin/local/chat/iframe.js index 66802960..770e18f3 100644 --- a/plugin/local/chat/iframe.js +++ b/plugin/local/chat/iframe.js @@ -1,4 +1,6 @@ -Volcanos(chat.ONIMPORT, {_init: function(can, msg) { can.current = msg.TableDetail(), can.onimport.layout(can) }, +Volcanos(chat.ONIMPORT, {_init: function(can, msg) { + can.current = msg.TableDetail(), can.onimport.layout(can) + }, layout: function(can) { var item = can.current; can.sup.onexport.title(can, item.name||item.link.split("?")[0]) can.page.Appends(can, can._output, [{type: html.IFRAME, src: item.link, height: can.ConfHeight(), width: can.ConfWidth(), style: {border: 0}}]) }, diff --git a/plugin/local/code/inner.js b/plugin/local/code/inner.js index 8d1daa07..fbae64ed 100644 --- a/plugin/local/code/inner.js +++ b/plugin/local/code/inner.js @@ -38,7 +38,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl can.db._key_list = can.onkeymap._parse(event, can, mdb.PLUGIN, can.db._key_list, can.ui.content) }) }, _tabs: function(can) { if (!can.isCmdMode()) { return can.ui.tabs = can._action } - can.core.List([{name: can.page.unicode.menu, onclick: function() { can.user.carte(event, can, can.onaction, can.onaction.list) }}, + can.core.List([{name: can.page.unicode.menu, onclick: function() { can.user.carte(event, can, can.onaction, can.onaction.list.concat(can.user.isWebview? ["录屏", "编辑器", "浏览器"]: [])) }}, {name: can.page.unicode.back, style: {"font-size": "14px", "margin-top": "3px"}, onclick: function(event) { var list = {}; can.user.carte(event, can, {_style: "history"}, can.core.List(can.db.history, function(item) { var value = [item.path, item.file, item.line, ice.TB+(item.text&&item.text.length>30? item.text.slice(0, 30)+"...": item.text||"")].join(ice.DF); if (!list[value]) { list[value] = item; return value } @@ -54,7 +54,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl }}, ], function(item) { can.page.Append(can, can.ui.tabs, [can.base.Copy(item, {view: [[html.ICON, web.WEBSITE], html.DIV, item.name]})]) }) can.user.isMobile || can.page.Append(can, can.ui.tabs, [{view: mdb.TIME, _init: function(target) { - can.core.Timer({interval: 100}, function() { can.page.Modify(can, target, can.user.time(can, null, "%y-%m-%d %H:%M:%S %w")) }) + can.core.Timer({interval: 100}, function() { can.page.Modify(can, target, can.user.time(can, null, "%H:%M:%S %w")) }) can.onappend.figure(can, {action: "date", _hold: true}, target, function(sub, value) {}) }}]), can.user.info.avatar && can.page.Append(can, can.ui.tabs, [{view: aaa.AVATAR, list: [{img: can.user.info.avatar}]}]) }, @@ -283,14 +283,13 @@ Volcanos(chat.ONSYNTAX, {_init: function(can, msg, cb) { return can.base.isFunc(cb) && cb(msg._content = can.page.insertBefore(can, [{view: [html.CONTENT, html.IFRAME], src: can.misc.MergePodCmd(can, {pod: can.Option(nfs.FILE)}), height: can.ui.content.offsetHeight, width: can.ui.content.offsetWidth}], can.ui._content)) } var index = msg.Option(ctx.INDEX).split(ice.FS), meta = {type: chat.STORY, index: index[0], args: index.slice(1)} - return can.onimport.plug(can, meta, function(sub) { - sub.onimport.size(sub, can.ui.content.offsetHeight, can.ui.content.offsetWidth, true) + return can.onimport.plug(can, meta, function(sub) { sub.onimport.size(sub, can.ui.content.offsetHeight, can.ui.content.offsetWidth, true) sub.onimport._open = function(sub, msg, arg) { var url = can.base.ParseURL(arg), ls = url.origin.split("/chat/pod/") arg.indexOf(location.origin) == 0 && ls.length > 1? can.onimport.tabview(can, can.Option(nfs.PATH), ls[1].split(ice.PS)[0], web.DREAM): can.user.open(arg), sub.Update() } sub.onaction["打开链接"] = function() { can.onimport.tabview(can, can.Option(nfs.PATH), [meta.index].concat(sub.Input([], false)).join(ice.FS), ctx.INDEX) } sub.onaction.close = function() { can.onaction.back(can), msg._tab._close() } - sub.onexport.title = function(_, title) { can.page.Modify(can, msg._tab, title) } + sub.onexport.title = function(_, title) { can.page.Modify(can, can.page.SelectOne(can, msg._tab, "span.name"), title) } sub.onexport.record = function(_, value, key, line) { line.path && can.onimport.tabview(can, line.path, line.file, line.line); return true } sub.onexport.output = function() { can.onimport.layout(can) } msg._plugin = sub, can.base.isFunc(cb) && cb(msg._content = sub._target), sub.Focus() @@ -318,7 +317,7 @@ Volcanos(chat.ONSYNTAX, {_init: function(can, msg, cb) { }).join("")); return line }, }) -Volcanos(chat.ONACTION, {list: ["首页", "官网", "调试", "百度", "录屏", "编辑器", "浏览器"], +Volcanos(chat.ONACTION, {list: ["首页", "官网", "调试", "百度"], _getLine: function(can, line) { return can.page.Select(can, can.ui.content, "tr.line>td.line", function(td, index) { if (td.parentNode == line || index+1 == line) { return td.parentNode } })[0] }, _getLineno: function(can, line) { return can.page.Select(can, can.ui.content, "tr.line>td.line", function(td, index) { if (td.parentNode == line || index+1 == line) { return index+1 } })[0] }, appendLine: function(can, value) { var ui = can.page.Append(can, can.ui._content, [{view: [nfs.LINE, html.TR], list: [ diff --git a/plugin/local/code/vimer.js b/plugin/local/code/vimer.js index bf0fd0c4..4baa097b 100644 --- a/plugin/local/code/vimer.js +++ b/plugin/local/code/vimer.js @@ -107,13 +107,13 @@ Volcanos(chat.ONACTION, { "扩展": function(event, can) { can.user.input(can.request(event, {action: "extension"}), can, ["url"], function(list) { var sub = can.db.toolkit[list[0]]; sub? sub.select(): can.onimport.exts(can, list[0]) }) }, - "首页": function(event, can) { can.user.open(location.origin) }, + "首页": function(event, can) { can.user.open(location.origin+"?debug=true") }, "官网": function(event, can) { can.user.open("https://shylinux.com/") }, "调试": function(event, can) { can.user.opens(location.href.replace("debug=true", "debug=false")) }, "百度": function(event, can) { can.user.opens("https://baidu.com/") }, - "录屏": function(event, can) { can.user.isWebview && window.openapp("QuickTime Player") }, - "编辑器": function(event, can) { can.user.isWebview && window.opencmd("cd ~/contexts; vim +"+can.Option(nfs.LINE)+" "+can.Option(nfs.PATH)+can.Option(nfs.FILE)) }, - "浏览器": function(event, can) { can.user.isWebview && window.openurl(location.href) }, + "录屏": function(event, can) { window.openapp("QuickTime Player") }, + "编辑器": function(event, can) { window.opencmd("cd ~/contexts; vim +"+can.Option(nfs.LINE)+" "+can.Option(nfs.PATH)+can.Option(nfs.FILE)) }, + "浏览器": function(event, can) { window.openurl(location.href) }, _complete: function(event, can, target) { if (event == undefined || event.type == "click") { return } target = target||can.ui.complete var pre = can.ui.current.value.slice(0, can.ui.current.selectionStart), key = can.core.Split(pre, "\t .[]", ice.SP).pop()||"", end = can.ui.current.value.slice(can.ui.current.selectionStart) @@ -195,6 +195,7 @@ Volcanos(chat.ONKEYMAP, { r: shy("执行命令", function(event, can) { can.onaction.exec(event, can) }), v: shy("渲染界面", function(event, can) { can.onaction.show(event, can) }), f: shy("打开文件", function(event, can) { can.onaction.open(event, can) }), + " ": shy("打开文件", function(event, can) { can.onaction.open(event, can) }), l: shy("打开右边标签", function(can) { var next = can._tab.nextSibling; next && next.click() }), h: shy("打开左边标签", function(can) { var prev = can._tab.previousSibling; prev && prev.click() }), x: shy("关闭标签", function(can) { can._tab._close() }), diff --git a/plugin/table.js b/plugin/table.js index 2f82fed6..ceeec996 100644 --- a/plugin/table.js +++ b/plugin/table.js @@ -34,7 +34,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear( function close(target) { var next = target.nextSibling||target.previousSibling; if (!next) { return } next.click(), can.onmotion.delay(can, function() { can.base.isFunc(cbs) && cbs(tabs), can.page.Remove(can, target) }) } - return {view: html.TABS, title: tabs.text, list: [{text: [tabs.name, html.SPAN]}, {text: [can.page.unicode.delete, html.SPAN, html.ICON], onclick: function(event) { + return {view: html.TABS, title: tabs.text, list: [{text: [tabs.name, html.SPAN, mdb.NAME]}, {text: [can.page.unicode.delete, html.SPAN, html.ICON], onclick: function(event) { close(tabs._target), can.onkeymap.prevent(event) }}], onclick: function(event) { can.onmotion.select(can, action, html.DIV_TABS, tabs._target), can.base.isFunc(cb) && cb(event, tabs) diff --git a/proto.js b/proto.js index ffb33b4b..d27ee9b6 100644 --- a/proto.js +++ b/proto.js @@ -341,12 +341,13 @@ try { if (typeof(window) == lang.OBJECT) { // chrome case nfs.CSS: var item = document.createElement(mdb.LINK); item.href = url+Volcanos.meta.version, item.rel = "stylesheet", item.onload = cb, document.head.appendChild(item); break case nfs.JS: var item = document.createElement(nfs.SCRIPT); item.src = url+Volcanos.meta.version, item.onerror = cb, item.onload = cb, document.body.appendChild(item); break } } - Volcanos.meta._init = function(can) { var last = can.page.width() < can.page.height(); window.onresize = function(event) { can.misc.Event(event, can, function(msg) { - if (can.user.isMobile && last === can.page.width() < can.page.height()) { return } last = can.page.width() < can.page.height() - can.onmotion.delayOnce(can, function() { - can.onengine.signal(can, chat.ONRESIZE, can.request(event, kit.Dict(html.HEIGHT, window.innerHeight, html.WIDTH, window.innerWidth))) - }, 300, can._delay_resize = can._delay_resize||[]) - }) } } + window.onerror = function(message, source, lineno, colno, error) { window._version && alert([[source, lineno, colno].join(ice.DF), message].join(ice.NL)) } + Volcanos.meta._init = function(can) { window.onerror = function(message, source, lineno, colno, error) { can.misc.Error(message, source, lineno, colno, error) } + var last = can.page.width() < can.page.height(); window.onresize = function(event) { can.misc.Event(event, can, function(msg) { + if (can.user.isMobile && last === can.page.width() < can.page.height()) { return } last = can.page.width() < can.page.height() + can.onmotion.delayOnce(can, function() { can.onengine.signal(can, chat.ONRESIZE, can.request(event, kit.Dict(html.HEIGHT, window.innerHeight, html.WIDTH, window.innerWidth))) }, 300, can._delay_resize = can._delay_resize||[]) + }) } + } } else { // nodejs global.kit = kit, global.ice = ice global.ctx = ctx, global.mdb = mdb, global.web = web, global.aaa = aaa