From 51cd8ca01ab1b62a9d1a3a83b87b6dca0d6d7926 Mon Sep 17 00:00:00 2001 From: shy Date: Fri, 27 Oct 2023 13:38:55 +0800 Subject: [PATCH] add some --- frame.js | 5 ++--- lib/misc.js | 2 +- lib/user.js | 2 +- plugin/input/img.js | 2 +- plugin/local/mall/goods.js | 2 +- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/frame.js b/frame.js index ac4e347e..d9142445 100644 --- a/frame.js +++ b/frame.js @@ -346,7 +346,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { if (msg.append.length == 2 && msg.append[0] == mdb.KEY && msg.append[1] == mdb.VALUE) { if (key == mdb.VALUE) { key = data.key } data = {}, can.core.List(list, function(item) { data[item.key] = item.value }) } function run(event, cmd, arg) { can.misc.Event(event, can, function(msg) { can.run(can.request(event, data, can.Option()), [ctx.ACTION, cmd].concat(arg)) }) } if (key == web.SPACE && value) { value = can.page.Format(html.A, can.misc.MergePodCmd(can, {pod: value}), value) } - return {text: [value, html.TD], onclick: function(event) { var target = event.target + return {text: [msg.IsDetail() && key == mdb.KEY? can.user.trans(can, value, null, html.INPUT): value, html.TD], onclick: function(event) { var target = event.target if (can.page.tagis(target, html.INPUT) && target.type == html.BUTTON) { can.requestAction(event, target.name) meta && meta[target.name]? can.user.input(event, can, meta[target.name], function(args) { run(event, target.name, args) }): run(event, target.name) } else { can.sup.onimport.change(event, can.sup, key, event.target.innerText) || can.sup.onexport.record(can.sup, value, key, data, event) } @@ -522,8 +522,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { }, target._can = sub, can.base.Copy(sub, can.onfigure[input], true), sub._name = sub._path = path sub._target._close = sub.close = function() { can.page.Remove(can, sub._target), delete(target._can) }, sub.hidden = function() { return !can.page.isDisplay(sub._target) } meta.mode && can.onappend.style(sub, meta.mode), can.page.style(sub, sub._target, meta.style), can.base.isFunc(meta._init) && meta._init(sub, sub._target) - // can.onmotion.delay(can, function() { show(sub, cb) }, 300) - can.onmotion.delay(can, function() { show(sub, cb) }, 0) + show(sub, cb) }, can._root._target) }}) }) } }), can.onfigure[input]._init && can.onfigure[input]._init(can, meta, target, _cb) diff --git a/lib/misc.js b/lib/misc.js index 93f799b8..122a0f05 100644 --- a/lib/misc.js +++ b/lib/misc.js @@ -145,7 +145,7 @@ Volcanos("misc", { }, Template(can, path, file) { return can.base.Path(nfs.SRC_TEMPLATE, can.ConfIndex(), path, file) }, MergePath: function(can, file, path) { return file.indexOf(nfs.PS) == 0 || file.indexOf(ice.HTTP) == 0? file: can.base.Path(path, file) }, - MergeCache: function(can, hash) { return can.misc.MergeURL(can, {_path: can.base.Path(web.SHARE_CACHE, hash)}, true) }, + MergeCache: function(can, hash, pod) { return can.base.MergeURL(can.misc.MergeURL(can, {_path: can.base.Path(web.SHARE_CACHE, hash)}, true), ice.POD, pod) }, MergePodCmd: function(can, obj) { if (can.base.beginWith(obj.pod, nfs.PS, web.HTTP)) { if (location.search.indexOf("debug=true") > 0 && obj.pod.indexOf("debug=true") == -1) { diff --git a/lib/user.js b/lib/user.js index a82c2d02..b379d771 100644 --- a/lib/user.js +++ b/lib/user.js @@ -180,7 +180,7 @@ Volcanos("user", { item._init = function(target) { if (item.type == html.SELECT) { target.value = item.value||item.values[0] return can.onmotion.delay(can, function() { can.onappend.select(can, target, item) }) } if (item.name && item.name != ctx.ACTION) { target.value = msg.Option(item.name)||can.Option(item.name)||target.value||"" } - item.mode = chat.SIMPLE, can.onappend.figure(can, can.base.Copy({run: function(event, cmds, cb) { var _msg = can.request(event, {_handle: ice.TRUE, action: msg.Option(html.ACTION)}, msg, can.Option()) + item.mode = chat.SIMPLE, can.onappend.figure(can, can.base.Copy({space: msg.Option(web.SPACE), run: function(event, cmds, cb) { var _msg = can.request(event, {_handle: ice.TRUE, action: msg.Option(html.ACTION)}, msg, can.Option()) can.page.Select(can, ui.table, html.OPTION_ARGS, function(item) { item.name && item.value && _msg.Option(item.name, item.value) }) can.run(event, cmds, cb, true) }, _enter: function(event) { return action.submit(event, can, html.SUBMIT), true }}, item), target) diff --git a/plugin/input/img.js b/plugin/input/img.js index 44a3a2ea..bb812d00 100644 --- a/plugin/input/img.js +++ b/plugin/input/img.js @@ -1,7 +1,7 @@ Volcanos(chat.ONFIGURE, {img: { _init: function(can, meta, target) { target.value == meta.value && (target.value = ""); var images = can.core.Split(target.value) var count = parseInt(meta.value||"1"), width = target.parentNode.offsetWidth-22; for (var n = 1; n < 10; n++) { if (n*n >= count) { width = width/n; break } } width -= 1 - function add(target, hash) { target._hash = hash, can.page.Appends(can, target, [{img: can.misc.MergeURL(can, {_path: web.SHARE_CACHE+hash}, true), height: width, width: width}]) } + function add(target, hash) { target._hash = hash, can.page.Appends(can, target, [{img: can.base.MergeURL(can.misc.MergeURL(can, {_path: web.SHARE_CACHE+hash}, true), ice.POD, meta.space), height: width, width: width}]) } function set() { target.value = can.page.SelectChild(can, target.parentNode, html.DIV, function(target) { return target._hash }).join(mdb.FS) } can.onmotion.hidden(can, target) for (var i = 0; i < count; i++) { diff --git a/plugin/local/mall/goods.js b/plugin/local/mall/goods.js index 15022ab5..d2b35d3a 100644 --- a/plugin/local/mall/goods.js +++ b/plugin/local/mall/goods.js @@ -4,7 +4,7 @@ Volcanos(chat.ONIMPORT, { can.page.Appends(can, can.ui.content, msg.Table(function(item) { if (!list[item.zone]) { list[item.zone] = item, can.onimport.item(can, {name: item.zone}, function() {}) } return {view: html.ITEM, list: [ - {view: wiki.IMAGE, list: [{img: can.misc.MergeCache(can, can.core.Split(item.image)[0])}]}, + {view: wiki.IMAGE, list: [{img: can.misc.MergeCache(can, can.core.Split(item.image)[0], item.space)}]}, {view: wiki.CONTENT, list: [ {view: [html.TITLE, html.DIV, item.name]}, {view: [html.CONTENT, html.DIV, item.text]},