From c2d7e27afe5bc55a53c3962b747732590d0a40c5 Mon Sep 17 00:00:00 2001 From: shylinux Date: Thu, 23 Mar 2023 00:13:33 +0800 Subject: [PATCH] opt mdb --- frame.js | 4 +++- index.css | 10 +++++----- lib/date.js | 3 --- plugin/local/code/inner.js | 4 ++-- plugin/local/code/inner/syntax.js | 5 +++-- plugin/state.js | 4 ++-- plugin/story/json.js | 15 --------------- 7 files changed, 15 insertions(+), 30 deletions(-) diff --git a/frame.js b/frame.js index 8c397bc7..62b5f99c 100644 --- a/frame.js +++ b/frame.js @@ -156,7 +156,9 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { list: {name: web.REFRESH, cb: function(event) { can.Update(event) }}, back: {name: "goback", cb: function(event) { can.onimport._back(can) }}, refresh: {name: web.REFRESH, cb: function(event) { can.Update(event) }}, - next: {name: mdb.NEXT}, prev: {name: mdb.PREV}, play: {name: web.PLAY}, + prev: {name: mdb.PREV, cb: function(event) { can.onaction.prev(event, can) }}, + next: {name: mdb.NEXT, cb: function(event) { can.onaction.next(event, can) }}, + play: {name: web.PLAY}, // create: {name: mdb.CREATE}, insert: {name: mdb.CREATE}, "": {name: mdb.DELETE, cb: function(event) { can.onaction.close(event, can) }}, }[item.name||""]; if (!icon) { return } item.style = "icons" diff --git a/index.css b/index.css index bf5abc3f..9ce0c03d 100644 --- a/index.css +++ b/index.css @@ -6,10 +6,10 @@ input:not([type=file]) { background-color:cyan; padding:0 5px; margin-right:5px; input:not([type=button]) { width:120px; } input[name=path] { width:160px; } input[name=line] { width:40px; } -input[name=limit] { width:48px; } -input[name=offend] { width:48px; } -input[name=id] { width:48px; } -input[name=ID] { width:48px; } +input[name=limit] { width:60px; } +input[name=offend] { width:60px; } +input[name=id] { width:60px; } +input[name=ID] { width:60px; } input[name=url] { width:320px; } input[name=cmd] { background-color:black; color:white; width:100%; } input[type=button] { background-color:black; color:cyan; } @@ -166,7 +166,7 @@ fieldset:not(.float)>form.option>div.text>span.value { display:none; } fieldset.float div.item.text:hover>span.icon.delete { visibility:hidden; } fieldset.float>form.option>div.text>input { display:none; } fieldset.float>form.option>div.text>span.value { padding:7px; height:32px; display:block; } -fieldset.float>form.option>div.item.button { display:none; } +/* fieldset.float>form.option>div.item.button { display:none; } */ fieldset.float>form.option>div.icon { display:block; } fieldset.full>form.option>div.icon.delete { display:block; } fieldset.cmd>form.option>div.icon { display:block; } diff --git a/lib/date.js b/lib/date.js index 95cfc117..ca538693 100644 --- a/lib/date.js +++ b/lib/date.js @@ -250,6 +250,3 @@ Volcanos("date", { // @1900-2100区间内的公历转农历 '7f07e7f0e47f531b0723b0b6fb0721','7f0e26665b66a449801e9808297c35','665f67f0e37f1489801eb072297c35', '7ec967f0e37f14998082b0787b06bd','7f07e7f0e47f531b0723b0b6fb0721','7f0e27f1487f531b0b0bb0b6fb0722'], }) -Volcanos("page", { - replace: function(can, text, key, value) { return can.base.replaceAll(text, "<", "<", ">", ">", key, value) }, -}) diff --git a/plugin/local/code/inner.js b/plugin/local/code/inner.js index adcbd5c9..f20003f3 100644 --- a/plugin/local/code/inner.js +++ b/plugin/local/code/inner.js @@ -171,7 +171,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl process: function(can, msg, target, height, width, cb) { can.onmotion.clear(can, target) if (msg.Option(ice.MSG_PROCESS) == ice.PROCESS_FIELD) { msg.Table(function(item) { item.type = chat.STORY, item.height = height, item.width = width, item.display = msg.Option(ice.MSG_DISPLAY) - if (can.base.isIn(item.index, web.CODE_XTERM, web.WIKI_WORD)) { item.style = html.OUTPUT } + // if (can.base.isIn(item.index, web.CODE_XTERM, web.WIKI_WORD)) { item.style = html.OUTPUT } can.onimport.plug(can, item, function(sub) { sub.onaction.close = function() { can.onmotion.hidden(can, target), can.onimport.layout(can) } sub.onexport.output = function(_sub, _msg) { can.onmotion.delay(can, function() { can.base.isFunc(cb) && cb(_sub, _msg) }) } @@ -274,7 +274,7 @@ Volcanos(chat.ONSYNTAX, {_init: function(can, msg, cb) { msg._plugin = sub, can.base.isFunc(cb) && cb(msg._content = sub._target), sub.Focus() }, can.ui._content.parentNode) }, - _parse: function(can, line) { line = can.page.replace(can, line||"") + _parse: function(can, line) { function wrap(text, type) { return can.page.Format(html.SPAN, text, type) } var p = can.onsyntax[can.db.parse]||{}; p = can.onsyntax[p.link]||p, p.split = p.split||{} if (p.prefix && can.core.Item(p.prefix, function(pre, type) { if (can.base.beginWith(line, pre)) { return line = wrap(line, type) } }).length > 0) { return line } diff --git a/plugin/local/code/inner/syntax.js b/plugin/local/code/inner/syntax.js index 002425b4..f88dc3fd 100644 --- a/plugin/local/code/inner/syntax.js +++ b/plugin/local/code/inner/syntax.js @@ -260,8 +260,9 @@ Volcanos(chat.ONSYNTAX, { case "func": if (ls[1] == "(") { ls[1] = ls[2]+ice.PT+ls[5] if (ls[5].toLowerCase()[0] == ls[5][0]) { push("- "+ls[1]) } else { push("+ "+ls[1]) } break } + case "const": + case "var": if (ls[1] == "(") { break } case "type": - case "var": if (ls[1].toLowerCase()[0] == ls[1][0]) { push("- "+ls[1]) } else { push("+ "+opts.package+ice.PT+ls[1]) } break } } else if (indent == 4) { @@ -314,7 +315,7 @@ Volcanos(chat.ONSYNTAX, { "iota": code.CONSTANT, "true": code.CONSTANT, "false": code.CONSTANT, "nil": code.CONSTANT, "kit": code.PACKAGE, "ice": code.PACKAGE, - "Any": code.DATATYPE, "Map": code.DATATYPE, "Maps": code.DATATYPE, "Message": code.DATATYPE, + "Any": code.DATATYPE, "List": code.DATATYPE, "Map": code.DATATYPE, "Maps": code.DATATYPE, "Message": code.DATATYPE, "m": code.OBJECT, "msg": code.OBJECT, }, }, godoc: {link: "go"}, diff --git a/plugin/state.js b/plugin/state.js index cd8898f9..f228b65a 100644 --- a/plugin/state.js +++ b/plugin/state.js @@ -132,8 +132,8 @@ Volcanos(chat.ONACTION, {list: [ clear: function(event, can) { can.onmotion.clear(can, can._output) }, actions: function(event, can) { can.onmotion.toggle(can, can._action) }, full: function(event, can) { can.onaction["切换全屏"](event, can, "切换全屏", can.core.Value(can, chat._OUTPUTS_CURRENT)) }, - next: function(event, can) { can.runAction(event, mdb.NEXT, [can.Status(mdb.TOTAL)||0, can.Option(mdb.LIMIT)||can.Action(mdb.LIMIT)||"", can.Option(mdb.OFFEND)||can.Action(mdb.OFFEND)||""]) }, - prev: function(event, can) { can.runAction(event, mdb.PREV, [can.Status(mdb.TOTAL)||0, can.Option(mdb.LIMIT)||can.Action(mdb.LIMIT)||"", can.Option(mdb.OFFEND)||can.Action(mdb.OFFEND)||""]) }, + prev: function(event, can) { can.runAction(event, mdb.PREV, [can.Status(mdb.TOTAL)||0, can.Option(mdb.LIMIT)||can.Action(mdb.LIMIT)||"", can.Option(mdb.OFFEND)||can.Action(mdb.OFFEND)||""], function(msg) { can.onimport._process(can, msg) }) }, + next: function(event, can) { can.runAction(event, mdb.NEXT, [can.Status(mdb.TOTAL)||0, can.Option(mdb.LIMIT)||can.Action(mdb.LIMIT)||"", can.Option(mdb.OFFEND)||can.Action(mdb.OFFEND)||""], function(msg) { can.onimport._process(can, msg) }) }, upload: function(event, can) { can.user.upload(event, can) }, keyboard: function(event, can) { can.base.isUndefined(can._daemon) && can.ondaemon._list[0] && (can._daemon = can.ondaemon._list.push(can)-1) diff --git a/plugin/story/json.js b/plugin/story/json.js index 94992e5c..19e5f3df 100644 --- a/plugin/story/json.js +++ b/plugin/story/json.js @@ -43,18 +43,3 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { }; show(data, can.page.Append(can, target, [{view: html.ITEM}]).item, 0, 0) }, }, [""]) -Volcanos(chat.ONACTION, {list: ["展开", "折叠", "复制"], - "展开": function(event, can) { - can.page.Select(can, can._output, [html.DIV_LIST, html.DIV_LIST], function(list) { - can.onmotion.toggle(can, list, true) - }) - }, - "折叠": function(event, can) { - can.page.Select(can, can._output, [html.DIV_LIST, html.DIV_LIST], function(list) { - can.onmotion.hidden(can, list) - }) - }, - "复制": function(event, can) { - can.user.copy(event, can, can._msg.Result()) - }, -})