From 85d4f281613b7f13333f65bcadaff13db25b8b43 Mon Sep 17 00:00:00 2001 From: shy Date: Mon, 14 Aug 2023 11:04:57 +0800 Subject: [PATCH] opt some --- lib/base.js | 6 +++--- lib/page.js | 2 +- plugin/local/code/vimer.css | 2 +- plugin/story/json.css | 1 + proto.js | 3 ++- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/base.js b/lib/base.js index 4835c19e..d88d90ab 100644 --- a/lib/base.js +++ b/lib/base.js @@ -44,10 +44,10 @@ Volcanos("base", { if (str.indexOf(ice.HTTP) == 0) { var res = this._parse(str, {type: mdb.LINK, name: "", text: str}); return res.name = res._origin.split("://").pop().split(nfs.PS)[0], res } 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() + 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")) { return parseInt(size) * this._unit.g } - if (size.endsWith("mb") || size.endsWith("m")) { return parseInt(size) * this._unit.m } + 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) }, _unit: {k: 1024, m: 1024*1024, g: 1024*1024*1024, t: 1024*1024*1024*1024}, diff --git a/lib/page.js b/lib/page.js index 5c052733..157363e9 100644 --- a/lib/page.js +++ b/lib/page.js @@ -185,7 +185,7 @@ 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(parseInt(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)) }) 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 }) 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 } diff --git a/plugin/local/code/vimer.css b/plugin/local/code/vimer.css index dfa49d99..5eebc164 100644 --- a/plugin/local/code/vimer.css +++ b/plugin/local/code/vimer.css @@ -1,7 +1,7 @@ fieldset.vimer>div.output>div.project>div.zone.space div.item.stop { color:gray; } fieldset.inner>div.output>div.layout>div.layout>div.content div.tips { display:none; } fieldset.vimer>div.output>div.layout>div.layout div.content div.tips { color:gray; font-style:italic; position:absolute; top:0; right:0; } -fieldset.vimer>div.output>div.layout>div.layout div.content input.current { background-color:transparent !important; color:transparent; padding-left:10px; height:20px; position:absolute; } +fieldset.vimer>div.output>div.layout>div.layout div.content input.current { background-color:transparent; color:transparent; padding-left:10px; height:20px; position:absolute; } fieldset.vimer>div.output>div.layout>div.layout div.content div.complete { background-color:unset; padding-top:0; display:none; position:absolute; height:1px; overflow:visible; } fieldset.vimer>div.output>div.layout>div.layout div.content div.complete div.prefix { color:transparent; white-space:pre; float:left; } fieldset.vimer>div.output>div.layout>div.layout div.content div.complete table.content thead { display:none; } diff --git a/plugin/story/json.css b/plugin/story/json.css index c698c7d7..4f432326 100644 --- a/plugin/story/json.css +++ b/plugin/story/json.css @@ -4,3 +4,4 @@ div.json div.item div.item:hover { border:var(--box-border); } div.json div.item label.nonce { color:#9cbeca4f; } div.json div.item span.string { color:orange; } div.json label { user-select:none; } +body:not(.windows) div.json { font-family:monospace; } diff --git a/proto.js b/proto.js index 0b350b71..f7bfa927 100644 --- a/proto.js +++ b/proto.js @@ -99,6 +99,7 @@ var web = {CHAT: "chat", WIKI_PORTAL: "web.wiki.portal", CHAT_MACOS_DESKTOP: "web.chat.macos.desktop", CHAT_MACOS_SESSION: "web.chat.macos.session", + CHAT_IFRAME: "web.chat.iframe", CHAT_FAVOR: "web.chat.favor", CHAT_FLOWS: "web.chat.flows", TEAM_PLAN: "web.team.plan", @@ -327,7 +328,7 @@ var Volcanos = shy({iceberg: "/chat/", volcano: "/frame.js", cache: {}, pack: {} can.base.isFunc(item.Option)? can.core.List(item.Option(), function(key) { key.indexOf("_") == 0 || key.indexOf("user.") == 0 || set(key, item.Option(key)) }): can.core.Item(can.base.isFunc(item)? item(): item, set) - }); set(ice.MSG_HEIGHT, can.ConfHeight()||"32"), set(ice.MSG_WIDTH, can.ConfWidth()||"320"), set(ice.MSG_MODE, can.Mode()) + }); set(ice.MSG_HEIGHT, (can.ConfHeight()||"32")+""), set(ice.MSG_WIDTH, (can.ConfWidth()||"320")+""), set(ice.MSG_MODE, can.Mode()) return msg }, requestAction: function(event, button) { return can.request(event, {action: button, _toast: ice.PROCESS+" "+button}) },