diff --git a/frame.js b/frame.js index 0c68125c..a1ae18dc 100644 --- a/frame.js +++ b/frame.js @@ -13,38 +13,43 @@ Volcanos(chat.ONENGINE, {_init: function(can, meta, list, cb, target) { can.core.ItemCB(sub.onaction, function(key, cb) { can.onengine.listen(can, key, function(msg) { can.core.CallFunc(cb, {can: sub, msg: msg}) }) }) can.core.CallFunc([sub.onaction, chat._INIT], {can: sub, cb: next, target: sub._target}) }, target) - }, function() { can.onmotion._init(can, target), can.onkeymap._init(can, target), can.misc.Info(can.user.title(), ice.RUN, can) + }, function() { can.onlayout._init(can, target), can.onmotion._init(can, target), can.onkeymap._init(can, target), can.misc.Info(can.user.title(), ice.RUN, can) can.onengine.listen(can, chat.ONSEARCH, function(msg, arg) { arg[0] == ctx.COMMAND && can.run(msg, ["can.command"]) }) can.onengine.signal(can, chat.ONMAIN, can.request()), can.base.isFunc(cb) && cb(can) }) - can.onappend.topic(can, "dark", {topic: "black", plugin: "black", input: "#212121", output: "#0d1117", table: "black", + can.onappend.topic(can, "dark", {topic: "black", plugin: "black", legend: "#212121", input: "#212121", output: "#0d1117", table: "black", hover: "#212121", border: "gray", label: "silver", text: "white", warn: "red", notice: "blue"}), - can.onappend.topic(can, "light", {topic: "white", plugin: "aliceblue", input: "white", output: "white", table: "aliceblue", + can.onappend.topic(can, "light", {topic: "white", plugin: "aliceblue", legend: "lavender", input: "white", output: "white", table: "aliceblue", hover: "aliceblue", border: "transparent", label: "black", text: "black", warn: "red", notice: "blue"}) can.onappend.icon(can, { - 16: { - open: [-27, -158], - close: [-82, -158], - refresh: [-194, -241], - back: [-27, -185], + close: { + 16: [-82, -158], + 18: [-93, -177], + 20: [-103, -197], + 24: [-123, -236], }, - 18: { - open: [-30, -177], - close: [-93, -177], - refresh: [-218, -271], - back: [-30, -208], + create: { + 16: [-27, -158], + 18: [-30, -177], + 20: [-33, -197], }, - 20: { - open: [-30, -177], - close: [-103, -197], - refresh: [-242, -301], - back: [-33, -232], + refresh: { + 16: [-194, -241], + 18: [-218, -271], + 20: [-242, -301], + 24: [-291, -362], }, - 24: { - open: [-40, -236], - close: [-123, -236], - refresh: [-291, -362], - back: [-40, 278], + back: { + 16: [-27, -185], + 18: [-30, -208], + 20: [-33, -232], + 24: [-40, 278], + }, + open: { + 16: [-27, -158], + 18: [-30, -177], + 20: [-30, -177], + 24: [-40, -236], }, }) }, @@ -58,15 +63,17 @@ Volcanos(chat.ONENGINE, {_init: function(can, meta, list, cb, target) { if (panel.onengine._plugin(event, can, msg, panel, cmds, cb)) { return } if (panel.onengine._static(event, can, msg, panel, cmds, cb)) { return } + msg.Option(ice.SESS_WIDTH) || msg.Option(ice.SESS_WIDTH, panel.Conf(html.WIDTH)) + msg.Option(ice.SESS_HEIGHT) || msg.Option(ice.SESS_HEIGHT, panel.Conf(html.HEIGHT)) var toast, _toast = msg.Option(chat._TOAST); if (_toast) { can.onmotion.delay(can, function() { toast = toast||can.user.toastProcess(msg._can, _toast) }, 500) } msg.option = can.core.List(msg.option, function(item) { return [chat._TOAST, ice.MSG_HANDLE].indexOf(item) > -1 && delete(msg[item])? undefined: item }) - msg.Option(chat.TOPIC) || msg.Option(chat.TOPIC, can.getHeader(chat.TOPIC)) - if (can.base.isUndefined(msg._daemon)) { var sub = msg._can; can.base.isUndefined(sub._daemon) && can.ondaemon._list[0] && (sub._daemon = can.ondaemon._list.push(sub)-1) + msg.Option(ice.MSG_TOPIC) || msg.Option(ice.MSG_TOPIC, can.getHeader(chat.TOPIC)) + if (can.base.isUndefined(msg[ice.MSG_DAEMON])) { var sub = msg._can; can.base.isUndefined(sub._daemon) && can.ondaemon._list[0] && (sub._daemon = can.ondaemon._list.push(sub)-1) if (sub._daemon) { msg.Option(ice.MSG_DAEMON, can.core.Keys(can.ondaemon._list[0], sub._daemon)) } } can.onengine.signal(panel, chat.ONREMOTE, can.request({}, {_follow: panel._follow, _msg: msg, _cmds: cmds})) var names = msg.Option(chat._NAMES)||panel._names||((can.Conf("iceberg")||Volcanos.meta.iceberg)+panel._name) - can.misc.Run(event, can, {names: names, daemon: msg._daemon}, cmds, function(msg) { toast && toast.close(), toast = true + can.misc.Run(event, can, {names: names, daemon: msg[ice.MSG_DAEMON]}, cmds, function(msg) { toast && toast.close(), toast = true can.base.isFunc(cb) && cb(msg), Volcanos.meta.pack[can.core.Keys(panel._name, cmds.join(ice.FS))] = msg }) }, @@ -141,9 +148,11 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { var output = can.page.Select(can, field, html.DIV_OUTPUT)[0] var status = can.page.Select(can, field, html.DIV_STATUS)[0] - can.page.Append(can, option, [{view: "icon s18 close", onclick: function(event) { sub.onaction.close(event, sub) }}]) - can.page.Append(can, option, [{view: "icon s18 back", onclick: function(event) { sub.onimport._back(sub) }}]) - can.page.Append(can, option, [{view: "icon s18 refresh", onclick: function(event) { sub.Update(event) }}]) + if (meta.type != chat.PANEL) { + can.page.Append(can, option, [{view: "icon s18 close", onclick: function(event) { sub.onaction.close(event, sub) }}]) + can.page.Append(can, option, [{view: "icon s18 back", onclick: function(event) { sub.onimport._back(sub) }}]) + can.page.Append(can, option, [{view: "icon s18 refresh", onclick: function(event) { sub.Update(event) }}]) + } var sub = Volcanos(meta.name, {_root: can._root||can, _follow: can.core.Keys(can._follow, meta.name), _target: field, _legend: legend, _option: option, _action: action, _output: output, _status: status, _history: [], _inputs: {}, _outputs: [], @@ -215,7 +224,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { if (can.core.CallFunc([can, chat.ONIMPORT, ice.MSG_PROCESS], {can: can, msg: msg})) { return } } 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 == ""? /* 空白 */ {type: html.SPACE}: + can.base.isUndefined(item) || can.onappend.input(can, item == ""? /* 空白 */ {type: html.HR}: can.base.isString(item)? /* 按键 */ {type: html.BUTTON, name: item, value: can.user.trans(can, item, meta._trans), onclick: function(event) { var cb = meta[item]||meta[chat._ENGINE]; cb? can.core.CallFunc(cb, {event: event, can: can, button: item}): can.run(event, [ctx.ACTION, item].concat(can.sup.Input()), what) }, onkeydown: function(event) { if (event.key == lang.ENTER) { target.click() }}}: @@ -278,7 +287,6 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { ]}]) }, input: function(can, item, value, target, style) { - if (item.type == html.SPACE) { return can.page.Append(can, target, [{view: can.base.join([html.ITEM, html.SPACE])}]) } var input = can.page.input(can, can.base.Copy({}, item), value) if (item.type == html.SELECT && item.value) { input._init = function(target) { target.value = value||item.value } } if (item.type == html.TEXT) { input.onkeydown = item.onkeydown||function(event) { @@ -344,7 +352,8 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { var value = can.onengine.plugin(can, meta.index); if (value) { can.onappend._plugin(can, value, meta, function(sub, meta, skip) { _cb(sub, meta, skip), can.onmotion.delay(can, function() { value.meta && value.meta._init && value.meta._init(sub, meta) }) }, target, field); return res } - can.runAction(can.request({}, meta), ctx.COMMAND, [meta.index], function(msg) { msg.Table(function(value) { can.onappend._plugin(can, value, meta, _cb, target, field) })}); return res + // can.runAction(can.request({}, meta), ctx.COMMAND, [meta.index], function(msg) { msg.Table(function(value) { can.onappend._plugin(can, value, meta, _cb, target, field) })}); return res + can.runAction({}, ctx.COMMAND, [meta.index], function(msg) { msg.Table(function(value) { can.onappend._plugin(can, value, meta, _cb, target, field) })}); return res }, _float: function(can, index, args) { can.onappend.plugin(can, {mode: chat.FLOAT, index: index, args: args}, function(sub) { @@ -374,31 +383,32 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { }) }, icon: function(can, list) { - var text = can.core.Item(list, function(size, list) { return can.core.Item(list, function(key, value) { + var text = can.core.Item(list, function(key, list) { return can.core.Item(list, function(size, value) { return `div.icon.s${size}.${key} { - background:url(/publish/icon/full.jpg); background-size:${size*20}px; width:${size}px; height:${size}px; - background-repeat: no-repeat; background-position-x:${value[0]}px; background-position-y:${value[1]}px; -}` + background:url(/publish/icon/full.jpg); background-size:${size*20}px; width:${size}px; height:${size}px; + background-repeat: no-repeat; background-position-x:${value[0]}px; background-position-y:${value[1]}px; }` }).join(ice.NL) }).join(ice.NL) - can.page.Append(can, document.head, ctx.STYLE, {"innerText": text}), console.log(html.ICON, text) + can.page.Append(can, document.head, ctx.STYLE, {"innerText": text}) //, console.log(html.ICON, text) }, topic: function(can, topic, color, style, list) { const SOLID = " solid 1px", GLASS = "transparent" const INPUT_STYLE = "input-style", INPUT_HOVER_STYLE = "input-hover-style", OUTPUT_STYLE = "output-style", GLASS_STYLE = "glass-style" const TABLE_HEAD_STYLE = "table-head-style", TABLE_HEAD_HOVER_STYLE = "table-head-hover-style", TABLE_ROW_HOVER_STYLE = "table-row-hover-style", TABLE_CELL_HOVER_STYLE = "table-cell-hover-style" const ITEM_HOVER_STYLE = "item-hover-style", CARTE_ITEM_HOVER_STYLE = "carte-item-hover-style", CARTE_ITEM_STYLE = "carte-item-style" const PANEL_STYLE = "panel-style", PLUGIN_STYLE = "plugin-style" + const LEGEND_STYLE = "legend-style" function _bg(color) { var res = {"background-color": color}, arg = arguments; for (var i = 1; i < arg.length; i += 2) { res[arg[i]] = arg[i+1] } return res } function _fg(color) { var res = {"color": color}, arg = arguments; for (var i = 1; i < arg.length; i += 2) { res[arg[i]] = arg[i+1] } return res } function _b_r(size) { return {"border-radius": size} } style = style||kit.Dict( - INPUT_STYLE, _bg(color.input, html.COLOR, color.label, html.BORDER, color.border+SOLID, "border-radius", "5px", "outline", html.NONE, "box-shadow", html.NONE), - INPUT_HOVER_STYLE, _fg(color.text, html.BORDER, color.text+SOLID), OUTPUT_STYLE, _bg(color.output), GLASS_STYLE, _bg(GLASS), + LEGEND_STYLE, _bg(color.legend), + INPUT_STYLE, _bg(color.input, html.COLOR, color.label, "border-radius", "5px", "outline", html.NONE, "box-shadow", html.NONE), + INPUT_HOVER_STYLE, _fg(color.text), OUTPUT_STYLE, _bg(color.output), GLASS_STYLE, _bg(GLASS), TABLE_HEAD_STYLE, _bg(color.table, html.COLOR, color.label), TABLE_HEAD_HOVER_STYLE, _bg(color.table, html.COLOR, text), TABLE_ROW_HOVER_STYLE, _bg(color.table), TABLE_CELL_HOVER_STYLE, _bg(color.hover), ITEM_HOVER_STYLE, _bg(color.hover, html.COLOR, color.text), CARTE_ITEM_HOVER_STYLE, _bg(color.input, html.COLOR, color.text), PANEL_STYLE, _bg(color.topic, html.COLOR, color.label), PLUGIN_STYLE, _bg(color.plugin, "border-radius", "10px"), ), list = list||[ {type: "", style: _fg(color.label)}, - {type: html.LEGEND, style: [INPUT_STYLE, TABLE_HEAD_STYLE]}, {type: html.LEGEND, style: [INPUT_HOVER_STYLE]}, + {type: html.LEGEND, style: [INPUT_STYLE, TABLE_HEAD_STYLE, LEGEND_STYLE]}, {type: html.LEGEND, style: [INPUT_HOVER_STYLE]}, {type: html.SELECT, style: [INPUT_STYLE]}, {type: html.SELECT, style: [INPUT_HOVER_STYLE]}, {type: html.INPUT, style: [INPUT_STYLE]}, {type: html.INPUT, style: [INPUT_HOVER_STYLE]}, {type: html.INPUT+":not([type=button])", style: _b_r(0)}, {type: html.INPUT+":not([type=button])", name: [html.HOVER], style: {border: color.notice+SOLID}}, @@ -433,6 +443,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { {type: html.FIELDSET_PANEL, name: [chat.HEADER], list: [{type: html.DIV_OUTPUT, list: [{type: html.DIV, style: [ITEM_HOVER_STYLE]}], }]}, {type: html.FIELDSET_PANEL, name: [chat.FOOTER], list: [{type: html.DIV_OUTPUT, list: [{type: html.DIV, style: [ITEM_HOVER_STYLE]}], }]}, {type: html.FIELDSET_PANEL, name: [chat.FOOTER], list: [{type: html.DIV_OUTPUT, list: [{type: html.DIV_TOAST, style: [TABLE_HEAD_STYLE]}], }]}, + {type: html.FIELDSET_PANEL, name: [chat.ACTION], list: [{type: html.DIV_OUTPUT, style: [OUTPUT_STYLE]}]}, {type: html.FIELDSET_PLUGIN, style: [PLUGIN_STYLE]}, {type: html.FIELDSET_PLUGIN, list: [{type: html.DIV_STATUS, style: {"border-top": color.border+SOLID}}]}, {type: html.FIELDSET_STORY, style: [PLUGIN_STYLE]}, {type: html.FIELDSET_STORY, list: [{type: html.DIV_STATUS, style: {"border-top": color.border+SOLID}}]}, {type: html.FIELDSET_INPUT, style: [PLUGIN_STYLE]}, {type: html.FIELDSET_INPUT, style: _b_r(0)}, @@ -443,10 +454,10 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { function render(pre, list) { return can.core.List(list, function(item) { var type = item.type+can.core.List(item.name, function(name) { return (name==html.HOVER? ice.DF: ice.PT)+name }).join("") if (!item.name && type.indexOf(".select") == -1 && type.indexOf(":hover") == -1 && can.base.isArray(item.style) && item.style.join(",").indexOf("-hover-") > -1) { type += ":hover" } return (item.style? (pre+ice.SP+type+" { "+(can.base.isArray(item.style)? can.core.List(item.style, function(item) { - return can.core.Item(style[item], function(key, value) { return key+": "+value }).join("; ") + return can.core.Item(style[item], function(key, value) { return key&&value? key+": "+value: undefined }).join("; ") }).join("; "): can.core.Item(can.base.Obj(item.style), function(key, value) { return key+": "+value }).join("; "))+" }"): "")+(item.list? render(pre+ice.SP+type, item.list): "") }).join(ice.NL) } - var text = render("body."+topic, list); can.page.Append(can, document.head, "style", {"innerText": text}), console.log("topic", topic, text) + var text = render("body."+topic, list); can.page.Append(can, document.head, "style", {"innerText": text}) //, console.log("topic", topic, text) }, layout: function(can, target, type, list) { const FLOW = "flow", FLEX = "flex" switch (type||ice.AUTO) { @@ -840,6 +851,17 @@ Volcanos(chat.ONKEYMAP, {_init: function(can, target) { target = target||documen selectCtrlN: function(event, can, target, key, cb) { if (!event.ctrlKey || event.key < "0" || event.key > "9") { return } return can.page.Select(can, target, key, function(target, index) { if (index+1 == event.key) { return cb? cb(target): target.click() } })[0] }, + selectItems: function(event, can, target, name) { name = name||event.target.value + can.page.Select(can, target, html.DIV_ITEM, function(item) { + can.page.ClassList.set(can, item, html.HIDE, item.innerText.indexOf(name) == -1) + }), can.onkeymap.selectCtrlN(event, can, target, html.DIV_ITEM+":not(.hide)", function(target) { + target.click(), can.onmotion.focus(can, event.target) + }) + if (event.key == lang.ENTER) { can.onmotion.focus(can, event.target) + can.page.Select(can, target, html.DIV_ITEM+":not(.hide)")[0].click() + } + if (event.key == lang.ESCAPE) { event.target.blur() } + }, selectInputs: function(event, can, cb, target) { if (can.page.ismodkey(event)) { return } if (event.key == lang.ESCAPE) { return target.blur() } if (event.ctrlKey || event.key == lang.TAB) { if (can.base.isUndefined(target._index)) { target._index = -1, target._value = target.value } function select(order) { if (order == -1) { target.value = target._value } diff --git a/page/index.css b/index.css similarity index 83% rename from page/index.css rename to index.css index 84660e98..81023287 100644 --- a/page/index.css +++ b/index.css @@ -29,9 +29,15 @@ div.project div.item { padding:2px 10px; } div.project div.item>div.name { padding-left:20px; } div.project div.switch { margin-top:2px; width:12px; float:left; rotate:90deg; } div.project div.switch.open { translate:3px -3px; rotate:180deg; } -div.project div.zone>div.name { background-color:steelblue; color:white; text-align:center; padding:3px; clear:both; } +div.project div.zone>div.name { background-color:steelblue; color:white; text-align:center; padding:3px; clear:both; position:relative; } +div.project div.zone>div.name>div.icon { margin-left:3px; display:none; float:right; } +div.project div.zone:hover>div.name>div.icon { display:block; } +div.project div.zone>div.list>div.zone:hover>div.name>div.icon { top:3px; } div.project div.zone>div.list>div.zone>div.name { text-align:left; padding-left:20px; } +div.project div.zone>div.list>div.zone>div.name:hover { margin-left:10px; transition:all 0.3s; } +div.project div.zone>div.list { min-width:200px; overflow:auto; } div.project div.zone>div.action>div.item { float:right; clear:none; } +div.project div.zone>div.action>div.item input[type=text] { margin-right:-10px; } table.content thead { position:sticky; top:2px; } table.content th { background-color:steelblue; padding:2px 5px; } table.content td { padding:2px 5px; } @@ -39,6 +45,7 @@ table.content.action th:last-child { position:sticky; right:2px; } table.content.action td:last-child { background-color:steelblue; position:sticky; right:2px; } div.code { background-color:#343a3445; font-size:12px; padding:10px; border:green solid 1px; } div.story[data-type=spark] { background-color:#2169a9a6; color:white; padding:5px 10px; border-left:blue solid 5px; margin:10px; } +h1 { text-align:center; margin:20px 0; } h2 { margin:20px 0; } h3 { margin:20px 0; } ul { padding-left:40px; margin:20px 0; } /* fieldset */ fieldset.contexts { position:fixed; } fieldset.panel>legend { display:none; } @@ -70,7 +77,6 @@ fieldset.input.date select[name=year] { width:128px; } fieldset.input.date select[name=month] { width:102px; } fieldset.input.date input:not([type=file]) { margin-right:0; } fieldset.input.date table.content { text-align:center; width:350px; } -fieldset.input.date div.action div.space { width:0; clear:both; } fieldset.input.date div.output td { padding:2px 10px; } fieldset.input.date div.output td.prev { color:gray; } fieldset.input.date div.output td.next { color:gray; } @@ -86,19 +92,15 @@ body>div.toast div.content { color:blue; text-align:center; } body>div.toast div.progress { border:green solid 1px; margin-left:-2px; height:20px; clear:both; } body>div.toast div.progress div.current { background-color:red; height:18px; } body>div.toast div.action { display:block; } -body>div.toast div.action>div.item.space { height:unset; } body>div.carte { padding:0; } +body>div.carte input[name=filter] { margin-left:5px; width:calc(100% - 10px); position:sticky; top:0; } body>div.carte div.item { padding:5px 10px; } -body>div.carte div.space { border-bottom:gray solid 1px; } -body>div.input div.content { overflow:auto; } body>div.input td { padding:5px; } body>div.input select { width:200px; } body>div.input textarea { height:120px; width:200px; } body>div.input input:not([type=button]) { width:200px; } body>div.input div.action input[type=button] { width:90px; } body>div.input div.action div { margin:5px; float:right; } -body>div.input.login { background-color:steelblue; padding:10px; min-width:240px; } -body>div.input.login input[type=button] { width:90px; } body>div.upload div.item { float:left; } body>div.upload div.output { border:red solid 1px; } body>div.upload div.progress { background-color:red; height:10px; width:0; } @@ -110,28 +112,25 @@ body>div.upload input[type=file] { width:320px; } legend { font-size:1.2rem; height:31px; } select, input { font-size:1rem; height:31px; } textarea { tab-size:2; height:93px; } table.content, div.project, div.item, div.code, div.story[data-type=spark], svg { font-family:monospace; white-space:pre; text-align:left; } -h1 { text-align:center; margin:20px 0; } h2 { margin:20px 0; } h3 { margin:20px 0; } ul { padding-left:40px; margin:20px 0; } div.action>div.tabs { padding:5px; height:31px; } div.status>div.item { padding:5px; height:30px; } div.status>div.item>label { font-size:0.6rem; } -div.status>legend { margin-left:2px; margin-right:0; float:right; clear:none; } -div.code { position:sticky; left:0; } /* display */ +form.option, div.action { display:contents; } +form.option>div.item>label, div.action>div.item>label, .hidden, .hide { display:none; } +div.action, div.output, div.status, div.project, div.display, div.profile, div.content, table.content, table.content td, div.code, div.story, div.toast { overflow:auto; } +legend, form.option, form.option>div.item, div.action, div.action>div.item, div.action>div.tabs, div.status>div.item { float:left; } +div.output, div.status, div.item.textarea, div.project div.item, div.content, div.code, div.story[data-type=spark] { clear:both; } +div.status>legend { margin-left:2px; margin-right:0; float:right; clear:none; } +fieldset.plugin:not(.float):not(.full):not(.cmd) { padding:10px; margin:10px; } +fieldset.plugin:not(.float):not(.full):not(.cmd)>legend { float:none; } +fieldset.auto, fieldset.full, fieldset.float, div.float { position:fixed; z-index:10; } +div.code { position:sticky; left:0; } form.option>div.icon { margin:5px; display:none; float:left; cursor:pointer; } fieldset.float:not(.input) form.option>div.icon { display:block; } fieldset.full form.option>div.icon { display:block; } fieldset.plug form.option>div.icon { display:block; margin-left:5px; } fieldset:not(.panel):not(.input) form.option>div.icon.refresh { display:block; margin-right:5px; } - -form.option, div.action { display:contents; } -form.option>div.item>label, div.action>div.item>label, .hidden, .hide { display:none; } -legend, form.option, form.option>div.item, div.action, div.action>div.item, div.action>div.tabs, div.status>div.item { float:left; } -div.output, div.status, div.item.textarea, div.project div.item, div.content, div.code, div.story[data-type=spark] { clear:both; } -div.action, div.output, div.status, div.project, div.display, div.profile, div.content, table.content, table.content td, div.code, div.story, body>div.toast { overflow:auto; } -fieldset.plugin:not(.float):not(.full):not(.cmd) { padding:10px; margin:10px; } -fieldset.plugin:not(.float):not(.full):not(.cmd)>legend { float:none; } -fieldset:not(.float):not(.plug):not(.full)>form.option input[type=button][name=close] { display:none; } -fieldset.auto, fieldset.full, fieldset.float, div.float { position:fixed; z-index:10; } /* hover */ legend:hover { background-color:skyblue; } select:hover { background-color:gray; color:cyan; } @@ -143,12 +142,12 @@ div.carte div.item:hover { background-color:cornflowerblue; } select, input[type=text], textarea { box-shadow:4px 4px 20px 4px #626bd0; } legend, select, input[type=button], div.tabs, div.item, span.item, div.zone>div.name, th, td, h1, h2, h3 { cursor:pointer; } div.title, div.story[data-type=spark] { cursor:copy; } -/* white */ +/* topic */ body.black a { color:yellow; } body.black div.project div.zone>div.list>div.zone>div.name { background-color:#09466fc2; } body.white { background-color:rgba(5,34,56,0.75); color:white; } body.white select { background-color:yellowgreen; color:white; } -body.white input:not([type=button]) { background-color:white; } +body.white input { background-color:white; } body.white input[name=cmd] { background-color:black; color:white; } body.white input[type=button] { background-color:cornflowerblue; color:white; } body.white input[type=button][name=restart] { background-color:blue; } @@ -183,7 +182,17 @@ 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; } -/* print */ +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)>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; } +body.light fieldset.panel:not(.main)>div.output div.menu:hover { background-color:#2b3446; color:white; } +body.light fieldset.panel:not(.main)>div.output fieldset>div.output { color:black; } body.print { -webkit-filter: grayscale(100%); } body.print { background-color:white; color:black; } body.print legend, body.print select, body.print input, body.print input[type=button], body.print textarea { background-color:snow; color:black; } @@ -211,25 +220,28 @@ body.mobile input { font-size:1.2rem; height:38px; } body.mobile textarea { font-size:1.2rem; } body.mobile form.option>div.item { margin:0; height:38px; } body.mobile div.action>div.item { margin:0; height:38px; } -body.mobile>div.carte div.item { font-size:1.6rem; } -body.mobile>div.input.login input { font-size:1.4rem; width:264px; } -body.mobile table.content th { padding:6px 6px; } +body.mobile div.carte div.item { font-size:1.6rem; } +body.mobile table.content th { padding:6px; } 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.head { font-size:1.6rem; padding:0; height:3rem; width:100%; position:fixed; top:0; } -body.mobile fieldset.Header.head div.search { padding:0; height:3rem; width:100%; margin:0; } -body.mobile fieldset.Header.head div.search>input { background-color:#21181838; color:white; height:53px; width:100%; } +body.mobile fieldset.Header { font-size:1.6rem; padding:0; height:3rem; width:100%; position:fixed; top:0; } +body.mobile fieldset.Header div.search { padding:0; height:3rem; width:100%; margin:0; } +body.mobile fieldset.Header div.search>input { 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.main { margin-top:3rem; margin-bottom:3rem; } -body.mobile fieldset.Action.main.cmd { margin-top:0; margin-bottom:0; } -body.mobile fieldset.Footer.foot { font-size:1.6rem; height:3rem; width:100%; position:fixed; bottom:0; } -body.mobile fieldset.Footer.foot div.output { height:3rem; } -body.mobile fieldset.Footer.foot div.output div { height:3rem; } -body.mobile fieldset.Footer.foot input[name=cmd] { height:3rem; } +body.mobile fieldset.Action { margin-top:3rem; margin-bottom:3rem; } +body.mobile fieldset.Action.cmd { margin-top:0; margin-bottom:0; } +body.mobile fieldset.Footer { font-size:1.6rem; height:3rem; width:100%; position:fixed; bottom:0; } +body.mobile fieldset.Footer div.output { height:3rem; } +body.mobile fieldset.Footer div.output div { height:3rem; } +body.mobile fieldset.Footer input[name=cmd] { height:3rem; } body.mobile fieldset.input.date div.output td { padding:8px 20px; } body.mobile fieldset.word.float>div.output>div.project { top:38px; } /* misc */ +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.panel.Action.cmd>div.toggle.project { display:none; } fieldset.panel.Search div.story[data-type=spark] { padding:0; margin:0; } fieldset.plugin.location>div.action input[type=text] { width:40px; } @@ -242,6 +254,10 @@ fieldset.plugin.inner.cmd>legend { display:none; } fieldset.plugin.inner.cmd>div.action { display:none; } fieldset.plugin.inner.cmd>form.option { display:none; } fieldset.xterm div.toggle { display:none; } +fieldset>div.output>fieldset.plug { position:absolute; bottom:0; right:0; display:none; } +fieldset>div.output>fieldset.plug.select { display:block; } +body.mobile fieldset.plugin>legend { border:none; } +.unselectable { -webkit-touch-callout:none; -webkit-user-select:none; -khtml-user-select:none; -moz-user-select:none; -ms-user-select:none; -o-user-select:none; user-select:none; } /* layout */ table.layout { border-spacing:0; } table.layout td { vertical-align:top; } diff --git a/lib/base.js b/lib/base.js index 891c59af..74657d9b 100644 --- a/lib/base.js +++ b/lib/base.js @@ -111,7 +111,7 @@ Volcanos("base", { h = parseInt(n/1000), h > 0 && (res += h), n = n % 1000 return res + (n > 0? ice.PT+parseInt(n/10): "") + "s" }, - isNight: function() { var now = new Date(); return now.getHours() < 7 || now.getHours() >= 17 }, + isNight: function() { var now = new Date(); return now.getHours() < 7 || now.getHours() > 17 }, isNumber: function(val) { return typeof val == lang.NUMBER }, isString: function(val) { return typeof val == lang.STRING }, isObject: function(val) { return typeof val == lang.OBJECT }, diff --git a/lib/core.js b/lib/core.js index a03d5169..6d2d5e42 100644 --- a/lib/core.js +++ b/lib/core.js @@ -28,7 +28,7 @@ Volcanos("core", { var res = [], begin = 0; function push(obj) { obj && res.push(typeof obj == lang.STRING || opt.detail? obj: obj.text), begin = -1 } for (var s = "", i = 0; i < str.length; i++) { if (space[str[i]]) { if (s) { continue } - begin > -1 && push(str.slice(begin, i)), opt.detail && push({type: html.SPACE, text: str.slice(i, i+1)}) + begin > -1 && push(str.slice(begin, i)), opt.detail && push({type: lang.SPACE, text: str.slice(i, i+1)}) } else if (block[str[i]]) { if (s) { continue } begin > -1 && push(str.slice(begin, i)), push(str.slice(i, i+1)) } else if (quote[str[i]]) { diff --git a/lib/misc.js b/lib/misc.js index c1ce3c9b..be89676f 100644 --- a/lib/misc.js +++ b/lib/misc.js @@ -169,7 +169,7 @@ Volcanos("misc", {Message: function(event, can) { var msg = {} SearchOrConf: function(can, key, def) { return can.base.getValid(can.misc.Search(can, key), can.Conf(key), def) }, SearchHash: function(can) { if (!can.isCmdMode()) { return [] } if (arguments.length > 1) { location.hash = encodeURIComponent(can.core.List(arguments).slice(1).join(ice.FS)) } - return can.core.Split(decodeURIComponent(location.hash.slice(1)))||[] + return can.core.Split(decodeURIComponent(location.hash.slice(1)), ",:")||[] }, Search: function(can, key, value) { var args = {} if (value == undefined && can.base.isString(key)) { var ls = can.core.Split(location.pathname, ice.PS); if (ls[0] == chat.SHARE) { args[chat.SHARE] = ls[1] } diff --git a/lib/page.js b/lib/page.js index f8d5d7d0..0f803503 100644 --- a/lib/page.js +++ b/lib/page.js @@ -45,7 +45,7 @@ Volcanos("page", {ClassList: { can.core.List(key, function(item) { if (!item) { return } if (item.nodeName) { target.appendChild(item); return } if (can.base.isString(item)) { item = {view: [item]} } - var type = item.type||html.DIV, data = item.data||{}, name = item.name||data.name||"" + var type = item.type||html.DIV, data = item.data||{}, name = item.name||data.name||""; data.className = data.className||"" can.core.Item(item, function(key, value) { switch (key) { case mdb.TYPE: break case mdb.NAME: break @@ -64,11 +64,11 @@ Volcanos("page", {ClassList: { can.base.isFunc(list[1]) && list[1](event, name), can.onkeymap.prevent(event); return true } } else if (item.select) { var list = item.select; type = html.SELECT - data.name = name = name||list[0][0], data.title = can.user.trans(can, data.title||name), data.className = data.className||list[0][0]||"" + data.name = name = name||list[0][0], data.className = data.className||list[0][0]||"", data.title = can.user.trans(can, data.title||name) item.list = list[0].slice(1).map(function(value) { return {type: html.OPTION, value: value, inner: can.user.trans(can, value)} }) data.onchange = function(event) { can.base.isFunc(list[1]) && list[1](event, event.target.value, name) } } else if (item.input) { var list = can.core.List(item.input); type = html.INPUT, name = name||list[0]||"" - data.type = data.type||"text", data.name = data.name||name, data.autocomplete = "off", data.className = data.className||data.name + data.type = data.type||"text", data.name = data.name||name, data.className = data.className||data.name data.onfocus = data.onfocus||function(event) { event.target.setSelectionRange(0, -1) } data.onkeydown = function(event) { can.base.isFunc(list[1]) && list[1](event) } data.onkeyup = function(event) { can.base.isFunc(list[2]) && list[2](event) } @@ -82,10 +82,12 @@ Volcanos("page", {ClassList: { } else if (item.td) { type = html.TR, item.list = item.td.map(function(text) { return {text: [text, html.TD]} }) } if (type == html.SELECT) { data.title = can.user.trans(can, data.title||data.name) } if (type == html.INPUT) { data.type == html.BUTTON && (data.value = can.user.trans(can, data.value)) - if (data.type == html.TEXT||data.type == html.PASSWORD||!data.type) { data.autocomplete = data.autocomplete||"off" + if (data.type == html.TEXT||data.type == html.PASSWORD||!data.type) { data.placeholder = (data.placeholder||data.name||"").split(ice.PT).pop(), data.title = can.user.trans(can, data.title||data.placeholder) + data.autocomplete = data.autocomplete||"off" } } else if (type == html.TEXTAREA) { data.placeholder = can.user.trans(can, (data.placeholder||data.name||"").split(ice.PT).pop()) } + if (!data.className) { delete(data.className) } !data.name && item.name && (data.name = item.name); var node = can.page.Create(can, type, data) value[name||""] = value[can.core.Split(data.className)[0]||""] = value[type] = node, value._target = value._target||node, value.first = value.first||node, value.last = node item.list && can.page.Append(can, node, item.list, value), target && target.appendChild && target.appendChild(node), can.base.isFunc(item._init) && item._init(node, value) @@ -156,7 +158,6 @@ Volcanos("page", {ClassList: { case html.USERNAME: // no break case html.PASSWORD: // no break case html.TEXT: - item.autocomplete = "off" item.name = item.name||item.type item.value = value||item.value||"" item.placeholder = item.placeholder||item.name||item.type diff --git a/lib/user.js b/lib/user.js index df3af1dc..de16115d 100644 --- a/lib/user.js +++ b/lib/user.js @@ -103,10 +103,11 @@ Volcanos("user", {info: {}, agent: { function remove_sub(carte) { carte._sub && can.page.Remove(can, carte._sub._target), delete(carte._sub) } function click(event, item) { can.base.isFunc(cb)? cb(event, item, meta): meta[item] && meta[item](event, can, item), can.onkeymap.prevent(event), can.user.isMobile && can.page.Remove(can, ui._target) } var ui = can.page.Append(can, document.body, [{view: [[chat.CARTE, meta._style||"", chat.FLOAT]], list: can.core.List(list, function(item, index) { - return can.base.isString(item)? item ==""? /* space */ {view: html.SPACE}: /* string */ {view: [html.ITEM, html.DIV, can.user.trans(can, item, trans)], onclick: function(event) { click(event, item) }, onmouseenter: function(event) { remove_sub(carte) } }: + return can.base.isString(item)? item ==""? /* space */ {type: html.HR}: /* string */ {view: [html.ITEM, html.DIV, can.user.trans(can, item, trans)], onclick: function(event) { click(event, item) }, onmouseenter: function(event) { remove_sub(carte) } }: can.base.isArray(item)? /* array */ {view: html.ITEM, list: [{text: can.user.trans(can, item[0], trans)+" -> "}], onmouseenter: function(event) { var sub = can.user.carte(event, can, meta, item.slice(1), cb, carte, trans); can.onlayout.figure(event, can, sub._target, true), remove_sub(carte), carte._sub = sub - } }: /* object */ {view: html.ITEM, list: [{text: can.user.trans(can, item.name, trans), onclick: function(event) { click(event, item.name) }, onmouseenter: function(event) { remove_sub(carte) } }] } + // } }: #<{(| object |)}># {view: html.ITEM, list: [{text: can.user.trans(can, item.name, trans), onclick: function(event) { click(event, item.name) }, onmouseenter: function(event) { remove_sub(carte) } }] } + } }: /* object */ item }), onmouseover: function(event) { can.onkeymap.prevent(event) } }]); can.onkeymap.prevent(event) var carte = {_target: ui._target, _parent: parent, layout: can.onlayout.figure(event, can, ui._target)} can.page.Select(can, ui._target, "img", function(target) { target.onload = function() { can.onlayout.figure(event, can, ui._target) } }) diff --git a/favicon.ico b/page/favicon.ico similarity index 100% rename from favicon.ico rename to page/favicon.ico diff --git a/page/index.html b/page/index.html index c6cd6ce7..4230b8df 100644 --- a/page/index.html +++ b/page/index.html @@ -1,14 +1,13 @@ - - volcanos - - - + + volcanos + + + - - - + + + - diff --git a/panel/action.js b/panel/action.js index 460ab60b..15f46dc5 100644 --- a/panel/action.js +++ b/panel/action.js @@ -20,7 +20,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg) { can.onmotion.clear(can) }), can.user.title(meta.name), skip || next() }), can.onlayout._init(can) }, _run: function(can, sub, cbs) { can._plugins = can.misc.concat(can, can._plugins, [sub]) - sub.run = function(event, cmds, cb) { (!cmds || cmds[0] != ctx.ACTION) && sub.request(event, {height: sub.ConfHeight(), width: sub.ConfWidth()}) + sub.run = function(event, cmds, cb) { (!cmds || cmds[0] != ctx.ACTION) && sub.request(event, kit.Dict(ice.SESS_HEIGHT, sub.ConfHeight(), ice.SESS_WIDTH, sub.ConfWidth())) return cbs(event, cmds, cb) }, sub.Mode(can.Mode()), sub.ConfHeight(can.ConfHeight()), sub.ConfWidth(can.ConfWidth()), can.page.style(can, sub._output, html.MAX_WIDTH, can.ConfWidth()) }, @@ -99,7 +99,9 @@ Volcanos(chat.ONACTION, {_init: function(can, target) { "refer", "参考手册", ), onmain: function(can) { can.onimport._share(can, can.misc.Search(can, web.SHARE)) }, - onlogin: function(can) { if (!can.Conf(chat.TOOL) && !can.user.mod.isCmd) { return } + onlogin: function(can) { + can.ondaemon._init(can) + if (!can.Conf(chat.TOOL) && !can.user.mod.isCmd) { return } can.onengine.signal(can, chat.ONACTION_CMD) can._names = location.pathname, can.Conf(chat.TOOL)? can.onappend.layout(can, can._output, "flow", can.core.List(can.Conf(chat.TOOL), function(item, index, list) { if (list.length == 1) { item.height = window.innerHeight-2*html.ACTION_HEIGHT } diff --git a/panel/footer.css b/panel/footer.css index 21b87932..292d81ef 100644 --- a/panel/footer.css +++ b/panel/footer.css @@ -7,8 +7,8 @@ fieldset.Footer>div.output div.state { font-family:monospace; float:right; } fieldset.Footer>div.output div.state label { font-size:12px; } fieldset.Footer>div.output div.toast { background-color:darkcyan; float:right; } fieldset.Footer>div.output div.cmd { padding:0; float:left; } -fieldset.Footer>div.output input[name=cmd] { margin-left:40px; width:120px; transition:all 0.5s; } -fieldset.Footer>div.output input[name=cmd]:focus { width:320px; transition:all 0.5s; } +fieldset.Footer>div.output input[name=cmd] { margin-left:40px; width:120px; transition:all 1s; } fieldset.Footer>div.output input[name=cmd]:hover { width:320px; transition:all 0.5s; } +fieldset.Footer>div.output input[name=cmd]:focus { width:320px; transition:all 0.5s; } fieldset.story.nlog.float tbody tr.warn { color:yellow; } fieldset.story.nlog.float tbody tr.error { color:red; } diff --git a/panel/footer.js b/panel/footer.js index a5689b6c..1857f598 100644 --- a/panel/footer.js +++ b/panel/footer.js @@ -27,6 +27,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { _data: function(can, name, item) { can[name] = can[name]||can.request(), can[name].Push(item), can.onimport.count(can, name) }, }) Volcanos(chat.ONACTION, {_init: function(can) { if (can.user.isExtension || can.user.mod.isPod) { can.onmotion.hidden(can) } }, + onsize: function(can) { can.ConfHeight(can._target.offsetHeight), can.ConfWidth(can._target.offsetWidth) }, onlogin: function(can, msg) { can.run({}, [], function(msg) { can.onmotion.clear(can), can.onimport._init(can, msg, can._output) }) }, ontoast: function(can, msg) { can.core.CallFunc(can.onimport.toast, {can: can, msg: msg}) }, ondebug: function(can, msg) { can.core.CallFunc(can.onimport.debug, {can: can, msg: msg}) }, diff --git a/panel/header.css b/panel/header.css index b71661b6..f71ff0f7 100644 --- a/panel/header.css +++ b/panel/header.css @@ -1,14 +1,16 @@ -fieldset.Header { font-size:1.1rem; padding:0 5px; height:31px; overflow:auto; z-index:10; } +fieldset.Header { font-size:1.1rem; line-height:21px; padding:0 5px; height:31px; overflow:auto; z-index:10; } fieldset.Header>div.output { overflow:hidden; } -fieldset.Header>div.output div { padding:5px; height:31px; float:left; cursor:pointer; } +fieldset.Header>div.output div.menu { padding:5px; height:31px; float:left; cursor:pointer; } +fieldset.Header>div.output div.title { padding:5px; height:31px; float:left; cursor:pointer; } +fieldset.Header>div.output div.state { padding:5px; height:31px; float:left; cursor:pointer; } fieldset.Header>div.output div:hover { background-color:#2e515f; } fieldset.Header>div.output div.title { float:left; } fieldset.Header>div.output div.state { float:right; } fieldset.Header>div.output div.state.avatar { padding:0; height:31px; } fieldset.Header>div.output div.state.avatar>img { height:31px; } -fieldset.Header>div.output div.search { margin-left:20px; float:left; } -fieldset.Header>div.output search { float:left; } -fieldset.Header>div.output div.search>input { margin-top:-5px; height:30px; transition:all 0.5s; } -fieldset.Header>div.output div.search>input:focus { width:320px; transition:all 0.5s; } +fieldset.Header>div.output div.search.title { margin-left:20px; float:left; } +fieldset.Header>div.output div.search>input { margin-top:-5px; height:30px; transition:all 1s; } fieldset.Header>div.output div.search>input:hover { width:320px; transition:all 0.5s; } -fieldset.Header>div.output river { margin-right:100px; } +fieldset.Header>div.output div.search>input:focus { width:320px; transition:all 0.5s; } +fieldset.Header>div.output div.river { margin-right:100px; } +fieldset.Header>div.output div.search { float:left; } diff --git a/panel/header.js b/panel/header.js index 2b39cfc6..ff939236 100644 --- a/panel/header.js +++ b/panel/header.js @@ -49,7 +49,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { }, topic: function(can, topic) { topic && (can._topic = can.base.Obj(topic).join(ice.SP)), can.user.topic(can, can.onexport.topic(can)) }, menu: function(can, cmds, cb, trans) { can.base.isString(cmds) && (cmds = [cmds]) - return can.page.Append(can, can._output, [{type: cmds[0], list: can.core.List(can.base.getValid(cmds.slice(1), [cmds[0]]), function(item) { + return can.page.Append(can, can._output, [{view: cmds[0], list: can.core.List(can.base.getValid(cmds.slice(1), [cmds[0]]), function(item) { if (can.base.isString(item)) { return {view: [html.MENU, html.DIV, can.user.trans(can, item, trans)], onclick: function(event) { can.base.isFunc(cb) && cb(event, item, [item]) }} } if (can.base.isArray(item)) { return {view: [html.MENU, html.DIV, can.user.trans(can, item[0], trans)], onmouseenter: function(event) { @@ -71,10 +71,10 @@ Volcanos(chat.ONACTION, { } can.user.info.usernick = can.Conf(aaa.USERNICK), can.user.info.language = can.misc.Search(can, aaa.LANGUAGE)||msg.Option(aaa.LANGUAGE) can.user.info.background = msg.Option(aaa.BACKGROUND), can.user.info.avatar = msg.Option(aaa.AVATAR) msg.Option(nfs.SCRIPT) && can.require(can.base.Obj(msg.Option(nfs.SCRIPT)), function(can) { can.onaction.source(can, msg) }) - can.onmotion.clear(can), can.onimport._init(can, msg, can._output), can.ondaemon._init(can), can.onengine.signal(can, chat.ONLOGIN, msg) + can.onmotion.clear(can), can.onimport._init(can, msg, can._output), can.onengine.signal(can, chat.ONLOGIN, msg) }) }, - onsize: function(can) { can.onimport.topic(can) }, + onsize: function(can) { can.onimport.topic(can), can.ConfHeight(can._target.offsetHeight), can.ConfWidth(can._target.offsetWidth) }, onstorm_select: function(can, river, storm) { can.Conf(chat.RIVER, river), can.Conf(chat.STORM, storm) }, onaction_cmd: function(can) { can.onmotion.hidden(can) }, onsearch_focus: function(can) { can._search && can._search.focus() }, diff --git a/panel/river.js b/panel/river.js index 9d9e9909..03e921d6 100644 --- a/panel/river.js +++ b/panel/river.js @@ -26,6 +26,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg) { var select; can.page.Append }, }) Volcanos(chat.ONACTION, {list: [mdb.CREATE, web.REFRESH], _init: function(can) { can.onmotion.hidden(can) }, + onsize: function(can) { can.ConfHeight(can._target.offsetHeight), can.ConfWidth(can._target.offsetWidth) }, onlogin: function(can, msg) { can.run({}, [], function(msg) { if (msg.Option(ice.MSG_RIVER) == "_share") { return } can.onmotion.clear(can), can.onimport._main(can, msg), can.onimport._init(can, msg), can.onimport._menu(can, msg) can.user.isMobile ||can.user.isExtension || can.user.mod.isPod || can.onmotion.toggle(can, can._target, true) diff --git a/panel/search.js b/panel/search.js index cadb0db8..d3a3d452 100644 --- a/panel/search.js +++ b/panel/search.js @@ -39,7 +39,7 @@ Volcanos(chat.ONACTION, {_init: function(can) { can.onmotion.hidden(can) }, list onopensearch: function(can, msg, type, word) { can.onimport.select(can, msg, [type||mdb.FOREACH, word||""]) }, onkeydown: function(can, msg) { msg._event.key == lang.ESCAPE && can.onmotion.hidden(can, can._target) }, onsize: function(can, height, width) { can.ConfHeight(height-2*html.PLUGIN_MARGIN-2*html.ACTION_HEIGHT), can.ConfWidth(width-2*html.PLUGIN_MARGIN) - can.core.List([can.ui.content, can.ui.display, can.ui.profile], function(target) { can.page.style(can, target, html.MAX_WIDTH, can.ConfWidth()) }) + can.ui && can.core.List([can.ui.content, can.ui.display, can.ui.profile], function(target) { can.page.style(can, target, html.MAX_WIDTH, can.ConfWidth()) }) can.core.List(can._plugins, function(sub) { sub.onimport.size(sub, can.base.Min(320, can.ConfHeight()-html.ACTION_HEIGHT-can.ui.content.offsetHeight-can.ui.display.offsetHeight)-2*html.ACTION_HEIGHT-1, can.ConfWidth()-1, true) }) can.page.style(can, can._output, html.MAX_HEIGHT, can.ConfHeight()-html.ACTION_HEIGHT) }, diff --git a/plugin/local/code/inner.css b/plugin/local/code/inner.css index 23436c94..b930bb02 100644 --- a/plugin/local/code/inner.css +++ b/plugin/local/code/inner.css @@ -1,6 +1,7 @@ fieldset.inner>form.option input[name=path] { width:80px; } fieldset.inner>form.option input[name=file] { width:160px; } fieldset.inner>div.output * { font-size:14px; font-family:monospace; outline:none; } +fieldset.inner>div.output legend { font-size:1rem; line-height:2rem; } fieldset.inner>div.output div.content { position:relative; } fieldset.inner>div.output div.content td.text span.comment { color:green; } fieldset.inner>div.output div.content td.text span.keyword { color:yellow; } @@ -10,8 +11,8 @@ fieldset.inner>div.output div.content td.text span.function { color:lightgreen; fieldset.inner>div.output div.content td.text span.constant { color:magenta; } fieldset.inner>div.output div.content td.text span.string { color:magenta; } fieldset.inner>div.output div.content td.text span.object { color:cyan; } -fieldset.inner>div.output legend { font-size:1rem; line-height:2rem; } fieldset.inner>div.output>div.project { width:230px; } +fieldset.inner>div.output>div.project>div.zone>div.name { letter-spacing:10px; } fieldset.inner>div.output>div.layout.flow>div.tabs { display:none; } fieldset.inner>div.output>div.layout.flow>div.path { display:none; } fieldset.inner.cmd>div.output>div.layout.flow>div.tabs { height:38px; display:block; overflow:auto; } @@ -22,6 +23,7 @@ fieldset.inner.cmd>div.output>div.layout.flow>div.tabs div.time { float:right; } fieldset.inner.cmd>div.output>div.layout.flow>div.path { padding:5px; display:block; } fieldset.inner.cmd>div.output>div.layout.flow>div.path span.func { margin-left:20px; } +body.black fieldset.inner>div.output div.content td.text span.comment { background-color:blue; color:cyan; } body.white fieldset.inner.cmd>div.output { background-color:aliceblue; } body.white fieldset.inner.cmd>div.output div.content { background-color:white; } body.white fieldset.inner.cmd>div.output>div.layout.flow>div.tabs div.select { background-color:white; } @@ -38,34 +40,6 @@ body.white fieldset.inner>div.output div.content td.text span.function { color:g body.white fieldset.inner>div.output div.content td.text span.constant { color:brown; } body.white fieldset.inner>div.output div.content td.text span.string { color:royalblue; } body.white fieldset.inner>div.output div.content td.text span.object { color:darkcyan; } -body.black fieldset.inner>div.output div.content td.text span.comment { background-color:blue; color:cyan; } -body.mobile fieldset.inner>form.option input[name=file] { width:90px; } -body.mobile fieldset.word fieldset.inner>form.option input[type=text] { display:none; } - -div.zone>div.action>div.item input[type=text] { margin-right:-10px; } -div.zone>div.list>div.zone>div.name:hover { margin-left:10px; transition:all 0.3s; } -div.tabs>div div.icon { margin-left:10px; margin-top:1px; float:right; visibility:hidden; } -div.tabs>div:hover div.icon { visibility:visible; } div.tabs>div.select div.icon { visibility:visible; } -div.action>div div.icon { margin-left:10px; margin-top:1px; float:right; visibility:hidden; } -div.action>div:hover div.icon { visibility:visible; } div.action>div.select div.icon { visibility:visible; } -div.carte.path.float { font-size:14px; border-radius:0; } div.carte.path.float div.item { padding:5px; } -div.path span.item { padding:5px; cursor:pointer; } -tr.line>td.line { text-align:right; padding:0 10px; position:sticky; left:0; } -tr.line>td.text { line-height:20px; white-space:pre; padding-left:10px; cursor:text; } -body.white tr.line.select { background-color:dimgray; } body.white tr.line:hover { background-color:dimgray; } -body.black tr.line.select { background-color:darkblue; } body.black tr.line:hover { background-color:darkblue; } -fieldset>div.output>fieldset.plug { position:absolute; bottom:0; right:0; display:none; } -fieldset>div.output>fieldset.plug.select { display:block; } -body.mobile fieldset.plugin>legend { border:none; } -.unselectable { -webkit-touch-callout:none; -webkit-user-select:none; -khtml-user-select:none; -moz-user-select:none; -ms-user-select:none; -o-user-select:none; user-select:none; } - -body.dark fieldset.inner>div.output div.content td.text span.comment { color:green; } -body.dark fieldset.inner>div.output div.content td.text span.keyword { color:royalblue; } -body.dark fieldset.inner>div.output div.content td.text span.datatype { color:lavender; } -body.dark fieldset.inner>div.output div.content td.text span.function { color:lightgreen; } -body.dark fieldset.inner>div.output div.content td.text span.constant { color:gray; } -body.dark fieldset.inner>div.output div.content td.text span.string { color:orange; } -body.dark fieldset.inner>div.output div.content td.text span.object { color:gold; } body.light fieldset.inner>div.output div.content td.text span.comment { color:darkgray; } body.light fieldset.inner>div.output div.content td.text span.keyword { color:darkblue; } body.light fieldset.inner>div.output div.content td.text span.package { color:blue; } @@ -74,3 +48,25 @@ body.light fieldset.inner>div.output div.content td.text span.function { color:d body.light fieldset.inner>div.output div.content td.text span.constant { color:gray; } body.light fieldset.inner>div.output div.content td.text span.string { color:brown; } body.light fieldset.inner>div.output div.content td.text span.object { color:purple; } +body.dark fieldset.inner>div.output div.content td.text span.comment { color:green; } +body.dark fieldset.inner>div.output div.content td.text span.keyword { color:royalblue; } +body.dark fieldset.inner>div.output div.content td.text span.datatype { color:lavender; } +body.dark fieldset.inner>div.output div.content td.text span.function { color:lightgreen; } +body.dark fieldset.inner>div.output div.content td.text span.constant { color:gray; } +body.dark fieldset.inner>div.output div.content td.text span.string { color:orange; } +body.dark fieldset.inner>div.output div.content td.text span.object { color:gold; } +body.mobile fieldset.inner>form.option input[name=file] { width:90px; } +body.mobile fieldset.word fieldset.inner>form.option input[type=text] { display:none; } + +div.action>div div.icon { margin-left:10px; margin-top:1px; float:right; visibility:hidden; } +div.action>div:hover div.icon { visibility:visible; } div.action>div.select div.icon { visibility:visible; } +div.tabs>div div.icon { margin-left:10px; margin-top:1px; float:right; visibility:hidden; } +div.tabs>div:hover div.icon { visibility:visible; } div.tabs>div.select div.icon { visibility:visible; } +div.carte.path.float { font-size:14px; border-radius:0; } div.carte.path.float div.item { padding:5px; } +div.path span.item { padding:5px; cursor:pointer; } +tr.line>td.line { text-align:right; padding:0 10px; position:sticky; left:0; } +tr.line>td.text { line-height:20px; white-space:pre; padding-left:10px; cursor:text; } +body.white tr.line.select { background-color:dimgray; } body.white tr.line:hover { background-color:dimgray; } +body.black tr.line.select { background-color:darkblue; } body.black tr.line:hover { background-color:darkblue; } + + diff --git a/plugin/local/code/inner.js b/plugin/local/code/inner.js index 599b8e1c..c8244a80 100644 --- a/plugin/local/code/inner.js +++ b/plugin/local/code/inner.js @@ -72,7 +72,12 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl case ice.SP: indent++; break default: return indent } } } - var package = "", block = "", list = [], current = "", percent = ""; can.page.Select(can, can.ui.content, "tr.line>td.text", function(item, index) { + var carte, list = [{input: ["filter", function(event) { + can.onkeymap.selectItems(event, can, carte._target) + }], _init: function(target) { can.onmotion.delay(can, function() { target.focus() }) }}] + + var package = "", block = "", current = "", percent = "" + can.page.Select(can, can.ui.content, "tr.line>td.text", function(item, index) { var text = item.innerText, _indent = indent(text) function push(item) { list.push(item) if (index < can.Option(nfs.LINE)) { current = list[list.length-1], percent = " = "+parseInt((index+1)*100/(can.max||1))+"%" } @@ -105,9 +110,8 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl } } }); (can.parse == nfs.JS || can.parse == nfs.GO) && can.page.Append(can, target, [{view: [[html.ITEM, "func"], html.SPAN, (current||"function")+" / "+can.max+percent], onclick: function(event) { - can.user.carte(event, can, {_style: nfs.PATH}, list, function(ev, button) { - can.onimport.tabview(can, can.Option(nfs.PATH), can.Option(nfs.FILE), can.core.Split(button, ice.DF)[1]) - can.onmotion.clearFloat(can) + carte = can.user.carte(event, can, {_style: nfs.PATH}, list, function(ev, button) { + can.onimport.tabview(can, can.Option(nfs.PATH), can.Option(nfs.FILE), can.core.Split(button, ice.DF)[1]), can.onmotion.clearFloat(can) }) }}]) }, @@ -140,7 +144,9 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl }), can.ui.current && can.onmotion.toggle(can, can.ui.current, !isCommand() && !isDream()) var ls = can.file.split(ice.PS); if (ls.length > 4) { ls = [ls.slice(0, 2).join(ice.PS)+"/.../"+ls.slice(-2).join(ice.PS)] } can.Status(kit.Dict("文件", ls.join(ice.PS), "类型", can.parse)), can.onimport.layout(can) - can.onaction.selectLine(can, can.Option(nfs.LINE)), can.onaction.scrollIntoView(can) + if (!skip) { + can.onaction.selectLine(can, can.Option(nfs.LINE)), can.onaction.scrollIntoView(can) + } can.base.isFunc(cb) && cb(), cb = null }) } @@ -162,7 +168,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl }, project: function(can, path) { can.onimport.zone(can, can.core.Item(can.onfigure, function(name, cb) { - if (can.base.isFunc(cb)) { return {name: name, _init: function(target, zone) { return cb(can, target, zone, path) }} } + if (can.base.isFunc(cb)) { return {name: name, _trans: can.onfigure._trans? can.onfigure._trans[name]||"": "", _init: function(target, zone) { return cb(can, target, zone, path) }} } }), can.ui.project), can.user.isMobile && !can.user.isLandscape() && can.onmotion.hidden(can, can.ui.project) }, profile: function(can, msg) { var sup = can.db.tabview[can.onexport.keys(can)] @@ -308,7 +314,6 @@ Volcanos(chat.ONSYNTAX, {_init: function(can, msg, cb) { p.keyword && (line = can.core.List(can.core.Split(line, p.split.space||"\t ", p.split.operator||"{[(.,:;!?|&*/+-<=>)]}", {detail: true}), function(item, index, array) { item = can.base.isObject(item)? item: {text: item}; var text = item.text, type = p.keyword[text] switch (item.type||type) { - case html.SPACE: return text case lang.STRING: return wrap(item.left+text+item.right, lang.STRING) case code.COMMENT: case code.KEYWORD: @@ -430,7 +435,7 @@ Volcanos(chat.ONACTION, { can.onappend.figure(can, {action: "key", mode: chat.SIMPLE, _enter: function(event) { if (event.ctrlKey) { meta.grep() } else { meta[button](), can.onmotion.delay(can, function() { target.focus() }) } return true }, run: function(event, cmds, cb) { var msg = can.request(event); can.core.List(can.core.Split(can.current.text(), "\t {([,:;=<>])}", {detail: true}), function(value) { - if (can.base.isObject(value)) { if (value.type == html.SPACE) { return } + if (can.base.isObject(value)) { value.type == lang.STRING && msg.Push(mdb.VALUE, value.left+value.text+value.right), msg.Push(mdb.VALUE, value.text) } else { msg.Push(mdb.VALUE, value) diff --git a/plugin/local/code/vimer.css b/plugin/local/code/vimer.css index 8ae85c82..febc649b 100644 --- a/plugin/local/code/vimer.css +++ b/plugin/local/code/vimer.css @@ -1,7 +1,10 @@ fieldset.vimer>div.output div.project div.zone.create>div.action { display:none; } fieldset.vimer>div.output div.project div.zone.create>div.list div.item { padding:2px; float:left; clear:none; } fieldset.vimer>div.output div.project div.zone.create>div.list div.item input { letter-spacing:2px; } -fieldset.vimer>div.output div.project div.zone.recent>div.list { min-width:200px; max-height:240px; overflow:auto; } +fieldset.vimer>div.output div.project div.zone.recent>div.list { min-width:200px; max-height:120px; } +fieldset.vimer>div.output div.project div.zone.repos>div.list { max-height:120px; } +fieldset.vimer>div.output div.project div.zone.dream>div.list { max-height:120px; } +fieldset.vimer>div.output div.project div.zone.dream div.item.stop { color:gray; } fieldset.vimer>div.output input.current { background-color:transparent; color:transparent; padding-left:10px; height:20px; position:absolute; } fieldset.vimer>div.output input.current.insert { caret-color:black; } fieldset.vimer>div.output input.current.normal { caret-color:lightgray; } diff --git a/plugin/local/code/vimer.js b/plugin/local/code/vimer.js index 9d4db121..6d1ea9ff 100644 --- a/plugin/local/code/vimer.js +++ b/plugin/local/code/vimer.js @@ -4,6 +4,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onimport._input(can), can.onkeymap._build(can), can.onkeymap._plugin(can) can.onengine.listen(can, "tabview.line.select", function(msg) { can.onaction._selectLine(can) }) can.onengine.plugin(can, can.onplugin), can.base.isFunc(cb) && cb(msg) + can.ui.project.onscroll = function() { can.onmotion.clearFloat(can) } }, target) }) }, _input: function(can) { var ui = can.page.Append(can, can.ui.content.parentNode, [ @@ -15,32 +16,33 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { if (can.mode == mdb.NORMAL) { can.onkeymap.prevent(event), can.Status("按键", can.db._keylist.join("")) } }, onkeyup: function(event) { can.onaction._complete(event, can) }, onfocus: function() { var target = can.ui.complete; can.current.line.appendChild(target), can.onmotion.toggle(can, target, true) - }, onblur: function(event) { }, onclick: function(event) { -// }, onblur: function(event) { can.onmotion.hidden(can, can.ui.complete) }, onclick: function(event) { + }, onclick: function(event) { can.onkeymap._insert(event, can) - }}, {view: [[code.COMPLETE, "float"]]}, + }}, {view: [[code.COMPLETE, chat.FLOAT]]}, ]); can.ui.current = ui.current, can.ui.complete = ui.complete }, }, [""]) Volcanos(chat.ONFIGURE, { create: function(can, target, zone, path) { can.isCmdMode()? can.onappend._action(can, can.base.Obj(can._msg.Option(ice.MSG_ACTION)).concat( ["首页", "官网" , "文档" , "git"], window.webview? ["浏览器", "录屏", "日志", "编辑器"]: [] - ), target): can.onmotion.hidden(can, target.parentNode) + ), target): can.onmotion.hidden(can, target.parentNode), can.onmotion.hidden(can, target) can.sup.onexport.link = function(can) { var args = can.Option() var meta = can.Conf(); args.cmd = meta.index||can.core.Keys(meta.ctx, meta.cmd) return can.misc.MergePodCmd(can, args, true) } - can.onmotion.hidden(can, target) }, recent: function(can, target, zone, path) { var total = 0 function show(msg, cb) { var list = {}; msg.Table(function(item) { var path = item.path+item.file - if (!list[path]) { zone._total(++total), can.page.Append(can, target, cb(item, path)) } list[path] = item + if (!list[path]) { can.page.Append(can, target, cb(item, path)), zone._total(++total) } list[path] = item }) } can.runAction({}, code.FAVOR, ["_recent_file"], function(msg) { msg.Push(nfs.PATH, ice.USR_VOLCANOS).Push(nfs.FILE, "frame.js") - msg.Push(nfs.PATH, ice.USR_VOLCANOS).Push(nfs.FILE, "page/index.css") - msg.Push(nfs.PATH, ice.USR_VOLCANOS).Push(nfs.FILE, "plugin/local/code/inner.js") + msg.Push(nfs.PATH, ice.USR_VOLCANOS).Push(nfs.FILE, "index.css") + msg.Push(nfs.PATH, ice.USR_VOLCANOS).Push(nfs.FILE, "plugin/table.js") msg.Push(nfs.PATH, ice.USR_VOLCANOS).Push(nfs.FILE, "plugin/local/code/vimer.js") + msg.Push(nfs.PATH, ice.USR_VOLCANOS).Push(nfs.FILE, "plugin/local/code/inner.js") + msg.Push(nfs.PATH, ice.USR_VOLCANOS).Push(nfs.FILE, "plugin/local/code/inner.css") + msg.Push(nfs.PATH, ice.USR_VOLCANOS).Push(nfs.FILE, "plugin/local/code/vimer.css") msg.Push(nfs.PATH, ice.USR_ICEBERGS).Push(nfs.FILE, "core/code/vimer.go") show(msg, function(item, path) { return [{text: [path.split(ice.PS).slice(-2).join(ice.PS), html.DIV, html.ITEM], onclick: function(event) { can.onimport.tabview(can, item.path, item.file) @@ -48,8 +50,9 @@ Volcanos(chat.ONFIGURE, { }) }, source: function(can, target, zone, path) { var total = 0 - var hash = location.hash; if (can.isCmdMode() && hash) { var args = can.core.Split(decodeURIComponent(hash).slice(1), ice.DF) } else { args = [] } - function show(target, path) { can.run(can.request({}, {dir_root: path, dir_deep: true}), [nfs.PWD], function(msg) { + var args = can.base.getValid(can.misc.SearchHash(can), [can.Option(nfs.PATH), can.Option(nfs.FILE)]) + function show(target, zone, path) { can.run(can.request({}, {dir_root: path, dir_deep: true}), [nfs.PWD], function(msg) { + can.onmotion.clear(can, target) var node; function add(list) { can.core.List(list, function(item) { if (path == args[0] && args[1].indexOf(item.path) == 0) { item.expand = true } item._menu = shy({ create: function(event) { can.user.input(event, can, ["filename"], function(list) { @@ -62,40 +65,58 @@ Volcanos(chat.ONFIGURE, { trash: function(event) { can.runAction(event, nfs.TRASH, [can.base.Path(path, item.path)], function() { item._remove() }) }, }), item._init = function(target) { item._remove = function() { can.page.Remove(can, target.parentNode), delete(node[item.path]) } } }) return can.onimport.tree(can, list, nfs.PATH, ice.PS, function(event, item) { can.onimport.tabview(can, path, item.path) }, target, node) - } node = add(msg.Table(), node), can.Status("目录", zone._total(total += msg.Length())) + } node = add(msg.Table(), node), can.Status("目录", zone._total(msg.Length())) + + if (zone._icon == true) { return } zone._icon = true + can.page.Append(can, zone._legend, [{view: "icon s16 create", onclick: function(event) { can.user.input(event, can, ["filename"], function(list) { + can.runAction(can.request(event, {path: path, file: list[0]}), nfs.SAVE, [], function(msg) { can.onimport.tabview(can, path, list[0]) + can.onimport.tree(can, [{path: list[0]}], nfs.PATH, ice.PS, function(event, item) { can.onimport.tabview(can, path, item.path) }, target, node) + can.core.List(list[0].split(ice.PS), function(item, index, array) { can.onmotion.toggle(can, node[array.slice(0, index+1).join(ice.PS)], true) }) + }) + }), can.onkeymap.prevent(event) }}]) + can.page.Append(can, zone._legend, [{view: "icon s16 refresh", onclick: function(event) { + show(target, zone, path), can.onkeymap.prevent(event), can.user.toastSuccess(can) + }}]) }, true) } if (path.length == 1) { return show(target, path[0]) } - can.onimport.zone(can, can.core.List(path, function(path) { return {name: path, _init: function(target, zone) { - if (path == args[0]) { show(target, path) } else { can.onmotion.hidden(can, zone._action), can.onmotion.hidden(can, zone._target) } - }, _delay_show: function(target) { path != args[0] && show(target, path) } }}), target), can.page.Remove(can, target.previousSibling) + can.onimport.zone(can, can.core.List(path, function(path) { + return path.indexOf("-story") == -1 && path.indexOf("-dict") == -1 && {name: path, _init: function(target, zone) { + path == args[0] && show(target, zone, path) + }, _delay_show: path == args[0]? undefined: function(target, zone) { show(target, zone, path) }} + }), target), can.page.Remove(can, target.previousSibling) }, + repos: function(can, target, zone, path) { zone._delay_show = function() { can.runAction({}, nfs.REPOS, [], function(msg) { + msg.Table(function(value) { can.onimport.item(can, {name: can.page.Color(value.type)+ice.TB+value.file}, function() { + can.onimport.tabview(can, value.path, value.file) + }, function() {}, target) }), zone._total(msg.Length()) + }) } }, dream: function(can, target, zone) { var call = arguments.callee - can.runAction({}, ice.RUN, [web.DREAM], function(msg) { msg.Table(function(item) { var color = item.status == cli.START? "": "gray" - can.page.style(can, can.onimport.item(can, item, function(event) { can.onimport.tabview(can, can.Option(nfs.PATH), item.name, web.DREAM) }, function(event) { + can.runAction({}, ice.RUN, [web.DREAM], function(msg) { can.onmotion.clear(can, target), msg.Table(function(item) { + can.page.ClassList.add(can, can.onimport.item(can, item, function(event) { can.onimport.tabview(can, can.Option(nfs.PATH), item.name, web.DREAM) }, function(event) { return shy(kit.Dict(cli.START, [cli.OPEN, cli.STOP], cli.STOP, [cli.START, nfs.TRASH])[item.status], function(event, button) { can.runAction(can.request({}, item), ice.RUN, [web.DREAM, ctx.ACTION, button], function(msg) { - if (can.sup.onimport._process(can.sup, msg)) { return } can.onmotion.clear(can, target), call(can, target, zone) + can.sup.onimport._process(can.sup, msg) || call(can, target, zone) }) }) - }, target), {color: color}) - }), zone._total(msg.Length()) }) - return shy(kit.Dict(web.REFRESH, function(event, can, button) { zone.refresh() }, + }, target), item.status) + }), zone._total(msg.Length()), can.user.toastSuccess(can) }) + return shy(kit.Dict( + web.REFRESH, function(event, can, button) { call(can, target, zone) }, mdb.CREATE, function(event, can, button) { can.onaction.dream(event, can, web.DREAM) }, code.PUBLISH, function(event, can, button) { can.runAction(event, button, [], function(msg) { can.user.toastConfirm(can, msg.Result(), button) }) }, )) }, - plugin: function(can, target, zone) { var total = 0 + plugin: function(can, target, zone) { zone._delay_show = function() { var total = 0 can.onimport.tree(can, can.core.ItemKeys(can.onengine.plugin.meta, function(key) { return total++, {index: key} }), ctx.INDEX, ice.PT, function(event, item) { can.onimport.tabview(can, can.Option(nfs.PATH), can.core.Keys(ice.CAN, item.index), ctx.INDEX) - }, target), zone._total(total) - can.onmotion.hidden(can, target), can.onmotion.hidden(can, target.previousSibling) - }, - module: function(can, target, zone) { + }, target), zone._total(total), can.onmotion.hidden(can, target), can.onmotion.hidden(can, target.previousSibling) + } }, + module: function(can, target, zone) { zone._delay_show = function() { can.runAction(can.request({}, {fields: ctx.INDEX}), ctx.COMMAND, [mdb.SEARCH, ctx.COMMAND], function(msg) { can.onimport.tree(can, msg.Table(), ctx.INDEX, ice.PT, function(event, item) { can.onimport.tabview(can, can.Option(nfs.PATH), item.index, ctx.INDEX) }, target), zone._total(msg.Length()) }) - }, + } }, }) Volcanos(chat.ONACTION, { _daemon: function(event, can, arg) { switch (arg[0]) { @@ -345,7 +366,8 @@ Volcanos(chat.ONKEYMAP, { }), J: shy("合并两行", function(can) { var next = can.current.next(); if (!next) { return } var line = can.onaction.selectLine(can), text = can.current.text(), rest = can.onexport.text(can, next) - can.ui.current.value = can.current.text(text.trimRight()+(can.base.endWith(text, "(")||can.base.beginWith(rest, ")")? "": ice.SP)+rest.trimLeft()), can.onaction.deleteLine(can, next) + can.ui.current.value = can.current.text(text.trimRight()+(can.base.endWith(text, "(")||can.base.beginWith(rest, ")")? "": + can.base.beginWith(rest.trim(), ",")? "": ice.SP)+rest.trimLeft()), can.onaction.deleteLine(can, next) can.db.undo.push(function() { can.onaction.modifyLine(can, line, text), can.onaction.insertLine(can, rest, line+1) }) }), ".": shy("重复操作", function(can) { var cb = can.db.redo.pop(); cb && cb() }), diff --git a/plugin/local/wiki/draw.css b/plugin/local/wiki/draw.css deleted file mode 100644 index b2e29668..00000000 --- a/plugin/local/wiki/draw.css +++ /dev/null @@ -1,3 +0,0 @@ -fieldset.draw td.content { position:relative; } -// fieldset.draw div.output { background-color:#1b5b738c; } -fieldset.draw div.output div.content svg { background-color:#1b5b738c; } diff --git a/plugin/local/wiki/draw.js b/plugin/local/wiki/draw.js index 667a8b97..95e62499 100644 --- a/plugin/local/wiki/draw.js +++ b/plugin/local/wiki/draw.js @@ -73,7 +73,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear( sub.onimport.size(sub, can.ConfHeight()/2, can.ConfWidth()-can.ui.project.offsetWidth, true) }) }, -}, [""]) +}) Volcanos(chat.ONACTION, {list: [[svg.GRID, 1, 2, 3, 4, 5, 10, 20], [svg.FONT_SIZE, 12, 16, 18, 24, 32], [svg.STROKE_WIDTH, 1, 2, 3, 4, 5], [svg.STROKE, cli.RED, cli.YELLOW, cli.GREEN, cli.CYAN, cli.BLUE, cli.PURPLE, cli.BLACK, cli.WHITE], diff --git a/plugin/local/wiki/word.js b/plugin/local/wiki/word.js index 83536555..8532a1cf 100644 --- a/plugin/local/wiki/word.js +++ b/plugin/local/wiki/word.js @@ -156,7 +156,7 @@ Volcanos(chat.ONACTION, { can.keylist = can.onkeymap._parse(event, can, "normal", can.keylist) }})), can.onkeymap._build(can) - sub.page.style(sub, sub._target, html.BACKGROUND, can._root._target.style.background) + sub.page.style(sub, sub._target, "background", can._root._target.style.background) sub.page.style(sub, sub._output, html.HEIGHT, can.page.height()-2*html.ACTION_HEIGHT) sub.page.style(sub, sub._output, html.WIDTH, can.page.width()) diff --git a/plugin/story/spide.css b/plugin/story/spide.css deleted file mode 100644 index 12f9f1b8..00000000 --- a/plugin/story/spide.css +++ /dev/null @@ -1 +0,0 @@ -fieldset.draw.spide div.output div.toggle { display:none; } diff --git a/plugin/story/spide.js b/plugin/story/spide.js index f1b0e07c..706f5984 100644 --- a/plugin/story/spide.js +++ b/plugin/story/spide.js @@ -24,7 +24,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb) { can.svg.Val(svg.FONT_SIZE, can.size = parseInt(can.Action(html.SIZE))), can.margin = parseInt(can.Action(html.MARGIN)) can.onaction[can.Action(ice.VIEW)](event, can, can.Action(ice.VIEW)) }, -}, [""]) +}) Volcanos(chat.ONACTION, {list: [[ice.VIEW, "横向", "纵向"], [html.SIZE, 24, 32, 48], [html.MARGIN, 10, 30, 50]], size: function(event, can) { can.onimport.layout(can) }, margin: function(event, can) { can.onimport.layout(can) }, "横向": function(event, can, button) { can.onimport._height(can, can._tree[can.dir_root]), can.onmotion.clear(can, can.svg) diff --git a/plugin/story/trend.css b/plugin/story/trend.css deleted file mode 100644 index e670aaeb..00000000 --- a/plugin/story/trend.css +++ /dev/null @@ -1,2 +0,0 @@ -fieldset.draw.trend div.output div.toggle { display:none; } - diff --git a/plugin/story/trend.js b/plugin/story/trend.js index 80668699..3607a01e 100644 --- a/plugin/story/trend.js +++ b/plugin/story/trend.js @@ -42,7 +42,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb) { can.requireDraw(functio transform: function(can, target) { target.Value("transform", "translate(0, "+parseInt(can.ConfHeight())+") scale(1, -1)") }, -}, [""]) +}) Volcanos(chat.ONACTION, {list: [ [ice.VIEW, "趋势图", "柱状图", "折线图", "数据源"], [html.HEIGHT, ice.AUTO, 100, 200, 400, 600, 800], diff --git a/plugin/table.js b/plugin/table.js index f5ea780c..a16fecc5 100644 --- a/plugin/table.js +++ b/plugin/table.js @@ -101,31 +101,32 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl }); return node }, zone: function(can, list, target) { - return can.page.Append(can, target, can.core.List(list, function(zone, index) { can.base.isString(zone) && (zone = {name: zone}); return zone && {view: html.ZONE+ice.SP+zone.name, list: [ - {view: html.NAME, inner: can.user.trans(can, zone.name), onclick: function() { - if (zone._delay_show) { zone._delay_show(zone._target), delete(zone._delay_show) } + return can.page.Append(can, target, can.core.List(list, function(zone) { can.base.isString(zone) && (zone = {name: zone}); return zone && {view: [[html.ZONE, zone.name]], list: [ + {view: html.NAME, inner: can.user.trans(can, zone.name), _init: function(target) { + zone._legend = target + }, onclick: function() { + if (zone._delay_show) { zone._delay_show(zone._target, zone), delete(zone._delay_show) } can.onmotion.toggle(can, zone._action), can.onmotion.toggle(can, zone._target) }, oncontextmenu: function(event) { zone._menu? can.user.carteRight(event, can, zone._menu.meta, zone._menu.list||can.core.Item(zone._menu.meta), function(event, button, meta) { (meta[button]||can.onaction[button])(event, can, button) - }): can.page.Select(can, document.body, can.page.Keys("div.carte.float"), function(target) { can.page.Remove(can, target) }) + }): can.onmotion.clearCarte(can) }}, {view: html.ACTION, _init: function(target) { zone._action = target - can.onappend._action(can, [{input: html.TEXT, placeholder: "search", onkeyup: function(event) { + can.onappend._action(can, [{input: html.TEXT, placeholder: mdb.SEARCH, onkeyup: function(event) { can.page.Select(can, zone._target, html.DIV_LIST, function(item) { can.onmotion.toggle(can, item, true) }) - can.page.Select(can, zone._target, html.DIV_ITEM, function(item) { - can.page.Select(can, item, "div.name", function(name) { can.onmotion.toggle(can, item, name.innerText.indexOf(event.target.value) > -1) }) - }) - }, onclick: function(event) { - can.onmotion.focus(can, event.target) + can.onkeymap.selectItems(event, can, zone._target) + }, onfocus: function(event) { var target = event.target + target.setSelectionRange && target.setSelectionRange(0, target.value.length) }, _init: function(target) { zone._search = target can.onmotion.delay(can, function() { can.page.styleWidth(can, target, can.core.Value(target.parentNode.parentNode, "parentNode.offsetWidth")-10) }) }}], target, {}) }}, {view: html.LIST, _init: function(target) { can.ui[zone.name] = zone zone._total = function(total) { return can.page.Modify(can, zone._search, {placeholder: "search in "+total+" item"}), total } - zone._target = target, zone.refresh = function() { can.onmotion.clear(can, target), zone._init(target, zone) } + zone._target = target, zone.refresh = function() { zone._init(target, zone) } can.base.isFunc(zone._init) && (zone._menu = zone._init(target, zone)||zone._menu) + if (zone._delay_show) { can.onmotion.hidden(can, zone._action), can.onmotion.hidden(can, zone._target) } }} ]} })) }, diff --git a/proto.js b/proto.js index b0dcc106..6ab76211 100644 --- a/proto.js +++ b/proto.js @@ -1,8 +1,8 @@ var kit = {proto: function(sub, sup) { return sub.__proto__ = sup, sub }, - Dict: function() { var res = {}, args = arguments; for (var i = 0; i < args.length; i += 2) { var value = args[i] - if (typeof value == "object") { i--; for (var k in value) { res[k] = value[k] } - for (var j = 0; j < value.length; j += 2) { res[value[j]] = value[j+1] } - } else if (typeof value == "string" && value) { res[value] = args[i+1] } + Dict: function() { var res = {}, arg = arguments; for (var i = 0; i < arg.length; i += 2) { var key = arg[i] + if (typeof key == "object") { i--; for (var k in key) { res[k] = key[k] } + for (var j = 0; j < key.length; j += 2) { res[key[j]] = key[j+1] } + } else if (typeof key == "string" && key) { res[key] = arg[i+1] } } return res }, } var ice = { @@ -13,22 +13,16 @@ var ice = { SHOW: "show", HIDE: "hide", HELP: "help", COPY: "copy", VIEW: "view", MODE: "mode", SHIP: "ship", EXEC: "exec", - DEV: "dev", - POD: "pod", CTX: "ctx", CMD: "cmd", ARG: "arg", OPT: "opt", + DEV: "dev", POD: "pod", CTX: "ctx", CMD: "cmd", ARG: "arg", OPT: "opt", CAN: "can", MSG: "msg", RUN: "run", RES: "res", ERR: "err", - CAN_PLUGIN: "can.plugin", + CAN_PLUGIN: "can._plugin", - MSG_DETAIL: "detail", - MSG_OPTION: "option", - MSG_APPEND: "append", - MSG_RESULT: "result", - MSG_FIELDS: "fields", - MSG_SESSID: "sessid", + MSG_DETAIL: "detail", MSG_OPTION: "option", MSG_APPEND: "append", MSG_RESULT: "result", + MSG_SESSID: "sessid", MSG_FIELDS: "fields", MSG_SOURCE: "_source", MSG_TARGET: "_target", MSG_HANDLE: "_handle", - MSG_DAEMON: "_daemon", MSG_UPLOAD: "_upload", MSG_ACTION: "_action", MSG_STATUS: "_status", @@ -39,21 +33,12 @@ var ice = { MSG_PROCESS: "_process", PROCESS_AGAIN: "_again", - MSG_TITLE: "sess.title", - MSG_TOPIC: "sess.topic", - MSG_RIVER: "sess.river", - MSG_STORM: "sess.storm", - - MSG_USERNAME: "user.name", - MSG_USERNICK: "user.nick", - + MSG_TITLE: "sess.title", MSG_TOPIC: "sess.topic", MSG_RIVER: "sess.river", MSG_STORM: "sess.storm", MSG_WIDTH: "sess.width", MSG_HEIGHT: "sess.height", + MSG_DAEMON: "sess.daemon", + MSG_USERNAME: "user.name", MSG_USERNICK: "user.nick", LOG_DISABLE: "log.disable", - - ErrWarn: "warn: ", - ErrNotLogin: "not login: ", - ErrNotRight: "not right: ", - ErrNotFound: "not found: ", - ErrNotValid: "not valid: ", + + ErrWarn: "warn: ", ErrNotLogin: "not login: ", ErrNotRight: "not right: ", ErrNotFound: "not found: ", ErrNotValid: "not valid: ", USR_ICEBERGS: "usr/icebergs/", USR_VOLCANOS: "usr/volcanos/", @@ -84,16 +69,16 @@ var mdb = { FOREACH: "*", RANDOMS: "%", } var web = { - SPACE: "space", DREAM: "dream", SHARE: "share", - WEBSITE: "website", DRAW: "draw", CLEAR: "clear", REFRESH: "refresh", RESIZE: "resize", FILTER: "filter", SUBMIT: "submit", CANCEL: "cancel", UPLOAD: "upload", DOWNLOAD: "download", TOIMAGE: "toimage", + SHARE: "share", SPACE: "space", DREAM: "dream", + WEBSITE: "website", DRAW: "draw", CLEAR: "clear", REFRESH: "refresh", RESIZE: "resize", FILTER: "filter", + CANCEL: "cancel", SUBMIT: "submit", UPLOAD: "upload", DOWNLOAD: "download", TOIMAGE: "toimage", SHARE_CACHE: "/share/cache/", SHARE_LOCAL: "/share/local/", GET: "GET", PUT: "PUT", POST: "POST", DELETE: "DELETE", - Accept: "Accept", ContentType: "Content-Type", - ContentJSON: "application/json", ContentFORM: "application/x-www-form-urlencoded", + Accept: "Accept", ContentType: "Content-Type", ContentJSON: "application/json", ContentFORM: "application/x-www-form-urlencoded", + VIDEO_WEBM: "video/webm", CODE_INNER: "web.code.inner", WIKI_WORD: "web.wiki.word", - VIDEO_WEBM: "video/webm", } var aaa = { LOGIN: "login", LOGOUT: "logout", INVITE: "invite", TOKEN: "token", @@ -104,11 +89,13 @@ var aaa = { var lex = { SPLIT: "split", PREFIX: "prefix", SUFFIX: "suffix", } -var gdb = { - SIGNAL: "signal", +var yac = { } var ssh = { } +var gdb = { + SIGNAL: "signal", +} var tcp = { HOST: "host", PORT: "port", } @@ -140,9 +127,9 @@ var code = { TEMPLATE: "template", COMPLETE: "complete", NAVIGATE: "navigate", CURRENT: "current", } var wiki = { - TITLE: "title", BRIEF: "brief", REFER: "refer", SPARK: "spark", + TITLE: "title", BRIEF: "brief", REFER: "refer", SPARK: "spark", SHELL: "shell", ORDER: "order", TABLE: "table", CHART: "chart", IMAGE: "image", VIDEO: "video", - FIELD: "field", SHELL: "shell", LOCAL: "local", PARSE: "parse", + FIELD: "field", LOCAL: "local", PARSE: "parse", NAVMENU: "navmenu", PREMENU: "premenu", CONTENT: "content", STORY_ITEM: ".story", H2: "h2.story", H3: "h3.story", } @@ -150,10 +137,10 @@ var chat = { LIB: "lib", PAGE: "page", PANEL: "panel", PLUGIN: "plugin", STORY: "story", PLUG: "plug", TOAST: "toast", CARTE: "carte", INPUT: "input", UPLOAD: "upload", CONTEXTS: "contexts", LAYOUT: "layout", PROJECT: "project", CONTENT: "content", DISPLAY: "display", PROFILE: "profile", ACTIONS: "actions", - TITLE: "title", TOPIC: "topic", BLACK: "black", WHITE: "white", PRINT: "print", + TITLE: "title", TOPIC: "topic", BLACK: "black", WHITE: "white", PRINT: "print", LIGHT: "light", DARK: "dark", SHARE: "share", RIVER: "river", STORM: "storm", FIELD: "field", TOOL: "tool", STATE: "state", MENUS: "menus", SSO: "sso", LOCATION: "location", IFRAME: "iframe", - SIMPLE: "simple", OUTPUT: "output", FLOAT: "float", FULL: "full", CMD: "cmd", + OUTPUT: "output", SIMPLE: "simple", FLOAT: "float", FULL: "full", CMD: "cmd", HEADER: "Header", ACTION: "Action", FOOTER: "Footer", libs: ["/lib/base.js", "/lib/core.js", "/lib/date.js", "/lib/misc.js", "/lib/page.js", "/lib/user.js"], @@ -216,19 +203,18 @@ var html = {PLUGIN_MARGIN: 10, ACTION_HEIGHT: 31, ACTION_MARGIN: 200, FIELDSET_PANEL: "fieldset.panel", FIELDSET_PLUGIN: "fieldset.plugin", FIELDSET_STORY: "fieldset.story", FIELDSET_INPUT: "fieldset.input", FIELDSET_FLOAT: "fieldset.float", FIELDSET_HEAD: "fieldset.head", FIELDSET_FOOT: "fieldset.foot", FIELDSET_LEFT: "fieldset.left", FIELDSET_MAIN: "fieldset.main", OPTION_ARGS: "select.args,input.args,textarea.args", INPUT_ARGS: "input.args,textarea.args", INPUT_BUTTON: "input[type=button]", INPUT_FILE: "input[type=file]", - FORM: "form", SELECT: "select", INPUT: "input", TEXT: "text", FILE: "file", BUTTON: "button", TEXTAREA: "textarea", + BODY: "body", FORM: "form", SELECT: "select", INPUT: "input", TEXT: "text", FILE: "file", BUTTON: "button", TEXTAREA: "textarea", CLICK: "click", CANCEL: "cancel", SUBMIT: "submit", UPLOAD: "upload", USERNAME: "username", PASSWORD: "password", - TABLE: "table", THEAD: "thead", TBODY: "tbody", TR: "tr", TH: "th", TD: "td", BR: "br", UL: "ul", LI: "li", + TABLE: "table", THEAD: "thead", TBODY: "tbody", TR: "tr", TH: "th", TD: "td", BR: "br", UL: "ul", LI: "li", BR: "br", HR: "hr", H1: "h1", H2: "h2", H3: "h3", A: "a", LABEL: "label", INNER: "inner", TITLE: "title", SPAN: "span", CODE: "code", DIV: "div", IMG: "img", VIDEO: "video", WSS: "wss", SVG: "svg", CANVAS: "canvas", IFRAME: "iframe", - SPACE: "space", WEBVIEW: "webview", CHROME: "chrome", MOBILE: "mobile", LANDSCAPE: "landscape", + WEBVIEW: "webview", CHROME: "chrome", MOBILE: "mobile", LANDSCAPE: "landscape", - BODY: "body", - HOVER: "hover", HOVER_SELECT: "hover,select", - CLASS: "class", DISPLAY: "display", BLOCK: "block", NONE: "none", HIDDEN: "hidden", TOGGLE: "toggle", SIZE: "size", + CLASS: "class", DISPLAY: "display", BLOCK: "block", NONE: "none", OVERFLOW: "overflow", HIDDEN: "hidden", SCROLL: "scroll", FLOAT: "float", CLEAR: "clear", BOTH: "both", PADDING: "padding", BORDER: "border", MARGIN: "margin", MARGIN_TOP: "margin-top", MARGIN_X: "margin-x", MARGIN_Y: "margin-y", HEIGHT: "height", WIDTH: "width", MIN_HEIGHT: "min-height", MAX_HEIGHT: "max-height", MIN_WIDTH: "min-width", MAX_WIDTH: "max-width", LEFT: "left", TOP: "top", RIGHT: "right", BOTTOM: "bottom", - BACKGROUND: "background", COLOR: "color", OPACITY: "opacity", OVERFLOW: "overflow", SCROLL: "scroll", SPEED: "speed", FLOAT: "float", CLEAR: "clear", BOTH: "both", + BACKGROUND_COLOR: "background-color", COLOR: "color", OPACITY: "opacity", TOGGLE: "toggle", SPEED: "speed", SIZE: "size", + HOVER: "hover", HOVER_SELECT: "hover,select", PAGE: "page", TABS: "tabs", MENU: "menu", NODE: "node", ZONE: "zone", LIST: "list", ITEM: "item", NAME: "name", ICON: "icon", @@ -242,24 +228,20 @@ var html = {PLUGIN_MARGIN: 10, ACTION_HEIGHT: 31, ACTION_MARGIN: 200, DIV_FLOAT: "div.float", DIV_TOAST: "div.toast", DIV_CARTE: "div.carte", } var lang = { - UNDEFINED: "undefined", STRING: "string", NUMBER: "number", BOOLEAN: "boolean", FUNCTION: "function", OBJECT: "object", ARRAY: "array", + SPACE: "space", UNDEFINED: "undefined", STRING: "string", NUMBER: "number", BOOLEAN: "boolean", FUNCTION: "function", OBJECT: "object", ARRAY: "array", META: "Meta", ALT: "Alt", CONTROL: "Control", SHIFT: "Shift", TAB: "Tab", ESCAPE: "Escape", ENTER: "Enter", CMD: "Cmd", CTRL: "Ctrl", SPACE: "Space", BACKSPACE: "Backspace", ESC: "Esc", PS: "/", } -function shy(help, meta, list, cb) { var args = arguments, i = 0; function next(type) { - if (type == lang.OBJECT) { if (typeof args[i] == lang.OBJECT && args[i].length == undefined) { return args[i++] } - } else if (type == lang.ARRAY) { if (typeof args[i] == lang.OBJECT && args[i].length != undefined) { return args[i++] } - } else if (i < args.length && (!type || type == typeof args[i])) { return args[i++] } - } return cb = typeof args[args.length-1] == lang.FUNCTION? args[args.length-1]: function() {}, cb.help = next(lang.STRING)||"", cb.meta = next(lang.OBJECT)||{}, cb.list = next(lang.ARRAY)||[], cb +function shy(help, meta, list, cb) { var arg = arguments, i = 0; function next(type) { + if (type == lang.OBJECT) { if (typeof arg[i] == lang.OBJECT && arg[i].length == undefined) { return arg[i++] } + } else if (type == lang.ARRAY) { if (typeof arg[i] == lang.OBJECT && arg[i].length != undefined) { return arg[i++] } + } else if (i < arg.length && (!type || type == typeof arg[i])) { return arg[i++] } + } return cb = typeof arg[arg.length-1] == lang.FUNCTION? arg[arg.length-1]: function() {}, cb.help = next(lang.STRING)||"", cb.meta = next(lang.OBJECT)||{}, cb.list = next(lang.ARRAY)||[], cb }; var _can_name = "", _can_path = "" var Volcanos = shy({version: window._version||"", iceberg: "/chat/", volcano: "/frame.js", cache: {}, pack: {}, args: {}}, function(name, can, libs, cb) { var meta = arguments.callee.meta, list = arguments.callee.list; if (typeof name == lang.OBJECT) { - if (name.length > 0) { return Volcanos({panels: [ - {name: chat.HEADER, pos: html.HIDE, state: [aaa.USERNICK]}, - {name: chat.ACTION, pos: html.MAIN, tool: name}, - {name: chat.FOOTER, pos: html.HIDE} - ]}) } + if (name.length > 0) { return Volcanos({panels: [{name: chat.HEADER, pos: html.HIDE, state: [aaa.USERNICK]}, {name: chat.ACTION, pos: html.MAIN, tool: name}, {name: chat.FOOTER, pos: html.HIDE}]}) } var Config = name; name = Config.name||ice.CAN, _can_name = "", _can_path = "" meta.iceberg = Config.iceberg||meta.iceberg, meta.libs = Config.libs||chat.libs, panels = Config.panels||chat.panel_list libs = [], panels.forEach(function(p) { p && (libs = libs.concat(p.list = p.list||["/panel/"+p.name+nfs._JS, "/panel/"+p.name+nfs._CSS])) }), libs = libs.concat(Config.plugin||chat.plugin_list) @@ -270,7 +252,7 @@ var Volcanos = shy({version: window._version||"", iceberg: "/chat/", volcano: "/ for (list.reverse(); list.length > 0; list) { var sub = list.pop(); sub != can && cache.push(sub), sub._path = name } meta.cache[name] = cache cache.forEach(function(sub) { var name = sub._name; if (typeof cbs == lang.FUNCTION && cbs(can, name, sub)) { return } can[name] = can[name]||{}; for (var k in sub) { - name == "onimport" && k == "_init" && (can[name]._last_init = sub[k]) + name == chat.ONIMPORT && k == chat._INIT && (can[name]._last_init = sub[k]) can[name].hasOwnProperty(k) || sub.hasOwnProperty(k) && (can[name][k] = sub[k]) } }) @@ -303,7 +285,7 @@ var Volcanos = shy({version: window._version||"", iceberg: "/chat/", volcano: "/ key.indexOf("_") == 0 || key.indexOf("user.") == 0 || set(key, item.Option(key)) }): can.core.Item(can.base.isFunc(item)? item(): item, set) }); - set(html.HEIGHT, can.ConfHeight()), set(html.WIDTH, can.ConfWidth()) + set(ice.MSG_HEIGHT, can.ConfHeight()), set(ice.MSG_WIDTH, can.ConfWidth()) return msg }, diff --git a/publish/chrome/daemon.js b/publish/chrome/daemon.js index bbb9e941..e06def77 100644 --- a/publish/chrome/daemon.js +++ b/publish/chrome/daemon.js @@ -37,7 +37,7 @@ Volcanos({ }, _motion: function(can) { can.user.toast = function(can, message, title) { chrome.notifications.create(null, { - message: message, title: title||can._name, iconUrl: "/favicon.ico", type: "basic", + message: message, title: title||can._name, iconUrl: "/page/favicon.ico", type: "basic", })} chrome.contextMenus && chrome.contextMenus.create({title: "volcanos", onclick: function(event) { chrome.tabs.query({currentWindow: true, active: true}, function(tabs) {