diff --git a/const.js b/const.js index 2d78ecc1..e944b864 100644 --- a/const.js +++ b/const.js @@ -395,6 +395,7 @@ var icon = { compile: "bi bi-tools", publish: "bi bi-send-check", version: "bi bi-tags", upgrade: "bi bi-rocket-takeoff", install: "bi bi-box-arrow-in-down", // vimer: "bi bi-code-slash", vimer: "bi bi-file-earmark-code", + word: "bi bi-book", repos: "bi bi-git", build: "bi bi-tools", tag: "bi bi-tags", xterm: "bi bi-terminal", cmds: "bi bi-terminal", diff --git a/frame.js b/frame.js index 9f05203e..0d193822 100644 --- a/frame.js +++ b/frame.js @@ -70,7 +70,6 @@ Volcanos(chat.ONENGINE, {_init: function(can, meta, list, cb, target) { }, }) Volcanos(chat.ONDAEMON, {_init: function(can, name, type, cbs) { if (can.user.isLocalFile) { return } - // return can.misc.WSS(can, {type: type||web.PORTAL, name: name||can.misc.Search(can, cli.DAEMON)||can.user.isChrome&&can.misc.sessionStorage(can, "can.daemon")||""}, function(event, msg, cmd, arg, cb) { return can.misc.WSS(can, {type: type||web.PORTAL, name: name||can.misc.Search(can, cli.DAEMON)||""}, function(event, msg, cmd, arg, cb) { if (cbs && can.core.CallFunc(cbs, {event: event, msg: msg, cmd: cmd, arg: arg, cb: cb})) { return } var sub = can.ondaemon._list[can.core.Keys(msg[ice.MSG_TARGET])]||can; can.base.isFunc(sub.ondaemon[cmd])? @@ -257,7 +256,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { // qrcode: !can.isCmdMode() && "生成链接", // chat: can.misc.Search(can, ice.MSG_DEBUG) == ice.TRUE && "发送聊天", help: can.page.ClassList.has(can, can._fields||can._target, html.PLUGIN) && can.Conf("_help") && can.Conf("_help") != "" && "查看文档", - vimer: can.page.ClassList.has(can, can._fields||can._target, html.PLUGIN) && can.Conf("_fileline") && can.misc.Search(can, ice.MSG_DEBUG) == ice.TRUE && "查看源码", + // vimer: can.page.ClassList.has(can, can._fields||can._target, html.PLUGIN) && can.Conf("_fileline") && can.misc.Search(can, ice.MSG_DEBUG) == ice.TRUE && "查看源码", }, function(key, value) { return (value || value === "") && {view: [[html.ITEM, html.BUTTON, key, mdb.ICONS, "state"]], list: [{icon: icon[key]}], title: can.user.trans(can, key), onclick: function(event) { var cb = _can.onaction[value]; cb && _can.onaction[value](event, _can, value, _can.sub) @@ -457,17 +456,17 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { }, buttons: function(can, value) { return {view: html.ACTION, inner: value.action, _init: function(target) { - can.onappend.mores(can, target, value, 5) + can.onappend.mores(can, target, value, 7) can.page.Select(can, target, html.INPUT, function(target) { - if (!icon[target.name]) { + var _icon = can.Conf("feature._icons."+target.name)||icon[target.name] + if (!_icon) { target.onclick = function(event) { can.Update(can.request(event, value), [ctx.ACTION, target.name]) } return } - can.page.insertBefore(can, [{icon: icon[target.name], onclick: function(event) { - target.onclick(event) - // can.Update(can.request(event, value), [ctx.ACTION, target.name]) + can.page.insertBefore(can, [{icon: _icon, onclick: function(event) { + target.onclick? target.onclick(event): can.Update(can.request(event, value), [ctx.ACTION, target.name]) }}], target), can.onappend.style(can, mdb.ICONS, target) }) }} @@ -714,13 +713,12 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) { can.runActionCommand(sub.request(event, {pod: meta.space}), sub._index, cmds, cb) } }, sub._index = value.index||meta.index, can.base.isFunc(cb) && cb(sub, meta, skip) - if (meta.style == html.FLOAT || value.style == html.FLOAT) { can.onlayout._float(sub) } + if (meta.style == html.FLOAT || value.style == html.FLOAT) { can.onmotion.float(sub) } }, target||can._output, field) }, _float: function(can, index, args, cb) { - can.onappend.plugin(can, typeof index == code.OBJECT? (index.mode = chat.FLOAT, index.args = args, index): {index: index, args: args, mode: chat.FLOAT}, function(sub) { - sub._target.onclick = function(event) { can.page.Select(can, document.body, html.FIELDSET_FLOAT, function(target) { can.page.style(can, target, "z-index", target == sub._target? 10: 9) }) } - sub.onmotion.float(sub), sub.onaction.close = function() { can.page.Remove(can, sub._target) }, cb && cb(sub) + can.onappend.plugin(can, typeof index == code.OBJECT? (index.style = chat.FLOAT, index.args = args, index): {index: index, args: args, style: chat.FLOAT}, function(sub) { + sub.onaction.close = function() { can.page.Remove(can, sub._target) }, cb && cb(sub) }, can._root._target) }, figure: function(can, meta, target, cb) { if (meta.type == html.SELECT || meta.type == html.BUTTON) { return } @@ -800,16 +798,6 @@ Volcanos(chat.ONLAYOUT, {_init: function(can, target) { target = target||can._ro }); can.onmotion.move(can, target, layout), can.onmotion.slideGrow(can, target) return layout }, - _float: function(can) { var target = can._fields||can._target, sup = can._fields? can.sup: can - var height = can.base.Max(html.FLOAT_HEIGHT, can.page.height()-can.getHeaderHeight()-html.ACTION_HEIGHT), width = can.base.Max(html.FLOAT_WIDTH, can.page.width()-can.getRiverWidth()-2*html.PLUGIN_MARGIN) - sup.onimport.size(sup, height, width, false), can.onappend.style(can, html.FLOAT) - can.onmotion.resize(can, target, function(height, width) { sup.onimport.size(sup, height, width, false) }, can.getHeaderHeight(), can.getRiverWidth()) - var left = can.getRiverWidth()+html.PLUGIN_MARGIN+html.PLUGIN_PADDING+(can.user.mod.isCmd? 0: 120), top = can.page.height()/4; if (can.user.isMobile) { left = 0 } - can.page.style(can, target, html.LEFT, can.page.width()-width-html.PLUGIN_MARGIN, html.TOP, can.page.height()-height-html.ACTION_HEIGHT-html.PLUGIN_MARGIN) - target.onclick = function(event) { can.onkeymap.prevent(event) - can.page.Select(can, document.body, "fieldset.float,div.float", function(target) { can.page.style(can, target, "z-index", 9) }), can.page.style(can, target, "z-index", 10) - } - }, }) Volcanos(chat.ONMOTION, {_init: function(can, target) { target.onclick = function(event) { @@ -931,12 +919,17 @@ Volcanos(chat.ONMOTION, {_init: function(can, target) { var last = can._delay_list.meta[key]||0, self = can._delay_list.meta[key] = can._delay_list.list.push(cb) return can.core.Timer(interval||30, function() { cb(self, last, can._delay_list.meta[key]) }) }, - float: function(can) { var top = html.HEADER_HEIGHT, left = can.getRiverWidth() - var height = can.base.Max(html.FLOAT_HEIGHT, can.page.height()/2), width = can.base.Max(html.FLOAT_WIDTH, can.page.width()-can.getRiverWidth()) - if (can.user.mod.isCmd) { height = can.base.Max(can.page.height()/2-html.ACTION_HEIGHT, can.page.height(), 320), width = can.page.width()/2, top = html.ACTION_HEIGHT, left = 0 } - if (can.user.isMobile) { if (can.user.isLandscape()) { height = can.page.height()*3/4, width = can.page.width()*3/4 } else { width = can.page.width() } } - can.onimport.size(can, height, width, true), can.onmotion.move(can, can._target, {left: can.page.width()-width, top: (can.page.height()-height)/2}) - can.onmotion.resize(can, can._target, function(height, width) { can.onimport.size(can, height, width, true) }, top, left) + float: function(can) { var target = can._fields||can._target, sup = can._fields? can.sup: can + var margin = (can.getFooterHeight()||html.ACTION_HEIGHT)+(can.user.isMobile? html.ACTION_HEIGHT: 0)+html.PLUGIN_MARGIN + var height = can.base.Max(html.FLOAT_HEIGHT, can.page.height()-can.getHeaderHeight()-margin), width = can.base.Max(html.FLOAT_WIDTH, can.page.width()-can.getRiverWidth()-2*html.PLUGIN_MARGIN) + sup.onimport.size(sup, height, width, false), can.onappend.style(can, html.FLOAT) + can.onmotion.resize(can, target, function(height, width) { sup.onimport.size(sup, height, width, false) }, can.getHeaderHeight(), can.getRiverWidth()) + var left = can.page.width()-width-html.PLUGIN_MARGIN, top = can.page.height()-height-margin + can.page.style(can, target, html.LEFT, left, html.TOP, top) + target.onclick = function(event) { + // can.onkeymap.prevent(event) + can.page.Select(can, document.body, "fieldset.float", function(target) { can.page.style(can, target, "z-index", 8) }), can.page.style(can, target, "z-index", 9) + } }, clear: function(can, target) { return can.page.Modify(can, target||can._output, ""), target }, filter: function(can, value) { diff --git a/index.css b/index.css index 744fe03c..dec986e6 100644 --- a/index.css +++ b/index.css @@ -63,8 +63,8 @@ body { --card-button:5; --body-font-family:sans-serif; - --legend-font-family:var(--input-font-family); --status-font-family:var(--body-font-family); - --input-font-family:cursive; --table-font-family:var(--code-font-family); + --legend-font-family:var(--body-font-family); --status-font-family:var(--body-font-family); + --input-font-family:var(--code-font-family); --table-font-family:var(--code-font-family); --code-font-family:monospace; --svg-font-family:var(--code-font-family); --body-font-size:16px; --legend-font-size:20px; --status-font-size:12px; --code-font-size:14px; --code-line-height:24px; --code-tabs-height:48px; @@ -72,31 +72,23 @@ body { } body.mobile { --footer-height:60px; --qrcode-height:284px; --svg-font-size:13px; } body.width1 { /* 320-640 手机竖屏 */ - --url-input-width:160px; - --river-width:280px; --project-width:120px; --input-width:80px; + --river-width:280px; --project-width:120px; --input-width:80px; --url-input-width:160px; --form-width:320px; --river-margin:0; --plugin-margin:0; --button-margin:5px; - --table-button:2; - --card-button:3; - --form-width:320px; + --table-button:2; --card-button:3; } body.width2 { /* 640-960 手机横屏 平板竖屏 笔记本调试 */ - --url-input-width:160px; - --input-width:80px; - --table-button:3; + --input-width:80px; --url-input-width:160px; } body.width3 { /* 960-1280 平板横屏 */ - --table-button:3; + --float-width:1000px; } body.width4 { /* 1280-1600 笔记本 显示器调试 */ --float-width:1000px; - --table-button:4; } body.width5 { /* 1600-1920 */ - --table-button:4; } body.width6 { /* 1920-2240 显示器 */ - --river-width:280px; --input-width:180px; - --card-height:160px; + --river-width:280px; --input-width:180px; --card-height:160px; } /* element */ * { box-sizing:border-box; padding:0; border:0; margin:0; tab-size:4; } @@ -108,13 +100,14 @@ input[type=checkbox] { margin:var(--input-margin); } table.content thead { position:sticky; top:2px; } table.content th { padding:var(--input-padding) 24px; } table.content th { position:relative; } -table.content th i { position:absolute; right:var(--input-padding); } -table.content th:not(.select) i { display:none; } +table.content th>i { position:absolute; right:var(--input-padding); } +table.content th:not(.select)>i { display:none; } table.content th.select[data-asc="0"] i.bi-sort-up { display:none; } table.content th.select[data-asc="1"] i.bi-sort-down-alt { display:none; } table.content td.option { cursor:pointer; } table.content td { padding:var(--table-padding); } -table.content td i { padding:var(--input-padding); font-size:20px; } +table.content td i { padding:var(--input-padding); } +/* table.content td i { padding:var(--input-padding); font-size:20px; } */ table.content.detail td { padding:var(--table-padding) 0; } table.content.detail td:first-child { text-align:center; } table.content.detail td i { display:none; } @@ -453,11 +446,11 @@ div.float { box-shadow:var(--plugin-box-shadow); } /* font */ body.windows { --code-font-family:"Courier New"; } body { font-family:var(--body-font-family); } -legend { font-family:var(--legend-font-family); } +legend { font-family:var(--legend-font-family); font-style:italic; } input { font-family:var(--input-font-family); } kbd { font-family:var(--code-font-family); } table.content { font-family:var(--table-font-family); } -table.content th { font-family:var(--input-font-family); } +table.content th { font-family:var(--input-font-family); font-style:italic; } body div.code { font-family:var(--table-font-family); } body div.tabs { font-family:var(--code-font-family); } body div.path { font-family:var(--code-font-family); } @@ -565,9 +558,8 @@ fieldset:not(.float)>form.option>div.text>span.value { display:none; } fieldset.float:not(.plug)>form.option>div.text:not(.filter)>input { display:none; } fieldset.float:not(.plug)>form.option>div.text.filter>span.value { display:none; } fieldset.float:not(.plug)>form.option>div.text>span.icon { display:none; } -body:not(.mobile) fieldset.float:not(.plug)>form.option>div.item:last-child { margin-right:var(--action-height); } -body:not(.mobile) fieldset.float:not(.plug)>div.action>div.item:last-child { margin-right:var(--action-height); } -fieldset.float>form.option>div.item:last-child { margin-right:0; } +body.width6 fieldset.float>form.option>div.item:last-child { margin-right:var(--action-height); } +body.width6 fieldset.float>div.action>div.item:last-child { margin-right:var(--action-height); } fieldset.float>div.action>div.item.button._space.icons { margin-left:0; } /* svg */ svg text { font-size:var(--svg-font-size); font-family:var(--svg-font-family); stroke:var(--body-fg-color); fill:var(--body-fg-color); cursor:pointer; } diff --git a/lib/misc.js b/lib/misc.js index c6a3e8db..94a26c1c 100644 --- a/lib/misc.js +++ b/lib/misc.js @@ -214,7 +214,7 @@ Volcanos("misc", { var raw = new RegExp("(https?://[^/]+)([^?#]*)([^#]*)(.*)").exec(url) var ls = can.core.Split(raw[2], nfs.PS); if (ls[0] == chat.SHARE) { args[chat.SHARE] = ls[1] } - if (ls[0] == "s") { args[ice.POD] = ls[1]; if (ls[2] == "c") { args[ice.CMD] = ls[3] } } + if (ls[0] == "s") { args[ice.POD] = decodeURIComponent(ls[1]); if (ls[2] == "c") { args[ice.CMD] = ls[3] } } if (ls[0] == "c") { args[ice.CMD] = ls[1] } for (var i = 1; i < ls.length; i += 2) { if (can.base.isIn(ls[i], [ice.POD, ice.CMD])) { args[ls[i]] = ls[i+1] } } return args @@ -239,6 +239,7 @@ Volcanos("misc", { value === ""? delete(args[key]): (args[key] = value) } location.pathname.indexOf("/chat/pod/") == 0 && delete(args["pod"]) + location.pathname.indexOf("/s/") == 0 && delete(args["pod"]) var search = can.base.Args(args) return search? (location.search = search): (location.href = location.href.split(ice.QS)[0]) }, diff --git a/panel/footer.js b/panel/footer.js index 862f9fdd..825cd2f3 100644 --- a/panel/footer.js +++ b/panel/footer.js @@ -78,8 +78,7 @@ Volcanos(chat.ONEXPORT, {list: [NTIP, NLOG, NCMD, NKEY, html.WIDTH, html.HEIGHT, nkey: function(can) { can.onexport._float(can, NKEY, "can.localStorage") }, version: function(can) { can.onexport._float(can, NKEY, "can.runtime") }, _float: function(can, name, index, args, cb) { can.ui[name]? can.ui[name].onaction.close(): can.onappend._float(can, index, args||[], function(sub) { can.ui[name] = sub - can.page.style(can, sub._target, {top: "", right: 0, bottom: html.ACTION_HEIGHT}), can.base.isFunc(cb) && cb(sub) - can.onmotion.delay(can, function() { sub.onaction.close = function() { can.page.Remove(can, sub._target), delete(can.ui[name]) } }) + can.base.isFunc(cb) && cb(sub), can.onmotion.delay(can, function() { sub.onaction.close = function() { can.page.Remove(can, sub._target), delete(can.ui[name]) } }) }) }, }) Volcanos(chat.ONPLUGIN, { diff --git a/proto.js b/proto.js index 64f2e65e..7a2f1dfd 100644 --- a/proto.js +++ b/proto.js @@ -86,6 +86,7 @@ var Volcanos = shy({iceberg: "", volcano: "", frame: chat.FRAME_JS, _cache: {}, getHeaderTheme: function(cb) { return can.get(chat.HEADER, chat.THEME, cb) }, getHeaderLanguage: function(cb) { return can.get(chat.HEADER, aaa.LANGUAGE, cb) }, getHeaderHeight: function() { return can._root.Header? can._root.Header._target.offsetHeight: 0}, + getFooterHeight: function() { return can._root.Footer? can._root.Footer._target.offsetHeight: 0}, getHeader: function(key, cb) { return can.get(chat.HEADER, key, cb) }, setHeader: function(key, value) { return can.set(chat.HEADER, key, value) }, setAction: function(key, value) { return can.set(chat.ACTION, key, value) },