diff --git a/const.js b/const.js index 42d99726..f6498cb3 100644 --- a/const.js +++ b/const.js @@ -41,8 +41,8 @@ var ice = { MSG_RIVER: "sess.river", MSG_STORM: "sess.storm", MSG_COST: "sess.cost", MSG_MODE: "sess.mode", - MSG_NODETYPE: "node.type", TABLE_CHECKBOX: "table.checkbox", - FROM_DAEMON: "from.daemon", + MSG_NODETYPE: "node.type", MSG_NODENAME: "node.name", + TABLE_CHECKBOX: "table.checkbox", FROM_DAEMON: "from.daemon", PROCESS_REWRITE: "_rewrite", PROCESS_FIELD: "_field", @@ -390,6 +390,7 @@ var html = { CONFIRM: "confirm", CLOSE: "close", CLICK: "click", FOCUS: "focus", BLUR: "blur", TABLE: "table", THEAD: "thead", TBODY: "tbody", TR: "tr", TH: "th", TD: "td", HEADER: "header", NAV: "nav", MAIN: "main", ASIDE: "aside", FOOTER: "footer", + NEED: "need", MUST: "must", FAVICON: "favicon", BACKGROUND_COLOR: "background-color", COLOR: "color", diff --git a/frame.js b/frame.js index 2b308915..59b90f35 100644 --- a/frame.js +++ b/frame.js @@ -194,12 +194,9 @@ Volcanos(chat.ONAPPEND, { }) }) }), can.base.isFunc(cb) && cb(sub) if (sub.isOutputStyle()) { return } if (can.user.isMobile && !can.user.isLandscape()) { return } - sub.isCmdMode() && !can.base.isIn(meta.index, web.CODE_VIMER, web.CODE_INNER, web.CHAT_MACOS_DESKTOP) && can.page.insertBefore(can, [{view: "header", list: can.user.header(sub)}], sub._output, sub._fields||sub._target) - sub.isCmdMode() && can.onmotion.delay(can, function() { wx.ready(function () { - wx.updateAppMessageShareData({title: sub.Conf("help"), desc: "", link: location.href, imgUrl: sub.Conf(mdb.ICONS)}) - wx.updateTimelineShareData({title: sub.Conf("help"), link: location.href, imgUrl: sub.Conf(mdb.ICONS)}) - }) }, 300) - + if (!sub.isCmdMode()) { return } + !can.base.isIn(meta.index, web.CODE_VIMER, web.CODE_INNER, web.CHAT_MACOS_DESKTOP) && can.page.insertBefore(can, [{view: "header", list: can.user.header(sub)}], sub._output, sub._fields||sub._target) + can.user.agent.cmd = sub, can.user.agent.init && can.user.agent.init(sub) }); return sub }, _option: function(can, meta, option, skip) { var index = -1, args = can.base.Obj(meta.args||meta.arg, []), opts = can.base.Obj(meta.opts, {}) @@ -364,6 +361,8 @@ Volcanos(chat.ONAPPEND, { } msg.Defer(), can.base.isFunc(cb) && cb(msg), can.page.style(can, can._target, "visibility", ""), can._output.scrollTop = output_old.scrollTop, can._output.scrollLeft = output_old.scrollLeft can.page.style(can, can._output, "visibility", "", "position", ""), can.page.Remove(can, output_old) + can.isCmdMode() && (can.user.agent.cmd = can) + can.isCmdMode() && can.user.agent.init && can.user.agent.init(can) }, target: output}), msg.Defer() }) }, diff --git a/lib/user.js b/lib/user.js index 547d6156..d491db31 100644 --- a/lib/user.js +++ b/lib/user.js @@ -1,6 +1,5 @@ Volcanos("user", { agent: { - enableDebug: function(can) {}, getLocation: function(can, cb) { var call = arguments.callee; if (call._res) { return cb(call._res) } navigator.geolocation.getCurrentPosition(function(res) { cb(call._res = {type: "ip", name: "当前位置", text: "某某大街", latitude: res.coords.latitude.toFixed(6), longitude: res.coords.longitude.toFixed(6)}) @@ -10,10 +9,13 @@ Volcanos("user", { window.open("https://map.baidu.com/search/"+encodeURIComponent(msg.Option(mdb.TEXT)) +"/@12958750.085,4825785.55,16z?querytype=s&da_src=shareurl&wd="+encodeURIComponent(msg.Option(mdb.TEXT))) }, + chooseImage: function(can, cb, count) { can.base.isFunc(cb) && cb([]) }, + uploadImage: function(can, id, cb) {}, + previewImage: function(can, url, list) {}, + scanQRCode: function(can, cb) { can.user.input(event, can, [{type: html.TEXTAREA, name: mdb.TEXT, text: ""}], function(list) { cb(can.base.ParseJSON(list[0])) }) }, connectWifi: function(can, ssid, password, cb, cbs) {}, getClipboard: function(can, cb) {}, - scanQRCode: function(can, cb) { can.user.input(event, can, [{type: html.TEXTAREA, name: mdb.TEXT, text: ""}], function(list) { cb(can.base.ParseJSON(list[0])) }) }, - chooseImage: function(can, cb) { can.base.isFunc(cb) && cb([]) }, + enableDebug: function(can) {}, }, info: {}, isIPad: false, isTesla: navigator.userAgent.indexOf("Tesla") > -1, @@ -143,7 +145,7 @@ Volcanos("user", { } var input = can.page.Append(can, document.body, [{type: html.TEXTAREA, value: text}])._target can.onmotion.focus(can, input), document.execCommand("Copy"), can.page.Remove(can, input) - return can.user.toastSuccess(can, text, "copy success"), can.misc.Log(nfs.COPY, text), text + return can.user.toastSuccess(can, text, can.user.trans(can, "copy success", "复制成功")), can.misc.Log(nfs.COPY, text), text }, carte: function(event, can, meta, list, cb, parent, trans) { var msg = can.request(event); event = msg._event function remove_sub(carte) { carte._sub && can.page.Remove(can, carte._sub._target), delete(carte._sub) } parent? remove_sub(parent): can.onmotion.clearCarte(can) diff --git a/panel/header.js b/panel/header.js index 144fd858..3b00fb6a 100644 --- a/panel/header.js +++ b/panel/header.js @@ -72,8 +72,7 @@ Volcanos(chat.ONIMPORT, { }) Volcanos(chat.ONACTION, {_init: function(can) {}, onsize: function(can) { - can.ConfHeight(can._target.offsetHeight), can.ConfWidth(can._target.offsetWidth) - can.onimport.theme(can) + can.ConfHeight(can._target.offsetHeight), can.ConfWidth(can._target.offsetWidth), can.onimport.theme(can) }, onmain: function(can) { if (window.parent == window && can.misc.Search(can, ice.MSG_SESSID) && can.misc.CookieSessid(can, can.misc.Search(can, ice.MSG_SESSID)) && !can.user.isMailMaster) { @@ -86,22 +85,23 @@ Volcanos(chat.ONACTION, {_init: function(can) {}, function show(msg) { var p = can.misc.Search(can, "redirect_uri") if (p && location.pathname == web.BASIC_LOGIN) { return location.replace(can.base.MergeURL(p, ice.MSG_SESSID, can.misc.CookieSessid(can))) } var p = can.misc.Search(can, ice.BACK); if (p && location.pathname == web.CHAT_SSO) { return location.reload() } - can.user.info.usernick = can.Conf(aaa.USERNICK) - can.user.info.username = msg.Option(ice.MSG_USERNAME) - can.user.info.userrole = msg.Option(ice.MSG_USERROLE) can.user.info.nodetype = msg.Option(ice.MSG_NODETYPE) + can.user.info.nodename = msg.Option(ice.MSG_NODENAME) + can.user.info.userrole = msg.Option(ice.MSG_USERROLE) + can.user.info.username = msg.Option(ice.MSG_USERNAME) + can.user.info.usernick = can.Conf(aaa.USERNICK) can.user.info.repos = msg.Option(nfs.REPOS) can.user.info.email = msg.Option(aaa.EMAIL) can.user.info.avatar = msg.Option(aaa.AVATAR) can.user.info.background = msg.Option(aaa.BACKGROUND) - can.user.info.titles = msg.Option("titles")||document.title can.user.info.favicon = msg.Option("favicon") + can.user.info.titles = msg.Option("titles")||document.title lang(msg, function() { can.onmotion.clear(can), can.onimport._init(can, can.request(), can._output), can.onengine.signal(can, chat.ONLOGIN) }) } can.run(can.request({}, {_method: http.GET}), [], function(msg) { lang(msg) // can.page.requireModules(can, [msg.Option("icon.lib")]) can.ui.diy = can.base.Obj(msg.Option("diy"))||{}, can.__theme = can.onimport._theme(can, can.page.theme(function(theme) { - can.onengine.signal(can, chat.ONTHEMECHANGE, can.request(event, {theme: can.__theme = can.onimport._theme(can, theme)})) + can.onengine.signal(can, chat.ONTHEMECHANGE, can.request(event, {theme: can.__theme = can.onimport._theme(can, theme)})), can.onimport.theme(can) })), can.onimport.theme(can, can.misc.Search(can, "theme")||"") can.onaction._menus[3] = [aaa.LANGUAGE, ice.AUTO].concat(can.core.List(msg["language.list"], function(item) { return can.base.trimSuffix(item, nfs._JS) })) can.onaction._menus[2] = [chat.THEME, ice.AUTO].concat(can.core.List(msg["theme.list"], function(item) { return can.base.trimSuffix(item, nfs._CSS) }))