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

opt inner.js

This commit is contained in:
harveyshao 2023-01-26 13:26:32 +08:00
parent 2dfd2306da
commit 00394e2c84
11 changed files with 81 additions and 84 deletions

View File

@ -273,6 +273,7 @@ fieldset.draw div.output div.content svg { background-color:#1b5b738c; }
fieldset.draw.spide div.output div.toggle { display:none; }
fieldset.draw.trend div.output div.toggle { display:none; }
fieldset.web.code.git.status div.output table.content { width:100%; }
fieldset.can.view { font-size:14px; }
body.mobile fieldset.plugin>legend { border:none; }
/* layout */
table.layout { border-spacing:0; }

View File

@ -120,7 +120,7 @@ Volcanos("misc", {Message: function(event, can) { var msg = {}
POST: function(can, msg, url, form, cb) { var xhr = new XMLHttpRequest(), begin = new Date(); msg._xhr = xhr
xhr.open(msg._method||web.POST, url), xhr.onreadystatechange = function() { if (xhr.readyState != 4) { return }
try { var res = JSON.parse(xhr.responseText) } catch (e) { var res = {result: [xhr.responseText]} } msg.Option("_cost", new Date() - begin)
if (xhr.status == 200) { return can.base.isFunc(cb) && cb(msg.Copy(res)) }
if (xhr.status == 200) { return msg.detail || (msg.detail = res.detail), can.base.isFunc(cb) && cb(msg.Copy(res)) }
can.user.toastFailure(can, xhr.response), can.misc.Warn(xhr.status, res, url, form)
}, xhr.setRequestHeader(web.Accept, msg._accept||web.ContentJSON)
if (msg._upload) {
@ -213,8 +213,13 @@ Volcanos("misc", {Message: function(event, can) { var msg = {}
},
localStorage: function(can, key, value) {
if (value != undefined) { localStorage.setItem(key, value) }
if (value === "") { localStorage.removeItem(key) }
return localStorage.getItem(key)
},
sessionStorage: function(can, key, value) {
if (value != undefined) { sessionStorage.setItem(key, value) }
return sessionStorage.getItem(key)
},
_signal: function(args) {
this._list.push(args)
}, _list: [],

View File

@ -285,7 +285,9 @@ Volcanos("page", {ClassList: {
} else if (value.length != undefined) {
can.core.List(value, function(value, index) { can.page.AppendData(can, ui.list, can.core.Keys(prefix, index), index, value, cb) })
} else {
can.core.List(can.core.Item(value, function(key, val) { if (value.hasOwnProperty(key) && val) { return key } }).sort(), function(key) { can.page.AppendData(can, ui.list, can.core.Keys(prefix, key), key, value[key], cb) })
can.core.List(can.core.Item(value, function(key, val) { if (
(value["preventDefault"] && val && typeof val != code.FUNCTION) || (value["responseText"] && val && typeof val != code.FUNCTION) ||
value.hasOwnProperty(key) && val) { return key } }).sort(), function(key) { can.page.AppendData(can, ui.list, can.core.Keys(prefix, key), key, value[key], cb) })
var key = "__proto__"; value[key] && can.core.Item(value[key]).length > 0 && can.page.AppendData(can, ui.list, can.core.Keys(prefix, key), key, value[key], cb)
}
}}, {view: [[html.LIST, html.HIDE]], style: {"margin-left": "20px"}}])
@ -299,7 +301,7 @@ Volcanos("page", {ClassList: {
var ui = {}; tag = tag||target.tagName.toLowerCase(), isclose = tag != mdb.META && tag != mdb.LINK, _field = field(target)
var inner = target.innerHTML? can.page.unicode.inner: ""; if (target && target.tagName) { target.innerText == target.innerHTML && (inner = target.innerText) }
return {view: mdb.VIEW, list: [
{view: [[html.ITEM]], list: [
{view: [[html.ITEM, target.tagName && target.tagName.toLowerCase()]], list: [
{text: (target.children.length > 0? can.page.unicode.close: ice.SP)+ice.SP, _init: function(target) { ui.toggle = target }},
{className: code.KEYWORD, text: can.page.replace(can, ice.LT)}, {className: code.KEYWORD, text: tag}, {type: html.SPAN, list: _field},
{className: code.KEYWORD, text: can.page.replace(can, ice.GT)}, inner && {text: inner, _init: function(target) { ui.inner = target }},

View File

@ -41,7 +41,7 @@ Volcanos("user", {info: {}, agent: {
can.Conf(chat.DISPLAY) && name.push(can.Conf(chat.DISPLAY)), can.user.mod.isCmd && name.push(chat.SIMPLE)
can.user.language(can) && name.push(can.user.language(can)), can.page.styleClass(can, document.body, name.join(ice.SP))
},
language: function(can) { return can.misc.Search(can, aaa.LANGUAGE)||can.user.info.language },
language: function(can) { return can.misc.Search(can, aaa.LANGUAGE)||can.misc.localStorage(can, "can.language")||can.user.info.language||"zh" },
trans: function(can, text, list) { if (can.user.language(can) == "en") { return text }
if (can.base.isObject(text)) { return can.core.Item(text, function(k, v) { can.core.Value(can._trans, k, v) }) }
if (can.base.isFunc(text)) { text = text.name||"" } if (can.base.isString(list)) { return list }

View File

@ -75,36 +75,3 @@ body.mobile table.layout td.content div.toggle.project { width:30px; padding-top
body.mobile table.layout td.content div.toggle.profile { width:30px; padding-top:35px; }
body.mobile table.layout td.content div.toggle.display { margin-top:-30px; height:30px; }
body.mobile table.layout td.content div.toggle.display>div { translate:5px -15px; }
div.head { background-color:#404040; color:white; padding:5px; height:42px; clear:both; }
div.head div.username { float:right; margin-right:10px; }
div.head div.username div.name { padding:10px; float:left; }
div.head div.username div.icon { float:left; }
div.head div.username img { height:42px; }
div.head div.menu { cursor:pointer; padding:10px; float:left; }
div.head>div.menu:hover { background-color:#323232; }
div.left { background-color:#323232; width:160px; padding:20px; overflow:auto; float:left; }
div.left div.item { background-color:#323232; color:white; padding:5px 10px; }
div.left div.item:hover { background-color:#404040; }
div.left div.username div { color:white; text-align:center; padding:10px; }
div.left div.username img { width:120px; }
div.main iframe { border:0; }
div.main input[type=button] { padding:0 20px; }
div.main { background-color:#cccccc; color:black; overflow:auto; float:left; }
div.main fieldset.plugin { background-color:#f8f8f8; padding:10px; margin:10px; }
div.main fieldset.plugin legend { margin-bottom:10px; display:block; float:left; }
div.main fieldset.plugin select { outline:none; box-shadow:none; }
div.main fieldset.plugin form.option { display:block; clear:both; }
div.main fieldset.plugin form.option div.item { margin:5px; }
div.main fieldset.plugin div.action div.item { margin:5px; }
div.main fieldset.plugin table.content tr { border:lightgray solid 1px; }
div.main fieldset.plugin table.content tr:hover { background-color:aliceblue; }
div.main fieldset.plugin table.content th { background-color:aliceblue; padding:10px; }
div.main fieldset.plugin table.content td { background-color:white; padding:10px; }
div.foot { background-color:#404040; color:white; padding:5px; height:42px; clear:both; }
div.foot div.username { float:right; margin-right:10px; }
div.foot div.username div.name { padding:10px; float:left; }
div.foot div.username div.icon { float:left; }
div.foot div.username img { height:42px; }
div.foot div.menu { cursor:pointer; padding:10px; float:left; }
div.foot>div.menu:hover { background-color:#323232; }

View File

@ -230,11 +230,8 @@ Volcanos(chat.ONENGINE, {_engine: function(event, sup, msg, can, cmds, cb) {
}})
Volcanos(chat.ONPLUGIN, {
_plugin: shy("默认插件", [mdb.NAME, ice.LIST, ice.BACK]),
plugin: shy("默认插件", [mdb.NAME, ice.LIST, ice.BACK]),
layout: shy("界面布局", {
_init: function(can) {
can.Option(chat.LAYOUT, can.getAction(chat.LAYOUT)||ice.AUTO)
},
_init: function(can) { can.Option(chat.LAYOUT, can.getAction(chat.LAYOUT)||ice.AUTO) },
}, ["layout:select=auto,tabs,tabview,horizon,vertical,free,grid,flow,page", ice.RUN], function(can, msg, arg) { can.onaction.layout(can, arg[0], true) }),
"parse": shy("生成网页", {
"show": function(can, msg, arg) { var name = arg[1]||ice.CAN; can.isCmdMode() && can.user.title(name)

View File

@ -103,6 +103,24 @@ Volcanos(chat.ONPLUGIN, {
return {name: item, value: stat[item]||"0"}
})))
}) }),
localStorage: shy("本地存储", [mdb.NAME, mdb.VALUE, ice.LIST, ice.BACK], function(can, msg, arg) {
if (arg.length == 0) {
can.core.Item(localStorage, function(name, value) { if (can.base.isFunc(value) || name == "length") { return }
msg.Push(mdb.NAME, name).Push(mdb.VALUE, value)
}); return msg.StatusTimeCount()
}
if (arg.length > 1) { localStorage.setItem(arg[0], arg[1]) }
msg.Echo(localStorage.getItem(arg[0]))
}),
sessionStorage: shy("会话存储", [mdb.NAME, mdb.VALUE, ice.LIST, ice.BACK], function(can, msg, arg) {
if (arg.length == 0) {
can.core.Item(sessionStorage, function(name, value) { if (can.base.isFunc(value) || name == "length") { return }
msg.Push(mdb.NAME, name).Push(mdb.VALUE, value)
}); return msg.StatusTimeCount()
}
if (arg.length > 1) { sessionStorage.setItem(arg[0], arg[1]) }
msg.Echo(sessionStorage.getItem(arg[0]))
}),
data: shy("网页数据", [mdb.KEY], function(can, msg, arg) { can.onmotion.delay(can, function() { var can = msg._can
if (can.Option(mdb.KEY)) {
can.page.AppendData(can, can._output, can.Option(mdb.KEY), can.Option(mdb.KEY).split(ice.PT).pop(), can.core.Value(can._root, can.Option(mdb.KEY)), function(prefix, value) {
@ -118,13 +136,16 @@ Volcanos(chat.ONPLUGIN, {
if (can.Option(mdb.KEY)) {
can.page.Append(can, can._output, [can.page.AppendView(can, can.page.SelectOne(can, document.body, can.Option(mdb.KEY))||document.body)])
} else {
can.page.Append(can, can._output, [can.page.AppendView(can, document, "html", [
var ui = can.page.Append(can, can._output, [can.page.AppendView(can, document, "html", [
can.page.AppendView(can, document.head, "head"), can.page.AppendView(can, document.body, "body", null, false, function(target) {
var list = []; for (var p = target; p && p.tagName && p != document.body; p = p.parentNode) {
list.push(p.tagName.toLowerCase()+(p.className? ice.PT+p.className.replaceAll(ice.SP, ice.PT).replace(".picker", ""): ""))
} can.Option(mdb.KEY, list.reverse().join(ice.SP+ice.GT+ice.SP))
}),
], true)])
can.onmotion.delay(can, function() {
can.page.Select(can, ui._target, "div.item.head,div.item.body", function(target) { target.click() })
})
}
}) }),
})

View File

@ -117,7 +117,7 @@ Volcanos(chat.ONACTION, {
})
Volcanos(chat.ONEXPORT, {height: function(can) { return can._target.offsetHeight },
topic: function(can) {
return can._topic || can.misc.Search(can, chat.TOPIC) || can.__topic || (can.base.isNight()? "dark": "light")
return can._topic || can.misc.Search(can, chat.TOPIC) || can.misc.localStorage(can, "can.topic") || can.__topic || (can.base.isNight()? "dark": "light")
},
background: function(can) { return can.user.info.background == "void"? "": can.user.info.background },
avatar: function(can) { return can.user.info.avatar == "void"? "": can.user.info.avatar },
@ -128,7 +128,9 @@ Volcanos(chat.ONPLUGIN, {
}),
topic: shy("界面主题", {
_init: function(can) { can.Option(chat.TOPIC, can.getHeader(chat.TOPIC)) },
}, ["topic:select=dark,light,white,black,print", ice.RUN], function(can, msg, arg) {
}, ["topic:select=auto,dark,light,white,black,print", ice.RUN], function(can, msg, arg) {
if (arg[0] == "auto") { arg[0] = "" }
if (arg.length > 0) { can.misc.localStorage(can, "can.topic", arg[0]) }
msg.Echo(can.onimport.topic(can, arg[0]))
}),
location: shy("请求地址", {
@ -152,7 +154,9 @@ Volcanos(chat.ONPLUGIN, {
}),
language: shy("语言地区", {
_init: function(can) { can.Option(aaa.LANGUAGE, can.user.info.language||"zh") },
}, ["language:select=zh,en", ice.RUN], function(can, msg, arg) {
}, ["language:select=auto,zh,en", ice.RUN], function(can, msg, arg) {
if (arg[0] == "auto") { arg[0] = "" }
if (arg.length > 0) { can.misc.localStorage(can, "can.language", arg[0]) }
can.runAction(event, aaa.LANGUAGE, [arg[0]], function(msg) { can.user.reload() })
}),
logout: shy("退出登录", kit.Dict(

View File

@ -12,7 +12,6 @@ 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>div.project { width:230px; }
fieldset.inner>div.output>div.project * { font-size:14px; font-family:monospace; outline:none; }
fieldset.inner>div.output>div.project>div.zone>div.item { letter-spacing:10px; }
fieldset.inner>div.output>div.project>div.zone>div.item span.icon { font-size:22px; line-height:18px; width:20px; float:right; display:none; }
fieldset.inner>div.output>div.project>div.zone:hover>div.item span.icon { display:block; }
fieldset.inner>div.output>div.project>div.zone div.action>div.item { padding-right:0; width:100%; }
@ -26,20 +25,18 @@ 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; }
fieldset.inner.cmd>div.output>div.layout.flow>div.tabs>div>span.icon { padding:0 5px; }
fieldset.inner.cmd>div.output>div.layout.flow>div.tabs div.website.icon { font-size:18px; line-height:32px; padding:2px 5px; margin-top:2px; }
fieldset.inner.cmd>div.output>div.layout.flow>div.tabs div.avatar { padding:0; height:38px; float:right; }
fieldset.inner.cmd>div.output>div.layout.flow>div.tabs div.website.icon { font-size:18px; line-height:32px; padding:2px 5px; margin-top:2px; position:sticky; top:0; }
fieldset.inner.cmd>div.output>div.layout.flow>div.tabs div.avatar { padding:0; height:38px; float:right; position:sticky; top:0; }
fieldset.inner.cmd>div.output>div.layout.flow>div.tabs div.avatar>img { height:38px; }
fieldset.inner.cmd>div.output>div.layout.flow>div.tabs div.time { float:right; }
fieldset.inner.cmd>div.output>div.layout.flow>div.tabs div.time { float:right; position:sticky; top:0; }
fieldset.inner.cmd>div.output>div.layout.flow>div.path { font-style:italic; padding:5px; display:block; }
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>legend { font-size:1rem; padding:0 10px; float:right; }
div.vimer.find.float div.item>span.icon { margin-left:-20px; margin-right:10px; visibility:hidden; }
div.vimer.find.float div.item:hover>span.icon { visibility:visible; }
div.vimer.open.float td:first-child { display:none; }
body.zh fieldset.inner>div.output>div.project>div.zone>div.item { letter-spacing:10px; }
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; }
@ -75,6 +72,9 @@ 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.vimer.find.float div.item>span.icon { margin-left:-20px; margin-right:10px; visibility:hidden; }
div.vimer.find.float div.item:hover>span.icon { visibility:visible; }
div.vimer.open.float td:first-child { display:none; }
div.path span.item { padding:5px; cursor:pointer; }
div.carte.path.float { font-size:14px; border-radius:0; } div.carte.path.float div.item { padding:5px; }
tr.line>td.line { text-align:right; padding:0 10px; position:sticky; left:0; }

View File

@ -5,8 +5,11 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl
} if (msg.Result() == "" && can.Option(nfs.LINE) == "1") { return }
var files = can.core.Split(can.Option(nfs.FILE), ice.FS); can.Option(nfs.FILE, files[0])
var paths = can.core.Split(can.Option(nfs.PATH), ice.FS); can.Option(nfs.PATH, paths[0])
can.core.List(paths.concat(can.core.Split(msg.Option(nfs.REPOS))), function(p) { if (p && paths.indexOf(p) == -1 && p[0] != ice.PS) { paths.push(p) } })
can.db = {paths: paths, tabview: {}, history: [], profile_size: {}, display_size: {}, toolkit: {}}, can.onengine.plugin(can, can.onplugin)
can.core.List(paths.concat(can.core.Split(msg.Option(nfs.REPOS))), function(p) {
if (can.base.endWith(p, "-story/", "-dict/")) { return }
if (p && paths.indexOf(p) == -1 && p[0] != ice.PS) { paths.push(p) }
})
can.db = {paths: paths, tabview: {}, _history: [], history: [], profile_size: {}, display_size: {}, toolkit: {}}, can.onengine.plugin(can, can.onplugin)
can.ui = can.onappend.layout(can, can._output, "", [html.PROJECT, [html.TABS, nfs.PATH, [html.CONTENT, html.PROFILE], html.DISPLAY, html.PLUG]])
can.ui._content = can.ui.content, can.ui._profile = can.ui.profile, can.ui._display = can.ui.display, can.onmotion.hidden(can, can.ui.plug)
switch (can.Mode()) {
@ -24,7 +27,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl
} }
}) })
} var args = can.misc.SearchHash(can); can.db.tabview[can.onexport.keys(can)] = msg
can.onimport.tabview(can, can.Option(nfs.PATH), can.Option(nfs.FILE), can.Option(nfs.LINE), function() { if (!can.user.isWebview || args.length > 0) {
can.onimport.tabview(can, can.Option(nfs.PATH), can.Option(nfs.FILE), can.Option(nfs.LINE), function() { if (!can.user.isWebview && args.length > 0) {
can.onimport._tabview(can, args[args.length-3]||can.Option(nfs.PATH), args[args.length-2]||can.Option(nfs.FILE), args[args.length-1])
} }), can.base.isFunc(cb) && cb(msg)
},
@ -34,9 +37,9 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl
}) },
_tabs: function(can) { if (!can.isCmdMode()) { return can.ui.tabs = can._action }
can.core.List([{name: can.page.unicode.menu, onclick: function() { can.user.carte(event, can, can.onaction, can.onaction.list) }},
{name: "\u25C0", style: {"font-size": "14px", "margin-top": "3px"}, onclick: function() { history.back() }},
{name: "\u25C0", style: {"font-size": "14px", "margin-top": "3px"}, onclick: function() { can.onaction.back(can) }},
{name: "\u21BB", style: {"font-size": "24px", "margin-top": "0px"}, onclick: function() { location.reload() }},
{name: "\u25B6", style: {"font-size": "14px", "margin-top": "3px"}, onclick: function() { history.forward() }},
{name: "\u25B6", style: {"font-size": "14px", "margin-top": "3px"}, onclick: function() { can.onaction.reback(can) }},
], function(item) { can.page.Append(can, can.ui.tabs, [{view: [[html.ICON, web.WEBSITE], html.DIV, item.name], style: item.style, onclick: item.onclick}]) })
can.user.isMobile || can.page.Append(can, can.ui.tabs, [{view: mdb.TIME, _init: function(target) {
can.core.Timer({interval: 100}, function() { can.page.Modify(can, target, can.user.time(can, null, "%y-%m-%d %H:%M:%S %w")) })
@ -76,8 +79,8 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl
}], _init: function(target) { can.onmotion.delay(can, function() { target.placeholder = "search in "+list.length+" items", target.focus() }) }}]
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], onclick: function(event) {
carte = can.user.carte(event, can, {_style: nfs.PATH}, list, function(ev, button) { last[button] = true
can.onimport.tabview(can, can.Option(nfs.PATH), can.Option(nfs.FILE), can.core.Split(button, ice.DF)[1]), carte.close()
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) }
},
@ -88,7 +91,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl
tabview: function(can, path, file, line, cb) { 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.localStorage(can, "web.code.inner:selectLine:"+path+file)||can._msg.Option(nfs.LINE)||1}))
can.Option(can.onimport.history(can, {path: path, file: file, line: line||can.misc.sessionStorage(can, "web.code.inner:selectLine:"+path+file)||can._msg.Option(nfs.LINE)||1}))
can.onsyntax._init(can, can._msg, function(content) { var msg = can._msg; can.onexport.hash(can)
can.isCmdMode() && can.onexport.title(can, path+file), can.onmotion.select(can, can.ui.tabs, html.DIV_TABS, msg._tab), can.isCmdMode() && msg._tab.scrollIntoView()
if (isIndex()) {
@ -168,8 +171,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl
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) }
sub.run = function(event, cmds, cb) { can.runActionCommand(can.request(event, can.Option()), item.index, cmds, function(msg) {
height && sub.ConfHeight(item.height), width && sub.ConfWidth(item.width)
can.page.style(can, sub._output, html.MAX_HEIGHT, "", html.MAX_WIDTH, "")
height && sub.ConfHeight(item.height), width && sub.ConfWidth(item.width), can.page.style(can, sub._output, html.MAX_HEIGHT, "", html.MAX_WIDTH, "")
can.base.isFunc(cb) && cb(msg)
}) }
}, target)
@ -201,11 +203,11 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl
}, can.ui.plug.parentNode)
},
layout: function(can) { if (can.isSimpleMode()) { return can.page.style(can, can.ui.content, html.WIDTH, can.ConfWidth()) }
if (can.isCmdMode()) { can.page.styleHeight(can, can._output, can.ConfHeight(can.page.height())), can.ConfWidth(can.page.width()) }
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.layout(can.ConfWidth(), can.ConfHeight(), 0, function(content_height, content_width) { var sub = can.ui.content._plugin; if (!sub) { return }
if (content_height == sub.ConfHeight()+2*html.ACTION_HEIGHT && content_width == sub.ConfWidth()) { return }
sub.onimport.size(sub, can.ui.content.offsetHeight, can.ui.content.offsetWidth, true)
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)
})
},
exts: function(can, url, cb) { var sub = can.db.toolkit[url.split("?")[0]]; if (sub) { return can.base.isFunc(cb)? cb(sub): sub.select() }
@ -228,11 +230,10 @@ Volcanos(chat.ONFIGURE, {
}), nfs.PATH, ice.PS, function(event, item) {
can.onimport.tabview(can, path, item.path)
}, target), zone._total(msg.Length())
}, true) } if (path.length == 1) { return show(target, path[0]) }
}, true) } if (path.length == 1) { return show(target, zone, path[0]) }
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) }}
return {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, zone._action)
},
module: function(can, target, zone) { zone._delay_show = function() {
@ -243,7 +244,7 @@ Volcanos(chat.ONFIGURE, {
})
} },
plugin: function(can, target, zone) { var total = 0
can.onimport.tree(can, can.core.Item(can.onengine.plugin.meta, function(key) { return total++, {index: key} }), ctx.INDEX, ice.PT, function(event, item) {
can.onimport.tree(can, can.core.ItemKeys(can.onengine.plugin.meta, function(key) { if (key[0] != "_") { 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)
},
@ -272,7 +273,6 @@ Volcanos(chat.ONSYNTAX, {_init: function(can, msg, cb) {
src: can.misc.MergePodCmd(can, {pod: can.Option(nfs.FILE)}), height: can.ui.content.offsetHeight, width: can.ui.content.offsetWidth}], can.ui._content))
} var index = msg.Option(ctx.INDEX).split(ice.FS), meta = {type: chat.STORY, index: index[0], args: index.slice(1)}
return can.onimport.plug(can, meta, function(sub) {
can.onimport.layout(can), 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()
}
@ -336,7 +336,7 @@ Volcanos(chat.ONACTION, {list: ["首页", "官网", "调试", "百度"],
can.onexport.hash(can), scroll && can.onaction.scrollIntoView(can), can.onengine.signal(can, "tabview.line.select", can._msg)
})
can.misc.localStorage(can, "web.code.inner:currentFile", [can.Option(nfs.PATH), can.Option(nfs.FILE), can.onaction._getLineno(can, can.current.line)].join(ice.DF))
can.misc.localStorage(can, "web.code.inner:selectLine:"+can.Option(nfs.PATH)+can.Option(nfs.FILE), can.onaction._getLineno(can, can.current.line))
can.misc.sessionStorage(can, "web.code.inner:selectLine:"+can.Option(nfs.PATH)+can.Option(nfs.FILE), can.onaction._getLineno(can, can.current.line))
return can.onexport.line(can, line)
},
scrollIntoView: function(can, offset) { var current = can.onaction._getLineno(can, can.current.line), window = can.current.window(); offset = offset||parseInt(window/4)+2
@ -368,7 +368,12 @@ Volcanos(chat.ONACTION, {list: ["首页", "官网", "调试", "百度"],
if (can.page.isDisplay(can.ui.display)) { return can.onmotion.hidden(can, can.ui.display), can.onimport.layout(can) }
if (can.page.isDisplay(can.ui.profile)) { return can.onmotion.hidden(can, can.ui.profile), can.onimport.layout(can) }
},
back: function(can) { can.db.history.pop(); var last = can.db.history.pop(); last && can.onimport.tabview(can, last.path, last.file, last.line) },
back: function(can) { can.db._history.push(can.db.history.pop())
var last = can.db.history.pop(); last && can.onimport.tabview(can, last.path, last.file, last.line)
},
reback: function(can) {
var last = can.db._history.pop(); last && can.onimport.tabview(can, last.path, last.file, last.line)
},
exec: function(event, can) {
if (can.base.Ext(can.Option(nfs.FILE)) == nfs.JS) { delete(Volcanos.meta.cache[can.base.Path(ice.PS, ice.REQUIRE, can.Option(nfs.PATH), can.Option(nfs.FILE))]) }
can.runAction(can.request(event, {_toast: "执行中..."}), mdb.ENGINE, [can.db.parse, can.Option(nfs.FILE), can.Option(nfs.PATH)], function(msg) { can.onimport.display(can, msg) })
@ -407,8 +412,7 @@ Volcanos(chat.ONACTION, {list: ["首页", "官网", "调试", "百度"],
case web.DREAM: return can.onimport.tabview(can, can.Option(nfs.PATH), ls[1], ls[0])
case nfs.LINE: return can.onaction.selectLine(can, parseInt(ls[1]), true)
default: can.core.List(can.db.paths, function(path) { if (list[0].indexOf(path) == 0) { can.onimport.tabview(can, path, list[0].slice(path.length)) } })
} })._target
can.page.Modify(can, input, {"className": "input vimer open float"})
} })._target; can.page.Modify(can, input, {"className": "input vimer open float"})
can.page.style(can, input, html.LEFT, can.ui.project.offsetWidth+can.ui.content.offsetWidth/4-34, html.TOP, can.ui.content.offsetHeight/4, html.RIGHT, "")
},
find: function(event, can) {
@ -450,10 +454,7 @@ Volcanos(chat.ONACTION, {list: ["首页", "官网", "调试", "百度"],
},
})
Volcanos(chat.ONEXPORT, {list: ["目录", "类型", "文件", "行号", "跳转"],
size: function(can, size, full) {
if (size > 1) { return size }
if (size > 0) { return size*full }
},
size: function(can, size, full) { if (size > 1) { return size } if (size > 0) { return size*full } },
keys: function(can, path, file) { return [path||can.Option(nfs.PATH), file||can.Option(nfs.FILE)].join(ice.DF) },
line: function(can, line) { return parseInt(can.core.Value(can.page.SelectOne(can, line, "td.line"), "innerText")) },
position: function(can, index, total) { total = total||can.db.max; return (parseInt(index))+ice.PS+parseInt(total)+" = "+parseInt((index)*100/total)+"%" },
@ -474,7 +475,7 @@ Volcanos(chat.ONEXPORT, {list: ["目录", "类型", "文件", "行号", "跳转"
if (_indent == 0 && can.base.beginWith(text, "Volcanos")) {
var _block = can.base.trimPrefix(ls[1], "chat.").toLowerCase()
if (_block != block) { push("") } block = _block
if (text.indexOf("_init") > -1) { push(block+ice.PT+"_init"+ice.DF+(index+1)) }
if (text.indexOf(chat._INIT) > -1) { push(block+ice.PT+chat._INIT+ice.DF+(index+1)) }
} else if (_indent == 4) {
ls[0] && push(block+ice.PT+ls[0]+ice.DF+(index+1))
}

View File

@ -44,9 +44,8 @@ Volcanos(chat.ONFIGURE, {
} node = add(msg.Table(), node), can.Status("目录", zone._total(msg.Length()))
}, true) } if (path.length == 1) { return show(target, path[0]) }
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) }}
return {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, zone._action)
},
repos: function(can, target, zone) { can.onimport._zone(can, zone, "web.code.git.status", function(sub, msg) {