forked from x/volcanos
opt some
This commit is contained in:
parent
bf1f82955c
commit
675dc57b69
9
frame.js
9
frame.js
@ -512,8 +512,7 @@ Volcanos(chat.ONLAYOUT, {help: "页面布局", _init: function(can, target) { ta
|
|||||||
})
|
})
|
||||||
|
|
||||||
can.page.Select(can, target, html.FIELDSET_LEFT, function(field, index) {
|
can.page.Select(can, target, html.FIELDSET_LEFT, function(field, index) {
|
||||||
can.user.isMobile || (width -= field.offsetWidth)
|
can.page.styleHeight(can, field, height), can.user.isMobile || (width -= field.offsetWidth)
|
||||||
can.page.styleHeight(can, field, height)
|
|
||||||
can.page.Select(can, target, [[html.FIELDSET_LEFT, html.DIV_OUTPUT]], function(output) {
|
can.page.Select(can, target, [[html.FIELDSET_LEFT, html.DIV_OUTPUT]], function(output) {
|
||||||
can.page.styleHeight(can, output, height-html.ACTION_HEIGHT)
|
can.page.styleHeight(can, output, height-html.ACTION_HEIGHT)
|
||||||
})
|
})
|
||||||
@ -536,7 +535,11 @@ Volcanos(chat.ONLAYOUT, {help: "页面布局", _init: function(can, target) { ta
|
|||||||
var rect = event.target == document.body? {left: window.innerWidth/2, top: 200, right: window.innerWidth/2, bottom: 200}: event.target.getBoundingClientRect()
|
var rect = event.target == document.body? {left: window.innerWidth/2, top: 200, right: window.innerWidth/2, bottom: 200}: event.target.getBoundingClientRect()
|
||||||
var layout = right? {left: rect.right, top: rect.top}: {left: rect.left, top: rect.bottom}
|
var layout = right? {left: rect.right, top: rect.top}: {left: rect.left, top: rect.bottom}
|
||||||
can.getActionSize(function(left, top, width, height) { left = left||0, top = top||0
|
can.getActionSize(function(left, top, width, height) { left = left||0, top = top||0
|
||||||
if (layout.top+target.offsetHeight > window.innerHeight) { layout.top = "", layout.bottom = window.innerHeight-top-height }
|
if (layout.top+target.offsetHeight > window.innerHeight) {
|
||||||
|
layout.top = "", layout.bottom = can.base.Min(window.innerHeight-top-height, 0)
|
||||||
|
layout[html.MAX_HEIGHT] = window.innerHeight
|
||||||
|
layout["overflow"] = "auto"
|
||||||
|
}
|
||||||
if (layout.left+target.offsetWidth > window.innerWidth) { layout.left = "", layout.right = 0 }
|
if (layout.left+target.offsetWidth > window.innerWidth) { layout.left = "", layout.right = 0 }
|
||||||
})
|
})
|
||||||
return can.onmotion.move(can, target, layout), layout
|
return can.onmotion.move(can, target, layout), layout
|
||||||
|
@ -212,7 +212,12 @@ Volcanos("base", {help: "数据类型", Int: function(val, def) { return parseIn
|
|||||||
replaceAll: function(str) {
|
replaceAll: function(str) {
|
||||||
for (var i = 1; i < arguments.length; i += 2) { if (!arguments[i]) { continue }
|
for (var i = 1; i < arguments.length; i += 2) { if (!arguments[i]) { continue }
|
||||||
if (str.replaceAll) { str = str.replaceAll(arguments[i], arguments[i+1]); continue }
|
if (str.replaceAll) { str = str.replaceAll(arguments[i], arguments[i+1]); continue }
|
||||||
if (str.replace) { str = str.replace(arguments[i], arguments[i+1]); continue }
|
if (arguments[i] && str.replace) {
|
||||||
|
while (str.indexOf(arguments[i]) > -1) {
|
||||||
|
str = str.replace(arguments[i], arguments[i+1])
|
||||||
|
}
|
||||||
|
continue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return str
|
return str
|
||||||
},
|
},
|
||||||
|
@ -234,6 +234,8 @@ body.mobile textarea { font-size:1.2rem; border-radius:0; }
|
|||||||
body.mobile input[type=text] { font-size:1.2rem; height:38px; border-radius:0; margin-right:5px; }
|
body.mobile input[type=text] { font-size:1.2rem; height:38px; border-radius:0; margin-right:5px; }
|
||||||
body.mobile input[type=button] { font-size:1.2rem; height:38px; border-radius:0; }
|
body.mobile input[type=button] { font-size:1.2rem; height:38px; border-radius:0; }
|
||||||
body.mobile fieldset.float input[type=button] { font-size:1.4rem; height:38px; }
|
body.mobile fieldset.float input[type=button] { font-size:1.4rem; height:38px; }
|
||||||
|
body.mobile fieldset.plugin { margin:10px 0; }
|
||||||
|
body.mobile fieldset.plugin.full { margin:0; }
|
||||||
body.mobile table.layout div.toggle { font-size:48px; }
|
body.mobile table.layout div.toggle { font-size:48px; }
|
||||||
body.mobile table.content th { padding:6px 6px; }
|
body.mobile table.content th { padding:6px 6px; }
|
||||||
|
|
||||||
@ -269,11 +271,10 @@ body.mobile fieldset.Footer.foot div.output { height:3rem; }
|
|||||||
body.mobile fieldset.Footer.foot div.output div { height:2.6rem; }
|
body.mobile fieldset.Footer.foot div.output div { height:2.6rem; }
|
||||||
body.mobile fieldset.Footer.foot input[name=cmd] { height:38px; }
|
body.mobile fieldset.Footer.foot input[name=cmd] { height:38px; }
|
||||||
|
|
||||||
body.mobile.landscape fieldset.Header.head { position:unset; display:none; }
|
body.mobile.landscape fieldset.Header.head { position:unset; }
|
||||||
body.mobile.landscape fieldset.Header.head div.search>input { width:240px; }
|
|
||||||
body.mobile.landscape fieldset.Header.head div.state.time { display:block; }
|
body.mobile.landscape fieldset.Header.head div.state.time { display:block; }
|
||||||
body.mobile.landscape fieldset.Action.main { margin-top:0; margin-bottom:0; }
|
body.mobile.landscape fieldset.Action.main { margin-top:0; margin-bottom:0; }
|
||||||
body.mobile.landscape fieldset.Footer.foot { position:unset; display:none; }
|
body.mobile.landscape fieldset.Footer.foot { position:unset; }
|
||||||
body.mobile.landscape fieldset.Footer.foot input[name=cmd] { width:240px; }
|
body.mobile.landscape fieldset.Footer.foot input[name=cmd] { width:240px; }
|
||||||
|
|
||||||
body.mobile fieldset.draw.spide div.action { display:none; }
|
body.mobile fieldset.draw.spide div.action { display:none; }
|
||||||
|
@ -121,6 +121,10 @@ Volcanos(chat.ONKEYMAP, {help: "键盘交互", _focus: [], _init: function(can,
|
|||||||
Volcanos(chat.ONACTION, {help: "操作数据", _init: function(can, cb, target) {
|
Volcanos(chat.ONACTION, {help: "操作数据", _init: function(can, cb, target) {
|
||||||
can.Conf(html.MARGIN_Y, 4*html.PLUGIN_MARGIN+2*html.ACTION_HEIGHT+html.ACTION_MARGIN)
|
can.Conf(html.MARGIN_Y, 4*html.PLUGIN_MARGIN+2*html.ACTION_HEIGHT+html.ACTION_MARGIN)
|
||||||
can.Conf(html.MARGIN_X, 4*html.PLUGIN_MARGIN)
|
can.Conf(html.MARGIN_X, 4*html.PLUGIN_MARGIN)
|
||||||
|
if (can.user.isMobile) {
|
||||||
|
can.Conf(html.MARGIN_Y, 4*html.PLUGIN_MARGIN+2*html.ACTION_HEIGHT+html.ACTION_MARGIN)
|
||||||
|
can.Conf(html.MARGIN_X, 2*html.PLUGIN_MARGIN)
|
||||||
|
}
|
||||||
|
|
||||||
if (can.user.mod.isPod || can.user.isMobile) {
|
if (can.user.mod.isPod || can.user.isMobile) {
|
||||||
var gt = "❯", lt = "❮"; function toggle(view) { return can.onmotion.toggle(can, can._root.River._target) }
|
var gt = "❯", lt = "❮"; function toggle(view) { return can.onmotion.toggle(can, can._root.River._target) }
|
||||||
@ -205,10 +209,10 @@ Volcanos(chat.ONACTION, {help: "操作数据", _init: function(can, cb, target)
|
|||||||
can.onlayout._init(can)
|
can.onlayout._init(can)
|
||||||
|
|
||||||
var cb = can.onlayout[button]; if (can.base.isFunc(cb)? cb(can, silent): (function() {})()) { return }
|
var cb = can.onlayout[button]; if (can.base.isFunc(cb)? cb(can, silent): (function() {})()) { return }
|
||||||
can.page.style(can, can._target, html.HEIGHT, can.ConfHeight()+can.Conf(html.MARGIN_Y), html.WIDTH, can.ConfWidth()+can.Conf(html.MARGIN_X))
|
(button == "" && can.user.isMobile) || can.page.style(can, can._target, html.HEIGHT, can.ConfHeight()+can.Conf(html.MARGIN_Y), html.WIDTH, can.ConfWidth()+can.Conf(html.MARGIN_X))
|
||||||
can.core.Next(can._plugins, function(sub, next) { can.onmotion.delay(can, function() {
|
can.core.Next(can._plugins, function(sub, next) { can.onmotion.delay(can, function() {
|
||||||
sub.onaction._resize(sub, button == "" || button == ice.AUTO, can.ConfHeight(), can.ConfWidth()), next()
|
sub.onaction._resize(sub, button == "" || button == ice.AUTO, can.ConfHeight(), can.ConfWidth()), next()
|
||||||
if (button == "" || button == ice.AUTO) { can.page.style(can, sub._output, html.MAX_HEIGHT, "") }
|
if (button == "") { can.page.style(can, sub._output, html.MAX_HEIGHT, "") }
|
||||||
}, 10) })
|
}, 10) })
|
||||||
},
|
},
|
||||||
help: function(can, button) { can.user.open("/help/"+button+".shy") },
|
help: function(can, button) { can.user.open("/help/"+button+".shy") },
|
||||||
|
@ -145,6 +145,9 @@ Volcanos(chat.ONACTION, {help: "交互数据",
|
|||||||
"clear": "清除背景",
|
"clear": "清除背景",
|
||||||
"logout": "退出登录",
|
"logout": "退出登录",
|
||||||
},
|
},
|
||||||
|
onsize: function(can, msg) {
|
||||||
|
can.onimport.topic(can)
|
||||||
|
},
|
||||||
onmain: function(can, msg) {
|
onmain: function(can, msg) {
|
||||||
can.run({}, [], function(msg) {
|
can.run({}, [], function(msg) {
|
||||||
if (!can.Conf(aaa.USERNICK, msg.Option(aaa.USERNICK)||msg.Option(ice.MSG_USERNICK)||msg.Option(ice.MSG_USERNAME))) {
|
if (!can.Conf(aaa.USERNICK, msg.Option(aaa.USERNICK)||msg.Option(ice.MSG_USERNICK)||msg.Option(ice.MSG_USERNAME))) {
|
||||||
|
@ -279,6 +279,7 @@ Volcanos(chat.ONSYNTAX, {help: "语法高亮",
|
|||||||
"for": code.KEYWORD,
|
"for": code.KEYWORD,
|
||||||
"while": code.KEYWORD,
|
"while": code.KEYWORD,
|
||||||
"break": code.KEYWORD,
|
"break": code.KEYWORD,
|
||||||
|
"continue": code.KEYWORD,
|
||||||
"switch": code.KEYWORD,
|
"switch": code.KEYWORD,
|
||||||
"case": code.KEYWORD,
|
"case": code.KEYWORD,
|
||||||
"default": code.KEYWORD,
|
"default": code.KEYWORD,
|
||||||
|
@ -28,7 +28,7 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
|
|||||||
Volcanos(chat.ONFIGURE, {help: "索引导航",
|
Volcanos(chat.ONFIGURE, {help: "索引导航",
|
||||||
create: function(can, target, zone, path) {
|
create: function(can, target, zone, path) {
|
||||||
can.isCmdMode()? can.onappend._action(can, can.base.Obj(can._msg.Option(ice.MSG_ACTION)).concat(
|
can.isCmdMode()? can.onappend._action(can, can.base.Obj(can._msg.Option(ice.MSG_ACTION)).concat(
|
||||||
window.webview? ["查找", "git", "vim", "录屏", "日志", "编辑器", "浏览器", "首页", "百度"]: ["查找"]), target): can.onmotion.hidden(can, target.parentNode)
|
window.webview? ["查找", "录屏", "git", "vim", "日志", "编辑器", "浏览器", "首页", "百度"]: ["查找"]), target): can.onmotion.hidden(can, target.parentNode)
|
||||||
},
|
},
|
||||||
recent: function(can, target, zone, path) { var total = 0
|
recent: function(can, target, zone, path) { var total = 0
|
||||||
function show(msg, cb) {
|
function show(msg, cb) {
|
||||||
|
@ -111,7 +111,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear(
|
|||||||
},
|
},
|
||||||
layout: function(can) {
|
layout: function(can) {
|
||||||
can.page.styleWidth(can, can.ui.content, can.ConfWidth()-can.ui.project.offsetWidth-can.ui.profile.offsetWidth)
|
can.page.styleWidth(can, can.ui.content, can.ConfWidth()-can.ui.project.offsetWidth-can.ui.profile.offsetWidth)
|
||||||
if (can.isCmdMode() || can.isPlugType()) { can.page.styleHeight(can, can._output, can.ConfHeight())
|
if (can.isCmdMode() || can.isFullMode() || can.isPlugType()) { can.page.styleHeight(can, can._output, can.ConfHeight())
|
||||||
var height = can._display_heights[can.sup.task? [can.sup.task.zone, can.sup.task.id].join(ice.FS): ""]||200
|
var height = can._display_heights[can.sup.task? [can.sup.task.zone, can.sup.task.id].join(ice.FS): ""]||200
|
||||||
if (can.ui.display.innerHTML && can.ui.display.style.display != html.NONE) {
|
if (can.ui.display.innerHTML && can.ui.display.style.display != html.NONE) {
|
||||||
can.page.style(can, can.ui.content, html.HEIGHT, can.ConfHeight()-height)
|
can.page.style(can, can.ui.content, html.HEIGHT, can.ConfHeight()-height)
|
||||||
|
@ -100,6 +100,7 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
chart: function(can, data, target) {
|
chart: function(can, data, target) {
|
||||||
|
can.page.style(can, target, html.MAX_WIDTH, can.ConfWidth(), "overflow", "auto")
|
||||||
if (!data.fg && !data.bg) { target.className.baseVal = "story auto" }
|
if (!data.fg && !data.bg) { target.className.baseVal = "story auto" }
|
||||||
|
|
||||||
target.onclick = function(event) {
|
target.onclick = function(event) {
|
||||||
@ -164,7 +165,10 @@ Volcanos(chat.ONACTION, {help: "控件交互",
|
|||||||
})
|
})
|
||||||
|
|
||||||
can.onappend._init(can, {type: "story word float"}, [], function(sub) {
|
can.onappend._init(can, {type: "story word float"}, [], function(sub) {
|
||||||
sub.run = can.run, sub.sup = can, can.sub = sub, can.onappend._action(sub, [
|
sub.run = can.run, sub.sup = can, can.sub = sub, can.onappend._action(sub, can.user.isMobile && window.innerHeight > window.innerWidth? [
|
||||||
|
"大纲", "上一页",
|
||||||
|
"下一页", "结束",
|
||||||
|
]: [
|
||||||
["布局", "开讲", "网格", "快闪"], "大纲", "首页", "上一页",
|
["布局", "开讲", "网格", "快闪"], "大纲", "首页", "上一页",
|
||||||
["菜单"].concat(can.core.List(list, function(page) { return page[0].innerHTML })),
|
["菜单"].concat(can.core.List(list, function(page) { return page[0].innerHTML })),
|
||||||
"下一页", "隐藏", "结束",
|
"下一页", "隐藏", "结束",
|
||||||
|
@ -127,14 +127,14 @@ Volcanos(chat.ONACTION, {help: "交互操作", list: [
|
|||||||
"刷新数据": function(event, can) { can.Update({}, can.Input([], true)) },
|
"刷新数据": function(event, can) { can.Update({}, can.Input([], true)) },
|
||||||
"切换浮动": function(event, can, button, sub) {
|
"切换浮动": function(event, can, button, sub) {
|
||||||
can.onaction._switch(can, sub, "float", function() {
|
can.onaction._switch(can, sub, "float", function() {
|
||||||
can.ConfHeight(window.innerHeight/2), html.WIDTH, can.ConfWidth(window.innerWidth/2)
|
can.ConfHeight(window.innerHeight/2), html.WIDTH, can.ConfWidth(window.innerWidth/(can.user.isMobile? 1: 2))
|
||||||
can.getActionSize(function(left) { can.onmotion.move(can, can._target, {left: left||0, top: window.innerHeight/2-4*html.ACTION_HEIGHT-html.PLUGIN_MARGIN}) })
|
can.getActionSize(function(left) { can.onmotion.move(can, can._target, {left: left||0, top: window.innerHeight/2-4*html.ACTION_HEIGHT-html.PLUGIN_MARGIN}) })
|
||||||
}, function() { can.page.style(can, can._target, html.LEFT, "", html.TOP, "") })
|
}, function() { can.page.style(can, can._target, html.LEFT, "", html.TOP, "") })
|
||||||
},
|
},
|
||||||
"切换全屏": function(event, can, button, sub) {
|
"切换全屏": function(event, can, button, sub) {
|
||||||
can.onaction._switch(can, sub, "full", function() { can.ConfWidth(window.innerWidth)
|
can.onaction._switch(can, sub, "full", function() { can.ConfWidth(window.innerWidth)
|
||||||
can.page.style(can, can._target, html.LEFT, "", html.BOTTOM, "")
|
can.page.style(can, can._target, html.LEFT, "", html.BOTTOM, "")
|
||||||
can.ConfHeight(window.innerHeight-html.ACTION_HEIGHT-can.onexport.statusHeight(can)-(can.user.isMobile? 2*html.ACTION_HEIGHT: 0))
|
can.ConfHeight(window.innerHeight-html.ACTION_HEIGHT-can.onexport.statusHeight(can))
|
||||||
}, function() {})
|
}, function() {})
|
||||||
},
|
},
|
||||||
"共享工具": function(event, can) { var meta = can.Conf()
|
"共享工具": function(event, can) { var meta = can.Conf()
|
||||||
|
@ -43,6 +43,7 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
|
|||||||
return {height: height, width: width, space: space, step: step}
|
return {height: height, width: width, space: space, step: step}
|
||||||
},
|
},
|
||||||
layout: function(can) {
|
layout: function(can) {
|
||||||
|
can.onmotion.toggle(can, can._option, !can.user.isMobile || !can.isFullMode())
|
||||||
can.onaction[can.Action(ice.VIEW)]({}, can)
|
can.onaction[can.Action(ice.VIEW)]({}, can)
|
||||||
},
|
},
|
||||||
transform: function(can, target) {
|
transform: function(can, target) {
|
||||||
@ -51,7 +52,7 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
|
|||||||
}, [""])
|
}, [""])
|
||||||
Volcanos(chat.ONACTION, {help: "组件菜单", list: [
|
Volcanos(chat.ONACTION, {help: "组件菜单", list: [
|
||||||
[ice.VIEW, "趋势图", "柱状图", "折线图", "数据源"],
|
[ice.VIEW, "趋势图", "柱状图", "折线图", "数据源"],
|
||||||
[html.HEIGHT, ice.AUTO, 100, 200, 400, 600, 800, ice.AUTO],
|
[html.HEIGHT, ice.AUTO, 100, 200, 400, 600, 800],
|
||||||
["space", 10, 20, 50, 100],
|
["space", 10, 20, 50, 100],
|
||||||
[html.SPEED, 10, 20, 50, 100],
|
[html.SPEED, 10, 20, 50, 100],
|
||||||
],
|
],
|
||||||
|
@ -11,6 +11,7 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
|
|||||||
can.onappend.board(can, msg, target)
|
can.onappend.board(can, msg, target)
|
||||||
can.onmotion.story.auto(can, target)
|
can.onmotion.story.auto(can, target)
|
||||||
can.base.isFunc(cb) && cb(msg)
|
can.base.isFunc(cb) && cb(msg)
|
||||||
|
can.user.isMobile && can.onmotion.toggle(can, can._action, can.ConfHeight() < can.ConfWidth())
|
||||||
can.page.Select(can, target, "input[type=button]", function(target) {
|
can.page.Select(can, target, "input[type=button]", function(target) {
|
||||||
if (target.value == target.name) { target.value = can.user.trans(can, target.name) }
|
if (target.value == target.name) { target.value = can.user.trans(can, target.name) }
|
||||||
})
|
})
|
||||||
@ -220,7 +221,10 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
Volcanos(chat.ONLAYOUT, {help: "界面布局",
|
Volcanos(chat.ONLAYOUT, {help: "界面布局",
|
||||||
_init: function(can) { can.core.CallFunc([can.onimport, html.LAYOUT], {can: can}) },
|
_init: function(can) {
|
||||||
|
can.user.isMobile && can.onmotion.toggle(can, can._action, can.ConfHeight() < can.ConfWidth())
|
||||||
|
can.core.CallFunc([can.onimport, html.LAYOUT], {can: can})
|
||||||
|
},
|
||||||
float: function(can) { can.onlayout._init(can) },
|
float: function(can) { can.onlayout._init(can) },
|
||||||
full: function(can) {
|
full: function(can) {
|
||||||
can.sup.onimport.size(can.sup, can.ConfHeight(), can.ConfWidth(), false)
|
can.sup.onimport.size(can.sup, can.ConfHeight(), can.ConfWidth(), false)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user