mirror of
https://shylinux.com/x/volcanos
synced 2025-04-25 08:48:06 +08:00
add some
This commit is contained in:
parent
9e3ceb941e
commit
f73b5a9c51
3
frame.js
3
frame.js
@ -896,7 +896,8 @@ Volcanos(chat.ONKEYMAP, {_init: function(can, target) { target = target||documen
|
||||
can.page.Select(can, tr, html.TD, function(td) { has = has || td.innerText.indexOf(target.value)>-1 }), can.page.ClassList.set(can, tr, html.HIDDEN, !has)
|
||||
}), target._index = -1, target._value = target.value
|
||||
var total = can.page.Select(can, can._output, [html.TBODY, html.TR], function(tr) { if (!can.page.ClassList.has(can, tr, html.HIDDEN)) { return tr } }).length
|
||||
total == 0 && can.base.isFunc(cb) && cb(), can.Status(kit.Dict(mdb.TOTAL, total, mdb.INDEX, target._index))
|
||||
can.Status(kit.Dict(mdb.TOTAL, total, mdb.INDEX, target._index))
|
||||
total == 0 && can.base.isFunc(cb) && cb()
|
||||
},
|
||||
selectOutput: function(event, can) { if (!event.ctrlKey || event.key < "0" || event.key > "9") { return }
|
||||
event.key == "0"? can.onimport._back(can): can.page.Select(can, can._output, html.TR, function(tr, index) { if (index == event.key) {
|
||||
|
11
index.css
11
index.css
@ -152,7 +152,7 @@ body>div.input textarea { height:120px; width:240px !important; }
|
||||
body>div.input div.action { width:100%; position:sticky; bottom:0; }
|
||||
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 { text-align:center; clear:both; }
|
||||
body>div.input.login>div.output div.sso { display:flex; justify-content:center; 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; }
|
||||
@ -493,6 +493,15 @@ fieldset.qrcode>div.output div.code { padding:0; }
|
||||
fieldset.macos.desktop.cmd>div.output>fieldset.macos.dock { z-index:11; }
|
||||
fieldset.web.code.git.status>div.output table.content { width:100%; }
|
||||
fieldset.web.code.git>div.output>fieldset.web.code.inner>div.output { overflow:auto; }
|
||||
|
||||
fieldset.web.mall.region>div.output>table.content td:nth-child(3) { text-align:right; }
|
||||
fieldset.web.mall.region>div.output>table.content td:nth-child(4) { text-align:right; }
|
||||
fieldset.web.mall.region>div.output>table.content td:nth-child(5) { text-align:right; }
|
||||
|
||||
fieldset.web.mall.region>div.output>table.content td:nth-child(3) { text-align:right; }
|
||||
fieldset.web.mall.region>div.output>table.content td:nth-child(4) { text-align:right; }
|
||||
fieldset.web.mall.region>div.output>table.content td:nth-child(5) { text-align:right; }
|
||||
|
||||
fieldset.web.chat.iframe>form.option input[name=hash] { width:320px; }
|
||||
fieldset.can.view { font-size:14px; }
|
||||
fieldset.can.data { font-size:14px; }
|
||||
|
20
lib/base.js
20
lib/base.js
@ -54,17 +54,17 @@ Volcanos("base", {
|
||||
try { res = JSON.parse(str), res.text = res.text||str, res.type = res.type||nfs.JSON } catch (e) { res = {type: mdb.TEXT, text: str} } return res
|
||||
},
|
||||
ParseSize: function(size) { size = size.toLowerCase().split(" ")[0]
|
||||
if (size.endsWith("tb") || size.endsWith("t")) { return parseInt(size) * this._unit.t }
|
||||
if (size.endsWith("gb") || size.endsWith("g") || size.endsWith("gib")) { return parseInt(size) * this._unit.g }
|
||||
if (size.endsWith("mb") || size.endsWith("m") || size.endsWith("mib")) { return parseInt(size) * this._unit.m }
|
||||
if (size.endsWith("kb") || size.endsWith("k")) { return parseInt(size) * this._unit.k }
|
||||
return parseInt(size)
|
||||
if (size.endsWith("tb") || size.endsWith("t")) { return parseFloat(size) * this._unit.t }
|
||||
if (size.endsWith("gb") || size.endsWith("g") || size.endsWith("gib")) { return parseFloat(size) * this._unit.g }
|
||||
if (size.endsWith("mb") || size.endsWith("m") || size.endsWith("mib")) { return parseFloat(size) * this._unit.m }
|
||||
if (size.endsWith("kb") || size.endsWith("k")) { return parseFloat(size) * this._unit.k }
|
||||
return parseFloat(size)
|
||||
}, _unit: {k: 1024, m: 1024*1024, g: 1024*1024*1024, t: 1024*1024*1024*1024},
|
||||
Size: function(size) { size = parseInt(size); var n = 100, k = this._unit.k, m = this._unit.m, g = this._unit.g, t = this._unit.t
|
||||
if (size > t) { return parseInt(size/t) + nfs.PT + parseInt(size/g%k*n/k) + "T" }
|
||||
if (size > g) { return parseInt(size/g) + nfs.PT + parseInt(size/m%k*n/k) + "G" }
|
||||
if (size > m) { return parseInt(size/m) + nfs.PT + parseInt(size/k%k*n/k) + "M" }
|
||||
if (size > k) { return parseInt(size/k) + nfs.PT + parseInt(size%k*n/k) + "K" }
|
||||
Size: function(size) { size = parseFloat(size); var n = 100, k = this._unit.k, m = this._unit.m, g = this._unit.g, t = this._unit.t
|
||||
if (size > t) { return parseFloat(size/t) + nfs.PT + parseFloat(size/g%k*n/k) + "T" }
|
||||
if (size > g) { return parseFloat(size/g) + nfs.PT + parseFloat(size/m%k*n/k) + "G" }
|
||||
if (size > m) { return parseFloat(size/m) + nfs.PT + parseFloat(size/k%k*n/k) + "M" }
|
||||
if (size > k) { return parseFloat(size/k) + nfs.PT + parseFloat(size%k*n/k) + "K" }
|
||||
return size + "B"
|
||||
},
|
||||
Number: function(d, n) { var res = []
|
||||
|
13
lib/page.js
13
lib/page.js
@ -184,8 +184,11 @@ Volcanos("page", {
|
||||
} }); return table },
|
||||
RangeTable: function(can, table, index, asc) { index = can.base.isArray(index)? can.core.List(index, function(item) { if (item > -1) { return item } }): [index]; if (index.length == 0) { return }
|
||||
var list = can.page.Select(can, table, html.TR, function(tr) { if (can.page.isDisplay(tr)) { return tr } }).slice(1)
|
||||
var is_time = true, is_number = true; can.core.List(list, function(tr) { var text = tr.childNodes[index[0]].innerHTML; is_time = is_time && Date.parse(text) > 0, is_number = is_number && !isNaN(parseFloat(text)) })
|
||||
var num_list = can.core.List(list, function(tr) { var text = tr.childNodes[index[0]].innerHTML; return is_time? Date.parse(text): is_number? can.base.ParseSize(text): text })
|
||||
var is_time = true, is_number = true; can.core.List(list, function(tr) {
|
||||
var text = tr.childNodes[index[0]].innerHTML;
|
||||
is_time = is_time && Date.parse(text) > 0, is_number = is_number && !isNaN(parseFloat(text||"0"))
|
||||
})
|
||||
var num_list = can.core.List(list, function(tr) { var text = tr.childNodes[index[0]].innerHTML; return is_time? Date.parse(text): is_number? can.base.ParseSize(text)||0: text })
|
||||
function isless(a, b, index) { if (a.childNodes[index[0]] && b.childNodes[index[0]]) {
|
||||
if (a.childNodes[index[0]].innerHTML < b.childNodes[index[0]].innerHTML) { return true }
|
||||
if (a.childNodes[index[0]].innerHTML > b.childNodes[index[0]].innerHTML) { return false }
|
||||
@ -213,10 +216,8 @@ Volcanos("page", {
|
||||
return list.concat(">", arg[1], "</", type, ">").join("")
|
||||
} },
|
||||
Color: function(text) { if (typeof text != code.STRING) { return "" } text = text.replace(/\\n/g, "<br>")
|
||||
if (text.indexOf(ice.HTTP) == 0 && text.length > 10) { var ls = text.split(lex.SP); text = "<a href='"+ls[0]+"' target='_blank'>"+ls[0]+"</a>"+ls.slice(1).join(lex.SP) }
|
||||
if (text.indexOf("export ctx_dev=") == 0 && text.length > 10) {
|
||||
return "<div class='story' data-type='spark' data-name='shell'><div>"+"<span>"+text+"</span>"+"</div></div>"
|
||||
}
|
||||
if (text.indexOf(ice.HTTP) == 0 && text.length > 10) { var ls = text.split(lex.SP); text = "<a href='"+ls[0]+"' target='_blank'>"+decodeURI(ls[0])+"</a>"+ls.slice(1).join(lex.SP) }
|
||||
if (text.indexOf("export ctx_dev=") == 0 && text.length > 10) { return "<div class='story' data-type='spark' data-name='shell'><div>"+"<span>"+text+"</span>"+"</div></div>" }
|
||||
if (text.indexOf("\033\[") == -1) { return text }
|
||||
text = text.replace(/\033\[31m/g, "<span style='color:#f00'>")
|
||||
text = text.replace(/\033\[32m/g, "<span style='color:#0f0'>")
|
||||
|
@ -55,8 +55,10 @@ Volcanos(chat.ONACTION, {_init: function(can, target) {
|
||||
})
|
||||
},
|
||||
onstorm_select: function(can, msg, river, storm) {
|
||||
if (can.onmotion.cache(can, function(save, load) { save({plugins: can._plugins})
|
||||
return load(can.core.Keys(can.Conf(chat.RIVER, river), can.Conf(chat.STORM, storm)), function(bak) { can._plugins = bak.plugins })
|
||||
if (can.onmotion.cache(can, function(save, load) { save({plugins: can._plugins}), can._plugins = []
|
||||
return load(can.core.Keys(can.Conf(chat.RIVER, river), can.Conf(chat.STORM, storm)), function(bak) {
|
||||
can._plugins = bak.plugins
|
||||
})
|
||||
}, can._output, can._action, can._header_tabs)) { if (msg.Option("refresh") != "true") { return can.onaction.layout(can) } }
|
||||
can.run(can.request({}, {_method: http.GET}), [river, storm], function(msg) {
|
||||
if (msg.Length() == 0) { return can.user.isLocalFile? can.user.toastFailure(can, "miss data"): can.onengine.signal(can, chat.ONACTION_NOTOOL, can.request({}, {river: river, storm: storm})) }
|
||||
|
@ -1,5 +1,8 @@
|
||||
Volcanos(chat.ONFIGURE, {key: {
|
||||
_load: function(event, can, cb, target, name, value) { can.runAction(event, mdb.INPUTS, [name, value||""], function(msg) {
|
||||
_load: function(event, can, cb, target, name, value) {
|
||||
if (target.value) { return can.onmotion.hidden(can, can._target, can.Status("total") > 0)}
|
||||
can.onmotion.toggle(can, can._target, can.Status("total") > 0)
|
||||
can.runAction(event, mdb.INPUTS, [name, value||""], function(msg) {
|
||||
name == ctx.INDEX && can.core.Item(can.onengine.plugin.meta, function(key) { msg.Push(ctx.INDEX, can.core.Keys(ice.CAN, key)) })
|
||||
can._show(can, msg, cb, target, name)
|
||||
}) },
|
||||
@ -23,7 +26,8 @@ Volcanos(chat.ONFIGURE, {key: {
|
||||
onblur: function(event, can, sub, cb) { sub && can.onmotion.delay(can, sub.close, 300) },
|
||||
onkeydown: function(event, can, meta, cb, target, sub, last) { if (event.key == code.TAB) { return }
|
||||
if (event.key == code.ENTER) { return meta._enter && (!can.page.tagis(event.target, html.TEXTAREA) || event.ctrlKey) && meta._enter(event, target.value)? sub.close(): last(event) }
|
||||
if (!sub) { return } sub.hidden() || can.onkeymap.selectCtrlN(event, can, sub._output, "tr:not(.hidden)>td:first-child", function(td) { return meta.select && (sub.close(), meta.select(target.value = td.innerText)), cb(sub, td.innerText, target.value), td })
|
||||
if (!sub) { return } can.onmotion.toggle(can, sub._target, true)
|
||||
sub.hidden() || can.onkeymap.selectCtrlN(event, can, sub._output, "tr:not(.hidden)>td:first-child", function(td) { return meta.select && (sub.close(), meta.select(target.value = td.innerText)), cb(sub, td.innerText, target.value), td })
|
||||
|| can.onmotion.delayOnce(can, function() { can.onkeymap.selectInputs(event, sub, function() { sub._load(event, sub, cb, target, meta.name) }, target) }, target.value.length < 3? 500: 150)
|
||||
},
|
||||
}})
|
||||
|
Loading…
x
Reference in New Issue
Block a user