1
0
forked from x/volcanos
This commit is contained in:
IT 老营长 @云轩领航-创始人 2023-11-24 20:21:59 +08:00
parent 44461f941c
commit d934ca02b0
8 changed files with 54 additions and 47 deletions

View File

@ -530,7 +530,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
function _cb(sub, value, old) { if (value == old) { return } target.value = value, can.base.isFunc(cb) && cb(sub, value, old) }
target.onkeydown = function() { if (event.key == code.ESCAPE && target._can) { return target._can.close(), target.blur() } else if (event.key == code.ENTER) { can.base.isFunc(cb) && cb(event, target.value) } }
can.core.ItemCB(can.onfigure[input], function(key, on) { var last = target[key]||function() { }; target[key] = function(event) { can.misc.Event(event, can, function(msg) {
function show(sub, cb) { can.base.isFunc(cb) && cb(sub, _cb), can.onlayout._figure(event, can, sub._target), can.onmotion.toggle(can, sub._target, true) }
function show(sub, cb) { can.base.isFunc(cb) && cb(sub, _cb), can.onlayout.figure(event, can, sub._target), can.onmotion.toggle(can, sub._target, true) }
can.core.CallFunc(on, {event: event, can: can, meta: meta, cb: _cb, target: target, sub: target._can, last: last, cbs: function(cb) {
target._can? show(target._can, cb): can.onappend._init(can, {type: html.INPUT, name: input, style: meta.name, mode: chat.FLOAT}, [path], function(sub) { sub.Conf(meta)
sub.run = function(event, cmds, cb) { var msg = sub.request(event)
@ -559,20 +559,21 @@ Volcanos(chat.ONLAYOUT, {_init: function(can, target) { target = target||can._ro
}), can.onengine.signal(can, chat.ONSIZE, can.request({}, {height: height, width: width}))
can.user.isMobile && can.user.isLandscape() || can.page.style(can, document.body, kit.Dict(html.OVERFLOW, html.HIDDEN))
},
expand: function(can, target, width, height) { var margin = 2*html.PLUGIN_PADDING
expand: function(can, target, width, height, item) { var margin = 2*html.PLUGIN_PADDING
var n = parseInt(target.offsetWidth/(width+margin)); width = target.offsetWidth/n - margin
if (width+margin >= target.offsetWidth) { n = 1, width = target.offsetWidth - margin }
can.page.SelectChild(can, target, html.DIV_ITEM, function(target) {
height = can.page.styleHeight(can, target, height), can.page.styleWidth(can, target, width)
can.page.SelectChild(can, target, item||html.DIV_ITEM, function(target) {
can.page.styleHeight(can, target, height), 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
figure: function(event, can, target, right, min) {
if (!event || !event.target) { return {} } target = target||can._fields||can._target
var rect = event.target == document.body? {left: can.page.width()/2, top: can.page.height()/2, right: can.page.width()/2, bottom: can.page.height()/2}: (event.currentTarget||event.target).getBoundingClientRect()
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, height = can.base.Max(height, can.page.height()-top)
if (can.user.isMobile) {
if (target.offsetHeight > height/2) { layout.top = top }
if (target.offsetHeight > height/2 && can.page.tagis(target, "div.input")) { layout.top = top }
if (target.offsetWidth > width/2) { layout.left = left, can.page.style(can, target, html.WIDTH, width) }
}
if (layout.top+target.offsetHeight > top+height) {
@ -592,19 +593,6 @@ Volcanos(chat.ONLAYOUT, {_init: function(can, target) { target = target||can._ro
can.onmotion.move(can, target, layout), can.onmotion.slideGrow(can, target)
return layout
},
_figure: function(event, can, target, right, min) {
if (!can.user.isMobile) { return can.onlayout.figure(event, can, target, right, min) }
if (!event || !event.target) { return {} } target = target||can._fields||can._target
var rect = event.target == document.body? {left: can.page.width()/2, top: can.page.height()/2, right: can.page.width()/2, bottom: can.page.height()/2}: (event.currentTarget||event.target).getBoundingClientRect()
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, height = can.base.Max(height, can.page.height()-top)
can.page.style(can, target, html.MAX_HEIGHT, top+height-layout.top)
can.page.style(can, target, html.MAX_WIDTH, left+width-layout.left)
});
can.onmotion.move(can, target, layout), can.onmotion.slideGrow(can, target)
return layout
},
_float: function(can) { var target = can._fields||can._target, sup = can._fields? can.sup: can
can.onappend.style(can, html.FLOAT), can.onmotion.resize(can, target, function(height, width) { sup.onimport.size(sup, height, width, true) })
can.page.style(can, target, html.LEFT, 250, html.TOP, 132), sup.onimport.size(sup, 600, 600, true)

View File

@ -140,33 +140,38 @@ body>div.carte input[name=filter] { margin:var(--input-margin); width:calc(100%
body>div.carte div.item { white-space:pre; padding:var(--button-padding); }
body>div.carte div.item span.icon.next { float:right; line-height:22px; height:22px; }
body>div.carte.select.float>div.item { text-align:center; }
body>div.input { padding:var(--plugin-padding); }
body>div.input>legend { font-style:italic; width:100%; }
body>div.input td { padding:var(--table-padding); }
body>div.input td:nth-child(2) { padding:var(--table-padding) 0; }
body>div.input tr.img td:last-child>span { display:none; }
body>div.input tr.img td:last-child>div {
background-color:gray; margin:1px; float:left; cursor:pointer;
body>div.input tr.img td:last-child>div.item {
display:flex; flex-wrap:wrap; width:var(--river-width);
}
body>div.input tr.img td:last-child>div.item>div {
background-color:gray; margin:var(--input-margin);
display:flex; align-items:center; justify-content:center;
}
body>div.input tr.img td:last-child>div>span.icon {
display:none;
}
body>div.input tr.img td:last-child>div>span { font-size:var(--action-height); }
body>div.input tr.icon td:last-child { position:relative; }
body>div.input tr.icon td:last-child i:first-child { font-size:22px; position:absolute; left:15px; top:14px; }
/* body>div.input tr.icon td:last-child i:first-child { font-size:22px; } */
body>div.input tr.icon td:last-child img:first-child { position:absolute; height:28px; width:28px; left:12px; top:12px; }
body>div.input tr.icon td:last-child input { padding-left:var(--action-height); }
body>div.input tr.icons td:last-child { position:relative; }
body>div.input tr.icons td:last-child i:first-child { font-size:22px; position:absolute; left:15px; top:14px; }
/* body>div.input tr.icons td:last-child i:first-child { font-size:22px; } */
body>div.input tr.icons td:last-child img:first-child { position:absolute; height:28px; width:28px; left:12px; top:12px; }
body>div.input tr.icons td:last-child input { padding-left:var(--action-height); }
body>div.input td span.icon { margin-left:-20px; visibility:hidden; }
body>div.input td span.icons { margin-left:-20px; visibility:hidden; }
body>div.input td:hover span.icon { visibility:visible; }
body>div.input td:hover span.icons { visibility:visible; }
body>div.input textarea { height:var(--textarea-height); width:var(--project-width) !important; }
body>div.input select { width:var(--project-width) !important; }
body>div.input input:not([type=button]) { width:var(--project-width) !important; }
body>div.input input.select[type=button] { width:var(--project-width) !important; }
body>div.input textarea { height:var(--textarea-height); width:var(--river-width) !important; }
body>div.input select { width:var(--river-width) !important; }
body>div.input input:not([type=button]) { width:var(--river-width) !important; }
body>div.input input.select[type=button] { width:var(--river-width) !important; }
body>div.input input[name=cancel] { border:var(--danger-bg-color) solid 1px; }
body>div.input input[name=submit] { border:var(--notice-bg-color) solid 1px; }
body>div.input input[name=submit]:hover { background-color:var(--notice-bg-color); color:var(--notice-fg-color); }
@ -207,6 +212,7 @@ fieldset>div.output>div.code { font-size:var(--code-font-size); }
fieldset>div.status { font-style:italic; line-height:20px; max-height:var(--action-height); }
fieldset>div.status>div.item { padding:var(--input-padding); height:31px; }
fieldset>div.status>div.item>label { font-size:var(--status-font-size); }
fieldset>div.status>div.item>span { margin-left:var(--input-padding); }
fieldset>div.status>legend { font-style:italic; height:31px; }
body.mobile.landscape>div.input.login { padding:0; }
body.mobile.landscape>div.input.login>div.output { height:290px; }
@ -239,7 +245,7 @@ div.item.text.path>input { width:var(--project-width); }
div.item.text.line>input { width:var(--button-width) !important; }
div.item.text.limit>input { width:var(--button-width); }
div.item.text.offend>input { width:var(--button-width); }
div.item.text>i:first-child { position:absolute; padding:var(--input-padding); }
div.item.text>i:first-child { position:absolute; padding:7px; }
div.item.text>span.icon { font-size:var(--icon-font-size); padding:0 var(--input-padding); position:absolute; right:0; visibility:hidden; }
div.item.text:hover>span.icon { visibility:visible; }
div.item.button { position:relative; display:flex; align-items:center; height:var(--action-height); }
@ -267,10 +273,12 @@ fieldset.plugin.full>form.option>div.button.icons>span.icon { visibility:visible
fieldset.plugin.full>div.action>div.button.icons>input { display:none; }
fieldset.plugin.full>div.action>div.button.icons>span.icon { visibility:visible; position:unset; }
fieldset.plugin.cmd>form.option>div.icon.delete { display:none; }
fieldset.plugin.cmd>form.option>div.button.icons>input { display:none; }
fieldset.plugin.cmd>form.option>div.button.icons>span.icon { visibility:visible; position:unset; }
fieldset.plugin.cmd>div.action>div.button.icons>input { display:none; }
fieldset.plugin.cmd>div.action>div.button.icons>span.icon { visibility:visible; position:unset; }
fieldset.story>form.option>div.button.icons>input { display:none; }
fieldset.story>div.action>div.button.icons>input { display:none; }
fieldset.plug>form.option>div.icon:first-child { margin-left:var(--input-margin); }
@ -283,6 +291,10 @@ fieldset.float:not(.plug)>form.option>div.text>input { display:none; }
fieldset.float:not(.plug)>form.option>div.text>span.icon { display:none; }
fieldset>form.option>div.text>span.value { white-space:pre; padding:var(--input-padding); max-width:200px; height:var(--action-height); overflow:auto; }
body.mobile:not(.landscape) fieldset.float>form.option>div.text>span.value { display:none; }
body.mobile:not(.landscape) fieldset.plugin>form.option>div.button.icons>input { display:none; }
body.mobile:not(.landscape) fieldset.plugin>form.option>div.button.icons>span.icon { visibility:visible; position:unset; }
body.mobile:not(.landscape) fieldset.plugin>div.action>div.button.icons>input { display:none; }
body.mobile:not(.landscape) fieldset.plugin>div.action>div.button.icons>span.icon { visibility:visible; position:unset; }
body.windows form.option>div.icon { font-size:21px; line-height:var(--action-height); }
/* svg */
svg text { font-size:var(--svg-font-size); font-family:var(--code-font-family); stroke:var(--body-fg-color); fill:var(--body-fg-color); cursor:pointer; }
@ -318,7 +330,7 @@ div.project div.zone>div.item { text-align:center; padding:var(--input-padding);
div.project div.zone>div.item span:first-child { flex-grow:1; }
div.project div.zone>div.item span:first-child:hover { background-color:var(--hover-bg-color); }
div.project>div.zone>div.item span:first-child { font-style:italic; font-weight:bold; line-height:var(--action-height); }
div.project div.zone>div.item span.icon { font-size:22px; letter-spacing:0; padding:0 var(--input-padding); display:none; }
div.project div.zone>div.item span.icon { font-size:22px !important; letter-spacing:0; padding:0 var(--input-padding); display:none; }
div.project div.zone>div.item span.icon.refresh { margin-top:-2px; }
div.project div.zone:hover>div.item span.icon { display:block; }
div.project div.zone>div.list>div.zone>div.item { text-align:left; padding-left:var(--button-padding); transition:all .5s; }
@ -446,6 +458,7 @@ fieldset.panel:not(.main)>div.output a { color:var(--panel-output-fg-color); }
fieldset.panel:not(.main):not(.auto) div.item:hover { background-color:var(--panel-hover-bg-color); color:var(--panel-hover-fg-color); }
fieldset.panel:not(.main):not(.auto) div.item.select { background-color:var(--panel-hover-bg-color); color:var(--panel-hover-fg-color); }
fieldset.panel:not(.main):not(.auto) input { background-color:var(--panel-input-bg-color); color:var(--panel-input-fg-color); }
fieldset.panel:not(.main):not(.auto) input:hover { background-color:var(--panel-hover-bg-color); color:var(--panel-hover-fg-color); }
fieldset.panel:not(.main):not(.auto) input::placeholder { background-color:var(--panel-input-bg-color); color:var(--panel-fg-color); }
fieldset.panel.auto { background-color:var(--panel-bg-color); color:var(--panel-fg-color); }
fieldset.panel.auto>div.output { background-color:var(--panel-bg-color); color:var(--panel-fg-color); }

View File

@ -259,7 +259,16 @@ Volcanos("page", {
if (typeof arguments[i] == code.OBJECT) { can.page.Modify(can, target, {style: arguments[i--]}) } else { value[arguments[i]] = arguments[i+1] }
} return can.page.Modify(can, target, {style: value}), value },
tagis: function(target) { if (!target || !target.tagName) { return }
var type = target.tagName.toLowerCase(); for (var i = 1; i < arguments.length; i++) { if (type == arguments[i]) { return true } }
function isin(ls, list) {
for (var i = 0; i < ls.length; i++) { var has = false
for (var j = 0; j < list; j++) { if (ls[i] == list[j]) { has = true } }
if (!has) { return false }
} return true
}
var type = target.tagName.toLowerCase(); for (var i = 1; i < arguments.length; i++) {
var ls = arguments[i].split("."); if (type != ls[0]) { continue }
if (isin(ls.slice(1), target.classList)) { return true }
}
},
tagClass: function(target) { return target.tagName.toLowerCase()+(target.className? nfs.PT+target.className.replaceAll(lex.SP, nfs.PT): "") },
isDisplay: function(target) { return target && target.style.display != html.NONE && target.className.indexOf(html.HIDE) == -1 },

View File

@ -159,7 +159,7 @@ Volcanos("user", {
return item
})}]); can.onkeymap.prevent(event), can.page.Select(can, ui._target, html.IMG, function(target) { target.onload = function() {
can.onlayout.figure(event, can, ui._target) } })
var carte = {_target: ui._target, _parent: parent, layout: can.onlayout._figure(event, can, ui._target, parent, 200), close: function() { can.page.Remove(can, ui._target) }}
var carte = {_target: ui._target, _parent: parent, layout: can.onlayout.figure(event, can, ui._target, parent, 200), close: function() { can.page.Remove(can, ui._target) }}
return parent && (parent._sub = carte), carte
},
carteRight: function(event, can, meta, list, cb, parent) { var carte = can.user.carte(event, can, meta, list, cb, parent)

View File

@ -1,6 +1,6 @@
Volcanos(chat.ONFIGURE, {img: {
_init: function(can, meta, target) { target.value == meta.value && (target.value = ""); var images = can.core.Split(target.value)
var count = parseInt(meta.value||"1"), width = target.parentNode.offsetWidth-22; for (var n = 1; n < 10; n++) { if (n*n >= count) { width = width/n; break } } width -= 2
var count = parseInt(meta.value||"1"), width = target.parentNode.offsetWidth; for (var n = 1; n < 10; n++) { if (n*n >= count) { width = (width/n-10); break } }
function add(target, hash) { target._hash = hash, can.page.Appends(can, target, [{img: can.base.MergeURL(can.misc.MergeURL(can, {_path: web.SHARE_CACHE+hash}, true), {pod: meta.space||undefined}), height: width, width: width}]) }
function set() { target.value = can.page.SelectChild(can, target.parentNode, html.DIV, function(target) { return target._hash }).join(mdb.FS) }
can.onmotion.hidden(can, target)

View File

@ -18,7 +18,7 @@ Volcanos(chat.ONFIGURE, {key: {
}}
}), can.onappend._status(can, [mdb.TOTAL, mdb.INDEX]), can.Status(mdb.TOTAL, msg.Length()), can.onmotion.toggle(can, can._status, msg.Length() > 5)
can.page.style(can, can._output, html.MAX_HEIGHT, can.page.height()/2, html.MIN_WIDTH, target.offsetWidth, html.MAX_WIDTH, can.Conf("style.width")||can.page.width()/2)
msg.append.length == 1 && can.page.ClassList.add(can, can._target, chat.SIMPLE), can.onlayout._figure({target: target}, can, can._target, false, 200)
msg.append.length == 1 && can.page.ClassList.add(can, can._target, chat.SIMPLE), can.onlayout.figure({target: target}, can, can._target, false, 200)
can.onmotion.toggle(can, can._target, can.Status("total") > 0)
},
onclick: function(event, can, meta, target, cbs) {

View File

@ -62,7 +62,7 @@ tr.line.insert { background-color:#283e2d; } tr.line.delete { background-color:#
body.light tr.line.insert { background-color:#ffeef0; } body.light tr.line.delete { background-color:#e6ffed; }
body.white tr.line.insert { background-color:#ffeef0; } body.white tr.line.delete { background-color:#e6ffed; }
fieldset.inner:not(.monaco)>div.output div.content>tr.line * { font-family:var(--code-font-family); font-size:var(--code-font-size); }
/* body:not(.windows) fieldset.inner>div.output>div.project * { font-family:var(--code-font-family); font-size:var(--code-font-size); } */
body:not(.windows) fieldset.inner>div.output>div.project * { font-family:var(--code-font-family); }
body:not(.windows) fieldset.inner>div.output>div.project * { font-family:var(--code-font-family); font-size:var(--code-font-size); }
/* body:not(.windows) fieldset.inner>div.output>div.project * { font-family:var(--code-font-family); } */
body:not(.windows) fieldset.inner>div.output>div.layout>div.tabs { font-family:var(--code-font-family); font-size:var(--code-font-size); }
body:not(.windows) fieldset.inner>div.output>div.layout>div.path { font-family:var(--code-font-family); font-size:var(--code-font-size); }

View File

@ -107,7 +107,7 @@ Volcanos(chat.ONACTION, {
return can.core.CallFunc([can.onimport, data.type], [sub, data, item, can.page.width()]), item
}), }])
}), can.onmotion.hidden(can, sub.ui.project), can.ondetail.show(sub, 0)
sub.onappend._status(sub, [mdb.PAGE, cli.FROM, cli.COST]), sub.Status(cli.FROM, can.base.Time())
sub.onappend._status(sub, [mdb.PAGE, cli.FROM, cli.COST]), sub.Status(cli.FROM, can.base.Time()), sub.Status(mdb.PAGE, list.length)
var from = new Date(); can.core.Timer({interval: 100}, function() { var now = new Date(); sub.Status(cli.COST, can.base.Duration(now-from)) })
}, can._root._target)
},
@ -134,24 +134,21 @@ Volcanos(chat.ONDETAIL, {
flash: function(sub) { sub.core.Next(sub.page.Select(sub, sub.ui.content, html.DIV_PAGE), function(page, next) {
sub.sup.ondetail.show(sub, page), sub.onmotion.delay(sub, next, 500)
}) },
grid: function(sub) { sub.page.styleClass(sub, sub.ui.content, "content grid") },
grid: function(sub) {
sub.page.styleClass(sub, sub.ui.content, "content grid")
},
"开讲": function(event, can) {
can.page.SelectChild(can, can.ui.content, "*", function(target) { can.page.styleWidth(can, target, "") })
can.page.SelectChild(can, can.ui.content, "", function(target) { can.page.style(can, target, html.HEIGHT, "", html.WIDTH, "") })
can.sup.ondetail.show(can, 0)
},
"网格": function(event, can) {
var count = can.page.Select(can, can.ui.content, html.DIV_PAGE).length
var n = (can.sup.ConfHeight()-20)/340
for (var i = 1; i < 5; i++) { if (i*n > count) { break } }
can.onlayout.expand(can, can.ui.content, parseInt((can.sup.ConfWidth()-20)/i)-20)
"网格": function(event, can) { function size(p) { return (p-2*html.PLUGIN_PADDING)/3-2*html.PLUGIN_PADDING }
can.onlayout.expand(can, can.ui.content, can.base.Min(size(can.ConfWidth()), 320, 640), can.base.Min(size(can.ConfHeight()-2*html.ACTION_HEIGHT), 240, 320), html.DIV_PAGE)
can.sup.ondetail.grid(can)
},
"快闪": function(event, can) {
can.page.SelectChild(can, can.ui.content, "*", function(target) { can.page.styleWidth(can, target, "") })
can.page.SelectChild(can, can.ui.content, "", function(target) { can.page.style(can, target, html.HEIGHT, "", html.WIDTH, "") })
can.sup.ondetail.flash(can)
},
"大纲": function(event, can) { can.onmotion.toggle(can, can.ui.project) },
"首页": function(event, can) { can.sup.ondetail.show(can, 0) },
"上一页": function(event, can) { can.sup.ondetail.prev(can, can.ui.content) },