forked from x/volcanos
opt cli
This commit is contained in:
parent
d1b5111f5f
commit
08f0df672d
11
frame.js
11
frame.js
@ -1,18 +1,17 @@
|
||||
_can_name = "/frame.js"
|
||||
Volcanos("onengine", {help: "搜索引擎", list: [], _init: function(can, meta, list, cb, target) {
|
||||
|
||||
can.page.Select(can, document.body, "iframe", function(item) {
|
||||
can.page.Remove(can, item)
|
||||
})
|
||||
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)
|
||||
}
|
||||
if (can.user.isExtension) { Volcanos.meta.args = can.base.Obj(localStorage.getItem(ctx.ARGS), {}) }
|
||||
|
||||
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, "")
|
||||
}
|
||||
|
||||
if (can.user.isExtension) { Volcanos.meta.args = can.base.Obj(localStorage.getItem(ctx.ARGS), {}) }
|
||||
can.page.Select(can, target, html.IFRAME, function(item) { can.page.Remove(can, item) })
|
||||
|
||||
can.core.Next(list, function(item, next) { item.type = chat.PANEL
|
||||
can.onappend._init(can, can.base.Copy(item, can.core.Value(can._root, [chat.RIVER, item.name])), item.list, function(panel) {
|
||||
panel.run = function(event, cmds, cb) { var msg = panel.request(event); cmds = cmds||[]
|
||||
@ -515,7 +514,7 @@ Volcanos("onlayout", {help: "页面布局", list: [], _init: function(can, targe
|
||||
layout.right = 0, layout.left = ""
|
||||
}
|
||||
if (top+target.offsetHeight>window.innerHeight-32) {
|
||||
layout.bottom = window.innerHeight - event.clientY+event.offsetY-(right? 32: 32), layout.top = ""
|
||||
layout.bottom = window.innerHeight - event.clientY+event.offsetY, layout.top = ""
|
||||
if (right) { layout.bottom -= target.offsetHeight }
|
||||
}
|
||||
return can.page.style(can, target, layout), can.onmotion.move(can, target, layout), layout
|
||||
|
15
lib/user.js
15
lib/user.js
@ -114,8 +114,8 @@ Volcanos("user", {help: "用户操作", agent: {
|
||||
}), can.user.copy(msg._event, can, msg.Append(mdb.NAME))
|
||||
})
|
||||
},
|
||||
login: function(can, cb, method) {
|
||||
var ui = can.user.input({}, can, [{type: html.USERNAME}, {type: html.PASSWORD}], function(event, button, data, list) { return {
|
||||
login: function(can, cb, method, auto) {
|
||||
var list = {
|
||||
"登录": function() {
|
||||
can.run({}, [aaa.LOGIN, data[html.USERNAME], data[html.PASSWORD]], function(msg) {
|
||||
if (msg.Option(ice.MSG_USERNAME)) {
|
||||
@ -149,8 +149,9 @@ Volcanos("user", {help: "用户操作", agent: {
|
||||
})
|
||||
},
|
||||
"飞书": function() { location.href = "/chat/lark/sso" },
|
||||
}[button]() }, can.base.Obj(method, ["登录", "扫码", "授权"]))
|
||||
}; if (auto) { return list["授权"]() }
|
||||
|
||||
var ui = can.user.input({}, can, [{type: html.USERNAME}, {type: html.PASSWORD}], function(event, button, data, list) { return list[button]() }, can.base.Obj(method, ["登录", "扫码", "授权"]))
|
||||
can.page.Modify(can, ui._target, {className: "input login", style: {left: (window.innerWidth-ui._target.offsetWidth)/2, top: window.innerHeight/6}})
|
||||
},
|
||||
logout: function(can, force) { if (force||can.user.confirm("logout?")) {
|
||||
@ -204,18 +205,18 @@ Volcanos("user", {help: "用户操作", agent: {
|
||||
carte._float && can.page.Remove(can, carte._float._target), carte._float = sub
|
||||
can.onlayout.figure(event, can, sub._target, true)
|
||||
} }
|
||||
}) }] ); can.onlayout.figure(event, can, ui._target)
|
||||
}) }] )
|
||||
|
||||
ui._target.onmouseover = function(event) { can.onkeymap.prevent(event) }
|
||||
var carte = {_target: ui._target, _parent: parent}
|
||||
var carte = {_target: ui._target, _parent: parent, layout: can.onlayout.figure(event, can, ui._target)}
|
||||
return can.onkeymap.prevent(event), carte
|
||||
},
|
||||
carteRight: function(event, can, meta, list, cb, parent) {
|
||||
var carte = can.user.carte(event, can, meta, list, cb, parent)
|
||||
// can.onlayout.figure(event, can, carte._target, true)
|
||||
can.page.Modify(can, carte._target, {style: {
|
||||
left: event.clientX-event.offsetX+event.target.offsetWidth-3,
|
||||
top: carte._target.offsetTop-event.target.offsetHeight+5,
|
||||
top: carte._target.offsetTop-(carte.layout.bottom? -event.target.offsetHeight: event.target.offsetHeight)+5,
|
||||
bottom: "",
|
||||
}})
|
||||
return carte
|
||||
},
|
||||
|
@ -145,7 +145,7 @@ Volcanos("onaction", {help: "交互数据", list: [], _init: function(can, cb, t
|
||||
can.user.isLocalFile? init(): can.run({}, [chat.CHECK], function(msg) {
|
||||
can.Conf(aaa.USERNICK, msg.Option(ice.MSG_USERNICK)||msg.Option(ice.MSG_USERNAME))? init():
|
||||
msg.Option(chat.SSO)? can.user.jumps(msg.Option(chat.SSO)):
|
||||
can.user.login(can, init, msg.Option(aaa.LOGIN))
|
||||
can.user.login(can, init, msg.Option(aaa.LOGIN), msg.Option("login.dev"))
|
||||
})
|
||||
},
|
||||
onstorm_select: function(can, msg, river, storm) { can.Conf(chat.RIVER, river), can.Conf(chat.STORM, storm) },
|
||||
|
@ -137,7 +137,8 @@ Volcanos("onimport", {help: "导入数据", _init: function(can, msg, cb, target
|
||||
sub.page.style(sub, sub._output, html.MAX_WIDTH, sub.ConfWidth())
|
||||
sub.select = function() { return sub._legend.click(), sub }
|
||||
|
||||
var status = can.user.mod.isCmd? can._status: can.ui.toolkit.status
|
||||
// var status = can.user.mod.isCmd? can._status: can.ui.toolkit.status
|
||||
var status = can._status
|
||||
status.appendChild(sub._legend), sub._legend.onclick = function(event) {
|
||||
if (can.page.Select(can, status, ice.PT+html.SELECT)[0] == event.target) {
|
||||
can.page.ClassList.del(can, event.target, html.SELECT)
|
||||
|
Loading…
x
Reference in New Issue
Block a user