mirror of
https://shylinux.com/x/volcanos
synced 2025-04-25 08:48:06 +08:00
opt code
This commit is contained in:
parent
3154844147
commit
3aee99aa22
25
frame.js
25
frame.js
@ -1,23 +1,6 @@
|
||||
Volcanos(chat.ONENGINE, {_init: function(can, meta, list, cb, target) { can.require([can.volcano], null, function(can, key, sub) { can[key] = sub })
|
||||
if (!can.user.isMailMaster) { if (can.misc.Search(can, ice.MSG_SESSID)) { can.misc.CookieSessid(can, can.misc.Search(can, ice.MSG_SESSID)); return can.misc.Search(can, ice.MSG_SESSID, "") } }
|
||||
can.user.title(can.misc.SearchOrConf(can, chat.TITLE)||can.misc.Search(can, ice.POD)||location.host)
|
||||
can.page.Append(can, document.head, ctx.STYLE, {"innerText": `
|
||||
body, fieldset { border:0; margin:0; overflow:hidden; }
|
||||
fieldset>legend { float:left; }
|
||||
fieldset>form.option { float:left; }
|
||||
fieldset>div.action { float:left; }
|
||||
fieldset>div.output { clear:both; }
|
||||
fieldset>form.option>div.item { float:left; }
|
||||
fieldset>div.action>div.item { float:left; }
|
||||
fieldset>div.status>div.item { float:left; }
|
||||
fieldset.Action>legend { display:none; }
|
||||
div.float, fieldset.float { position:fixed; }
|
||||
div.input.float div.action>div.item { float:right; }
|
||||
div.item, fieldset>legend { cursor:pointer; }
|
||||
.hide { display:none; }
|
||||
`})
|
||||
can.onappend.theme(can, html.DARK), can.onappend.theme(can, html.LIGHT, {panel: cli.WHITE, plugin: cli.ALICEBLUE, legend: "lightsteelblue", input: cli.WHITE, output: cli.WHITE, table: cli.ALICEBLUE,
|
||||
hover: cli.ALICEBLUE, border: cli.TRANSPARENT, label: cli.BLACK, text: cli.BLACK, info: cli.BLUE, warn: cli.RED})
|
||||
can.run = function(event, cmds, cb) { var msg = can.request(event); cmds = cmds||[]; return (can.onengine[cmds[0]]||can.onengine._remote)(event, can, msg, can, cmds, cb) }
|
||||
can.core.Next(list, function(item, next) { item.type = chat.PANEL
|
||||
can.onappend._init(can, can.base.Copy(item, can.core.Value(can, [chat.RIVER, item.name])), item.list, function(sub) { can[item.name] = sub
|
||||
@ -216,7 +199,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
var action = meta.feature[cmds[1]]; if (can.base.isFunc(action)) { cb = cb||function() { can.Update() }
|
||||
return action.list && action.list.length > 0? can.user.input(event, can, action.list, function(data) {
|
||||
can.core.CallFunc(action, {can: can, msg: can.request(event, data), arg: cmds.slice(2), cb: cb})
|
||||
}): can.core.CallFunc(action, {can: can, msg: can.request(event), arg: cmds.slice(2), cb: cb})
|
||||
}): can.core.CallFunc(action, {sup: meta.can, can: can, msg: can.request(event), arg: cmds.slice(2), cb: cb})
|
||||
} return can.user.input(event, can, meta.feature[cmds[1]], function(args) { can.Update(can.request(event, {_handle: ice.TRUE}, can.Option()), cmds.slice(0, 2).concat(args), cb) })
|
||||
}
|
||||
return can.onengine._plugin(event, can, msg, can, cmds, cb) || can.run(event, cmds, function(msg) {
|
||||
@ -255,7 +238,6 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
], onclick: function(event) { can.user.copy(event, can, item.value) }}])
|
||||
})
|
||||
},
|
||||
|
||||
theme: function(can, theme, color, style, list) { const PANEL_STYLE = "panel-style", PLUGIN_STYLE = "plugin-style"
|
||||
const LEGEND_STYLE = "legend-style", 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"
|
||||
@ -328,7 +310,10 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
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? key+DF+value: undefined }).join(FS)
|
||||
}).join(FS): can.core.Item(can.base.Obj(item.style), function(key, value) { return key+DF+value }).join(FS))+" }"): "")+(item.list? render(pre+ice.SP+type, item.list): "")
|
||||
}).join(ice.NL) } can.page.Append(can, document.head, ctx.STYLE, {"innerText": render(html.BODY+ice.PT+theme, list)})
|
||||
}).join(ice.NL) }
|
||||
var text = render(html.BODY+ice.PT+theme, list)
|
||||
can.page.Append(can, document.head, ctx.STYLE, {"innerText": text})
|
||||
return text
|
||||
},
|
||||
style: function(can, style, target) { target = target||can._fields||can._target
|
||||
if (can.base.endWith(style, ".css")) { return can.require([style]) }
|
||||
|
@ -291,7 +291,7 @@ Volcanos("page", {
|
||||
requireModules: function(can, libs, cb, cbs) {
|
||||
for (var i = 0; i < libs.length; i++) { if (libs[i].indexOf(ice.PS) == 0 || libs[i].indexOf(ice.HTTP) == 0) { continue }
|
||||
if (libs[i].indexOf(nfs._CSS) == -1 && libs[i].indexOf(nfs._JS) == -1) { libs[i] = libs[i]+"/lib/"+libs[i]+nfs._JS }
|
||||
libs[i] = "/require/node_modules/"+libs[i]
|
||||
libs[i] = "/require/modules/"+libs[i]
|
||||
} can.require(libs, cb, cbs)
|
||||
},
|
||||
requireDraw: function(can, cb) { can.page.ClassList.add(can, can._fields, "draw")
|
||||
|
@ -1,13 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=0.8,maximum-scale=0.8,user-scalable=no">
|
||||
<meta charset="utf-8"><title>volcanos</title>
|
||||
<link rel="stylesheet" type="text/css" href="/index.css">
|
||||
<link rel="stylesheet" type="text/css" href="/page/cache.css">
|
||||
<link rel="shortcut icon" type="image/ico" href="/page/favicon.ico">
|
||||
</head>
|
||||
<body>
|
||||
<script src="/proto.js"></script>
|
||||
<script src="/page/cache.js"></script>
|
||||
<script src="/page/index.js"></script>
|
||||
</body>
|
@ -1,61 +0,0 @@
|
||||
Volcanos({name: "chat", river: {
|
||||
product: {name: "产品群", storm: {
|
||||
office: {name: "办公 office", list: [
|
||||
{name: "feel", help: "影音媒体", index: "web.wiki.feel"},
|
||||
{name: "draw", help: "思维导图", index: "web.wiki.draw"},
|
||||
{name: "data", help: "数据表格", index: "web.wiki.data"},
|
||||
{name: "location", help: "地图导航", index: "web.chat.location"},
|
||||
{name: "context", help: "编程", index: "web.wiki.word", args: ["src/main.shy"]},
|
||||
]},
|
||||
website: {name: "定制 website", index: [
|
||||
"web.chat.website",
|
||||
"web.chat.div",
|
||||
"web.code.vimer",
|
||||
"web.dream",
|
||||
]},
|
||||
}},
|
||||
project: {name: "研发群", storm: {
|
||||
studio: {name: "研发 studio", list: [
|
||||
{name: "vimer", help: "编辑器", index: "web.code.vimer"},
|
||||
{name: "repos", help: "代码库", index: "web.code.git.status"},
|
||||
{name: "plan", help: "任务表", index: "web.team.plan"},
|
||||
{name: "todo", help: "待办项", index: "web.team.todo"},
|
||||
{name: "ctx", help: "上下文", index: "web.wiki.word"},
|
||||
]},
|
||||
}},
|
||||
profile: {name: "测试群", storm: {
|
||||
release: {name: "发布 release", index: [
|
||||
"web.code.install",
|
||||
"web.code.upgrade",
|
||||
"web.code.webpack",
|
||||
"web.code.binpack",
|
||||
"web.code.autogen",
|
||||
"web.code.compile",
|
||||
"web.code.publish",
|
||||
"web.code.git.server",
|
||||
"web.code.git.status",
|
||||
]},
|
||||
research: {name: "测试 research", index: [
|
||||
"web.code.favor",
|
||||
"web.code.bench",
|
||||
"web.code.pprof",
|
||||
"web.code.xterm",
|
||||
"web.code.case",
|
||||
]},
|
||||
}},
|
||||
operate: {name: "运维群", storm: {
|
||||
aaa: {name: "权限 aaa", index: [
|
||||
"user", "totp", "sess", "role",
|
||||
]},
|
||||
web: {name: "应用 web", index: [
|
||||
"broad", "serve", "space", "dream", "route",
|
||||
"share", "spide", "cache", "story",
|
||||
]},
|
||||
cli: {name: "系统 cli", index: [
|
||||
"qrcode", "daemon", "system", "runtime", "mirrors", "forever", "port",
|
||||
]},
|
||||
nfs: {name: "文件 nfs", index: [
|
||||
"cat", "dir", "pack", "tail", "trash",
|
||||
]},
|
||||
}},
|
||||
}})
|
@ -45,6 +45,27 @@ Volcanos(chat.ONACTION, {_init: function(can) { var themeMedia = window.matchMed
|
||||
can.__theme = themeMedia.matches? html.DARK: html.LIGHT, themeMedia.addListener(function(event) { can.__theme = event.matches? html.DARK: html.LIGHT
|
||||
can.onengine.signal(can, chat.ONTHEMECHANGE, can.request(event, {theme: can.__theme}))
|
||||
}), can.onimport.theme(can)
|
||||
false && can.page.Append(can, document.head, ctx.STYLE, {"innerText": `
|
||||
body, fieldset { border:0; margin:0; overflow:hidden; }
|
||||
fieldset>legend { float:left; }
|
||||
fieldset>form.option { float:left; }
|
||||
fieldset>div.action { float:left; }
|
||||
fieldset>div.output { clear:both; }
|
||||
fieldset>form.option>div.item { float:left; }
|
||||
fieldset>div.action>div.item { float:left; }
|
||||
fieldset>div.status>div.item { float:left; }
|
||||
fieldset.Action>legend { display:none; }
|
||||
div.float, fieldset.float { position:fixed; }
|
||||
div.input.float div.action>div.item { float:right; }
|
||||
div.item, fieldset>legend { cursor:pointer; }
|
||||
.hide { display:none; }
|
||||
`})
|
||||
return can.require(["src/template/web.chat.header/dark.css", "src/template/web.chat.header/light.css"])
|
||||
can._themes = {
|
||||
"dark": can.onappend.theme(can, html.DARK),
|
||||
"light": can.onappend.theme(can, html.LIGHT, {panel: cli.WHITE, plugin: cli.ALICEBLUE, legend: "lightsteelblue", input: cli.WHITE, output: cli.WHITE, table: cli.ALICEBLUE,
|
||||
hover: cli.ALICEBLUE, border: cli.TRANSPARENT, label: cli.BLACK, text: cli.BLACK, info: cli.BLUE, warn: cli.RED}),
|
||||
}
|
||||
},
|
||||
onsize: function(can) { can.ConfHeight(can._target.offsetHeight), can.ConfWidth(can._target.offsetWidth) },
|
||||
onmain: function(can) {
|
||||
@ -141,7 +162,12 @@ Volcanos(chat.ONPLUGIN, {
|
||||
background: shy("背景图片", function(can, sub, cb) { can.page.Append(can, sub._output, [{img: can.user.info.background, style: kit.Dict(html.MAX_HEIGHT, sub.ConfHeight(), html.MAX_WIDTH, sub.ConfWidth())}]) }),
|
||||
language: shy("语言地区", {_init: function(can) { can.Option(aaa.LANGUAGE, can.user.info.language||ice.AUTO) }}, ["language:select=auto,zh,en", ice.RUN], function(can, msg, arg) { can.onimport.language(can, arg[0]) }),
|
||||
title: shy("网页标题", [chat.TITLE], function(can, msg, arg) { msg.Echo(can.user.title(arg[0])) }),
|
||||
theme: shy("界面主题", {_init: function(can) { can.Option(chat.THEME, can.getHeader(chat.THEME)) }}, ["theme:select=auto,dark,light,print,white,black", ice.RUN], function(can, msg, arg) {
|
||||
theme: shy("界面主题", {
|
||||
_init: function(can) { can.Option(chat.THEME, can.getHeader(chat.THEME)) },
|
||||
save: function(can, sup) {
|
||||
can.user.downloads(can, sup._themes[can.Option("theme")], can.Option("theme"), "css")
|
||||
},
|
||||
}, ["theme:select=auto,dark,light,print,white,black", ice.RUN, nfs.SAVE], function(can, msg, arg) {
|
||||
if (arg[0] == ice.AUTO) { arg[0] = "", can._theme = "" } can.misc.localStorage(can, "can.theme", arg[0]), can.onimport.theme(can, arg[0])
|
||||
}),
|
||||
logout: shy("退出登录", kit.Dict(aaa.LOGOUT, shy("退出", function(can) { can.user.logout(can._root.Header) })), [aaa.LOGOUT]),
|
||||
|
@ -36,7 +36,7 @@ Volcanos(chat.ONACTION, {list: [[ice.VIEW, "横向", "纵向"], [html.SIZE, 24,
|
||||
can.onaction._draw_vertical(can, can._tree[can.dir_root], can.margin, can.margin+(can.size+can.margin)/2)
|
||||
},
|
||||
_draw: function(can, tree, x, y, style) { var color = can.onimport._color(can, tree)
|
||||
tree.view = can.onimport.draw(can, {shape: html.TEXT, points: [{x: x, y: y}], style: can.base.Copy(kit.Dict(svg.STROKE, color, svg.FILL, color, html.INNER, tree.name), style)})
|
||||
tree.view = can.onimport.draw(can, {shape: html.TEXT, points: [{x: x, y: y}], style: can.base.Copy(kit.Dict(svg.STROKE, color, svg.FILL, color, html.INNER, tree.name||" "), style)})
|
||||
return can.core.ItemCB(can.ondetail, tree.view, can, tree), tree.view
|
||||
},
|
||||
_draw_vertical: function(can, tree, x, y) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user