From 30744696d67dc94da0f486615a3c16f149e901b4 Mon Sep 17 00:00:00 2001 From: shy Date: Thu, 7 Dec 2023 22:48:04 +0800 Subject: [PATCH] add usr/program/ --- frame.js | 4 +++- index.css | 4 +++- panel/footer.css | 2 +- plugin/state.js | 2 +- publish/client/mp/app.js | 6 ++---- publish/client/mp/conf.js | 6 ++++++ publish/client/mp/pages/river/river.js | 5 +---- publish/client/mp/utils/proto.js | 3 ++- 8 files changed, 19 insertions(+), 13 deletions(-) create mode 100644 publish/client/mp/conf.js diff --git a/frame.js b/frame.js index 248abfc6..a468474b 100644 --- a/frame.js +++ b/frame.js @@ -546,6 +546,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { 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) + can.page.Append(can, sub._target, [{text: [can.page.unicode.remove, "", "close"], onclick: function() { sub.close() }}]) sub.run = function(event, cmds, cb) { var msg = sub.request(event) if (meta.range) { for (var i = meta.range[0]; i < meta.range[1]; i += meta.range[2]||1) { msg.Push(mdb.VALUE, i) } cb(msg); return } (meta.run||can.run)(sub.request(event, can.Option()), cmds, cb, true) @@ -722,7 +723,8 @@ Volcanos(chat.ONMOTION, {_init: function(can, target) { index > 0 && can.page.ClassList.set(can, tr, html.HIDDEN, can.page.Select(can, tr, html.TD, function(td) { if (td.innerText.toLowerCase().indexOf(value.toLowerCase()) > -1) { return td } }) == 0) }) }, delayResize: function(can, target, key) { can.onmotion.delay(can, function() { can.page.Select(can, target, key, function(_target) { - can.page.style(can, target, html.WIDTH, _target.offsetWidth+10, html.LEFT, (window.innerWidth-_target.offsetWidth)/2, html.TOP, (window.innerHeight-_target.offsetHeight)/2) + var width = _target.offsetWidth+2*html.PLUGIN_PADDING + can.page.style(can, target, html.WIDTH, width, html.LEFT, (window.innerWidth-width)/2, html.TOP, (window.innerHeight-_target.offsetHeight)/2) }) }) }, delayLong: function(can, cb, interval, key) { can.onmotion.delay(can, cb, interval||300, key) }, delayOnce: function(can, cb, interval, list) { diff --git a/index.css b/index.css index a656d4fd..08347b68 100644 --- a/index.css +++ b/index.css @@ -128,7 +128,7 @@ fieldset.input.date>div.status>div.today { padding:var(--input-padding); } fieldset.input.icon img { height:var(--desktop-icon-size); width:var(--desktop-icon-size); } /* float */ body div.float { padding:var(--plugin-padding); box-shadow:var(--box-shadow); } -body>div.toast div.title { color:var(--notice-bg-color); float:left; } +body>div.toast div.title { word-break:break-all; color:var(--notice-bg-color); float:left; } body>div.toast div.delete { color:var(--notice-bg-color); float:right; cursor:pointer; } body>div.toast div.delete:hover { background-color:var(--hover-bg-color); } body>div.toast div.duration { color:var(--disable-fg-color); float:right; } @@ -450,6 +450,8 @@ fieldset:not(.panel):not(.full):not(.cmd) { border-radius:var(--plugin-radius); fieldset.input div.output { background-color:var(--plugin-bg-color); } fieldset.input tr:hover { background-color:var(--tr-hover-bg-color); } fieldset.input td:hover { background-color:var(--td-hover-bg-color); } +fieldset.input>span.close { padding:var(--input-padding); position:absolute; top:var(--input-padding); right:var(--input-padding); } +fieldset.input>span.close:hover { background-color:var(--hover-bg-color); color:var(--hover-fg-color); cursor:pointer; } div.float { background-color:var(--float-bg-color); color:var(--float-fg-color); } div.carte div.item { background-color:var(--carte-bg-color); } div.carte div.item:hover { background-color:var(--hover-bg-color); } diff --git a/panel/footer.css b/panel/footer.css index fb0de0d0..723ca823 100644 --- a/panel/footer.css +++ b/panel/footer.css @@ -1,7 +1,7 @@ fieldset.Footer { width:100%; } fieldset.Footer>div.output { font-style:italic; height:var(--footer-height); overflow:hidden; } fieldset.Footer>div.output div.item { padding:7px; height:var(--footer-height); float:left; } -fieldset.Footer>div.output div.title:first-child { font-weight:bold; text-align:center; width:var(--river-width); overflow:auto; } +fieldset.Footer>div.output div.title:first-child { font-weight:bold; text-align:center; width:var(--river-width); } fieldset.Footer>div.output div.state { font-family:var(--status-font-family); float:right; line-height:18px; } fieldset.Footer>div.output div.state label { font-size:var(--status-font-size); } fieldset.Footer>div.output div.toast { font-family:var(--status-font-family); float:right; line-height:18px; } diff --git a/plugin/state.js b/plugin/state.js index 1a42cce3..4b74a07c 100644 --- a/plugin/state.js +++ b/plugin/state.js @@ -112,7 +112,7 @@ Volcanos(chat.ONACTION, {list: [ can.ConfHeight(can.page.height()-can.onexport.marginTop()-can.onexport.marginBottom(can)), can.ConfWidth(can.page.width()) }) }, "远程控制": function(event, can) { can.onaction.keyboard(event, can) }, - "共享工具": function(event, can) { var meta = can.Conf(); can.onmotion.share(event, can, [], [mdb.NAME, meta.index, mdb.TEXT, JSON.stringify(can.Input())]) }, + "共享工具": function(event, can) { var meta = can.Conf(); can.onmotion.share(can.request(event, {pod: can.ConfSpace()}), can, [], [mdb.NAME, meta.index, mdb.TEXT, JSON.stringify(can.Input())]) }, "打开链接": function(event, can) { can.user.open(can.onexport.link(can)) }, "生成链接": function(event, can) { can.onmotion.share(event, can, [], [web.LINK, can.user.copy(event, can, can.onexport.link(can))]) }, "生成脚本": function(event, can) { var args = can.Input().join(lex.SP), list = [ diff --git a/publish/client/mp/app.js b/publish/client/mp/app.js index 71606124..f93a37c4 100644 --- a/publish/client/mp/app.js +++ b/publish/client/mp/app.js @@ -3,12 +3,10 @@ const core = require("utils/lib/core.js") const misc = require("utils/lib/misc.js") const page = require("utils/lib/page.js") const user = require("utils/lib/user.js") +const conf = require("conf.js") App({ - data: {}, conf: { - serve: "https://2021.shylinux.com", appid: "wxf4e5104d83476ed6", - module: "shylinux.com/x/volcanos", version: "v0.3.1", - }, base: base, core: core, misc: misc, page: page, user: user, + data: {}, conf: conf, base: base, core: core, misc: misc, page: page, user: user, onLaunch: function() { const res = wx.getSystemInfoSync() this.conf.platform = res.platform diff --git a/publish/client/mp/conf.js b/publish/client/mp/conf.js new file mode 100644 index 00000000..576624fe --- /dev/null +++ b/publish/client/mp/conf.js @@ -0,0 +1,6 @@ +module.exports = { + appid: "wxf4e5104d83476ed6", + serve: "https://2021.shylinux.com", + module: "shylinux.com/x/volcanos", + version: "v0.3.1", +} diff --git a/publish/client/mp/pages/river/river.js b/publish/client/mp/pages/river/river.js index cb1d2644..0bc31afd 100644 --- a/publish/client/mp/pages/river/river.js +++ b/publish/client/mp/pages/river/river.js @@ -6,16 +6,13 @@ Volcanos(chat.ONIMPORT, { msg.Dump(can), can.user.toast(can, "加载成功") }, }) -Volcanos("onaction", {list: ["刷新", "扫码", "登录", "网络"], +Volcanos("onaction", {list: ["刷新", "扫码", "登录"], "刷新": function(event, can) { can.onaction.refresh(event, can) }, "扫码": function(event, can) { can.user.agent.scanQRCode(can) }, "登录": function(event, can) { can.user.info = {}, can.misc.localStorage(can, ice.MSG_SESSID, can.conf.sessid = "") can.user.userinfo(can, function() { can.onaction.refresh(event, can) }) }, - "网络": function(event, can) { - can.user.agent.connectWifi(can, "CMCC-UQJ7", "RZGR9FGF") - }, refresh: function(event, can) { can.run(event, [], function(msg) { can.onimport._init(can, msg) }) }, onaction: function(event, can, button, data) { var name = data.name; (can.onaction[name]||function(event) { can.run(event, [ctx.ACTION, name]) })(event, can) diff --git a/publish/client/mp/utils/proto.js b/publish/client/mp/utils/proto.js index 2ec25a71..1f807dd3 100644 --- a/publish/client/mp/utils/proto.js +++ b/publish/client/mp/utils/proto.js @@ -19,7 +19,7 @@ Volcanos._init = function() { }); return msg }, run: function(event, cmds, cb) { wx.showLoading(); const sys = wx.getSystemInfoSync() - can.misc.request(can, can.request(event), can.base.MergeURL(can.onaction._apis||nfs.CHAT_ACTION, kit.Dict( + can.misc.request(can, can.request(event, {share: can.db.share}), can.base.MergeURL(can.onaction._apis||nfs.CHAT_ACTION, kit.Dict( ice.POD, can.db.pod||can.db.space, ice.MSG_THEME, sys.theme, ice.MSG_DEBUG, can.db.debug, )), {cmds: (can.onaction._cmds||[]).concat(cmds)}, function(msg) { wx.hideLoading() msg.Dump = function() { can.ui.setData({list: msg.Table()}) }, cb(msg) @@ -28,6 +28,7 @@ Volcanos._init = function() { }; Volcanos._page.__proto__ = getApp(), delete(Volcanos._page) var page = {data: {action: can.onaction.list, list: []}, onLoad: function(options) { can.ui = this, can.db = options, can.db.serve = can.db.serve||can.conf.serve + can.core.Item(can.db, function(key, value) { can.db[key] = decodeURIComponent(value) }) can.core.Item(can.db, function(key, value) { can.db[key] = decodeURIComponent(value) }) can.misc.Info("app show", can.ui.route, can.db), can.user.agent.enableDebug(can) can.user.title(can.db.title||can.db.pod||can.db.space||(can.db.serve||can.conf.serve).split("://")[1])