From 5632a7816f0979546ad75d4bcdb4ea75f8c89293 Mon Sep 17 00:00:00 2001 From: shy Date: Sun, 25 Feb 2024 20:35:07 +0800 Subject: [PATCH] add some --- const.js | 11 +++++++---- lib/misc.js | 7 ++++--- plugin/state.js | 10 +++------- plugin/table.js | 2 +- proto.js | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/const.js b/const.js index 081e9f08..fc9e7da8 100644 --- a/const.js +++ b/const.js @@ -32,10 +32,13 @@ var ice = { MSG_ACTION: "_action", MSG_STATUS: "_status", MSG_PROCESS: "_process", MSG_DISPLAY: "_display", MSG_TOOLKIT: "_toolkit", - MSG_USERNICK: "user.nick", MSG_USERNAME: "user.name", MSG_USERROLE: "user.role", MSG_LANGUAGE: "user.lang", - MSG_BG: "sess.bg", MSG_FG: "sess.fg", - MSG_COST: "sess.cost", MSG_MODE: "sess.mode", MSG_THEME: "sess.theme", MSG_TITLE: "sess.title", MSG_RIVER: "sess.river", MSG_STORM: "sess.storm", - MSG_DAEMON: "sess.daemon", LOG_DISABLE: "log.disable", LOG_TRACEID: "log.id", + MSG_USERWEB: "user.web", MSG_USERPOD: "user.pod", + MSG_USERROLE: "user.role", MSG_USERNAME: "user.name", MSG_USERNICK: "user.nick", MSG_LANGUAGE: "user.lang", + MSG_TITLE: "sess.title", MSG_THEME: "sess.theme", MSG_BG: "sess.bg", MSG_FG: "sess.fg", MSG_DAEMON: "sess.daemon", + LOG_DISABLE: "log.disable", LOG_TRACEID: "log.id", + MSG_RIVER: "sess.river", MSG_STORM: "sess.storm", + + MSG_COST: "sess.cost", MSG_MODE: "sess.mode", MSG_NODETYPE: "node.type", TABLE_CHECKBOX: "table.checkbox", FROM_DAEMON: "from.daemon", diff --git a/lib/misc.js b/lib/misc.js index d8aa0335..43464b55 100644 --- a/lib/misc.js +++ b/lib/misc.js @@ -183,9 +183,10 @@ Volcanos("misc", { return socket }, ResourceFavicon(can) { return can.misc.Resource(can, nfs.SRC_MAIN_ICO) }, - Resource(can, path, space) { - if (can.base.beginWith(path, web.HTTP, nfs.PS)) { return path } - return can.base.MergeURL(nfs.REQUIRE+path+_version, ice.POD, space||can.ConfSpace()||can.misc.Search(can, ice.POD)) + Resource(can, path, space, serve) { if (can.base.beginWith(path, web.HTTP, nfs.PS)) { return path } + var p = can.base.MergeURL(nfs.REQUIRE+path+_version, ice.POD, space||can.ConfSpace()||can.misc.Search(can, ice.POD)) + if (serve && serve.indexOf(location.origin) == -1) { var u = can.base.ParseURL(serve); p = u.origin + p } + return p }, ShareLocal(can, path, space) { if (can.base.beginWith(path, web.HTTP, nfs.PS)) { return path } return can.base.MergeURL(nfs.SHARE_LOCAL+path+_version, ice.POD, space||can.ConfSpace()) diff --git a/plugin/state.js b/plugin/state.js index a9644147..f1bce62c 100644 --- a/plugin/state.js +++ b/plugin/state.js @@ -14,7 +14,7 @@ Volcanos(chat.ONIMPORT, { _cookie: function(can, msg) { can.misc.Cookie(can, msg._arg[0], msg._arg[1]), can.Update() }, _session: function(can, msg) { can.misc.sessionStorage(can, msg._arg[0], msg._arg[1]), can.Update() }, _field: function(can, msg, cb) { var height = can.base.Max(html.STORY_HEIGHT, can.ConfHeight()-2*html.ACTION_HEIGHT), width = can.ConfWidth() - msg.Table(function(item) { can.onappend._plugin(can, item, {space: can.ConfSpace(), index: item.index, args: can.base.Obj(item.args||item.arg, []), height: height, width: width}, function(sub) { + msg.Table(function(item) { can.onappend._plugin(can, item, {index: item.index, args: can.base.Obj(item.args||item.arg, []), height: height, width: width}, function(sub) { sub.run = function(event, cmds, cb) { var index = msg.Option(ice.MSG_INDEX); can.run(can.request(event, {pod: item.space}), (msg[ice.MSG_PREFIX]? msg[ice.MSG_PREFIX]: index? [ctx.RUN, index]: []).concat(cmds), cb, true) } if (item.style != html.FLOAT && can.base.isIn(sub.ConfIndex(), wiki.PORTAL, chat.IFRAME, chat.DESKTOP, wiki.WORD, code.VIMER,)) { height = can.base.Max(can.onexport.outputHeight(can), can.ConfHeight(), 480) } can.page.ClassList.has(can, sub._target, html.FLOAT)? can.onmotion.float(sub): sub.onimport.size(sub, height, width, true), cb && cb(sub) @@ -298,12 +298,8 @@ Volcanos(chat.ONEXPORT, {_output: function(can, msg) {}, statusHeight: function(can) { return can.page.ClassList.has(can, can._target, html.OUTPUT) || !can.page.isDisplay(can._status) || (can._target.offsetHeight > 0 && can._status.offsetHeight == 0) || can._status.innerHTML == "" && !can.page.ClassList.has(can, can._target, html.PLUG)? 0: html.STATUS_HEIGHT }, - link: function(can) { - var args = can.Option(); - args.pod = can.ConfSpace(), args.cmd = can.ConfIndex(); - can.core.Item(args, function(key, value) { - if (!value) { delete(args[key]) } - }) + link: function(can) { var args = can.Option(); args.pod = can.ConfSpace(), args.cmd = can.ConfIndex() + can.core.Item(args, function(key, value) { !value && delete(args[key]) }) return can.misc.MergePodCmd(can, args, true) }, args: function(can) { return can.Option() }, close: function(can, msg) {}, diff --git a/plugin/table.js b/plugin/table.js index 4652d7ce..1ea479f3 100644 --- a/plugin/table.js +++ b/plugin/table.js @@ -90,7 +90,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { }}]) }, icon: function(can, msg, target, cb) { msg.Table(function(value) { - var icon = can.misc.Resource(can, value.icon||can.page.drawText(can, value.name, 80), value.space||can.ConfSpace()) + var icon = can.misc.Resource(can, value.icons||value.icon||can.page.drawText(can, value.name, 80), value.space||msg.Option(ice.MSG_USERPOD), msg.Option(ice.MSG_USERWEB)) return can.page.Append(can, target, [{view: [[html.ITEM, value.status]], list: [{view: html.ICON, list: [{img: icon}]}, {view: [mdb.NAME, "", value.name]}], _init: function(target) { cb && cb(target, value) }, onclick: function(event) { can.sup.onexport.record(can.sup, value.name, mdb.NAME, value) }}])._target diff --git a/proto.js b/proto.js index 82e8cbee..5b93a521 100644 --- a/proto.js +++ b/proto.js @@ -106,7 +106,7 @@ var Volcanos = shy({iceberg: "", volcano: "", frame: chat.FRAME_JS, _cache: {}, isAutoMode: function() { return can.Mode() == "" }, Mode: function(value) { return can.Conf(ice.MODE, value) }, ConfDefault: function(value) { can.core.Item(value, function(k, v) { can.Conf(k) || can.Conf(k, v) }) }, - ConfSpace: function() { return can.Conf(web.SPACE)||can.Conf("_space")||"" }, + ConfSpace: function() { return can.Conf("_space")||can.Conf(web.SPACE)||"" }, ConfIndex: function() { return can.Conf("_command")||can.Conf(ctx.INDEX)||can.Conf("_index") }, ConfHeight: function(value) { return can.Conf(html.HEIGHT, value) }, ConfWidth: function(value) { return can.Conf(html.WIDTH, value) },