diff --git a/frame.js b/frame.js index ac9f1cfc..57c04e11 100644 --- a/frame.js +++ b/frame.js @@ -70,7 +70,6 @@ Volcanos(chat.ONENGINE, {_init: function(can, meta, list, cb, target) { can.requ }), signal: function(can, name, msg) { msg = msg||can.request(); var _msg = name == chat.ONREMOTE? msg.Option("_msg"): msg _msg.Option(ice.LOG_DISABLE) == ice.TRUE || can.misc.Log(name, can._name, (msg._cmds||[]).join(lex.SP), name == chat.ONMAIN? can: _msg) - // _msg.Option(ice.LOG_DISABLE) == ice.TRUE || can.misc.Log(name, can._name, (msg._cmds||[]).join(lex.SP), name == chat.ONMAIN? can: _msg, _msg._can._target) return can.core.List(can.onengine.listen.meta[name], function(cb) { can.core.CallFunc(cb, {event: msg._event, msg: msg}) }).length, msg }, }) @@ -146,6 +145,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { msg.RunAction(event, can.core.Value(sub, chat._OUTPUTS_CURRENT), [ctx.ACTION, button]) || msg.RunAction(event, sub, [ctx.ACTION, button]) || sub.runAction(event, button) }) }) }), can.base.isFunc(cb) && cb(sub) + if (can.user.isMobile && !can.user.isLandscape()) { return } sub.isCmdMode() && !can.base.isIn(meta.index, web.CODE_VIMER, web.CODE_INNER, web.WIKI_WORD) && can.page.insertBefore(can, can.user.header(can), sub._output, sub._fields) }); return sub }, @@ -194,9 +194,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { }, _action: function(can, list, action, meta) { meta = meta||can.onaction||{}, action = action||can._action, can.onmotion.clear(can, action) function run(event, button) { can.misc.Event(event, can, function(msg) { var _can = can._fields? can.sup: can - var cb = meta[button]||meta[chat._ENGINE]; cb? can.core.CallFunc(cb, {event: event, can: can, button: button}): - can.run(event, [ctx.ACTION, button].concat(_can.Input())) - // can.run(event, [ctx.ACTION, button].concat(_can.Input()), function(msg) { can.core.CallFunc([_can, chat.ONIMPORT, ice.MSG_PROCESS], {can: _can, msg: msg}) }) + var cb = meta[button]||meta[chat._ENGINE]; cb? can.core.CallFunc(cb, {event: event, can: can, button: button}): can.run(event, [ctx.ACTION, button].concat(_can.Input())) }) } return can.core.List(can.page.inputs(can, can.base.getValid(can.base.Obj(list), can.core.Value(can, [chat.ONACTION, mdb.LIST]), meta != can.onaction? can.core.Item(meta): [])||[]), function(item) { can.base.isUndefined(item) || can.onappend.input(can, item == ""? /* 1.空白 */ {type: html.BR}: @@ -206,8 +204,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { var button = event.target.value; meta[item[0]]? can.core.CallFunc(meta[item[0]], [event, can, item[0], button]): meta[button] && can.core.CallFunc(meta[button], [event, can, button]) }) }}: /* 4.其它 */(item.type == html.BUTTON && (item.value = item.value||can.user.trans(can, item.name, meta._trans), item.onclick = item.onclick||function(event) { run(event, item.name) - }, item._init = item._init||function(target) { - if (can.page.ClassList.has(can, can._target, chat.PANEL)) { return } + }, item._init = item._init||function(target) { if (!can.page.ClassList.has(can, can._target, chat.STORY)) { return } if (can.base.isIn(item.name, mdb.CREATE, mdb.INSERT)) { can.onappend.style(can, "icons", target.parentNode) can.page.Append(can, target.parentNode, [{icon: item.name, onclick: function(event) { can.Update(event, [ctx.ACTION, item.name]) }}]) } @@ -247,11 +244,9 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { can.core.CallFunc([sub, chat.ONIMPORT, chat._INIT], {can: sub, msg: msg, cb: function(msg) { action === false || can.onmotion.clear(can, can._action), sub.onappend._action(sub, can.Conf(ice.MSG_ACTION)||msg.Option(ice.MSG_ACTION), action||can._action) action === false || sub.onappend._status(sub, sub.onexport&&sub.onexport.list||msg.Option(ice.MSG_STATUS)), can.user.isMobile || sub.onappend.tools(sub, msg) - can.isCmdMode() && can.onappend.style(can, can.misc.Search(can, ctx.STYLE), can._target) - can.page.style(can, can._output, html.HEIGHT, "", html.WIDTH, "") - can.onappend.style(sub, sub.Conf(ctx.STYLE)) + // can.isCmdMode() && can.onappend.style(can, can.misc.Search(can, ctx.STYLE), can._target) + can.page.style(can, can._output, html.HEIGHT, "", html.WIDTH, ""), can.onappend.style(sub, sub.Conf(ctx.STYLE)) if (can.isFullMode() || can.isCmdMode()) { can.onimport.size(can, can.page.height(), can.page.width(), true) } - // can.core.List([chat.FLOAT], function(mode) { can.page.ClassList.has(can, can._target, mode) && sub.onlayout[mode](sub) }) can.onmotion.story.auto(can, can._output), can.onexport.output(can, msg), can.base.isFunc(cb) && cb(msg) }, target: output}) }) @@ -472,7 +467,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { }, _float: function(can, index, args, cb) { can.onappend.plugin(can, {index: index, args: args, mode: chat.FLOAT}, function(sub) { can.getActionSize(function(left, top, width, height) { var offset = can.user.isMobile? 0: height/4 - sub.onimport.size(sub, sub.ConfHeight(height-offset)-html.ACTION_HEIGHT, sub.ConfWidth(width), true) + sub.onimport.size(sub, sub.ConfHeight(height-offset)-html.ACTION_HEIGHT, sub.ConfWidth(can.base.Max(width, 800)), true) can.onmotion.move(can, sub._target, {left: left||0, top: (top||0)+offset}), can.base.isFunc(cb) && cb(sub) }), sub.onaction.close = function() { can.page.Remove(can, sub._target) } }, can._root._target) }, @@ -504,9 +499,13 @@ Volcanos(chat.ONLAYOUT, {_init: function(can, target) { target = target||can._ro }) can.page.SelectChild(can, target, html.FIELDSET_MAIN, function(field) { can.page.SelectChild(can, field, html.DIV_ACTION, function(action) { height -= action.offsetHeight }) + if (can.user.isMobile && can.user.isLandscape()) { return } can.page.SelectChild(can, field, html.DIV_OUTPUT, function(output) { can.page.styleHeight(can, output, height) }) }), can.onengine.signal(can, chat.ONSIZE, can.request({}, {height: height, width: width})) - can.page.style(can, document.body, kit.Dict(html.OVERFLOW, html.HIDDEN)) + can.user.isMobile && can.user.isLandscape() || can.page.style(can, document.body, kit.Dict(html.OVERFLOW, html.HIDDEN)) + }, + expand: function(can, target, width) { var n = parseInt(target.offsetWidth/(width+20)); width = target.offsetWidth/n - 20 + can.page.SelectChild(can, target, "*", function(target) { can.page.styleWidth(can, target, width) }) }, 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, max) { if (!event || !event.target) { return {} } target = target||can._fields||can._target @@ -521,7 +520,13 @@ Volcanos(chat.ONLAYOUT, {_init: function(can, target) { target = target||can._ro if (!right) { can.page.style(can, target, html.MAX_HEIGHT, max? height*max: top+height-layout.top) } 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 } + if (layout.left >= left+width) { + if (can.page.tagis(event.target, html.SPAN)) { + layout.left = left+width-target.offsetWidth-event.target.parentNode.offsetWidth + } else { + layout.left = left+width-target.offsetWidth-event.target.offsetWidth + } + } else if (layout.left+target.offsetWidth > left+width) { layout.left = left+width-target.offsetWidth } }); return can.onmotion.move(can, target, layout), layout }, }) @@ -638,22 +643,7 @@ Volcanos(chat.ONMOTION, {_init: function(can, target) { can.user.copy(event, can, target.innerText), can.base.isFunc(cb) && cb(event) can.onkeymap.prevent(event) } }, - move: function(can, target, layout) { var begin; layout = layout||{} - can.page.style(can, target, layout), target.onmousedown = function(event) { - if (event.target != target && !event.ctrlKey) { return } can.onkeymap.prevent(event) - layout.height = target.offsetHeight, layout.width = target.offsetWidth - layout.left = target.offsetLeft, layout.top = target.offsetTop - begin = can.base.Copy({x: event.x, y: event.y}, layout) - }, target.onmouseup = function(event) { begin = null }, target.onmousemove = function(event) { if (!begin) { return } - if (event.shiftKey) { - layout.height = begin.height + event.y - begin.y, layout.width = begin.width + event.x - begin.x - can.page.style(can, target, html.HEIGHT, layout.height, html.WIDTH, layout.width) - } else { - layout.left = begin.left + event.x - begin.x , layout.top = begin.top + event.y - begin.y - can.page.style(can, target, html.LEFT, layout.left, html.TOP, layout.top) - } - } - }, + move: function(can, target, layout) { layout && can.page.style(can, target, layout), can.onappend.style(can, "move", target) }, hide: function(can, time, cb, target) { target = target||can._target, can.page.style(can, target, html.OPACITY, 1) time = can.base.isObject(time)? time: {value: 10, length: time||20} can.core.Timer(time, function(event, value, index) { can.page.style(can, target, html.OPACITY, 1-(index+1)/time.length) }, diff --git a/index.css b/index.css index 1ec7aa58..207b7add 100644 --- a/index.css +++ b/index.css @@ -43,6 +43,7 @@ table.content th { background-color:steelblue; padding:2px 5px; } table.content td { padding:2px 5px; } table.content.action th:last-child { position:sticky; right:2px; } table.content.action td:last-child { background-color:steelblue; max-width:200px; position:sticky; right:2px; } +body.mobile table.content.action td:last-child { max-width:140px; } table.content.full { width:100%; } div.code { background-color:#5066b945; font-size:14px; } div.story[data-type=spark] { padding:5px 10px; border-left:blue solid 5px; } @@ -108,7 +109,7 @@ body>div.input td:hover span.icon { visibility:visible; } body>div.input select { width:230px; } body>div.input textarea { height:120px; width:240px; } body>div.input input:not([type=button]) { width:240px; } -body>div.input div.action input[type=button] { width:90px; } +body>div.input div.action input[type=button] { width:110px; } body>div.input div.action div { margin:5px; float:right; } body>div.input div.action { width:100%; } body>div.upload div.item { float:left; } @@ -139,6 +140,7 @@ fieldset.float div.text:hover>span.icon.delete { visibility:hidden; } fieldset.float>form.option>div.text>input { display:none; } fieldset.float>form.option>div.text>span { display:none; } fieldset.float>form.option>div.text>span.value { padding:7px; height:32px; display:block; max-width:200px; overflow:auto; } +body.mobile:not(.landscape) fieldset.float>form.option>div.text>span.value { display:none; } fieldset:not(.float)>form.option>div.text>span.value { display:none; } form.option>div.icon:first-child { margin-left:-5px; } form.option>div.icon { line-height:30px; font-size:26px; padding:0 5px; height:32px; } @@ -149,6 +151,7 @@ form.option>div.icon.next { font-size:18px; } form.option>div.icon.prev { font-size:18px; } form.option>div.icon.lt { font-size:20px; line-height:30px; } form.option>div.icon:hover { background-color:white; } +body.black form.option>div.icon:hover { background-color:#243783bd; } form.option>div.button>span.icon { line-height:30px; font-size:26px; padding:0 5px; height:32px; } div.action>div.button>span.icon { line-height:30px; font-size:26px; padding:0 5px; height:32px; } body:not(.mobile) fieldset:not(.story):not(.float):not(.full):not(.cmd)>form.option>div.button>span.icon { display:none; } @@ -193,10 +196,10 @@ body.dark svg g[stroke] text { stroke:unset; } body.dark svg g[stroke] rect { stroke:unset; } body.dark svg g[stroke] line { stroke:unset; } body.dark svg g[stroke] path { stroke:unset; } -body.black svg text { stroke:silver; fill:silver; } -body.black svg rect { stroke:silver; fill:transparent; } -body.black svg line { stroke:silver; } -body.black svg path { stroke:silver; } +body.black svg text { stroke:cyan; fill:cyan; } +body.black svg rect { stroke:cyan; fill:transparent; } +body.black svg line { stroke:cyan; } +body.black svg path { stroke:cyan; } body.black svg g[fill] text { fill:unset; } body.black svg g[fill] rect { fill:unset; } body.black svg g[stroke] text { stroke:unset; } @@ -218,6 +221,7 @@ legend, form.option, form.option>div.item, div.action, div.action>div.item, div. div.action, div.output, div.status, div.project, div.display, div.profile, div.content, table.content, table.content td, div.code, div.plug, div.story, div.toast, div.carte, fieldset.input { overflow:auto; } div.output, fieldset>div.status, div.item.textarea, div.project div.item, div.content:not(.item), div.code, div.story[data-type=spark] { clear:both; } fieldset>div.status>legend { margin-left:2px; margin-right:0; height:30px; float:right; clear:none; } +fieldset>div.status>legend:not(:hover):not(.select) { background-color:unset; } fieldset.Action>div.output>fieldset.plugin:not(.output):not(.float):not(.full):not(.cmd) { padding:10px; margin:10px; } fieldset.Action>div.output>fieldset.plugin:not(.float):not(.full):not(.cmd)>legend { float:none; } fieldset.auto, fieldset.full, fieldset.float, div.float { position:fixed; z-index:10; } @@ -232,11 +236,11 @@ div.tabs span.icon:hover { background-color:aliceblue; color:black; } div.tabs>div:hover span.icon { visibility:visible; } div.action>div.tabs:hover span.icon { visibility:visible; } div.tabs>div.select span.icon { visibility:visible; } -fieldset>div.output>div.code { position:sticky; left:0; bottom:0; } +fieldset>div.output>div.code { position:sticky; left:0; } div.plug { font-style:italic; } div.carte.select.float { border-radius:0; } div.carte.select.float>div.item { text-align:center; } -div.item.select span { margin-left:-25px; margin-right:10px; } +div.item.select span { margin-left:-25px; margin-right:15px; } div.item.select input { border-radius:0; min-width:60px; } div.project div.zone div.list { clear:both; } div.layout.flex>div.output { float:left; clear:none; } @@ -261,15 +265,16 @@ div.title, div.story[data-type=spark] { cursor:copy; } body.black a { color:yellow; } body.black div.project div.zone>div.list>div.zone>div.item { background-color:#09466fc2; } body.white { background-color:rgba(5,34,56,0.75); color:white; } +body.white.cmd { background-color:white; } body.white select { background-color:yellowgreen; color:white; } body.white div.item.select div { background-color:yellowgreen; color:white; float:right; height:32px; text-align:center; } -body.white input { background-color:white; } +body.white input { background-color:#ffffff7d; } body.white input[name=cmd] { background-color:black; color:white; } body.white input[type=button] { background-color:cornflowerblue; color:white; } body.white textarea { background-color:white; } body.white table.content th { background-color:skyblue; } body.white table.content.action td:last-child { background-color:skyblue; } -body.white div.zone>div.list>div.zone>div.item { background-color:aliceblue; color:black; } +body.white div.zone>div.list>div.zone>div.item { background-color:#f0f8ff63; color:black; } body.white div.float { background-color:aliceblue; color:black; } body.white fieldset.panel.Search a { color:yellow; } body.white fieldset.panel.Action { color:black; } @@ -290,6 +295,7 @@ body.white table.content td.select { background-color:#6495ed63; } body.white h1:hover { background-color:#4682b46b; } body.white h2:hover { background-color:#4682b46b; } body.white h3:hover { background-color:#4682b46b; } +body.light.cmd { background-color:aliceblue; } 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):not(.auto) input { background-color:#6b7488; color:white; border-radius:5px; } @@ -340,10 +346,11 @@ body.mobile div.carte div.item { padding:10px; } body.mobile table.content th { padding:6px; } body.mobile table.content { width:100%; } body.mobile fieldset:not(.panel):not(.input):not(.play)>div.action { display:none; } -body.mobile fieldset.plugin>legend { padding:0 20px; border:none; } +// body.mobile fieldset.plugin>legend { padding:0 20px; border:none; } body.mobile fieldset.plugin:not(.float):not(.full):not(.cmd) { margin:10px 0; } body.mobile fieldset.Action>div.output>fieldset.plugin:not(.float):not(.full):not(.cmd)>legend { margin:10px; } body.mobile fieldset.Header { padding:0; width:100%; position:fixed; top:0; } +body.mobile.landscape fieldset.Header { position:unset; } body.mobile fieldset.Header>div.output { font-size:1.4rem; line-height:48px; height:48px; } body.mobile fieldset.Header div.output div.search { padding:0; height:48px; width:100%; margin:0; } body.mobile fieldset.Header div.output div.search>input { font-size:2.2rem; background-color:#21181838; color:white; height:53px; width:100%; } @@ -353,6 +360,7 @@ body.mobile fieldset.Search>div.action>div.item.filter>input { width:100%; } body.mobile fieldset.River { min-width:240px; position:fixed; top:48px; z-index:10; } body.mobile fieldset.River>div.output { font-size:1.4rem; width:320px; } body.mobile fieldset.Action { margin-top:48px; } +body.mobile.landscape fieldset.Action { margin-top:0; } // body.mobile fieldset.Action { margin-top:3rem; margin-bottom:3rem; } body.mobile fieldset.Action.cmd { margin-top:0; margin-bottom:0; } body.mobile fieldset.Action>div.output { overflow-x:hidden; } @@ -366,6 +374,8 @@ body.mobile fieldset.Footer { display:none; } body.mobile fieldset.input.date div.output td { padding:8px 20px; } body.mobile fieldset.word.float>div.output>div.project { top:32px; } body.mobile fieldset.word>div.output { overflow-x:hidden; } +body.mobile fieldset.word>div.output>fieldset.story>form.option>div.text { display:none; } +body.mobile fieldset>div.status { overflow:hidden; } /* misc */ fieldset.cmd>div.item.time { padding:5px 10px; line-height:22px; float:right; } fieldset.cmd>div.item.avatar { padding:0; float:right; height:32px; } @@ -395,13 +405,13 @@ fieldset.qrcode>div.output div.code { padding:0; } fieldset.can.view { font-size:14px; } fieldset.can.data { font-size:14px; } body.en fieldset.input.date.float>div.action>div.item.select { margin:0 5px; } -body.en fieldset.input.date.float>div.action>div.item.select select { width:61px; } +body.en fieldset.input.date.float>div.action>div.item.select select { width:60px; } body.en fieldset.input.date.float>div.action>div.item.select.year select { width:106px; } body.en fieldset.input.date.float>div.action>div.item.select.month select { width:106px; } body.zh fieldset.input.date.float>div.action>div.item.select { margin:0 5px; } -body.zh fieldset.input.date.float>div.action>div.item.select select { width:65px; } -body.zh fieldset.input.date.float>div.action>div.item.select.year select { width:89px; } -body.zh fieldset.input.date.float>div.action>div.item.select.month select { width:89px; } +body.zh fieldset.input.date.float>div.action>div.item.select select { width:60px; } +body.zh fieldset.input.date.float>div.action>div.item.select.year select { width:84px; } +body.zh fieldset.input.date.float>div.action>div.item.select.month select { width:83px; } fieldset.input.date.float>div.action>div.item.button.today { margin-left:5px; } fieldset.input.date.float>div.action>div.item.button.next { margin-left:5px; } /* layout */ @@ -420,14 +430,15 @@ body.mobile table.layout td.content div.toggle.display { margin-top:-30px; heigh body.mobile table.layout td.content div.toggle.display>div { translate:5px -15px; } /* table card */ div.output.card>div.item.stop { color:gray; } -div.output.card>div.item { padding:10px; border:#e7e7e7 solid 1px; margin:10px; width:240px; float:left; } +div.output.card>div.item { padding:10px; border:#e7e7e7 solid 1px; margin:10px; width:320px; float:left; } div.output.card>div.item>div.title { font-size:1.2rem; font-weight:bold; padding:10px; border-bottom:solid 1px #e7e7e7; } -div.output.card>div.item>div.content { padding:10px; height:45px; } +div.output.card>div.item>div.content { padding:10px; height:70px; } div.output.card>div.item>div.action { text-align:right; width:100%; } -body.white div.output.card div.item input[type=button] { background-color:transparent; } -body.mobile div.output.card div.item { height:160px; width:calc(100% - 20px); float:none; } -body.mobile.simple div.output.card div.item { width:100%; } -body.mobile.landscape div.output.card div.item { width:auto; float:left; } +div.output.card>div.item>div.action>input { margin:0; } +// body.white div.output.card>div.item input[type=button] { background-color:transparent; } +body.mobile div.output.card>div.item { height:160px; width:calc(100% - 20px); float:none; } +body.mobile.simple div.output.card>div.item { width:100%; } +body.mobile.landscape div.output.card>div.item { width:auto; float:left; } /* scrollbar */ fieldset.panel.Action>div.output::-webkit-scrollbar { width:0 !important; height:0 !important; } fieldset.panel.River>div.output::-webkit-scrollbar { width:0 !important; height:0 !important; } diff --git a/lib/base.js b/lib/base.js index 8c0e4bf4..fbaa8751 100644 --- a/lib/base.js +++ b/lib/base.js @@ -1,6 +1,8 @@ Volcanos("base", { Int: function(val, def) { return parseInt(val)||def||0 }, - Min: function(val, min) { return val > min? val: min }, + Min: function(val, min, max) { + return val > min? val > max && max? max: val: min + }, Max: function(val, max) { return val < max? val: max }, Obj: function(val, def) { try { diff --git a/lib/page.js b/lib/page.js index 882bd7fa..d71cc0d6 100644 --- a/lib/page.js +++ b/lib/page.js @@ -1,6 +1,6 @@ Volcanos("page", { ClassList: { - has: function(can, target, key) { var list = target.className? target.className.split(lex.SP): []; return list.indexOf(key) > -1 }, + has: function(can, target, key) { var list = target.className && target.className.split? target.className.split(lex.SP): []; return list.indexOf(key) > -1 }, add: function(can, target, key) { Array.isArray(key) && (key = key.join(lex.SP)) var list = target.className? target.className.split(lex.SP): []; can.core.List(can.core.Split(key), function(key) { can.base.AddUniq(list, key) }) var value = list.join(lex.SP).trim(); return value != target.className && (target.className = value), value diff --git a/lib/user.js b/lib/user.js index c457b8fd..410d4c0a 100644 --- a/lib/user.js +++ b/lib/user.js @@ -35,11 +35,14 @@ Volcanos("user", { prompt: function(tip, def, cb, silent) { (text = silent? def: prompt(tip, def||"")) != undefined && typeof cb == lang.FUNCTION && cb(text); return text }, reload: function(force) { (force || confirm("重新加载页面?")) && location.reload() }, jumps: function(url) { location.href = url }, - opens: function(url) { window.openurl? window.openurl(url): (window.open(url) || (location.href = url)) }, - // open: function(url) { window.open(url) }, - open: function(url) { return window.open(url) || (location.href = url) }, - close: function(url) { return window.close() || history.back() }, + opens: function(url) { window.openurl? window.openurl(url): window.open(url) }, + open: function(url) { return window.open(url) }, + // opens: function(url) { window.openurl? window.openurl(url): (window.open(url) || (location.href = url)) }, + // open: function(url) { return window.open(url) || (location.href = url) }, + // close: function(url) { return window.close() || history.back() }, + close: function(url) { return window.close() }, theme: function(can, name) { can.base.isString(name) && (name = [name]) || name || [], can.user.isWindows && name.push("windows") + can.user.mod.isCmd && name.push(chat.CMD) can.user.isWebview && name.push(html.WEBVIEW), can.user.isMobile && name.push(html.MOBILE) && can.user.isLandscape() && name.push(html.LANDSCAPE) can.user.language(can) && name.push(can.user.language(can)), can.page.styleClass(can, document.body, name.join(lex.SP)) }, @@ -55,11 +58,10 @@ Volcanos("user", { nfs.SAVE, "保存", nfs.LOAD, "加载", nfs.COPY, "复制", nfs.EDIT, "编辑", nfs.SAVE, "保存", nfs.TRASH, "删除", nfs.SOURCE, "源码", nfs.MODULE, "模块", nfs.RECENT, "最近", cli.BEGIN, "开始", cli.START, "启动", cli.OPEN, "打开", cli.CLOSE, "关闭", cli.STOP, "停止", cli.END, "结束", cli.EXEC, "执行", cli.DONE, "完成", cli.RESTART, "重启", cli.SYSTEM, "命令", cli.ORDER, "加载", cli.BUILD, "构建", - code.INNER, "源码", chat.IFRAME, "浏览", chat.LOCATION, "地图", + code.XTERM, "终端", code.INNER, "源码", chat.IFRAME, "浏览", chat.LOCATION, "地图", html.PLUGIN, "插件", html.LABEL, "标签", html.HEIGHT, "高度", html.WIDTH, "宽度", ice.SHOW, "显示", ice.HIDE, "隐藏", chat.PROJECT, "项目", chat.PROFILE, "详情", chat.ACTIONS, "参数", "full", "全屏", "Close", "关闭", "Close Other", "关闭其它", "confirm", "确定", - code.XTERM, "终端", "today", "今天", )[text]||text }, @@ -166,6 +168,7 @@ Volcanos("user", { can.core.CallFunc(cb, {event: can.request(event, {_handle: ice.TRUE})._event, button: button, data: data, list: list, args: args, input: action}) || action.cancel() }, _target: ui._target, _engine: function(event, can, button) { action.submit(event, can, button) }, }); can.onlayout.figure(event, can, ui._target, false, 0.8), can.onmotion.delay(can, function() { action.focus() }) + can.onmotion.move(can, ui._target, {}) return button === true && action.submit(event, can, html.SUBMIT), action }, select: function(event, can, type, fields, cb, cbs) { diff --git a/panel/action.js b/panel/action.js index 4a958935..c4902459 100644 --- a/panel/action.js +++ b/panel/action.js @@ -58,7 +58,10 @@ Volcanos(chat.ONACTION, {_init: function(can, target) { }) }, _onaction_cmd: function(can) { can.onengine.signal(can, chat.ONACTION_CMD), can.onlayout._init(can) }, - onaction_cmd: function(can, msg) { can.page.ClassList.add(can, can._target, can.Mode(chat.CMD)), can.Conf(html.MARGIN_Y, 0), can.Conf(html.MARGIN_X, 0) }, + onaction_cmd: function(can, msg) { + can.page.ClassList.add(can, document.body, can.Mode(chat.CMD)) + can.page.ClassList.add(can, can._target, can.Mode(chat.CMD)), can.Conf(html.MARGIN_Y, 0), can.Conf(html.MARGIN_X, 0) + }, onsearch: function(can, msg, arg) { var fields = msg.Option(ice.MSG_FIELDS).split(mdb.FS) if (arg[0] == mdb.PLUGIN) { can.onexport.plugin(can, msg, arg, fields) } if (arg[0] == ctx.COMMAND) { can.onexport.command(can, msg, arg, fields) } diff --git a/panel/header.js b/panel/header.js index 0f935d77..ce3f1447 100644 --- a/panel/header.js +++ b/panel/header.js @@ -94,7 +94,7 @@ Volcanos(chat.ONACTION, {_init: function(can) { var themeMedia = window.matchMed can.core.List(msg.Append(), function(key) { args[key] = msg.Append(key) }) can.user.jumps(can.misc.MergeURL(can, args, true)) }, - carte: function(event, can, list, cb, trans) { can.user.carte(event, can, can.onaction, list, cb, null, trans) }, + carte: function(event, can, list, cb, trans) { return can.user.carte(event, can, can.onaction, list, cb, null, trans) }, share: function(event, can, args) { can.user.share(can, can.request(event), [ctx.ACTION, chat.SHARE].concat(args||[])) }, avatar: function(event, can) { can.onaction.carte(event, can, [can.page.Format(html.IMG, can.onexport.avatar(can), can.page.height()/2)]) }, usernick: function(event, can) { can.user.mod.isPod || can.user.isExtension || can.user.isLocalFile || can.onaction.carte(event, can, can.onaction._menus) }, diff --git a/panel/search.css b/panel/search.css index 352d78b4..873b7e74 100644 --- a/panel/search.css +++ b/panel/search.css @@ -1,5 +1,5 @@ fieldset.Search { background-color:#061c3ceb; padding:10px; position:fixed; left:230px; top:48px; } -fieldset.Search>div.action>div.item.filter>input { background-color:#6b7488; } +fieldset.Search>div.action>div.item.filter>input { background-color:#6b7488; color:white; } fieldset.Search>div.output table.content { width:100%; } fieldset.Search>div.output>div.profile { max-width:unset; } body.dark fieldset.Search>div.action>div.item.filter>input { background-color:#212121; } \ No newline at end of file diff --git a/plugin/local/code/inner.css b/plugin/local/code/inner.css index d26043be..9f09d7c8 100644 --- a/plugin/local/code/inner.css +++ b/plugin/local/code/inner.css @@ -74,6 +74,11 @@ body.white fieldset.inner.cmd>div.output>div.layout>div.path { background-color: body.white fieldset.inner>div.output div.content tr:hover { background-color:aliceblue; } body.white fieldset.inner>div.output div.content tr.select { background-color:aliceblue; } body.white fieldset.inner>div.output div.content tr.select td.line { background-color:steelblue; color:white; } + +body.white fieldset.inner.cmd>div.output { background-color:transparent; } +body.white fieldset.inner.cmd>div.output div.content { background-color:transparent; } +body.white fieldset.inner.cmd>div.output>div.layout>div.path { background-color:transparent; } + body.mobile fieldset.inner>form.option input[name=file] { width:90px; } body.mobile fieldset.word fieldset.inner>form.option input[type=text] { display:none; } body.windows fieldset.inner>div.output { overflow:hidden; } diff --git a/plugin/local/code/vimer.css b/plugin/local/code/vimer.css index 8c6051fd..c4af0a17 100644 --- a/plugin/local/code/vimer.css +++ b/plugin/local/code/vimer.css @@ -19,4 +19,6 @@ fieldset.vimer>div.output>div.layout>div.layout div.content.insert input.current body.dark fieldset.vimer>div.output>div.layout>div.layout div.content.normal input.current { caret-color:gray; } body.dark fieldset.vimer>div.output>div.layout>div.layout div.content.insert input.current { caret-color:yellow; } body.black fieldset.vimer>div.output>div.layout>div.layout div.content.normal input.current { caret-color:gray; } -body.black fieldset.vimer>div.output>div.layout>div.layout div.content.insert input.current { caret-color:yellow; } \ No newline at end of file +body.black fieldset.vimer>div.output>div.layout>div.layout div.content.insert input.current { caret-color:yellow; } +body.black fieldset.vimer>div.output>div.layout>div.layout div.content div.complete table.content { background-color:#061c3ceb; } +body.white fieldset.vimer>div.output>div.layout>div.layout div.content div.complete table.content { background-color:aliceblue; } \ No newline at end of file diff --git a/plugin/local/team/plan.js b/plugin/local/team/plan.js index 6651b09f..acbd3565 100644 --- a/plugin/local/team/plan.js +++ b/plugin/local/team/plan.js @@ -104,6 +104,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear( }, layout: function(can) { can.ui.layout(can.ConfHeight(), can.ConfWidth()) + can.user.isMobile && can.page.style(can, can.ui.content, html.HEIGHT, "") return can.page.styleHeight(can, can._output, can.ConfHeight()), can.page.styleHeight(can, can.ui.project, can.ConfHeight()) var height = can._display_heights[can.sup.task? [can.sup.task.zone, can.sup.task.id].join(mdb.FS): ""]||html.ACTION_HEIGHT diff --git a/plugin/local/wiki/draw.js b/plugin/local/wiki/draw.js index 851679d0..b4f8d832 100644 --- a/plugin/local/wiki/draw.js +++ b/plugin/local/wiki/draw.js @@ -6,6 +6,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear( can.page.Select(can, target, mdb.FOREACH, function(target) { can.onimport._block(can, target), can.page.tagis(target, svg.G) && target.Value(html.CLASS) && can.onimport._group(can, target) }) can.ui.profile && can.core.ItemCB(can.onaction, function(key, cb) { target[key] = function(event) { can.misc.Event(event, can, function(msg) { cb(event, can) }) } }) }), can.ondetail._select(can, (can.isCmdMode()? pid: "")||can.Option(svg.PID)||can.svg.Value(svg.PID)), can.onkeymap._build(can) + can.ui.profile && can.user.isMobile && can.onmotion.hidden(can, can.ui.profile) }, _block: function(can, target) { target.Value = function(key, value) { if (can.base.isUndefined(key)) { return } if (can.base.isObject(key)) { return can.core.Item(key, target.Value), key } diff --git a/plugin/state.js b/plugin/state.js index ba060438..249c2cf3 100644 --- a/plugin/state.js +++ b/plugin/state.js @@ -83,6 +83,7 @@ Volcanos(chat.ONACTION, {list: [ if (!sub) { return } sub.ConfHeight(can.ConfHeight()), sub.ConfWidth(can.ConfWidth()), sub.Mode(can.Mode()), sub.onlayout._init(sub) can._target.click() + can.page.ClassList.del(can, can._target, "move") } }, "刷新界面": function(event, can) { var sub = can._outputs[0]; sub.onlayout._init(sub), can.user.toastSuccess(can) }, diff --git a/plugin/table.js b/plugin/table.js index deb52f95..c2f37d20 100644 --- a/plugin/table.js +++ b/plugin/table.js @@ -24,7 +24,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear( return {view: [[html.ITEM, item.status]], list: [{view: [wiki.TITLE, html.DIV, item.name]}, {view: [wiki.CONTENT, html.DIV, item.text]}, {view: html.ACTION, inner: item.action, onclick: function(event) { can.run(can.request(event, item), [ctx.ACTION, event.target.name]) }}, ]} - })) }, + })), can.onlayout.expand(can, can._output, 320) }, icon: function(can, name, button, target) { can.page.Append(can, target, [{text: [can.page.unicode[name]||name, html.SPAN, html.ICON], onclick: function(event) { can.base.isFunc(button)? button(event, button): can.onaction[button](event, can, button), can.onkeymap.prevent(event) }}]) }, @@ -44,14 +44,9 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear( oncontextmenu: function(event) { can.user.carte(event, can, kit.Dict( "Close", function(event) { close(target) }, "Close Other", function(event) { can.page.SelectChild(can, action, html.DIV_TABS, function(target) { target == tabs._target || close(target) }) }, - "Rename Tabs", function(event) { - can.user.input(event, can, [mdb.NAME], function(list) { - can.page.Select(can, target, "span.name", function(target) { - can.page.Modify(can, target, list[0]||tabs.name) - }) - }) - }, - menu.meta, + "Rename Tabs", function(event) { can.user.input(event, can, [mdb.NAME], function(list) { + can.page.Select(can, target, "span.name", function(target) { can.page.Modify(can, target, list[0]||tabs.name) }) + }) }, menu.meta, ), ["Close", "Close Other", "Rename Tabs", ""].concat(can.base.getValid(menu.list, can.core.Item(menu.meta))), function(event, button, meta) { (meta[button]||menu)(event, button, meta) }) }, }), target.click() }} @@ -71,8 +66,6 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear( }, plug: function(can, meta, cb, target, field) { if (!meta || !meta.index) { return } meta.type = meta.type||html.PLUG, meta.name = meta.index, can.onappend.plugin(can, meta, function(sub) { sub.sup = can - // can.page.style(can, sub._output, html.MAX_WIDTH, sub.ConfWidth(can.ConfWidth())) - // can.page.style(can, sub._output, html.MAX_HEIGHT, sub.ConfHeight(can.ConfHeight()-2*html.ACTION_HEIGHT), html.MAX_WIDTH, sub.ConfWidth(can.ConfWidth())) sub.run = function(event, cmds, cb) { if (can.page.Select(can, sub._option, "input[name=path]").length > 0 && sub.Option(nfs.PATH) == "") { sub.request(event, {path: nfs.PWD}) } can.runActionCommand(can.request(event, can.Option()), meta.index, cmds, cb) }, sub.onaction.close = function() { can.onmotion.hidden(can, target) }, can.base.isFunc(cb) && cb(sub) @@ -164,11 +157,7 @@ Volcanos(chat.ONLAYOUT, { }, }) Volcanos(chat.ONEXPORT, { - title: function(can, title) { - can.isCmdMode() && can.user.title(title) - return - can._legend.innerHTML = title, can.isCmdMode() && can.user.title(title); var sup = can.sup; if (sup) { sup._header_tabs && (sup._header_tabs.innerHTML = title), sup._tabs && (sup._tabs.innerHTML = title) } - }, + title: function(can, title) { can.isCmdMode() && can.user.title(title) }, table: function(can) { var msg = can._msg; if (msg.Length() == 0) { return } var res = [msg.append && msg.append.join(mdb.FS)]; msg.Table(function(line, index, array) { res.push(can.core.Item(line, function(key, value) { return value }).join(ice.FS)) }); return res.join(lex.NL) }, diff --git a/proto.js b/proto.js index b21c4bab..f386f306 100644 --- a/proto.js +++ b/proto.js @@ -375,6 +375,21 @@ try { if (typeof(window) == lang.OBJECT) { var meta = Volcanos.meta } } meta._init = function(can) { + var target, begin + window.onmousedown = function(event) { + for (target = event.target; target; target = target.parentNode) { if (target == document.body) { target = null; return } + if (can.page.tagis(target, html.DIV) && can.page.ClassList.has(can, target, html.OUTPUT)) { target = null; return } + if (can.page.tagis(event.target, html.INPUT, html.TEXTAREA)) { target = null; return } + if (can.page.ClassList.has(can, target, "move")) { break } + } begin = {left: target.offsetLeft, top: target.offsetTop, x: event.x, y: event.y} + can.page.SelectChild(can, document.body, ".float", function(target) { can.page.style(can, target, "z-index") && can.page.style(can, target, "z-index", 10) }), can.page.style(can, target, "z-index", 11) + }, window.onmouseup = function(event) { target = null, begin = {} } + window.onmousemove = function(event) { target && can.page.style(can, target, + html.LEFT, can.base.Min(begin.left + event.x - begin.x, 0, window.innerWidth-target.offsetWidth), + html.TOP, can.base.Min(begin.top + event.y - begin.y, 0, window.innerHeight-html.ACTION_HEIGHT) + ) && can.onkeymap.prevent(event) } + + window.ondblclick = function(event) { can.onkeymap.prevent(event) } window.onerror = function(message, source, lineno, colno, error) { meta.version? alert([message].concat(can.misc._stacks(0, error)).join(lex.NL)): can.misc.Error(message, lex.NL+[source, lineno, colno].join(ice.DF), error) }, window.onbeforeunload = function() { can.Action._socket && can.Action._socket.close() }