From b9db5b8b8d648ab3d583b88cf75d6a6f6f961e85 Mon Sep 17 00:00:00 2001 From: shy Date: Fri, 25 Apr 2025 18:23:50 +0800 Subject: [PATCH] add some --- frame.js | 4 ++-- index.css | 9 ++++++--- plugin/state.js | 1 + plugin/table.js | 29 ++++++++++++++++++++++++----- proto.js | 3 +++ 5 files changed, 36 insertions(+), 10 deletions(-) diff --git a/frame.js b/frame.js index c5349f41..38a7af04 100644 --- a/frame.js +++ b/frame.js @@ -343,13 +343,13 @@ Volcanos(chat.ONAPPEND, { Volcanos(display, {_root: can._root, _follow: can.core.Keys(can._follow, display), _fields: can._target, _target: output, _path: display||chat.PLUGIN_TABLE_JS, _legend: can._legend, _option: can._option, _action: action||can._action, _output: output, _status: status||can._status, Update: can.Update, Option: can.Option, Action: can.Action, Status: can.Status, db: {hash: [""], value: {}}, ui: {layout: function() {}}, - }, [display, msg.Option(ice.MSG_DISPLAY_CSS)||can.Conf("display_css")||undefined, chat.PLUGIN_TABLE_JS], function(sub) { sub.Conf(can.Conf()) + }, display.split(",").concat([msg.Option(ice.MSG_DISPLAY_CSS)||can.Conf("display_css")||undefined, chat.PLUGIN_TABLE_JS]), function(sub) { sub.Conf(can.Conf()) sub.db.hash = can.base.getValid(can.isCmdMode()? can.misc.SearchHash(can): [], can.onexport.storage(can, "hash"))||[] var last = can.sub; last && can.core.CallFunc([last, "onaction.hidden"], {can: last}) sub.run = function(event, cmds, cb, silent) { var msg = sub.request(event)._caller() msg.RunAction(event, sub, cmds) || can.Update(event, cmds||can.Input(cmds, !silent), cb, silent) }, can._outputs = can._outputs||[], can._outputs.push(sub), sub.sup = can, can.sub = sub - sub._index = can._index, can._msg = sub._msg = msg, sub.Conf(sub._args = can.base.ParseURL(display)) + sub._index = can._index, can._msg = sub._msg = msg, sub.Conf(sub._args = can.base.ParseURL(display.split(",")[0])) sub._trans = can.base.Copy(can.base.Copy(sub._trans||{}, can._trans), can.core.Value(sub, [chat.ONACTION, chat._TRANS])) if (sub.onimport && can.base.isArray(sub.onimport.list) && sub.onimport.list.length > 0) { can.onmotion.clear(can, can._option), can.onappend._option(can, {inputs: can.page.inputs(can, sub.onimport.list, html.TEXT) }) diff --git a/index.css b/index.css index e7708bc4..d3152512 100644 --- a/index.css +++ b/index.css @@ -436,9 +436,12 @@ body div.input.float input[name=cancel] { border:var(--box-danger); background-c body.mobile div.input.float input[name=submit] { border:var(--box-notice); background-color:var(--notice-bg-color); color:var(--notice-fg-color); } body div.input.float input[name=submit]:hover { background-color:var(--notice-bg-color); color:var(--notice-fg-color); } body div.input.float input[name=cancel]:hover { background-color:var(--danger-bg-color); color:var(--danger-fg-color); } -body div.input.float div.action { padding:var(--table-padding); width:100%; position:sticky; bottom:0; flex-direction:row-reverse; cursor:move; } -body div.input.float div.action>div.item { margin-left:var(--button-margin); float:right; } -body div.input.float div.action>div.item>input[type=button] { min-width:112px; } +body div.input.float div.action { + padding:var(--table-padding); width:100%; position:sticky; bottom:0; flex-direction:row-reverse; cursor:move; + display:flex; +} +body div.input.float div.action>div.item { margin-left:var(--button-margin); float:right; flex-grow:1; } +body div.input.float div.action>div.item>input[type=button] { min-width:112px; width:100%; } body>div.input.login { flex-direction:column; } body>div.input.login>div.action { border-bottom:var(--box-border); padding:0; flex-direction:row; } body>div.input.login>div.action>div.tabs { padding:var(--button-padding); } diff --git a/plugin/state.js b/plugin/state.js index 8322aa99..89a3035f 100644 --- a/plugin/state.js +++ b/plugin/state.js @@ -359,6 +359,7 @@ Volcanos(chat.ONEXPORT, { return can.misc.localStorage(can, [can.ConfSpace()||can.misc.Search(can, ice.POD), can.ConfIndex(), key], value) }, hash: function(can, hash) { + if (can.user.isMobile) { return } can.misc.SearchHash(can, hash), can.onexport.storage(can, "hash", hash) return hash }, diff --git a/plugin/table.js b/plugin/table.js index 1a231ad0..a676bef0 100644 --- a/plugin/table.js +++ b/plugin/table.js @@ -191,6 +191,20 @@ Volcanos(chat.ONIMPORT, { if (node[name].childElementCount == 2) { can.onmotion.delay(can, function() { node[name].firstChild.click() }) } }, oncontextmenu: function(event) { can.onimport._menu(event, can, item, cbs) + }, ondragenter: function(event) { + can.onkeymap.prevent(event) + }, ondragover: function(event) { + can.onkeymap.prevent(event) + }, ondrop: function(event) { + var msg = can.request(event, can.Option(), item, {_handle: ice.TRUE}) + can.core.List(event.dataTransfer.files, function(file) { + debugger + msg._upload = file + can.runAction(event, html.UPLOAD, [], function(msg) { + }) + }) + // msg._upload = event.dataTransfer.files[0] + can.onkeymap.prevent(event) }, _init: item._init}, {view: [[html.LIST, html.HIDE]]}]); node[name] = ui.list, item.expand && ui.item.click() }) }); return node }, @@ -294,7 +308,7 @@ Volcanos(chat.ONIMPORT, { plugin.sub.onexport.hash(plugin.sub, can.Option(PLACE_UID), can.ConfIndex(), can.Option(UID)) } } - sub._stacks_root.onexport.title(sub._stacks_root, current._name, can.ConfHelp(), + can.user.isMobile || sub._stacks_root.onexport.title(sub._stacks_root, current._name, can.ConfHelp(), can._msg.Option("_share_title")||(can._msg && can._msg.IsDetail()? can._msg.Append(html.TITLE)||can._msg.Append(mdb.NAME)||(can._msg.Append(UID)||"").slice(0, 6): "") // ||can.user.info.titles ) @@ -338,7 +352,8 @@ Volcanos(chat.ONIMPORT, { value.index == "web.team.renzhengshouquan.profile" && (ACTION_HEIGHT = 0) value.index.split(".").pop() == "credit" && (ACTION_HEIGHT = 0) value.type = html.STORY, value.style = html.OUTPUT, value.height = (can.user.isMobile? window.innerHeight: can.ConfHeight())-ACTION_HEIGHT - can.onappend.plugin(can, value, function(sub) { can._stacks_current.push(sub) + can.onappend.plugin(can, value, function(sub) { + can._stacks_current.push(sub) can.core.List(["_trans", "_style", "_icons", "_trans.input", "_trans.value"], function(key) { var value = sub.Conf(key); value && can.core.Item(can.Conf(key), function(k, v) { value[k] = value[k]||v }) }) @@ -355,9 +370,11 @@ Volcanos(chat.ONIMPORT, { sub._select(), msg.Option(ice.MSG_ACTION) && can.onappend._action(sub, msg.Option(ice.MSG_ACTION), _action, null, true) sub.sub.onaction._goback = goback } - sub.onimport._field = function(msg) { var sup = sub; can.onmotion.clear(can, sub._output) + sub.onimport._field = function(msg) { var sup = sub + can.onmotion.clear(can, sub._output) msg.Table(function(value) { value.style = html.OUTPUT can.onappend.plugin(can, value, function(sub) { can.onimport.myField(can, sub) + can._stacks_current.push(sub) sub.onexport.output = function(_sub, msg) { can.onimport.myOption(sub) can.user.isMobile && sub.onimport.size(sub, window.innerHeight-ACTION_HEIGHT, window.innerWidth, false) } @@ -371,14 +388,16 @@ Volcanos(chat.ONIMPORT, { }, sub._output) }) } - function goback(event, cb) { if (can._stacks_current.length == 1) { return cb && cb()} + function goback(event, cb) { + if (can._stacks_current.length == 1) { return cb && cb()} if (sub._history.length > 1) { sub.request(event, {_toast: "reload"}); return sub.onimport.back(event, sub), cb && cb() } var _last = can._stacks_current.pop() can.onmotion.slideOut(_last, function() { var last = can._stacks_current[can._stacks_current.length-1]; last._select() can.onmotion.delay(can, function() { can._root.Action.onlayout._init(can) }) last.request(event, {_toast: "reload"}) if (last.ConfIndex().split(".").pop() == "message") { last.Update(event) } - can._stacks_current.length == 1 && last._output.innerHTML == "" && last.Update(event) + // can._stacks_current.length == 1 && last._output.innerHTML == "" && last.Update(event) + last._output.innerHTML == "" && last.Update(event) cb && cb() }) } diff --git a/proto.js b/proto.js index 9ead2c42..cdd7d1ee 100644 --- a/proto.js +++ b/proto.js @@ -145,6 +145,9 @@ try { if (typeof(window) == code.OBJECT) { var meta = Volcanos.meta default: var item = document.createElement(nfs.SCRIPT); item.src = url, item.onerror = _cb, item.onload = _cb, document.body.appendChild(item) } } + document.ondrop = function(event) { + debugger + } meta.target = document.body, meta._height = window.innerHeight, meta._width = window.innerWidth meta._init = function(can) { var last = can.page.width() < can.page.height() window.onresize = function(event) { can.misc.Event(event, can, function(msg) {