1
0
mirror of https://shylinux.com/x/volcanos synced 2025-04-25 16:58:06 +08:00

opt sh.go

This commit is contained in:
IT 老营长 @云轩领航-创始人 2023-03-04 16:47:30 +08:00
parent cfeede0cd5
commit a9e3f1138f
22 changed files with 199 additions and 108 deletions

View File

@ -116,7 +116,13 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
var action = can.page.SelectOne(can, field, html.DIV_ACTION)
var output = can.page.SelectOne(can, field, html.DIV_OUTPUT)
var status = can.page.SelectOne(can, field, html.DIV_STATUS)
meta.index && can.page.Append(can, option, [{view: [[html.ITEM, html.ICON], html.DIV, can.page.unicode.delete], onclick: function(event) { sub.onaction.close(event, sub) }}])
meta.index && can.core.Item({
"delete": function(event) { sub.onaction.close(event, sub) },
"refresh": function(event) { sub.Update(event) },
"lt": function(event) { sub.onimport._back(sub) },
}, function(key, cb) {
can.page.Append(can, option, [{view: [[html.ITEM, html.ICON, key], html.DIV, can.page.unicode[key]], onclick: cb}])
})
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: [],
Status: function(key, value) { if (can.base.isObject(key)) { return can.core.Item(key, sub.Status), key }
@ -285,7 +291,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
{type: html.H1, style: [ITEM_HOVER_STYLE]}, {type: html.H2, style: [ITEM_HOVER_STYLE]}, {type: html.H3, style: [ITEM_HOVER_STYLE]},
{type: html.A, style: _fg(color.info)}, {type: html.LABEL, style: _fg(color.label)},
{type: html.FIELDSET_PANEL, style: [PANEL_STYLE]}, {type: html.FIELDSET_PANEL+ice.GT+html.DIV_OUTPUT, style: [PANEL_STYLE]},
{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.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]}]},
@ -443,7 +449,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
})
Volcanos(chat.ONLAYOUT, {_init: function(can, target) { target = target||can._root._target; var height = can.page.height(), width = can.page.width()
can.page.SelectChild(can, target, can.page.Keys(html.FIELDSET_HEAD, html.FIELDSET_FOOT), function(field) { height -= field.offsetHeight })
can.page.SelectChild(can, target, html.FIELDSET_LEFT, function(field) { can.user.isMobile || (width -= field.offsetWidth)
can.page.SelectChild(can, target, html.FIELDSET_LEFT, function(field) { can.user.isMobile || can.page.isDisplay(field) && (width -= field.offsetWidth)
var h = height; can.page.SelectChild(can, field, html.DIV_ACTION, function(action) { h -= action.offsetHeight })
can.page.SelectChild(can, field, html.DIV_OUTPUT, function(output) { can.page.styleHeight(can, output, h) })
})

View File

@ -114,14 +114,14 @@ body>div.upload div.status div.show { float:right; }
body>div.upload div.status div.size { text-align:center; }
body>div.upload input[type=file] { width:320px; }
/* font */
legend { font-size:1.2rem; line-height:31px; height:31px; }
legend { font-size:1.2rem; line-height:32px; height:32px; }
legend>span.delete { font-size:1rem; margin-left:5px; margin-right:-15px; visibility:hidden; }
// legend:hover>span.delete { visibility:visible; }
select, input { font-size:1rem; height:31px; } textarea { tab-size:2; height:93px; } input::placeholder { font-style:italic; }
select, input { font-size:1rem; height:32px; } textarea { tab-size:2; height:93px; } input::placeholder { font-style:italic; }
table.content, div.item, div.code, div.story[data-type=spark] { white-space:pre; text-align:left; }
table.content, div.item, div.code, div.story[data-type=spark] { font-family:monospace; }
div.action>div.tabs { padding:5px; height:31px; }
div.status>div.item { padding:5px; height:30px; float:left; }
div.action>div.tabs { padding:5px; height:32px; }
div.status>div.item { padding:5px; height:31px; float:left; }
div.status>div.item>label { font-size:0.6rem; }
/* display */
fieldset>form.option, fieldset>div.action { display:contents; } form.option.hide, div.action.hide { display:none; }
@ -134,8 +134,9 @@ fieldset>div.status>legend { margin-left:2px; margin-right:0; height:30px; float
fieldset.plugin:not(.output):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; }
fieldset.plug { position:absolute; bottom:0; right:0; } fieldset.cmd fieldset.plug { position:fixed; bottom:31px; right:0; }
fieldset.plug { position:absolute; bottom:0; right:0; } fieldset.cmd fieldset.plug { position:fixed; bottom:32px; right:0; }
fieldset.plug div.output table.content { width:100%; }
fieldset.plugin>div.output>fieldset.story { position:sticky; left:0; }
div.output { position:relative; }
div.tabs { position:relative; }
div.tabs span.icon { margin-left:5px; visibility:hidden; }
@ -147,11 +148,15 @@ div.plug { font-style:italic; }
div.item.text { position:relative; }
div.item.text>span.icon.delete { font-size:20px; line-height:28px; position:absolute; top:2px; right:10px; visibility:hidden; }
div.item.text:hover>span.icon.delete { visibility:visible; }
form.option>div.icon { font-size:26px; padding:0 5px; margin-left:-5px; height:31px; display:none; }
form.option>div.icon:first-child { margin-left:-5px; }
form.option>div.icon { font-size:26px; padding:0 5px; height:32px; display:none; }
form.option>div.icon.refresh { line-height:28px; }
form.option>div.icon.lt { font-size:20px; line-height:30px; }
form.option>div.icon:hover { background-color:white; }
fieldset.story>form.option>div.icon { display:block; }
fieldset.float>form.option>div.item.button { display:none; }
fieldset.story>form.option>div.icon.delete { display:block; }
fieldset.float>form.option>div.icon { display:block; }
fieldset.full>form.option>div.icon { display:block; }
fieldset.full>form.option>div.icon.delete { display:block; }
fieldset.plug>form.option>div.icon { margin-left:5px; }
div.carte.select.float { border-radius:0; }
div.carte.select.float>div.item { text-align:center; }
@ -173,7 +178,7 @@ 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 select { background-color:yellowgreen; color:white; }
body.white div.item.select div { background-color:yellowgreen; color:white; float:right; height:31px; text-align:center; }
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[name=cmd] { background-color:black; color:white; }
body.white input[type=button] { background-color:cornflowerblue; color:white; }
@ -282,8 +287,13 @@ fieldset.plugin.parse.cmd>div.status { display:none; }
fieldset.plugin.inner.cmd>legend { display:none; }
fieldset.plugin.inner.cmd>div.action { display:none; }
fieldset.plugin.inner.cmd>form.option { display:none; }
fieldset.plugin.inner.cmd fieldset.story>form.option>div.icon { display:block; }
fieldset.plugin.inner.cmd fieldset.story>form.option>div.item.button.list>input { display:none; }
fieldset.plugin.inner.cmd fieldset.story>form.option>div.item.button.back>input { display:none; }
fieldset.plugin.inner.cmd fieldset.xterm>form.option>div.item.text>input { width:320px; }
fieldset.plan div.output table.content { height:100%; width:100%; }
fieldset.xterm div.toggle { display:none; }
fieldset.xterm.output>div.output { overflow:hidden; }
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; }

View File

@ -113,7 +113,10 @@ Volcanos("misc", {
},
MergePath: function(can, file, path) { return file.indexOf(ice.PS) == 0 || file.indexOf(ice.HTTP) == 0? file: can.base.Path(path, file) },
MergeCache: function(can, hash) { return can.misc.MergeURL(can, {_path: can.base.Path(web.SHARE_CACHE, hash)}, true) },
MergePodCmd: function(can, obj) { obj.pod = can.core.Keys(can.misc.Search(can, ice.POD), obj.pod); return can.misc.MergeURL(can, obj, true) },
MergePodCmd: function(can, obj) {
if (can.base.beginWith(obj.pod, "http://", "https://")) { return obj.pod }
obj.pod = can.core.Keys(can.misc.Search(can, ice.POD), obj.pod); return can.misc.MergeURL(can, obj, true)
},
MergeURL: function(can, obj, clear) { var path = location.pathname; obj._path && (path = obj._path), delete(obj._path)
var hash = obj._hash||""; delete(obj._hash)
var args = [web.CHAT]; can.core.List([ice.POD, ice.CMD, web.WEBSITE], function(key) { obj[key] && args.push(key, obj[key]), delete(obj[key]) })
@ -133,9 +136,15 @@ Volcanos("misc", {
value === ""? delete(args[key]): (args[key] = value)
} var search = can.base.Args(args); return search? (location.search = search): (location.href = location.href.split(ice.QS)[0])
},
SearchHash: function(can) { if (!can.isCmdMode() && can._name != "Action") { return [] }
if (arguments.length > 1) { location.hash = can.core.List(arguments, function(item) { return encodeURIComponent(item) }).slice(1).join(ice.DF) }
return can.core.Split(decodeURIComponent(location.hash.slice(1)), ice.DF)||[]
SearchHash: function(can) { var hash = location.hash
if (arguments.length > 1) {
hash = can.core.List(arguments, function(item) {
return can.base.replaceAll(item, ":", "%3A")
return encodeURIComponent(item)
}).slice(1).join(ice.DF)
if (can.isCmdMode() || can._name == "Action") { location.hash = hash }
}
return can.core.List(can.core.Split(can.base.trimPrefix(location.hash, "#"), ice.DF)||[], function(item) { return decodeURIComponent(item) })
},
SearchOrConf: function(can, key, def) { return can.misc.Search(can, key)||Volcanos.meta.args[key]||can.misc.sessionStorage(can, "can."+key)||can.misc.localStorage(can, "can."+key)||can.Conf(key)||def },
CookieSessid: function(can, value, path) { return can.misc.Cookie(can, ice.MSG_SESSID+"_"+(location.port||(location.protocol == "https:"? "443": "80")), value, path) },

View File

@ -244,7 +244,11 @@ Volcanos("page", {
height: function() { return window.innerHeight },
width: function() { return window.innerWidth },
ismodkey: function(event) { return [lang.META, lang.ALT, lang.CONTROL, lang.SHIFT].indexOf(event.key) > -1 },
unicode: {menu: "☰", back: "◀", refresh: "↻", reback: "▶", delete: "✕", lt: "", gt: "", open: "▾", close: "▸", select: "▿", inner: ".."},
unicode: {
menu: "☰", back: "◀", refresh: "↻", reback: "▶", delete: "✕", lt: "", gt: "", open: "▾", close: "▸", select: "▿", inner: "..",
push: "\u21C8",
pull: "\u21CA",
},
inputs: function(can, list, type) { var _list = []; for (var i = 0; i < list.length; i++) { switch (list[i]) {
case "": _list.push(""); break
case ice.AUTO:

View File

@ -117,6 +117,11 @@ Volcanos("user", {
can.onmotion.clearCarte(can)
}) } function remove_sub(carte) { carte._sub && can.page.Remove(can, carte._sub._target), delete(carte._sub) }
var ui = can.page.Append(can, document.body, [{view: [[chat.CARTE, meta._style||"", chat.FLOAT]], list: can.core.List(list, function(item, index) {
if (item == "filter") {
return {input: [html.FILTER, function(event) { if (event.key == lang.ESCAPE) { return carte.close() } can.onkeymap.selectItems(event, can, carte._target) }],
_init: function(target) { can.onmotion.delay(can, function() { target.placeholder = "search in "+(can.core.List(list, function(item) { if (item) { return item } }).length-1)+" items", target.focus() }) }
}
}
function subs(event) { var sub = can.user.carte(event, can, meta, item.slice(1), cb||function(event, button) {
can.onimport && can.onimport[item[0]] && can.onimport[item[0]](can, button)
}, carte, trans); can.onlayout.figure(event, can, sub._target, true), remove_sub(carte), carte._sub = sub }

View File

@ -9,8 +9,9 @@ fieldset.Action.tabs>div.output>fieldset.plugin:not(.select) { display:none; }
fieldset.Header div.Action { display:contents; }
fieldset.Header div.Action>div.tabs:not(.hide) { margin-left:20px; display:contents; float:left; }
fieldset.Header div.Action>div.tabs:hover { background-color:unset; }
fieldset.Header div.tabs>div.tabs { background-color:unset; padding:10px; float:left; }
fieldset.Header div.tabs>div.tabs:hover { background-color:#6495ed63; }
fieldset.Header div.tabs>div.tabs { background-color:unset; padding:14px; float:left; }
fieldset.Header div.tabs>div.tabs:hover { background-color:#6495ed63; color:white; }
fieldset.Header div.tabs>div.tabs.select { background-color:#6495ed63; color:white; }
fieldset.Action.tabview>div.output>fieldset.plugin:not(.select) { display:none; }
fieldset.Action.vertical>div.output>fieldset.plugin { float:left; }
fieldset.Action.horizon>div.output>fieldset.plugin { float:left; }

View File

@ -35,7 +35,18 @@ Volcanos(chat.ONACTION, {_init: function(can, target) {
onlogin: function(can, msg) { can.ondaemon._init(can), can.onimport._menu(can, msg), can.onkeymap._build(can)
can._root.River && can.onmotion.delay(can, function() { if (can.Mode()) { return } var gt = can.page.unicode.gt, lt = can.page.unicode.lt, river = can._root.River._target
var target = can.page.Append(can, can._target, [{view: [[html.TOGGLE, chat.PROJECT], "", can.page.isDisplay(river)? lt: gt], onclick: function(event) {
can.page.Modify(can, target, (can._river_show = can.onmotion.toggle(can, river))? lt: gt), can.onaction.layout(can)
can.page.Modify(can, target, (can._river_show = can.onmotion.toggle(can, river))? lt: gt)
can.onaction.layout(can)
return
var total = 230, length = 20
var margin = can._river_show? -total: 0
can.ConfWidth(can.page.width()-(can._river_show? 0: total))
step = can._river_show? total/length: -total/length
can.core.Timer({interval: 10, length: length}, function() {
can.page.style(can, river, {"margin-left": margin += step, "display": "block"})
can.ConfWidth(can.ConfWidth()-step)
can.onaction.layout(can, "", true)
})
}}])._target; can._toggle = target
}); if (!can.Conf(chat.TOOL) && !can.user.mod.isCmd) { return } 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) { item.type = chat.PLUGIN
@ -66,9 +77,9 @@ Volcanos(chat.ONACTION, {_init: function(can, target) {
onresize: function(can) { can.onaction.layout(can), window.setsize && window.setsize(can.page.width(), can.page.height()) },
ontitle: function(can, msg) { can.onlayout._storage(can, "") },
layout: function(can, button) { can.page.ClassList.del(can, can._target, can._layout||can.onlayout._storage(can)), can._header_tabs && can.onmotion.hidden(can, can._header_tabs)
layout: function(can, button, skip) { can.page.ClassList.del(can, can._target, can._layout||can.onlayout._storage(can)), can._header_tabs && can.onmotion.hidden(can, can._header_tabs)
button = (can.onlayout._storage(can, can._layout = button == ice.AUTO? "": button))||can.misc.SearchOrConf(can, html.LAYOUT), can.page.ClassList.add(can, can._target, button)
can.onengine.signal(can, chat.ONLAYOUT, can.request({}, {layout: button})), can._root.River && can._river_show === false && can.onmotion.hidden(can, can._root.River._target), can.onlayout._init(can)
can.onengine.signal(can, chat.ONLAYOUT, can.request({}, {layout: button})), can._root.River && can._river_show === false && can.onmotion.hidden(can, can._root.River._target), skip || can.onlayout._init(can)
can.core.List(can._plugins, function(sub) { sub._delay_refresh = false, can.page.ClassList.set(can, sub._target, html.OUTPUT, [TABVIEW, HORIZON, VERTICAL].indexOf(button) > -1) })
var cb = can.onlayout[button]; can.base.isFunc(cb) && cb(can) || can.onlayout._plugin(can, button)
},

View File

@ -1,5 +1,5 @@
fieldset.Footer>div.output { padding:0; height:31px; }
fieldset.Footer>div.output div { padding:5px; height:31px; cursor:pointer; }
fieldset.Footer>div.output { padding:0; height:32px; }
fieldset.Footer>div.output div { padding:5px; height:32px; cursor:pointer; }
fieldset.Footer>div.output div:hover { background-color:#2e515f; }
fieldset.Footer>div.output div.title:first-child { text-align:center; margin-right:10px; width:230px; }
fieldset.Footer>div.output div.title { float:left; }

View File

@ -1,17 +1,17 @@
fieldset.Header>div.output { font-size:1.1rem; line-height:21px; padding:0; height:41px; overflow:hidden; }
// fieldset.Header>div.output { font-size:1.1rem; line-height:21px; padding:0; height:31px; overflow:hidden; }
fieldset.Header>div.output { font-size:1.1rem; line-height:21px; padding:0; height:48px; overflow:hidden; }
// fieldset.Header>div.output { font-size:1.1rem; line-height:21px; padding:0; height:32px; overflow:hidden; }
fieldset.Header>div.output div { float:left; cursor:pointer; }
// fieldset.Header>div.output div { height:31px; float:left; cursor:pointer; }
// fieldset.Header>div.output div { height:32px; float:left; cursor:pointer; }
fieldset.Header>div.output div:hover { background-color:#2e515f; }
fieldset.Header>div.output div.menu { padding:10px; }
fieldset.Header>div.output div.title { padding:10px; }
fieldset.Header>div.output div.menu { padding:14px; }
fieldset.Header>div.output div.title { padding:14px; }
fieldset.Header>div.output div.title:first-child { font-style:italic; font-weight:bold; text-align:center; margin-right:5px; width:230px; }
fieldset.Header>div.output div.state { padding:10px; float:right; }
fieldset.Header>div.output div.state { padding:14px; float:right; }
fieldset.Header>div.output div.state.time { margin-left:10px; }
fieldset.Header>div.output div.state.avatar { padding:0; height:41px; }
fieldset.Header>div.output div.state.avatar>img { height:41px; }
fieldset.Header>div.output div.search.title { padding:5px; }
fieldset.Header>div.output div.search>span.delete { top:7px; right:10px; }
fieldset.Header>div.output div.state.avatar { padding:0; height:48px; }
fieldset.Header>div.output div.state.avatar>img { height:48px; }
fieldset.Header>div.output div.search.title { padding:8px 5px; }
fieldset.Header>div.output div.search>span.delete { top:10px; right:10px; }
fieldset.Header>div.output div.search>input { margin-right:0; transition:all 1s; }
fieldset.Header>div.output div.search>input:focus { width:320px; transition:all 0.5s; }
// fieldset.Header>div.output div.search:hover>input { width:320px; transition:all 0.5s; }

View File

@ -1,4 +1,4 @@
fieldset.River { width:230px; float:left; }
fieldset.River { width:230px; float:left; margin-left:0; }
fieldset.River>div.action { padding:0 10px; width:100%; display:flex; justify-content:center; }
// fieldset.River>div.action>div.item { text-align:center; flex:2; }
fieldset.River>div.output { width:230px; }
@ -6,3 +6,4 @@ fieldset.River>div.output div.item { padding:10px 20px; border-left:solid 3px #0
// fieldset.River>div.output div.item { padding:3px 16px; border-left:solid 3px #00ffae; }
fieldset.River>div.output div.list div.item { border-left:solid 3px #ccdc4c; }
fieldset.River>div.output div.list { padding-left:5px; margin-left:8px; }
fieldset.River>div.output div.list.hide { height:0; display:block; overflow:hidden; }

View File

@ -1,4 +1,4 @@
fieldset.Search { background-color:#041a25bd; padding:10px; position:fixed; left:230px; top:31px; }
fieldset.Search { background-color:#041a25bd; padding:10px; position:fixed; left:230px; top:32px; }
fieldset.Search>div.action>div.item.filter>input { width:320px; }
fieldset.Search>div.output table.content { width:100%; }
fieldset.Search>div.status { display:block; }

View File

@ -1,5 +1,7 @@
Volcanos(chat.ONACTION, {
_init: function(can, meta, target) { meta.type == html.BUTTON && meta.action == ice.AUTO && can.base.isUndefined(can.sup._delay_init) && target.click() },
_init: function(can, meta, target) {
meta.type == html.BUTTON && meta.action == ice.AUTO && can.base.isUndefined(can.sup._delay_init) && target.click()
},
run: function(event, can) { can.run(event) }, refresh: function(event, can) { can.run(event) },
list: function(event, can) { can.sup.isSimpleMode() || can.run(event) }, back: function(event, can) { can.sup.onimport._back(can.sup) },
onclick: function(event, can) { can.Conf(mdb.TYPE) == html.BUTTON && can.run(event, [ctx.ACTION, can.Conf(mdb.NAME)].concat(can.sup.Input())), can.onkeymap.prevent(event) },

View File

@ -11,7 +11,7 @@ Volcanos(chat.ONFIGURE, {key: {
msg.Option(ice.MSG_PROCESS) == ice.PROCESS_AGAIN && can.onmotion.delay(can, function() { can._load(event, can, cb, target, name, value) })
}}
}), can.onappend._status(can, [mdb.TOTAL, mdb.INDEX]), can.Status(mdb.TOTAL, msg.Length())
can.page.style(can, can._output, html.MAX_WIDTH, can.page.width()/2)
can.page.style(can, can._output, html.MAX_HEIGHT, can.page.height()/2, html.MAX_WIDTH, target.offsetWidth)
msg.append.length == 1 && can.page.ClassList.add(can, can._target, chat.SIMPLE), can.onlayout.figure({target: target}, can, can._target)
},
onclick: function(event, can, meta, target, cbs) { can.onmotion.focus(can, target) },

View File

@ -13,10 +13,9 @@ fieldset.inner>div.output>div.layout>div.layout>div.content * { font-family:mono
fieldset.inner>div.output>div.layout>div.path { font-family:monospace; font-size:14px; }
fieldset.inner>div.output>div.layout>div.tabs { font-family:monospace; font-size:14px; }
fieldset.inner>div.output>div.project { width:230px; }
fieldset.inner>div.output>div.project div.action { width:100%; }
fieldset.inner>div.output>div.project * { font-family:monospace; font-size:14px; outline:none; }
fieldset.inner>div.output>div.project div.action { width:100%; }
fieldset.inner>div.output>div.project input[type=text] { box-shadow:none; }
fieldset.inner.cmd>div.output>div.project>div.zone>div.item { font-style:italic; font-weight:bold; line-height:32px; }
fieldset.inner>div.output>div.project div.zone>div.item span.icon { font-size:20px; line-height:16px; width:20px; float:right; display:none; }
fieldset.inner>div.output>div.project>div.zone>div.item span.icon { font-size:22px; line-height:32px; width:20px; float:right; display:none; }
fieldset.inner>div.output>div.project>div.zone:hover>div.item span.icon { display:block; }
@ -28,7 +27,10 @@ fieldset.inner>div.output>div.project>div.zone fieldset.plug { position:static;
fieldset.inner>div.output>div.layout.flow { position:relative; }
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.project>div.zone>div.item { font-style:italic; font-weight:bold; line-height:32px; }
fieldset.inner.cmd>div.output>div.project>div.zone>div.item>span.icon { font-style:normal; font-weight:normal; line-height:32px; }
fieldset.inner.cmd>div.output>div.layout.flow>div.tabs { height:38px; display:block; overflow:hidden; }
fieldset.inner.cmd>div.output>div.layout.flow>div.display>div.status { position:sticky; bottom:0; }
fieldset.inner.cmd>div.output>div.layout.flow>div.tabs.hide { display:none; }
fieldset.inner.cmd>div.output>div.layout.flow>div.tabs>div { padding:10px; height:38px; float:left; }
fieldset.inner.cmd>div.output>div.layout.flow>div.tabs>div>span { font-style:italic; }
@ -41,7 +43,7 @@ fieldset.inner.cmd>div.output>div.layout.flow>div.path { font-style:italic; padd
fieldset.inner.cmd>div.output>div.layout.flow>div.path.hide { display:none; }
fieldset.inner.cmd>div.output>div.layout.flow>div.path span.func { margin-left:20px; }
fieldset.inner.cmd>div.output>div.layout.flow>div.path span.view { font-size:22px; line-height:12px; padding:0 4px; float:right; cursor:pointer; }
fieldset.inner.cmd>div.output>div.layout.flow>div.plug { height:31px; clear:both; }
fieldset.inner.cmd>div.output>div.layout.flow>div.plug { height:32px; clear:both; }
fieldset.inner.cmd>div.output>div.layout.flow>div.plug>legend { font-size:1rem; padding:0 10px; float:right; }
body.zh fieldset.inner>div.output>div.project>div.zone>div.item { letter-spacing:10px; }

View File

@ -67,9 +67,9 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl
}}])
}) },
tabPath: function(event, can, ps, key, pre, cb, parent) { can.runAction(event, mdb.INPUTS, [key, pre], function(msg) { var _trans = {}
var carte = can.user[parent? "carteRight": "carte"](event, can, {_style: nfs.PATH}, msg.Table(function(value) {
var carte = can.user[parent? "carteRight": "carte"](event, can, {_style: nfs.PATH}, (msg.Length() > 10? ["filter"]: []).concat(msg.Table(function(value) {
var p = can.core.Split(value[key], ps).pop()+(can.base.endWith(value[key], ps)? ps: ""); return _trans[p] = value[key], p
}), function(event, button) {
})), function(event, button) {
can.base.endWith(button, ps)? can.onimport.tabPath(event, can, ps, key, pre+button, cb, carte): cb(can.core.Split(_trans[button], ps))
}, parent)._target, file = can.core.Split(event.target.innerHTML.trim(), ice.PT)[0]
can.page.Select(can, carte, html.DIV_ITEM, function(target) { target.innerHTML.trim() != event.target.innerHTML.trim() && can.base.beginWith(target.innerHTML, file+ice.PT) && carte.insertBefore(target, carte.firstChild) })
@ -89,20 +89,18 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl
}, function(text, cb) { return cb && {text: [text, html.SPAN, html.VIEW], style: cb.meta, onclick: cb} }))
var func = can.onexport.func(can); if (func.list.length == 0) { return } can.db.tabFunc = can.db.tabFunc||{}
var last = can.db.tabFunc[can.Option(nfs.PATH)+can.Option(nfs.FILE)]||{}; can.db.tabFunc[can.Option(nfs.PATH)+can.Option(nfs.FILE)] = last
var carte, list = [{input: [html.FILTER, function(event) { if (event.key == lang.ESCAPE) { return carte.close() } can.onkeymap.selectItems(event, can, carte._target)
}], _init: function(target) { can.onmotion.delay(can, function() { target.placeholder = "search in "+(can.core.List(list, function(item) { if (item) { return item } }).length-1)+" items", target.focus() }) }}]
can.core.Item(last, function(key) { list.push(key) }), list = list.concat(func.list)
var carte, list = ["filter"]; can.core.Item(last, function(key) { list.push(key) }), list = list.concat(func.list)
can.page.Append(can, target, [{view: [[html.ITEM, "func"], html.SPAN, (func.current||"func")+" / "+can.db.max+func.percent+ice.SP+can.base.Size(can._msg.result[0].length)], onclick: function(event) {
carte = can.user.carte(event, can, {_style: nfs.PATH}, list, function(ev, button) { last[button] = true, carte.close()
can.onimport.tabview(can, can.Option(nfs.PATH), can.Option(nfs.FILE), can.core.Split(button, ice.DF)[1])
})
}}]), can.ui.path.ondblclick = function(event) { can.onmotion.toggle(can, can.ui.project), can.onmotion.toggle(can, can.ui.tabs), can.onmotion.toggle(can, can.ui.plug), can.onimport.layout(can) }
}}]), can.ui.path.ondblclick = function(event) { var show = can.onmotion.toggle(can, can.ui.tabs); can.onmotion.toggle(can, can.ui.project, show), can.onimport.layout(can) }
},
_tabview: function(can, path, file, line, cb) { var key = can.onexport.keys(can, path, file)
if (!can.user.isWebview) { return can.onimport.tabview(can, path, file, line, cb) }
if (!can.db.tabview[key]) { return can.onimport.tabview(can, path, file, line, cb), can.db.tabview[key] = true }
},
tabview: function(can, path, file, line, cb) { var key = can.onexport.keys(can, path, file)
tabview: function(can, path, file, line, cb) { path = path||can.Option(nfs.PATH); var key = can.onexport.keys(can, path, file)
function isIndex() { return line == ctx.INDEX } function isDream() { return line == web.DREAM }
function show(skip) { can._msg && can._msg.Option(nfs.LINE, can.Option(nfs.LINE)), can._msg = can.db.tabview[key]
can.Option(can.onimport.history(can, {path: path, file: file, line: line||can.misc.sessionStorage(can, SELECT_LINE+ice.DF+path+file)||can._msg.Option(nfs.LINE)||1}))
@ -125,7 +123,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl
}
can.page.SelectChild(can, can.ui._content.parentNode, can.page.Keys(html.DIV_CONTENT, html.FIELDSET_STORY, [[[html.IFRAME, html.CONTENT]]]), function(target) {
if (can.onmotion.toggle(can, target, target == msg._content)) { can.ui.content = msg._content }
}), can.ui.content._plugin = msg._plugin
}), can.ui.content._plugin = msg._plugin, can.ui.profile._plugin = msg._profile
can.page.SelectChild(can, can.ui._content.parentNode, can.page.Keys(html.DIV_PROFILE, [[[html.IFRAME, html.PROFILE]]]), function(target) {
if (can.onmotion.toggle(can, target, target == msg._profile)) { can.ui.profile = msg._profile }
}), can.onimport.layout(can), can.ui.current && can.onmotion.toggle(can, can.ui.current, !isIndex() && !isDream())
@ -135,11 +133,13 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl
})
}
function load(msg) { var skip = false; can.db.tabview[key] = msg
can.onimport.tabs(can, [{name: file.split(isIndex()? ice.PT: ice.PS).pop(), text: file, _menu: shy([nfs.SAVE, code.COMPILE], function(event, button, meta) {
can.onimport.tabs(can, [{name: can.base.beginWith(file, "http://")? file.split(ice.QS)[0]: file.split(isIndex()? ice.PT: ice.PS).pop(), text: file, _menu: shy([
nfs.SAVE, nfs.TRASH,
], function(event, button, meta) {
can.onaction[button](event, can, button)
})}], function(event, tabs) {
can._tab = msg._tab = tabs._target, show(skip), skip = true
}, function(tabs) { can.onengine.signal(can, VIEW_REMOVE, msg)
}, function(tabs) { can.onengine.signal(can, VIEW_REMOVE, msg), can.ui.zone.source.refresh()
msg._content != can.ui._content && can.page.Remove(can, msg._content), msg._profile != can.ui._profile && can.page.Remove(can, msg._profile)
delete(can.ui._content._cache[key]), delete(can.ui._profile._cache[key]), delete(can.ui.display._cache[key])
delete(can._cache_data[key]), delete(can.db.tabview[key])
@ -167,6 +167,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl
var width = can.onexport.size(can, can.db.profile_size[can.onexport.keys(can)]||0.5, can.ConfWidth()-can.ui.project.offsetWidth)
can.onimport.process(can, msg, can.ui.profile, height, width, function(sub) { var _width = can.base.Max(sub._target.offsetWidth, width)
can.db.profile_size[can.onexport.keys(can)] = _width, can.onimport.layout(can), sub.onimport.size(sub, height, _width, true)
can.ui.profile._plugin = can._msg._profile = sub
})
can.page.Select(can, can.ui.profile, html.TABLE, function(target) { can.onmotion.delay(can, function() {
if (target.offsetWidth < can.ui._profile.offsetWidth) { can.db.profile_size[can.onexport.keys(can)] = target.offsetWidth, can.onimport.layout(can) }
@ -175,6 +176,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl
},
display: function(can, msg) { var width = can.ui.content.offsetWidth+can.ui.profile.offsetWidth||can.ConfWidth()-can.ui.project.offsetWidth
var height = can.onexport.size(can, can.db.display_size[can.onexport.keys(can)]||0.5, can.ui.content.offsetHeight||can.ConfHeight())
can.page.style(can, can.ui.display, html.MAX_HEIGHT, can.ConfHeight()/2)
can.onimport.process(can, msg, can.ui.display, height, width, function(sub) { var _height = can.base.Max(sub._target.offsetHeight, height)
// can.page.style(can, sub._target, html.MIN_HEIGHT, _height = can.base.Min(_height, can.ConfHeight()/4))
can.db.display_size[can.onexport.keys(can)] = _height, can.onimport.layout(can), sub.onimport.size(sub, _height, width, true)
@ -183,6 +185,8 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl
process: function(can, msg, target, height, width, cb) { can.onmotion.clear(can, target)
if (msg.Option(ice.MSG_PROCESS) == ice.PROCESS_FIELD) {
msg.Table(function(item) { item.type = chat.STORY, item.display = msg.Option(ice.MSG_DISPLAY), item.height = height-2*html.ACTION_HEIGHT, item.width = width
if (item.index == "web.code.xterm") { item.style = "output" }
if (item.index == "web.wiki.word") { item.style = "output" }
can.onimport.plug(can, item, function(sub) { height && sub.ConfHeight(item.height), width && sub.ConfWidth(item.width)
sub.onaction.close = function() { can.onmotion.hidden(can, target), can.onimport.layout(can) }
sub.onexport.output = function(_sub, _msg) { can.base.isFunc(cb) && cb(_sub, _msg) }
@ -199,7 +203,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl
return {text: [value, html.TD], onclick: function(event) { if (line.line || line.file) {
can.onimport.tabview(can, line.path||can.Option(nfs.PATH), line.file||can.Option(nfs.FILE), line.line||can.Option(nfs.LINE))
} }}
}, target), can.onappend.board(can, msg, target), can.onappend._status(can, msg.Option(ice.MSG_STATUS), can.page.Append(can, target, [html.STATUS])._target)
}, target), can.onappend.board(can, msg, target), msg.Option(ice.MSG_STATUS) && can.onappend._status(can, msg.Option(ice.MSG_STATUS), can.page.Append(can, target, [html.STATUS])._target)
} else {
return can.onmotion.toggle(can, target, false), can.onimport.layout(can), can.user.toastFailure(can, "nothing to display")
} return can.onmotion.toggle(can, target, true), can.onmotion.delay(can, function() { can.onimport.layout(can), can.user.toastSuccess(can) })
@ -227,7 +231,11 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl
if (can.isCmdMode()) { can.ConfHeight(can.page.height()), can.ConfWidth(can.page.width()) }
// can.ui.size = {profile: can.db.profile_size[can.onexport.keys(can)]||0.5, display: can.db.display_size[can.onexport.keys(can)]||3*html.ACTION_HEIGHT}
can.ui.size = {profile: can.db.profile_size[can.onexport.keys(can)]||0.5, display: can.db.display_size[can.onexport.keys(can)]}
can.ui.layout(can.ConfHeight(), can.ConfWidth(), 0, function(content_height, content_width) { var sub = can.ui.content._plugin; if (!sub) { return }
can.ui.layout(can.ConfHeight(), can.ConfWidth(), 0, function(content_height, content_width) {
var sub = can.ui.profile._plugin; if (sub && can.page.isDisplay(can.ui.profile)) {
sub.onimport.size(sub, can.ui.profile.offsetHeight, can.ui.profileWidth, true)
}
var sub = can.ui.content._plugin; if (!sub) { return }
if (content_height == sub.ConfHeight()+sub.onexport.actionHeight(sub)+sub.onexport.statusHeight(sub) && content_width == sub.ConfWidth()) { return }
sub.onimport.size(sub, content_height, content_width, true)
})
@ -288,10 +296,11 @@ Volcanos(chat.ONSYNTAX, {_init: function(can, msg, cb) {
})
},
_index: function(can, msg, cb) { if (msg._content) { return can.base.isFunc(cb) && cb(msg._content) }
if (can.Option(nfs.LINE) == web.DREAM) { can.ui.zone.dream && can.onmotion.delay(can, function() { can.ui.dream.refresh() }, 5000)
if (can.Option(nfs.LINE) == web.DREAM) { can.ui.zone.dream && can.onmotion.delay(can, function() { can.ui.zone.dream.refresh() }, 5000)
return can.base.isFunc(cb) && cb(msg._content = can.page.insertBefore(can, [{view: [html.CONTENT, html.IFRAME],
src: can.misc.MergePodCmd(can, {pod: can.Option(nfs.FILE)}), height: can.ui.content.offsetHeight, width: can.ui.content.offsetWidth}], can.ui._content))
} var index = msg.Option(ctx.INDEX).split(ice.FS), meta = {type: chat.STORY, index: index[0], args: index.slice(1)}
if (meta.index == "web.code.xterm" && meta.args.length > 0) { meta.style = "output" }
return can.onimport.plug(can, meta, function(sub) { sub.onimport.size(sub, can.ui.content.offsetHeight, can.ui.content.offsetWidth, true)
sub.onimport._open = function(sub, msg, arg) { var url = can.base.ParseURL(arg), ls = url.origin.split("/chat/pod/")
arg.indexOf(location.origin) == 0 && ls.length > 1? can.onimport.tabview(can, can.Option(nfs.PATH), ls[1].split(ice.PS)[0], web.DREAM): can.user.open(arg), sub.Update()
@ -487,9 +496,12 @@ Volcanos(chat.ONEXPORT, {list: [mdb.COUNT, mdb.TYPE, nfs.FILE, nfs.LINE, ice.BAC
selection: function(can, str) { var s = document.getSelection().toString(), begin = str.indexOf(s), end = begin+s.length
for (var i = begin; i >= 0; i--) { if (str[i].match(/[a-zA-Z0-9_.]/)) { s = str.slice(i, end) } else { break } } return s
},
hash: function(can) { var hash = [can.Option(nfs.PATH), can.Option(nfs.FILE), can.Option(nfs.LINE)].join(ice.DF)
if (can.isCmdMode()) { return location.hash = hash } return hash
split: function(can, file) { var ls = file.split(ice.PS)
if (ls.length == 1) { return [nfs.PWD, ls[0]] }
if (ls[0] == ice.USR) { return [ls.slice(0, 2).join(ice.PS)+ice.PS, ls.slice(2).join(ice.PS)] }
return [ls.slice(0, 1).join(ice.PS)+ice.PS, ls.slice(1).join(ice.PS)]
},
hash: function(can) { return can.misc.SearchHash(can, can.Option(nfs.PATH), can.Option(nfs.FILE), can.Option(nfs.LINE)) },
func: function(can) { var list = []
function indent(text) { var indent = 0; for (var i = 0; i < text.length; i++) { switch (text[i]) {
case ice.TB: indent+=4; break

View File

@ -148,15 +148,16 @@ Volcanos(chat.ONSYNTAX, {
split: {operator: "{[($.,:;&<|>=)]}"},
regexp: {
"[A-Z0-9_]+": code.CONSTANT,
"ish_[A-Za-z0-9_]+": code.FUNCTION,
},
keyword: {
"local": code.KEYWORD,
"export": code.KEYWORD,
"require": code.KEYWORD,
"request": code.KEYWORD,
"source": code.KEYWORD,
"return": code.KEYWORD,
"exit": code.KEYWORD,
".": code.KEYWORD,
"if": code.KEYWORD,
"then": code.KEYWORD,

View File

@ -17,24 +17,15 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.require(["i
Volcanos(chat.ONFIGURE, {
source: function(can, target, zone, path) { 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)
if (path == nfs.SRC) {
can.ui.zone.source.refresh = function() { show(target, zone, path) }
zone._icon({
"+": function(event) {
can.onaction.autogen(event, can, "autogen")
},
})
if (path == nfs.SRC) { can.ui.zone.source.refresh = function() { show(target, zone, path) }
zone._icon(kit.Dict(
can.page.unicode.refresh, function(event) { show(target, zone, path) },
"+", function(event) { can.user.carteRight(event, can, can.onaction, [nfs.MODULE, nfs.SCRIPT]) },
))
}
var total, 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.onappend.style(can, [code.VIMER, nfs.SOURCE, mdb.CREATE], can.user.input(event, can, ["filename"], function(list) {
can.request(event, {path: can.base.endWith(item.path, ice.PS)? path+item.path: path+item.path.split(ice.PS).slice(0, -1).join(ice.PS)+ice.PS, file: list[0]})
can.runAction(event, nfs.SAVE, [], function(msg) { var file = (msg.Option(nfs.PATH)+msg.Option(nfs.FILE)).slice(path.length)
add([{path: file}]), can.onimport.tabview(can, path, file)
})
})._target) },
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]) } } })
can.core.List(list, function(item) { if (path == args[0] && args[1].indexOf(item.path) == 0) { item.expand = true }
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()), can.Status(mdb.COUNT, total += zone._total(msg.Length()))
}, true) } if (path.length == 1) { return show(target, zone, path[0]) }
@ -44,26 +35,31 @@ Volcanos(chat.ONFIGURE, {
}), target), can.page.Remove(can, zone._action)
},
repos: function(can, target, zone) { can.onimport._zone(can, zone, "web.code.git.status", function(sub, msg) {
sub.onexport.record = function(sub, value, key, line) { can.onimport.tabview(can, line.path, line.file) }
zone._icon({
"\u21BA": function(event) { sub.Update(event) },
"\u21C8": function(event) { sub.runAction(event, "push") },
"\u21CA": function(event) { sub.runAction(event, "pull") },
"=": function() { can.onimport.tabview(can, can.Option(nfs.PATH), sub._index, ctx.INDEX) },
})
sub.onexport.record = function(sub, value, key, item) { can.onimport.tabview(can, item.path, item.file) }
zone._icon(kit.Dict(
can.page.unicode.refresh, function(event) { sub.Update(event) },
can.page.unicode.push, function(event) { sub.runAction(event, "push") },
can.page.unicode.pull, function(event) { sub.runAction(event, "pull") },
"=", function() { can.onimport.tabview(can, can.Option(nfs.PATH), sub._index, ctx.INDEX) },
))
}) },
favor: function(can, target, zone) { can.onimport._zone(can, zone, web.CHAT_FAVOR, function(sub, msg) {
sub.onexport.record = function(sub, value, key, item) { switch (item.type) {
case mdb.LINK: can.onimport.tabview(can, "", item.text, web.DREAM); break
case nfs.FILE: var ls = can.onexport.split(can, item.text); can.onimport.tabview(can, ls[0], ls[1]); break
case ctx.INDEX: can.onimport.tabview(can, "", item.text, ctx.INDEX); break
case ssh.SHELL: can.onimport.tabview(can, "", [web.CODE_XTERM, item.text].join(","), ctx.INDEX); break
} }
}) },
dream: function(can, target, zone) { can.onimport._zone(can, zone, web.DREAM, function(sub, msg) {
can.page.Select(can, sub._output, html.DIV_ITEM, function(target, index) { can.onappend.style(can, msg.status[index], target) })
sub.onimport._open = function(sub, msg, arg) { var url = can.misc.ParseURL(can, arg)
url.pod? can.onimport.tabview(can, can.Option(nfs.PATH), url.pod+(url.cmd? "/cmd/"+url.cmd:""), web.DREAM): can.user.open(arg)
}
sub.onexport.record = function(sub, value, key, line) { can.onimport.tabview(can, can.Option(nfs.PATH), value, web.DREAM) }
zone._icon({ "\u21BA": function(event) { sub.Update(event) }, "+": function(event) { sub.Update(event, [ctx.ACTION, mdb.CREATE], function(msg) {
can.onimport.tabview(can, can.Option(nfs.PATH), msg.Option(mdb.NAME), web.DREAM), sub.Update()
}) }})
sub.onexport.record = function(sub, value, key) { can.onimport.tabview(can, can.Option(nfs.PATH), value, web.DREAM) }
}) },
})
Volcanos(chat.ONACTION, {list: ["提交", "调试", "首页", "官网", "源码"],
Volcanos(chat.ONACTION, {list: ["编译", "调试", "首页", "收藏", "提交", "计划"],
_daemon: function(event, can, arg) { switch (arg[0]) {
case web.DREAM: can.runAction({}, arg[0], arg.slice(1), function(msg) { can.onimport.tabview(can, can.Option(nfs.PATH), can.core.Keys(can.misc.Search(can, ice.POD), msg.Option(mdb.NAME)), web.DREAM) }); break
case code.XTERM: can.runAction({}, arg[0], arg.slice(1), function(msg) { can.onimport.tabview(can, ctx.COMMAND, code.XTERM, msg.Result()) }); break
@ -89,6 +85,9 @@ Volcanos(chat.ONACTION, {list: ["提交", "调试", "首页", "官网", "源码"
} can.user.toastSuccess(can, button, can.Option(nfs.PATH)+can.Option(nfs.FILE))
})
},
trash: function(event, can, button) { can.onaction._run(event, can, button, [can.Option(nfs.PATH)+can.Option(nfs.FILE)], function() { can._msg._tab._close() }) },
script: function(event, can, button) { can.onaction._runs(event, can, button) },
module: function(event, can, button) { can.onaction._runs(event, can, button) },
compile: function(event, can, button) { can.runAction(can.request(event, {_toast: "编译中..."}), button, [], function(msg) { can.ui.search && can.ui.search.hidden()
if (msg.Length() > 0 || msg.Result()) { return can.onimport.exts(can, "inner/search.js", function(sub) { can.onappend._output(sub, msg, sub.Conf(ctx.DISPLAY)), sub.select() }) }
var toast = can.user.toastProcess(can, "重启中..."); can.onmotion.delay(can, function() { toast.close(), can.user.toastSuccess(can) }, 3000)
@ -111,11 +110,14 @@ Volcanos(chat.ONACTION, {list: ["提交", "调试", "首页", "官网", "源码"
"扩展": function(event, can) { can.user.input(can.request(event, {action: "extension"}), can, ["url"], function(list) {
var sub = can.db.toolkit[list[0]]; sub? sub.select(): can.onimport.exts(can, list[0])
}) },
"编译": function(event, can) { can.onaction.compile(event, can, "compile") },
"调试": function(event, can) { can.user.opens(location.href.replace("debug=true", "debug=false")) },
"首页": function(event, can) { can.user.open(location.origin+(can.misc.Search(can, log.DEBUG) == ice.TRUE? "?debug=true": "")) },
"收藏": function(event, can) { can.onimport.tabview(can, can.Option(nfs.PATH), "web.chat.favor", ctx.INDEX) },
"提交": function(event, can) { can.onimport.tabview(can, can.Option(nfs.PATH), "web.code.git.status", ctx.INDEX) },
"官网": function(event, can) { can.user.open("https://contexts.com.cn/") },
"源码": function(event, can) { can.user.open("https://shylinux.com/") },
"计划": function(event, can) { can.onimport.tabview(can, can.Option(nfs.PATH), "web.team.plan", ctx.INDEX) },
"全屏": function(event, can) { can._target.requestFullScreen() },
"录屏": function(event, can) { window.openapp("QuickTime Player") },
"编辑器": function(event, can) { window.opencmd("cd ~/contexts; vim +"+can.Option(nfs.LINE)+" "+can.Option(nfs.PATH)+can.Option(nfs.FILE)) },
@ -220,6 +222,7 @@ Volcanos(chat.ONKEYMAP, {
g: shy("查找搜索", function(event, can) { can.onaction.find(event, can) }),
},
normal: {
f: shy("打开文件", function(event, can) { can.onaction.open(event, can) }),
s: shy("保存文件", function(event, can) { can.onaction.save(event, can, nfs.SAVE) }),
c: shy("编译项目", function(event, can) { can.onaction.compile(event, can, code.COMPILE) }),

View File

@ -1,6 +1,7 @@
Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb) { can.onmotion.clear(can), can.onlayout._init(can)
can.page.requireModules(can, ["xterm/css/xterm.css", "xterm", "xterm-addon-fit", "xterm-addon-web-links"], function() {
var item = msg.TableDetail(); item.hash = can.Option(mdb.HASH), item.text && can.onmotion.delay(can, function() { can.onimport._input(can, item.text+ice.NL) }, 500)
can._delay_cmds = function() { item.text && can.onimport._input(can, item.text+ice.NL), delete(can._delay_cmds) }
var item = msg.TableDetail(); item.hash = item.hash||can.Option(mdb.HASH), item.text && can.onmotion.delay(can, function() { can._delay_cmds && can._delay_cmds() }, 1000)
can.onimport._connect(can, item), can.onappend.tools(can, msg, function(sub) {
sub.onexport.record = function(_, value, key, line) { can.onimport._input(can, value+ice.NL) }
}), msg.Option(ice.MSG_TOOLKIT, ""), can.base.isFunc(cb) && cb(msg), can.onappend._status(can)
@ -11,6 +12,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb) { can.onmotion.clear(can)
})
},
_connect: function(can, item) { var term = new Terminal({tabStopWidth: 4, cursorBlink: true, theme: can.onimport._theme(can, item)}); term.loadAddon(new WebLinksAddon.WebLinksAddon())
can.page.style(can, can._output, html.BACKGROUND_COLOR, term._publicOptions.theme.background||cli.BLACK)
var fitAddon = new FitAddon.FitAddon(); term.loadAddon(fitAddon), term._fit = fitAddon, can.onmotion.delay(can, function() { fitAddon.fit() })
term.onTitleChange(function(title) { can.onexport.title(can, title) }), can.onexport.title(can, item.name)
term.onResize(function(size) { can.onimport._resize(can, size) })
@ -22,13 +24,14 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb) { can.onmotion.clear(can)
can.runAction(can.request({}, size, can._current._item), "resize", [], function() { can.onexport.term(can) })
},
_input: function(can, data) { can._current && can.runAction(can.request({}, can._current._item), "input", [btoa(data)], function() {}) },
_theme: function(can, item) {
return can.base.Obj(item.theme)||(can.getHeaderTheme() == html.LIGHT? {background: cli.WHITE, foreground: cli.BLACK, cursor: cli.BLUE}: {})
_theme: function(can, item) { return can.base.Obj(item.theme)||(can.getHeaderTheme() == html.LIGHT? {background: cli.WHITE, foreground: cli.BLACK, cursor: cli.BLUE}: {}) },
grow: function(can, msg, _arg) {
can._delay_cmds && can._delay_cmds()
can._current.write(_arg)
},
grow: function(can, msg, _arg) { can._current.write(_arg) },
})
Volcanos(chat.ONLAYOUT, {_init: function(can) {
can.page.style(can, can._output, html.HEIGHT, can.ConfHeight()+4, html.WIDTH, can.ConfWidth(), html.MAX_WIDTH, "")
can.page.style(can, can._output, html.HEIGHT, can.ConfHeight(), html.WIDTH, can.ConfWidth(), html.MAX_WIDTH, "")
can._current && can._current._fit.fit(), can.onexport.term(can)
},
cmd: function(can) { can._current && can.onexport.title(can, can._current._item.name), can.ConfWidth(can.ConfWidth()-10) },
@ -38,11 +41,12 @@ Volcanos(chat.ONACTION, {
"波浪线": function(event, can, button) { can.onimport._input(can, "~"), can._current.focus() },
"反引号": function(event, can, button) { can.onimport._input(can, "`"), can._current.focus() },
})
Volcanos(chat.ONEXPORT, {list: [mdb.TYPE, mdb.NAME, "rows", "cols", "cursorY", "cursorX"],
Volcanos(chat.ONEXPORT, {list: [mdb.TIME, mdb.TYPE],
// Volcanos(chat.ONEXPORT, {list: [mdb.TIME, mdb.TYPE, mdb.NAME, "rows", "cols", "cursorY", "cursorX"],
term: function(can) { var term = can._current||{}, item = term._item; if (!item) { return }
can.core.List(can.onexport.list, function(key) {
can.Status(key, can.base.getValid(item[key], term[key], term.buffer.active[key], "")+"")
}), can.Status(mdb.TYPE, item[mdb.TYPE]||""), can.Status(mdb.NAME, item[mdb.NAME]||"")
},
title: function(can, title) { can.sup.onexport.title(can.sup, title) },
title: function(can, title) { can.sup.onexport.title(can.sup, title), can.Status(mdb.NAME, title) },
})

View File

@ -40,8 +40,8 @@ fieldset.word.float { padding:0; margin:0; position:fixed; left:0; top:0; z-inde
fieldset.word.float>div.action { display:contents; }
fieldset.word.float>div.status { clear:none; display:block; }
fieldset.word.float>div.output { background-color:#f0f8ff80; text-align:center; overflow:auto; }
fieldset.word.float>div.output>div.project { background-color:#4682b46b; padding:10px; position:fixed; right:0; top:31px; z-index:10; }
fieldset.word.float div.content div.page { text-align:center; margin-top:31px; display:none; }
fieldset.word.float>div.output>div.project { background-color:#4682b46b; padding:10px; position:fixed; right:0; top:32px; z-index:10; }
fieldset.word.float div.content div.page { text-align:center; margin-top:32px; display:none; }
fieldset.word.float div.content div.page.show { display:block; }
fieldset.word.float div.content.grid div.page { background-color:#a4cbecb5; margin:10px; height:200px; width:200px; overflow:auto; display:block; float:left; }
fieldset.word.float h1 { text-align:center; }

View File

@ -11,13 +11,13 @@ Volcanos(chat.ONIMPORT, {
_display: function(can, msg) { can.onappend._output(can, msg, msg.Option(ice.MSG_DISPLAY)) },
_clear: function(can, msg) { can.onmotion.clear(can) },
_inner: function(can, msg) { can.onappend.table(can, msg), can.onappend.board(can, msg), can.onmotion.story.auto(can) },
_field: function(can, msg) { var opts = {}
can.page.SelectArgs(can, can._option, "", function(target) { var value = msg.Option(target.name); target.name && value && (opts[target.name] = value) })
_field: function(can, msg) {
var opts = {}; can.page.SelectArgs(can, can._option, "", function(target) { var value = msg.Option(target.name); target.name && value && (opts[target.name] = value) })
var height = can.ConfHeight(); can.page.Select(can, can._output, html.TABLE, function(target) { height -= target.offsetHeight })
msg.Table(function(item) { can.onappend._plugin(can, item, {index: item.index, args: can.base.Obj(item.args||item.arg, []), height: can.base.Min(height, 200)}, function(sub, meta) {
sub.Conf(can.base.Obj(item.conf)); if (sub.isSimpleMode()) { (function() { sub.ConfHeight(can.ConfHeight()/2)
var msg = can.request(); msg.Echo(sub.Conf(ice.MSG_RESULT)), can.onappend._output(sub, msg, sub.Conf(ctx.DISPLAY))
})(); return } var opt = can.base.Obj(item[ice.OPT], []); sub.ConfWidth(can.ConfWidth())
})(); return } var opt = can.base.Obj(item[ice.OPT], []); sub.ConfWidth(can.ConfWidth()), can.page.style(can, sub._output, html.MAX_WIDTH, can.ConfWidth())
sub.run = function(event, cmds, cb) { var res = can.request(event, can.Option(), opts); for (var i = 0; i < opt.length; i += 2) { res.Option(opt[i], opt[i+1]) }
can.run(event, (msg.Option("_index") == can._index? msg[ice.MSG_PREFIX]||[]: [ice.RUN, msg.Option("_index")]).concat(cmds), cb, true)
}
@ -181,7 +181,7 @@ Volcanos(chat.ONEXPORT, {
output: function(can, msg) {},
action: function(can, button, line) {},
record: function(can, value, key, line) {},
actionHeight: function(can) { return html.ACTION_HEIGHT },
actionHeight: function(can) { return can.page.ClassList.has(can, can._target, "output")? 0: html.ACTION_HEIGHT },
statusHeight: function(can) { return !can.page.isDisplay(can._status) || can._status.innerHTML == "" || (can._target.offsetHeight > 0 && can._status.offsetHeight == 0)? 0: html.ACTION_HEIGHT },
title: function(can, title) { can.isCmdMode() && can.user.title(title) },
link: function(can) { var meta = can.Conf(), args = can.Option(); can.misc.Search(can, log.DEBUG) == ice.TRUE && (args[log.DEBUG] = ice.TRUE)

View File

@ -8,7 +8,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear(
can.page.Select(can, can.page.Create(can, html.DIV, value.action), html.INPUT, function(target) {
action.push(target.name), target.name != target.value && can.user.trans(can, kit.Dict(target.name, target.value))
})
can.onimport.item(can, {name: can.page.Color(value[can.Conf(mdb.FIELD)||mdb.VIEW]||value[mdb.NAME])}, function() {
can.onimport.item(can, {name: can.page.Color(value[can.Conf(mdb.FIELD)||mdb.VIEW]||value[mdb.NAME]||value[mdb.TEXT]), title: value[mdb.TEXT]}, function() {
can.sup.onexport.record(can, value.name, mdb.NAME, value)
}, function() { return shy(action, function(event, button, meta, carte) { can.misc.Event(event, can, function(msg) {
can.sup.onexport.action(can, button, value) || can.run(event, [ctx.ACTION, button], function(msg) { can.sup.onimport._process(can.sup, msg) || can.Update() }), carte.close()
@ -37,12 +37,22 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear(
}}], onclick: function(event) {
can.onmotion.select(can, action, html.DIV_TABS, tabs._target), can.base.isFunc(cb) && cb(event, tabs)
}, _init: function(target) { tabs._target = target; var menu = tabs._menu||shy()
target._close = function() { close(target) }
can.page.Modify(can, target, {draggable: true, _close: function() { close(target) },
ondragstart: function(event) { action._drop = function(before) { before.parentNode == action && action.insertBefore(target, before) } },
ondragover: function(event) { event.preventDefault(), action._drop(event.target) },
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) }) }, menu.meta
), ["Close", "Close Other", ""].concat(can.base.getValid(menu.list, can.core.Item(menu.meta))), function(event, button, meta) { (meta[button]||menu)(event, button, meta) }) },
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,
), ["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()
}}
}))._target },
@ -60,7 +70,8 @@ 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_HEIGHT, sub.ConfHeight(can.ConfHeight()-2*html.ACTION_HEIGHT), html.MAX_WIDTH, sub.ConfWidth(can.ConfWidth()))
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)
@ -68,6 +79,10 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear(
},
_zone: function(can, zone, index, cb, field) { zone._delay_show = function() { can.onimport.plug(can, {index: index, style: html.OUTPUT, mode: mdb.ZONE, field: field}, function(sub) {
var action = can.core.List(sub.Conf(ctx.INPUTS), function(item) { if (item.type == html.BUTTON && [ice.LIST, ice.BACK].indexOf(item.name) == -1) { return item.name } })
zone._icon(kit.Dict(
can.page.unicode.refresh, function(event) { sub.Update(event) },
"+", function(event) { sub.Update(event, [ctx.ACTION, mdb.CREATE]) },
))
sub.onexport.output = function(sub, msg) { zone._total(msg.Length()), cb(sub, msg)
zone._menu = shy({_trans: sub._trans}, action.concat(can.base.Obj(msg.Option(ice.MSG_ACTION), [])), function(event, button, meta, carte) {
sub.Update(event, [ctx.ACTION, button]), carte.close()
@ -117,7 +132,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear(
}) }); return node
},
item: function(can, item, cb, cbs, target) { target = target||(can.ui && can.ui.project? can.ui.project: can._output)
var ui = can.page.Append(can, target, [{view: [html.ITEM, html.DIV, item.nick||item.name], onclick: function(event) { can.onmotion.select(can, target, html.DIV_ITEM, event.target)
var ui = can.page.Append(can, target, [{view: [html.ITEM, html.DIV, item.nick||item.name], title: item.title, onclick: function(event) { can.onmotion.select(can, target, html.DIV_ITEM, event.target)
cb(event, event.target, event.target._list && can.onmotion.toggle(can, event.target._list))
}, oncontextmenu: function(event) { if (can.base.isFunc(cbs)) { var menu = cbs(event, ui._target); if (menu) { can.user.carteRight(event, can, menu.meta, menu.list, menu) } } },
}]); return ui._target

View File

@ -80,7 +80,11 @@ var web = {CHAT: "chat",
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",
CODE_INNER: "web.code.inner",
CODE_VIMER: "web.code.vimer",
CODE_XTERM: "web.code.xterm",
WIKI_WORD: "web.wiki.word",
CHAT_FAVOR: "web.chat.favor",
}
var aaa = {
LOGIN: "login", LOGOUT: "logout", INVITE: "invite", TOKEN: "token",
@ -95,6 +99,7 @@ var lex = {
var yac = {
}
var ssh = {
SHELL: "shell",
}
var gdb = {
SIGNAL: "signal",
@ -195,7 +200,7 @@ var mall = {
ASSET: "asset", SALARY: "salary",
}
var html = {PLUGIN_MARGIN: 10, ACTION_HEIGHT: 31, ACTION_MARGIN: 200,
var html = {PLUGIN_MARGIN: 10, ACTION_HEIGHT: 32, ACTION_MARGIN: 200,
FIELDSET: "fieldset", LEGEND: "legend", OPTION: "option", ACTION: "action", OUTPUT: "output", STATUS: "status",
FORM_OPTION: "form.option", DIV_ACTION: "div.action", DIV_OUTPUT: "div.output", DIV_STATUS: "div.status",
FIELDSET_PANEL: "fieldset.panel", FIELDSET_PLUGIN: "fieldset.plugin", FIELDSET_STORY: "fieldset.story", FIELDSET_INPUT: "fieldset.input", FIELDSET_PLUG: "fieldset.plug",