From 4086075a752bd25dcde94a45e7ba5bdb0009bc6f Mon Sep 17 00:00:00 2001 From: shy Date: Sat, 20 Apr 2024 19:26:22 +0800 Subject: [PATCH] add some --- const.js | 19 ++++++++++--------- frame.js | 2 +- index.css | 16 ++++++++++++++-- lib/misc.js | 3 ++- lib/page.js | 2 +- proto.js | 10 ++++++---- 6 files changed, 34 insertions(+), 18 deletions(-) diff --git a/const.js b/const.js index e77850af..c0b69357 100644 --- a/const.js +++ b/const.js @@ -205,6 +205,12 @@ var nfs = { USR_ICONS_ICEBERGS: "usr/icons/icebergs.jpg", USR_ICONS_VOLCANOS: "usr/icons/volcanos.jpg", + V: "/v/", + M: "/m/", + P: "/p/", + X: "/x/", + S: "/s/", + C: "/c/", REQUIRE: "/require/", REQUIRE_MODULES: "/require/modules/", SHARE_CACHE: "/share/cache/", SHARE_LOCAL: "/share/local/", WIKI_PORTAL: "/wiki/portal/", @@ -282,15 +288,10 @@ var chat = { "local/wiki/feel.js", "local/wiki/word.js", "local/team/plan.js", - ].map(function(p) { return "/plugin/"+p }).concat([ - "usr/icebergs/core/wiki/portal.css", - "usr/icebergs/core/wiki/portal.js", - ].map(function(p) { - return "/require/"+p - })), + ].map(function(p) { return "/v/plugin/"+p }), PLUGIN_LOCAL: "/plugin/local/", PLUGIN_STORY: "/plugin/story/", PLUGIN_INPUT: "/plugin/input/", PLUGIN_INPUT_JS: "/plugin/input.js", PLUGIN_TABLE_JS: "/plugin/table.js", PLUGIN_STATE_JS: "/plugin/state.js", - FRAME_JS: "/volcanos/frame.js", + FRAME_JS: "/v/frame.js", ONENGINE: "onengine", ONDAEMON: "ondaemon", ONAPPEND: "onappend", ONLAYOUT: "onlayout", ONMOTION: "onmotion", ONKEYMAP: "onkeymap", ONIMPORT: "onimport", ONACTION: "onaction", ONDETAIL: "ondetail", ONEXPORT: "onexport", @@ -412,8 +413,8 @@ var icon = { dream: "bi bi-box", space: "bi bi-box", store: "bi bi-shop", word: "bi bi-book", repos: "bi bi-git", vimer: "bi bi-bug", build: "bi bi-tools", xterm: "bi bi-terminal", stats: "bi bi-card-list", - matrix: "bi bi-grid-3x3-gap", - feel: "bi bi-images", + matrix: "bi bi-grid-3x3-gap", + feel: "bi bi-images", plan: "bi bi-calendar4-week", status: "bi bi-git", diff --git a/frame.js b/frame.js index 35b74728..822ca4d4 100644 --- a/frame.js +++ b/frame.js @@ -349,7 +349,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { can.core.List((can.base.Obj(list, can.core.Value(can, [chat.ONEXPORT, mdb.LIST]))||[]).concat([ can.ConfSpace() && {name: web.SPACE, value: can.ConfSpace()}, ], can.misc.Search(can, log.DEBUG)==ice.TRUE? [ - fileline && {name: nfs.SOURCE, value: can.base.trimPrefix(fileline.split("?")[0], nfs.REQUIRE), onclick: function(event) { can.onkeymap.prevent(event) + fileline && {name: nfs.SOURCE, value: can.base.trimPrefix(fileline.split("?")[0], nfs.REQUIRE, nfs.P), onclick: function(event) { can.onkeymap.prevent(event) var ls = can.misc.SplitPath(can, fileline); if (event.metaKey) { can.user.open(can.misc.MergePodCmd(can, {pod: can.ConfSpace(), cmd: web.CODE_VIMER, path: ls[0], file: ls[1]})) } else { can.onappend._float(can, web.CODE_VIMER, ls) } diff --git a/index.css b/index.css index 2109a730..9e80cb1a 100644 --- a/index.css +++ b/index.css @@ -1,4 +1,10 @@ /* variable */ +@media (prefers-color-scheme: light) { +body { --plugin-bg-color:white; --plugin-fg-color:black; } +} +@media (prefers-color-scheme: dark) { +body { --plugin-bg-color:black; --plugin-fg-color:silver; } +} body.light { --plugin-bg-color:white; --plugin-fg-color:black; --code-keyword:darkblue; --code-comment:green; @@ -169,7 +175,12 @@ body.en span[lang^=zh] { display:none; } body.zh span[lang^=en] { display:none; div.project div.action { width:100%; } div.project div.list { margin-left:var(--button-margin); clear:both; } div.project div.list fieldset { position:static; } -div.project div.item:not(.hide) { font-family:var(--code-font-family); white-space:pre; line-height:24px; padding:0 var(--button-margin); display:flex; align-items:center; } +div.project div.item:not(.hide) { + // white-space:pre; + line-height:24px; + padding:0 var(--button-margin); display:flex; align-items:center; + cursor:pointer; +} div.project div.item img { height:var(--action-height); width:var(--action-height); } div.project div.item img { margin:0; } div.project div.item input:not([type=button]) { border-right:0; } @@ -527,7 +538,8 @@ body { font-family:var(--body-font-family); } legend { font-family:var(--legend-font-family); font-style:italic; } input { font-family:var(--input-font-family); } kbd { font-family:var(--code-font-family); line-height:var(--code-line-height); } -kbd:hover { background-color:var(--hover-bg-color); } +// kbd:hover { background-color:var(--hover-bg-color); } +kbd:hover { background-color:var(--notice-bg-color); color:var(--notice-fg-color); } table.content { font-family:var(--table-font-family); } table.content th { font-family:var(--input-font-family); font-style:italic; } body div.code { font-family:var(--table-font-family); } diff --git a/lib/misc.js b/lib/misc.js index 822787bc..09f9d64e 100644 --- a/lib/misc.js +++ b/lib/misc.js @@ -204,7 +204,7 @@ Volcanos("misc", { }, ResourceFavicon(can, path) { return can.misc.Resource(can, path||can.user.info.favicon||nfs.SRC_MAIN_ICO) }, Resource(can, path, space, serve) { - if (!can.base.beginWith(path, web.HTTP, nfs.PS)) { path = nfs.REQUIRE+path+_version } + if (!can.base.beginWith(path, web.HTTP, nfs.PS)) { path = nfs.P+path+_version } if (!can.base.beginWith(path, web.HTTP)) { if (serve && serve.indexOf(location.origin) == -1) { var u = can.base.ParseURL(serve); path = u.origin + path } } if (path.indexOf("pod=") > 0) { return path } return can.base.MergeURL(path, ice.POD, space||can.ConfSpace()||can.misc.Search(can, ice.POD)) @@ -245,6 +245,7 @@ Volcanos("misc", { SplitPath: function(can, path) { if (path.indexOf("http") == 0) { return [path] } if (path.indexOf("/require/") == 0) { return [path] } + if (path.indexOf("/p/") == 0) { return [path] } if (path.indexOf("/plugin/") == 0) { return ["usr/volcanos/", path.split("?")[0]] } var ls = path.split(nfs.PS); if (ls.length == 1) { return [nfs.PWD, ls[0]] } if (ls[0] == ice.USR) { return [ls.slice(0, 2).join(nfs.PS)+nfs.PS, ls.slice(2).join(nfs.PS)] } diff --git a/lib/page.js b/lib/page.js index 18b2562f..c724ff42 100644 --- a/lib/page.js +++ b/lib/page.js @@ -394,7 +394,7 @@ Volcanos("page", { requireModules: function(can, libs, cb, cbs) { if (!libs || libs.length == 0) { return cb && cb() } for (var i = 0; i < libs.length; i++) { if (libs[i].indexOf(nfs.PS) == 0 || libs[i].indexOf(ice.HTTP) == 0) { continue } if (libs[i].indexOf(nfs._CSS) == -1 && libs[i].indexOf(nfs._JS) == -1) { libs[i] = libs[i]+"/lib/"+libs[i]+nfs._JS } - libs[i] = nfs.REQUIRE_MODULES+libs[i] + libs[i] = nfs.M+libs[i] } can.require(libs, cb, cbs) }, requireDraw: function(can, cb) { can.require([chat.PLUGIN_LOCAL+"wiki/draw.js", chat.PLUGIN_LOCAL+"wiki/draw/path.js"], function() { diff --git a/proto.js b/proto.js index 3dc1e56f..8d232067 100644 --- a/proto.js +++ b/proto.js @@ -28,15 +28,17 @@ var Volcanos = shy({iceberg: "", volcano: "", frame: chat.FRAME_JS, _cache: {}, } if (libs[0] == undefined) { return can.require(libs.slice(1), cb, cbs) } if (libs[0] == "") { libs[0] = can._path.replace(nfs._JS, nfs._CSS) } - if (libs[0].indexOf(nfs.SRC) == 0 || libs[0].indexOf(nfs.USR) == 0) { libs[0] = "/require/"+libs[0] } + if (libs[0].indexOf(nfs.SRC) == 0 || libs[0].indexOf(nfs.USR) == 0) { libs[0] = nfs.P+libs[0] } if (libs[0][0] != nfs.PS && libs[0].indexOf(web.HTTP) != 0) { libs[0] = can._path.slice(0, can._path.lastIndexOf(ice.PS)+1)+libs[0] } var name = (libs[0].indexOf(web.HTTP) == 0 || libs[0].indexOf("?pod=") > -1? libs[0]: libs[0].split(ice.QS)[0]).toLowerCase() function next() { can._load(name, cbs), can.require(libs.slice(1), cb, cbs) } - if (name.indexOf("/lib/") == 0) { name = "/volcanos"+name } - if (name.indexOf("/panel/") == 0) { name = "/volcanos"+name } - if (name.indexOf("/plugin/") == 0) { name = "/volcanos"+name } + if (name.indexOf("/lib/") == 0) { name = "/v"+name } + if (name.indexOf("/panel/") == 0) { name = "/v"+name } + if (name.indexOf("/plugin/") == 0) { name = "/v"+name } if (name.indexOf("/volcanos/") == 0 && meta.volcano) { name = meta.volcano+name } if (name.indexOf("/require/") == 0 && meta.iceberg) { name = meta.iceberg+name } + if (name.indexOf("/p/") == 0 && meta.iceberg) { name = meta.iceberg+name } + if (name.indexOf("/v/") == 0 && meta.iceberg) { name = meta.iceberg+name } meta.cache[name]? next(): meta._load(name, next) }, request: function(event) { event = event||{}, event = event._event||event