diff --git a/frame.js b/frame.js index c2af1ab0..dd8d5180 100644 --- a/frame.js +++ b/frame.js @@ -206,7 +206,7 @@ Volcanos("onappend", {help: "渲染引擎", list: [], _init: function(can, meta, _output0: function(can, meta, event, cmds, cb, silent) { var msg = can.request(event); if (msg.RunAction(event, can, cmds)) { return } if (msg.Option(ice.MSG_HANDLE) != ice.TRUE && cmds && cmds[0] == ctx.ACTION && meta.feature[cmds[1]]) { can.request(event, {action: cmds[1]}) return can.user.input(event, can, meta.feature[cmds[1]], function(ev, button, data, list, args) { var msg = can.request(event, {_handle: ice.TRUE}, can.Option()) - can.Update(event, cmds.slice(0, 2).concat(args), cb, true) + can.Update(event, cmds.slice(0, 2).concat(args), cb||function() { can.Update() }, true) }) } diff --git a/lib/core.js b/lib/core.js index 45e5e8f7..ad4d6e3b 100644 --- a/lib/core.js +++ b/lib/core.js @@ -139,6 +139,18 @@ Volcanos("core", {help: "数据结构", } return list }), + ItemSort: shy("迭代器", function(obj, key, cb) { var list = [] + var order = [], keys = {}, vals = {} + for (var k in obj) { order.push(obj[k][key]) + keys[obj[k][key]] = k, vals[obj[k][key]] = obj[k] + }; order.sort() + + for (var i in order) { var k = order[i] + var res = typeof cb == lang.FUNCTION? cb(keys[k], vals[k]): k + res != undefined && list.push(res) + } + return list + }), Item: shy("迭代器", function(obj, cb) { var list = [] for (var k in obj) { var res = typeof cb == lang.FUNCTION? cb(k, obj[k]): k diff --git a/lib/user.js b/lib/user.js index ca4ed5fd..2ea36aa5 100644 --- a/lib/user.js +++ b/lib/user.js @@ -29,7 +29,7 @@ Volcanos("user", {help: "用户操作", agent: { isLocalFile: location && location.protocol && location.protocol == "file:", isLandscape: function() { return window.innerWidth > window.innerHeight }, mod: { - isPod: location && location.pathname && (location.pathname.indexOf("/chat/pod/") == 0), + isPod: location && location.pathname && (location.pathname.indexOf("/chat/pod/") == 0 || location.pathname.indexOf("/x/") == 0), isDiv: location && location.pathname && (location.pathname.indexOf("/chat/div/") == 0), isCmd: location && location.pathname && (location.pathname.indexOf("/chat/pod/") == 0 && location.pathname.indexOf("/cmd/") > 0 || location.pathname.indexOf("/chat/cmd/") == 0 || location.pathname.indexOf("/help/") == 0), diff --git a/page/index.js b/page/index.js index a672fc14..c17bd35e 100644 --- a/page/index.js +++ b/page/index.js @@ -5,47 +5,14 @@ Volcanos({name: "chat", panels: [ {name: "Footer", help: "状态条", pos: chat.FOOT, state: ["ncmd"]}, {name: "Search", help: "搜索框", pos: chat.AUTO}, ], main: {name: "Header", list: ["/publish/order.js"]}, river: { - serivce: {name: "运营群", storm: { - wx: {name: "公众号 wx", list: [ - {name: "微信公众号", help: "wx", index: "web.wiki.word", args: ["usr/icebergs/misc/wx/wx.shy"]}, - ]}, - mp: {name: "小程序 mp", list: [ - {name: "微信小程序", help: "mp", index: "web.wiki.word", args: ["usr/icebergs/misc/mp/mp.shy"]}, - ]}, - lark: {name: "机器人 lark", list: [ - {name: "飞书机器人", help: "lark", index: "web.wiki.word", args: ["usr/icebergs/misc/lark/lark.shy"]}, - ]}, - }}, product: {name: "产品群", storm: { office: {name: "办公 office", list: [ {name: "feel", help: "影音媒体", index: "web.wiki.feel"}, {name: "draw", help: "思维导图", index: "web.wiki.draw"}, {name: "data", help: "数据表格", index: "web.wiki.data"}, {name: "plan", help: "计划任务", index: "web.team.plan"}, - {name: "think", help: "智库", index: "web.wiki.word", args: ["usr/learning/"]}, - {name: "index", help: "索引", index: "web.wiki.word", args: ["usr/learning/index.shy"]}, {name: "context", help: "编程", index: "web.wiki.word", args: ["src/main.shy"]}, ]}, - english: {name: "英汉 english", list: [ - {name: "english", help: "英汉", index: "web.wiki.alpha.alpha", args: ["word", "hi"]}, - {name: "chinese", help: "汉英", index: "web.wiki.alpha.alpha", args: ["line", "你好"]}, - {name: "wubi", help: "五笔", index: "web.code.input.wubi", args: ["word", "wqvb"]}, - {name: "wubi", help: "五笔", index: "web.code.input.wubi", args: ["line", "你好"]}, - ]}, - learning: {name: "学习 learning", list: [ - {name: "golang", help: "编程", index: "web.wiki.word", args: ["usr/golang-story/src/main.shy"]}, - {name: "tmux", help: "粘贴", index: "web.code.tmux.text"}, - {name: "study", help: "学习", index: "web.wiki.word", args: ["usr/learning/study.shy"]}, - ]}, - chrome: {name: "爬虫 chrome", list: [ - {name: "feel", help: "网页爬虫", index: "web.wiki.feel", args: ["spide/"], feature: { - display: "/plugin/local/wiki/feel.js", - height: 200, limit: 3, - }}, - {name: "cached", help: "爬虫缓存", index: "web.code.chrome.cache", args: []}, - {name: "spided", help: "网页爬虫", index: "web.code.chrome.spide", args: location && location.protocol && location.protocol=="chrome-extension:"? ["1", "", "spide"]: ["1"]}, - {name: "modify", help: "编辑页面", index: "web.code.chrome.modify", args: []}, - ]}, }}, project: {name: "研发群", storm: { studio: {name: "研发 studio", list: [ @@ -54,36 +21,6 @@ Volcanos({name: "chat", panels: [ {name: "plan", help: "任务表", index: "web.team.plan"}, {name: "ctx", help: "上下文", index: "web.wiki.word"}, ]}, - web: {name: "网页 web", list: [ - {name: "HTML5", help: "浏览器", index: "web.wiki.word", args: ["usr/icebergs/misc/chrome/chrome.shy"]}, - ]}, - cli: {name: "命令 cli", list: [ - {name: "bash", help: "命令行", index: "web.wiki.word", args: ["usr/icebergs/misc/bash/bash.shy"]}, - {name: "git", help: "代码库", index: "web.wiki.word", args: ["usr/icebergs/misc/git/git.shy"]}, - {name: "vim", help: "编辑器", index: "web.wiki.word", args: ["usr/icebergs/misc/vim/vim.shy"]}, - {name: "tmux", help: "命令行", index: "web.wiki.word", args: ["usr/icebergs/misc/tmux/tmux.shy"]}, - ]}, - linux: {name: "系统 linux", list: [ - {name: "idc", help: "平台", index: "web.wiki.word", args: ["usr/linux-story/idc/idc.shy"]}, - {name: "iso", help: "系统", index: "web.wiki.word", args: ["usr/linux-story/iso/iso.shy"]}, - {name: "iot", help: "设备", index: "web.wiki.word", args: ["usr/linux-story/iot/iot.shy"]}, - {name: "cli", help: "命令", index: "web.wiki.word", args: ["usr/linux-story/cli/cli.shy"]}, - {name: "linux", help: "系统", index: "web.wiki.word", args: ["usr/linux-story/src/main.shy"]}, - ]}, - nginx: {name: "代理 nginx", list: [ - {name: "nginx", help: "代理", index: "web.wiki.word", args: ["usr/nginx-story/src/main.shy"]}, - ]}, - context: {name: "编程 context", list: [ - {name: "golang", help: "编程", index: "web.wiki.word", args: ["usr/golang-story/src/main.shy"]}, - ]}, - redis: {name: "缓存 redis", list: [ - {name: "redis", help: "缓存", index: "web.wiki.word", args: ["usr/redis-story/src/main.shy"]}, - {name: "kafka", help: "队列", index: "web.wiki.word", args: ["usr/redis-story/src/kafka/kafka.shy"]}, - ]}, - mysql: {name: "存储 mysql", list: [ - {name: "mysql", help: "数据存储", index: "web.wiki.word", args: ["usr/mysql-story/src/main.shy"]}, - {name: "clickhouse", help: "数据存储", index: "web.wiki.word", args: ["usr/mysql-story/src/clickhouse/clickhouse.shy"]}, - ]}, }}, profile: {name: "测试群", storm: { website: {name: "定制 website", index: [ diff --git a/panel/river.js b/panel/river.js index 69738177..c475363c 100644 --- a/panel/river.js +++ b/panel/river.js @@ -65,13 +65,13 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg, }) Volcanos("onengine", {help: "解析引擎", list: [], _engine: function(event, can, msg, panel, cmds, cb) { var list = can._root.river - cmds.length == 0 && can.core.Item(list, function(key, value) { + cmds.length == 0 && can.core.ItemSort(list, "order", function(key, value) { if (can.core.Item(value.storm).length == 0) { return } msg.Push({hash: key, name: can.user.language(can) == "en"? key: value.name}) // 群组列表 }); if (cmds.length != 1 && cmds[1] != chat.STORM) { return false } var river = list[cmds[0]]; if (!river) { return false } - can.core.Item(river.storm, function(key, value) { + can.core.ItemSort(river.storm, "order", function(key, value) { msg.Push({hash: key, name: can.user.language(can) == "en"? key: value.name}) // 应用列表 }), can.base.isFunc(cb) && cb(msg); return true }})