mirror of
https://shylinux.com/x/volcanos
synced 2025-04-25 16:58:06 +08:00
opt auto
This commit is contained in:
parent
568f0e96ac
commit
890a227ab1
2
const.js
2
const.js
@ -81,7 +81,7 @@ var web = {CHAT: "chat", PORTAL: "portal", STUDIO: "studio", SERVICE: "service",
|
||||
STATS: "stats", ADMIN: "admin",
|
||||
WORKER: "worker", SERVER: "server", GATEWAY: "gateway",
|
||||
ONLINE: "online", OFFLINE: "offline",
|
||||
OPEN: "open", LINK: "link", HTTP: "http", DOMAIN: "domain", URL: "url",
|
||||
FULL: "full", OPEN: "open", LINK: "link", HTTP: "http", DOMAIN: "domain", URL: "url",
|
||||
SHARE_CACHE: "/share/cache/", SHARE_LOCAL: "/share/local/",
|
||||
AT: ice.AT, QS: ice.QS,
|
||||
|
||||
|
28
frame.js
28
frame.js
@ -160,8 +160,6 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
back: {name: "goback", cb: function(event) { can.onimport.back(event, can) }},
|
||||
prev: {name: mdb.PREV, cb: function(event) { var sub = can.sub; sub.onaction && sub.onaction.prev? sub.onaction.prev(event, sub): can.onaction.prev(event, can) }},
|
||||
next: {name: mdb.NEXT, cb: function(event) { var sub = can.sub; sub.onaction && sub.onaction.next? sub.onaction.next(event, sub): can.onaction.next(event, can) }},
|
||||
// play: {name: web.PLAY},
|
||||
// favor: {name: "favor"},
|
||||
}[item.name||""]; if (!icon) { return } item.style = "icons"
|
||||
can.page.Append(can, option, [{view: [[html.ITEM, html.ICON, icon.name, item.name], html.DIV, can.page.unicode[icon.name]], title: can.user.trans(can, item.name), onclick: icon.cb||function(event) {
|
||||
var msg = can.request(event), cmds = [ctx.ACTION, item.name]; msg.RunAction(event, can.sub, cmds) || msg.RunAction(event, can, cmds) || can.Update(event, cmds)
|
||||
@ -179,9 +177,6 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
if (item.type == html.BUTTON && can.page.isIconInput(can, item.name)) {
|
||||
can.onappend.icons(can, sub._target, item.name, function(event) { can.Update(event, [ctx.ACTION, item.name].concat(can.page.SelectArgs(sub))) })
|
||||
}
|
||||
// item.type == html.BUTTON && can.onappend.icons(can, sub._target, can.Conf(["_icons", item.name]), function(event) {
|
||||
// can.Update(event, [ctx.ACTION, item.name].concat(can.page.SelectArgs(sub)))
|
||||
// })
|
||||
sub.run = function(event, cmds, cb, silent) { var msg = can.requestAction(event, item.name)._caller()
|
||||
msg.RunAction(event, sub, cmds) || msg.RunAction(event, can.sub, cmds) || can.Update(event, can.Input(cmds, !silent), cb, silent)
|
||||
}, can._inputs = can._inputs||{}, can._inputs[item.name] = sub, sub.sup = can
|
||||
@ -206,7 +201,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
var rest = list.slice(limit-1); list = list.slice(0, limit-1), list.push({type: html.BUTTON, name: "more", onclick: function(event) {
|
||||
can.user.carte(event, can, {_trans: meta._trans||can._trans}, can.core.List(rest, function(item) { return item.name }), function(event, button) { run(event, button) })
|
||||
}}) }
|
||||
return can.core.List(list, function(item) {
|
||||
can.core.List(list, function(item) {
|
||||
can.base.isUndefined(item) || can.onappend.input(can, item == ""? /* 1.空白 */ {type: html.BR}:
|
||||
can.base.isString(item)? /* 2.按键 */ {type: html.BUTTON, name: item, value: can.user.trans(can, item, meta._trans), onclick: function(event) {
|
||||
run(event, item)
|
||||
@ -218,7 +213,16 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
}, item._init = item._init||function(target) { item.action && can.onappend.figure(sub, item, target, function(_sub, value) { can.Update() })
|
||||
if (item.type == html.BUTTON && can.page.isIconInput(can, item.name)) { can.onappend.icons(can, target, item.name) }
|
||||
}), item), "", action)
|
||||
}), meta
|
||||
})
|
||||
var _can = can._fields? can.sup: can
|
||||
can.isCmdMode() || can.base.beginWith(can.ConfIndex(), "can.") || can.page.tagis(can._fields||can._target, html.FIELDSET_PANEL, html.FIELDSET_PLUG) || action == can._action && can.page.Append(can, action,
|
||||
can.core.Item({full: "切换全屏", open: "打开链接"}, function(key, value) {
|
||||
return {view: [[html.ITEM, html.BUTTON, key, "icons"]], list: [{icon: icon[key]}], title: can.user.trans(can, key), onclick: function(event) {
|
||||
_can.onaction[value](event, _can, value, _can.sub)
|
||||
}}
|
||||
})
|
||||
)
|
||||
return meta
|
||||
},
|
||||
_output0: function(can, meta, event, cmds, cb, silent) { var msg = can.request(event); meta.feature = meta.feature||{}
|
||||
if (msg.Option(ice.MSG_HANDLE) != ice.TRUE && cmds && cmds[0] == ctx.ACTION) { if (msg.RunAction(event, can.sub, cmds)) { return } }
|
||||
@ -273,13 +277,13 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
},
|
||||
_status: function(can, list, status, msg) { status = status||can._status, can.onmotion.clear(can, status); var keys = {}
|
||||
var fileline = can.base.trimPrefix((can.Conf("_fileline")||"").split("?")[0], "/require/")
|
||||
can.core.List((can.base.Obj(list, can.core.Value(can, [chat.ONEXPORT, mdb.LIST]))||[]).concat(can.misc.Search(can, log.DEBUG)==ice.TRUE? [
|
||||
can.core.List((can.base.Obj(list, can.core.Value(can, [chat.ONEXPORT, mdb.LIST]))||[]).concat([
|
||||
can.ConfSpace() && {name: web.SPACE, value: can.ConfSpace()},
|
||||
], can.misc.Search(can, log.DEBUG)==ice.TRUE? [
|
||||
can.Conf("_fileline") && {name: nfs.SOURCE, value: fileline, onclick: function(event) { can.onkeymap.prevent(event)
|
||||
var ls = can.misc.SplitPath(can, fileline); if (event.metaKey) {
|
||||
can.user.open(can.misc.MergePodCmd(can, {pod: can.ConfSpace(), cmd: web.CODE_VIMER, path: ls[0], file: ls[1]}))
|
||||
} else {
|
||||
can.onappend._float(can, web.CODE_VIMER, ls)
|
||||
}
|
||||
} else { can.onappend._float(can, web.CODE_VIMER, ls) }
|
||||
}},
|
||||
{name: html.HEIGHT, value: can.ConfHeight(), onclick: function(event) { can.onappend._float(can, {index: "can.view", _target: can._fields||can._target}) }},
|
||||
{name: html.WIDTH, value: can.ConfWidth(), onclick: function(event) { can.onappend._float(can, {index: "can.data", _target: can}) }},
|
||||
@ -728,7 +732,7 @@ Volcanos(chat.ONMOTION, {_init: function(can, target) {
|
||||
scrollHold: function(can, cb, target) { target = target || can._output; var left = target.scrollLeft; cb(), target.scrollLeft = left },
|
||||
scrollIntoView: function(can, target, margin) { if (can._scroll) { return } can._scroll = true, margin = margin||0
|
||||
var offset = (target.offsetTop-margin) - target.parentNode.scrollTop, step = offset < 0? -20: 20
|
||||
if (Math.abs(offset) > 1000) {
|
||||
if (Math.abs(offset) > 3000) {
|
||||
return target.parentNode.scrollTop = (target.offsetTop-margin), delete(can._scroll)
|
||||
}
|
||||
can.core.Timer({interval: 10, length: offset/step}, function() {
|
||||
|
@ -35,9 +35,10 @@ body {
|
||||
|
||||
--river-width:var(--project-width); --project-width:230px; --input-width:120px; --button-width:60px;
|
||||
--action-height:32px; --status-height:var(--action-height); --footer-height:var(--action-height); --header-height:48px;
|
||||
--plug-width:800px; --plug-height:480px; --story-height:var(--plug-height); --float-height:var(--story-height); --float-width:1000px; --desktop-width:1200px; --desktop-height:684px;
|
||||
--textarea-height:96px; --qrcode-height:360px; --iframe-height:420px; --desktop-icon-size:80px;
|
||||
--river-margin:80px; --action-margin:200px;
|
||||
--desktop-height:684px; --float-height:480px; --plug-height:var(--story-height); --story-height:var(--float-height);
|
||||
--desktop-width:1200px; --float-width:1200px; --plug-width:800px;
|
||||
--textarea-height:96px; --qrcode-height:360px; --iframe-height:420px;
|
||||
--river-margin:80px; --action-margin:200px; --desktop-icon-size:80px;
|
||||
--plugin-padding:10px; --plugin-margin:var(--plugin-padding);
|
||||
--legend-padding:20px; --title-margin:var(--legend-padding);
|
||||
--button-padding:var(--plugin-padding); --button-margin:var(--button-padding);
|
||||
|
@ -287,7 +287,7 @@ Volcanos("page", {
|
||||
tagis: function(target) { if (!target || !target.tagName) { return }
|
||||
function isin(ls, list) {
|
||||
for (var i = 0; i < ls.length; i++) { var has = false
|
||||
for (var j = 0; j < list; j++) { if (ls[i] == list[j]) { has = true } }
|
||||
for (var j = 0; j < list.length; j++) { if (ls[i] == list[j]) { has = true } }
|
||||
if (!has) { return false }
|
||||
} return true
|
||||
}
|
||||
|
25
lib/user.js
25
lib/user.js
@ -1,7 +1,6 @@
|
||||
Volcanos("user", {
|
||||
agent: {
|
||||
enableDebug: function(can) {
|
||||
},
|
||||
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)})
|
||||
@ -31,7 +30,7 @@ Volcanos("user", {
|
||||
isLocalFile: location && location.protocol && location.protocol == "file:",
|
||||
isLandscape: function() { return window.innerWidth > window.innerHeight },
|
||||
mod: {
|
||||
isPod: location && location.pathname && (location.pathname.indexOf(web.CHAT_POD) == 0 || location.pathname.indexOf("/x/") == 0),
|
||||
isPod: location && location.pathname && (location.pathname.indexOf(web.CHAT_POD) == 0 || location.pathname.indexOf("/x/") == 0 || location.pathname.indexOf("/s/") == 0),
|
||||
isCmd: location && location.pathname && (location.pathname.indexOf(web.CHAT_POD) == 0 && location.pathname.indexOf("/cmd/") > 0
|
||||
|| location.pathname.indexOf(web.CHAT_CMD) == 0 || location.pathname.indexOf(nfs.WIKI_PORTAL) == 0
|
||||
),
|
||||
@ -58,7 +57,7 @@ Volcanos("user", {
|
||||
can.user.mod.isCmd && name.push(chat.CMD), can.user.mod.cmd && name.push(can.user.mod.cmd.replaceAll(".", " "))
|
||||
can.user.isMobile && name.push(html.MOBILE) && can.user.isLandscape() && name.push(html.LANDSCAPE)
|
||||
can.user.isWebview && name.push(html.WEBVIEW), can.user.isWindows && name.push("windows")
|
||||
name.push("width"+parseInt((can.page.width()+32)/320))
|
||||
name.push(html.WIDTH+parseInt((can.page.width()+32)/320))
|
||||
can.page.styleClass(can, document.body, name.join(lex.SP))
|
||||
},
|
||||
title: function(text) { if (window.webview) { return title(text) } return text && (document.title = text), document.title },
|
||||
@ -71,7 +70,6 @@ Volcanos("user", {
|
||||
return can.core.Value(list, key) || can.core.Value(can._trans, key) ||
|
||||
can.Conf(["trans", key]) || can.Conf(["feature._trans", key]) ||
|
||||
can.core.Value(can.user._trans, key) || text
|
||||
|
||||
}, _trans: {"_week_header": ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]},
|
||||
time: function(can, time, fmt) { var now = can.base.Date(time), list = can.user._trans["_week_header"]
|
||||
return fmt == "%W"? list: can.base.Time(time, (fmt||"%y-%m-%d %H:%M:%S").replace("%w", list[now.getDay()]))
|
||||
@ -110,16 +108,11 @@ Volcanos("user", {
|
||||
}, function() { action.close() }), _target: ui._target,
|
||||
}); can.onmotion.story.auto(can, ui._target), meta.resize && can.onmotion.delayResize(can, ui._target, meta.resize)
|
||||
if (meta.action && meta.action.length == 1 && meta.action[0] === "") {
|
||||
can.page.Select(can, action._target, html.DIV_ACTION, function(target) {
|
||||
can.onmotion.hidden(can, target)
|
||||
})
|
||||
}
|
||||
return can._toast && (can._toast.close(), delete(can._toast)), can._toast = action
|
||||
can.page.Select(can, action._target, html.DIV_ACTION, function(target) { can.onmotion.hidden(can, target) })
|
||||
} return can._toast && (can._toast.close(), delete(can._toast)), can._toast = action
|
||||
},
|
||||
space: function(can) { return can.Conf(web.SPACE)||can.Conf(ice.POD)||can.misc.Search(can, ice.POD) },
|
||||
template: function(can, file) {
|
||||
return can.base.MergeURL(can.base.Path(nfs.SRC_TEMPLATE, can.Conf(ctx.INDEX), file), ice.POD, can.user.space(can))
|
||||
},
|
||||
template: function(can, file) { return can.base.MergeURL(can.base.Path(nfs.SRC_TEMPLATE, can.Conf(ctx.INDEX), file), ice.POD, can.user.space(can)) },
|
||||
share: function(can, msg, cmds) { can.page.exportValue(can, msg)
|
||||
can.run(msg, cmds||[ctx.ACTION, chat.SHARE], function(msg) { can.user.copy(msg._event, can, msg.Append(mdb.NAME))
|
||||
can.user.toast(can, {title: msg.Append(mdb.NAME), duration: -1, content: msg.Append(mdb.TEXT), action: [cli.CLOSE, cli.OPEN], resize: html.IMG})
|
||||
@ -167,8 +160,7 @@ Volcanos("user", {
|
||||
], onmouseenter: subs, onclick: subs}
|
||||
}
|
||||
return item
|
||||
})}]); can.onkeymap.prevent(event), can.page.Select(can, ui._target, html.IMG, function(target) { target.onload = function() {
|
||||
can.onlayout.figure(event, can, ui._target) } })
|
||||
})}]); can.onkeymap.prevent(event), can.page.Select(can, ui._target, html.IMG, function(target) { target.onload = function() { can.onlayout.figure(event, can, ui._target) } })
|
||||
var carte = {_target: ui._target, _parent: parent, layout: can.onlayout.figure(event, can, ui._target, parent, 200), close: function() { can.page.Remove(can, ui._target) }}
|
||||
return parent && (parent._sub = carte), carte
|
||||
},
|
||||
@ -188,7 +180,6 @@ Volcanos("user", {
|
||||
item = can.base.isString(item)? {type: html.TEXT, name: item}: item.length > 0? {type: html.SELECT, name: item[0], values: item.slice(1)}: item
|
||||
item.type = item.type||(item.values? html.SELECT: item.name == html.TEXT? html.TEXTAREA: html.TEXT), need[item.name] = item.need
|
||||
item._init = function(target) {
|
||||
// if (item.type == html.SELECT) { target.value = item.value||item.values[0]; return can.onmotion.delay(can, function() { can.onappend.select(can, target, item) }) }
|
||||
if (item.name && item.name != ctx.ACTION) { target.value = item.value||msg.Option(item.name)||can.Option(item.name)||can.Status(item.name)||target.value||"" }
|
||||
item.mode = chat.SIMPLE, can.onappend.figure(can, can.base.Copy({space: msg.Option(web.SPACE), run: function(event, cmds, cb) { var _msg = can.request(event, {_handle: ice.TRUE, action: msg.Option(html.ACTION)}, msg, can.Option())
|
||||
can.page.Select(can, ui.table, html.OPTION_ARGS, function(item) { item.name && item.value && _msg.Option(item.name, item.value) })
|
||||
@ -303,7 +294,7 @@ Volcanos("user", {
|
||||
}; return can.core.List(can.base.getValid(can.core.List(arguments).slice(1), [html.SPACE, mdb.TIME, aaa.AVATAR, aaa.USERNICK]), function(item) { return meta[item] })
|
||||
},
|
||||
email: function(can) {
|
||||
can.page.Select(can, document.body, "iframe", function(target) {
|
||||
can.page.Select(can, document.body, html.IFRAME, function(target) {
|
||||
can.page.style(can, target, html.HEIGHT, can.page.height())
|
||||
can.page.style(can, target, html.WIDTH, can.page.width())
|
||||
})
|
||||
|
@ -11,6 +11,7 @@ Volcanos(chat.ONIMPORT, {
|
||||
_inner: function(can, sub, msg) { can.onappend.table(sub, msg), can.onappend.board(sub, msg), can.onmotion.story.auto(sub) },
|
||||
_field: function(can, msg, cb) { var height = can.base.Max(html.STORY_HEIGHT, can.ConfHeight()), width = can.ConfWidth()
|
||||
msg.Table(function(item) { can.onappend._plugin(can, item, {_space: can.ConfSpace(), index: item.index, args: can.base.Obj(item.args||item.arg, []), height: height, width: width}, function(sub) {
|
||||
if (can.base.isIn(sub.ConfIndex(), web.CODE_VIMER, web.CHAT_MACOS_DESKTOP, web.WIKI_PORTAL)) { height = can.base.Max(can.onexport.outputHeight(can), can.ConfHeight()) }
|
||||
can.onmotion.delay(can, function() { can.onmotion.scrollIntoView(can, sub._target) }, 300)
|
||||
sub.run = function(event, cmds, cb) { var index = msg.Option(ice.MSG_INDEX)
|
||||
can.run(event, (!index || index == can._index || index.indexOf("can.") == 0? msg[ice.MSG_PREFIX]||[]: [ctx.RUN, index]).concat(cmds), cb, true)
|
||||
|
Loading…
x
Reference in New Issue
Block a user