forked from x/volcanos
opt some
This commit is contained in:
parent
bf3ca5d28f
commit
4f9b4fb8cf
4
frame.js
4
frame.js
@ -387,7 +387,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
)
|
||||
vbar.innerHTML = `${parseInt(target.scrollTop)}+${target.offsetHeight}/${target.scrollHeight}`
|
||||
var width = can.base.Min(target.offsetWidth*target.offsetWidth/target.scrollWidth, target.offsetWidth/4)
|
||||
target.scrollWidth > target.offsetWidth && can.page.style(can, hbar, html.WIDTH, width, html.BOTTOM, -target.scrollTop, html.VISIBILITY, html.VISIBLE,
|
||||
target.scrollWidth > target.offsetWidth+10 && can.page.style(can, hbar, html.WIDTH, width, html.BOTTOM, -target.scrollTop, html.VISIBILITY, html.VISIBLE,
|
||||
html.LEFT, target.scrollLeft+target.scrollLeft/(target.scrollWidth-target.offsetWidth)*(target.offsetWidth-width),
|
||||
)
|
||||
hbar.innerHTML = `${target.scrollLeft}+${target.offsetWidth}/${target.scrollWidth}`
|
||||
@ -509,7 +509,7 @@ Volcanos(chat.ONLAYOUT, {_init: function(can, target) { target = target||can._ro
|
||||
can.user.isMobile && can.user.isLandscape() || can.page.style(can, document.body, kit.Dict(html.OVERFLOW, html.HIDDEN))
|
||||
},
|
||||
expand: function(can, target, width) { var n = parseInt(target.offsetWidth/(width+20)); width = target.offsetWidth/n - 20
|
||||
can.page.SelectChild(can, target, "", function(target) { can.page.styleWidth(can, target, width) })
|
||||
can.page.SelectChild(can, target, html.DIV_ITEM, function(target) { can.page.styleWidth(can, target, width) })
|
||||
},
|
||||
background: function(can, url, target) { can.page.style(can, target||can._root._target, "background-image", url == "" || url == "void"? "": 'url("'+url+'")') },
|
||||
figure: function(event, can, target, right, min) { if (!event || !event.target) { return {} } target = target||can._fields||can._target
|
||||
|
12
index.css
12
index.css
@ -133,6 +133,10 @@ body>div.input div.action { width:100%; }
|
||||
body>div.input div.action>div.item { margin:5px; float:right; }
|
||||
body>div.input div.action>div.item>input[type=button] { width:110px; }
|
||||
body>div.input.login>div.output { text-align:center; }
|
||||
body>div.input.login>div.output div.sso { cursor:pointer; }
|
||||
body>div.input.login>div.output div.sso:hover { background-color:var(--hover-bg-color); }
|
||||
body>div.input.login>div.output div.sso>img { height:32px; }
|
||||
body>div.input.login>div.output div.sso>span { height:32px; display:inline-block; vertical-align:middle; }
|
||||
body>div.input.simple td:first-child { display:none; }
|
||||
body>div.upload div.action input[type=file] { width:320px; }
|
||||
body>div.upload div.output { border:var(--box-notice); }
|
||||
@ -450,7 +454,11 @@ body.mobile fieldset.inner>form.option input[name=file] { width:90px; }
|
||||
body.windows fieldset.inner>div.output { overflow:hidden; }
|
||||
body.windows fieldset.inner>div.output>div.layout>div.layout>div.profile { overflow:hidden; }
|
||||
/* scrollbar */
|
||||
div.scrollbar { background-color:#0000ff66; border-radius:10px; position:absolute; visibility:hidden; font-size:8px !important; }
|
||||
div.scrollbar {
|
||||
background-color:#0000ff66;
|
||||
font-size:8px !important; line-height:10px;
|
||||
border-radius:10px; position:absolute; visibility:hidden;
|
||||
}
|
||||
div.scrollbar.vertical { writing-mode:tb; width:10px; right:0; top:0; transition:width .3s 1s; }
|
||||
div.scrollbar.vertical:hover { width:30px; transition:width .1s; font-size:24px !important; }
|
||||
div.scrollbar.horizon:hover { height:30px; transition:height .1s; font-size:24px !important; }
|
||||
@ -462,6 +470,8 @@ div.status::-webkit-scrollbar { width:0 !important; height:0 !important; }
|
||||
div.project::-webkit-scrollbar { width:0 !important; height:0 !important; }
|
||||
div.content::-webkit-scrollbar { width:0 !important; height:0 !important; }
|
||||
fieldset.word>div.output::-webkit-scrollbar { width:0 !important; height:0 !important; }
|
||||
fieldset.dream>div.output::-webkit-scrollbar { width:0 !important; height:0 !important; }
|
||||
fieldset.web.code.git.search>div.output::-webkit-scrollbar { width:0 !important; height:0 !important; }
|
||||
div.toggle::-webkit-scrollbar { width:0 !important; height:0 !important; }
|
||||
div.story[data-type=spark]::-webkit-scrollbar { width:0 !important; height:0 !important; }
|
||||
div.carte::-webkit-scrollbar { width:0 !important; height:0 !important; }
|
||||
|
26
lib/user.js
26
lib/user.js
@ -232,7 +232,7 @@ Volcanos("user", {
|
||||
can.user.input(event, can, [{name: mdb.NAME, value: name}], function(list) { can.user.download(can, url, list[0], nfs.PNG) })
|
||||
}), resize: html.IMG,
|
||||
}) },
|
||||
login: function(can, cb, method) { var trans = kit.Dict(aaa.USERNAME, "用户", aaa.PASSWORD, "密码", aaa.LOGIN, "登录")
|
||||
login: function(can, cb, method, sso) { var trans = kit.Dict(aaa.USERNAME, "用户", aaa.PASSWORD, "密码", aaa.LOGIN, "登录")
|
||||
function layout() { can.page.style(can, ui._target, {left: (window.innerWidth-ui._target.offsetWidth)/2, top: window.innerHeight/8}) }
|
||||
function button(list) { return {view: [html.ITEM, html.TR], list: [{type: html.TD}, {type: html.TD, list: can.core.Item(list, function(key, cb) {
|
||||
return {type: html.INPUT, value: can.user.trans(can, key, trans), data: {type: html.BUTTON}, onclick: cb}
|
||||
@ -241,22 +241,34 @@ Volcanos("user", {
|
||||
{type: html.TD, list: [{text: can.user.trans(can, name, trans)}]},
|
||||
{type: html.TD, list: [{type: html.INPUT, name: name, data: {type: type||html.TEXT}}]},
|
||||
]} }
|
||||
var _sso = can.core.Item(sso, function(key, value) {
|
||||
return {view: "sso", list: [{img: can.misc.Resource(can, value.icon)}, {text: key}], onclick: function() { can.user.jumps(value.url) }}
|
||||
})
|
||||
can.misc.CookieSessid(can, "")
|
||||
var ui = can.onappend.tabview(can, {
|
||||
"扫码授权": function(target) { can.misc.WSS(can, {type: aaa.LOGIN, name: "", "sess.theme": can.getHeaderTheme()}, function(cmd, arg) {
|
||||
if (cmd == cli.PWD) { var _cmd = " space login "+arg[0]; return can.page.Modify(can, target, arg[2]), can.page.Append(can, target, [
|
||||
{text: "<br/>或命令授权: "+_cmd, title: "点击复制,并后台执行此命令,即可登录", style: {cursor: "copy"}, onclick: function() { can.user.copy(event, can, _cmd) }},
|
||||
]), can.onmotion.delay(can, function() { layout() }, 10) }
|
||||
].concat(_sso)), can.onmotion.delay(can, function() { layout() }, 10) }
|
||||
if (cmd == ice.MSG_SESSID) {
|
||||
if (!can.misc.CookieSessid(can, arg[0])) { can.user.info.sessid = arg[0] }
|
||||
return can.page.Remove(can, ui._target), can.base.isFunc(cb) && cb()
|
||||
}
|
||||
}) },
|
||||
"密码登录": function(target) { var _ui = can.page.Append(can, target, [input(aaa.USERNAME), input(aaa.PASSWORD, aaa.PASSWORD), button(kit.Dict(aaa.LOGIN, function(event) {
|
||||
can.runAction(event, aaa.LOGIN, [_ui.username.value, _ui.password.value], function(msg) {
|
||||
if (!msg.Option(ice.MSG_USERNAME)) { return can.user.toastFailure(can, "用户或密码错误") }
|
||||
can.page.Remove(can, ui._target), can.base.isFunc(cb) && cb()
|
||||
"密码登录": function(target) {
|
||||
var _ui = can.page.Append(can, target, [input(aaa.USERNAME), input(aaa.PASSWORD, aaa.PASSWORD), button(kit.Dict(aaa.LOGIN, function(event) {
|
||||
can.runAction(event, aaa.LOGIN, [_ui.username.value, _ui.password.value], function(msg) {
|
||||
if (!msg.Option(ice.MSG_USERNAME)) { return can.user.toastFailure(can, "用户或密码错误") }
|
||||
can.page.Remove(can, ui._target), can.base.isFunc(cb) && cb()
|
||||
})
|
||||
}))]); can.page.Append(can, target, _sso)
|
||||
can.misc.WSS(can, {type: aaa.LOGIN}, function(cmd, arg) {
|
||||
if (cmd == ice.MSG_SESSID) {
|
||||
if (!can.misc.CookieSessid(can, arg[0])) { can.user.info.sessid = arg[0] }
|
||||
return can.page.Remove(can, ui._target), can.base.isFunc(cb) && cb()
|
||||
}
|
||||
})
|
||||
}))]) },
|
||||
},
|
||||
}, can.base.Obj(method, can.user.isMobile? ["密码登录"]: ["扫码授权"]), can.page.Append(can, document.body, [{view: "input login float"}])._target)
|
||||
can.onmotion.delay(can, function() { layout() })
|
||||
},
|
||||
|
@ -70,7 +70,7 @@ Volcanos(chat.ONACTION, {_init: function(can) {
|
||||
if (can.base.beginWith(location.pathname, "/wiki/portal/", "/chat/cmd/web.wiki.portal/", "/chat/cmd/web.chat.oauth.client", "/chat/pod/20230511-golang-story/cmd/web.code.gitea.client")) { return show(msg) }
|
||||
if (location.pathname == "/" && can.base.beginWith(msg.Option(ice.MAIN)||"", "/wiki/portal/", "/chat/cmd/web.wiki.portal/")) { return show(msg) }
|
||||
if (!can.Conf(aaa.USERNICK, msg.Option(aaa.USERNICK)||msg.Option(ice.MSG_USERNICK)||msg.Option(ice.MSG_USERNAME))) {
|
||||
return msg.Option(chat.SSO)? can.user.jumps(msg.Option(chat.SSO)): can.user.login(can, function() { can.onengine.signal(can, chat.ONMAIN, msg) }, msg.Option(aaa.LOGIN))
|
||||
return can.user.login(can, function() { can.onengine.signal(can, chat.ONMAIN, msg) }, msg.Option(aaa.LOGIN), can.base.Obj(msg.Option(chat.SSO)))
|
||||
} show(msg)
|
||||
})
|
||||
},
|
||||
|
@ -12,9 +12,9 @@ fieldset.word>div.output iframe { height:480px; width:100%; }
|
||||
fieldset.word>div.output svg.story[data-index] text { cursor:pointer; }
|
||||
fieldset.word>div.output input.story[type=button] { font-family:system-ui; font-weight:bold; padding:20px 40px; margin:10px; height:64px; box-shadow:var(--box-shadow); }
|
||||
fieldset.word>div.output fieldset.web.code.inner.output div.output td.line { border-right:var(--box-border); }
|
||||
fieldset.word>div.output fieldset.story { margin:20px 0; }
|
||||
fieldset.word>div.output fieldset.story:not(.full) { margin:20px 0; }
|
||||
fieldset.word>div.output ul { margin:20px 40px; }
|
||||
fieldset.word>div.output fieldset.story:not(.float)>form.option>div.icon.delete { display:none; }
|
||||
fieldset.word>div.output fieldset.story:not(.float):not(.full)>form.option>div.icon.delete { display:none; }
|
||||
|
||||
fieldset.word>div.navmenu { background-color:inherit; overflow:auto; min-width:120px; clear:both; float:left; }
|
||||
fieldset.word>div.navmenu div.list { margin-left:20px; }
|
||||
|
@ -17,6 +17,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear(
|
||||
]}
|
||||
}))
|
||||
can.onimport.layout = function() { can.onlayout.expand(can, can._output, 320) }
|
||||
can.onappend.scroll(can, can._output)
|
||||
},
|
||||
_vimer_zone: function(can, msg, target) { msg.Table(function(value) { var action = can.page.parseAction(can, value)
|
||||
can.onimport.item(can, {icon: value.icon||value.avatar_url, name: can.page.Color(value[can.Conf(mdb.FIELD)||mdb.VIEW]||value[mdb.NAME]||value[mdb.TEXT]||value[mdb.TYPE]), title: value[mdb.TEXT]||value.description}, function(event) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user