mirror of
https://shylinux.com/x/volcanos
synced 2025-04-25 16:58:06 +08:00
opt some
This commit is contained in:
parent
fe17b61034
commit
3888cd8593
63
frame.js
63
frame.js
@ -146,6 +146,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
}) })
|
||||
}), can.base.isFunc(cb) && cb(sub)
|
||||
sub.isCmdMode() && can.onappend.style(sub, can.misc.Search(can, ctx.STYLE))
|
||||
sub.isCmdMode() && sub.Conf(can.misc.Search(can))
|
||||
if (can.user.isMobile && !can.user.isLandscape()) { return }
|
||||
if (can.page.ClassList.has(can, sub._target, html.OUTPUT)) { return }
|
||||
sub.isCmdMode() && !can.base.isIn(meta.index, web.CODE_VIMER, web.CODE_INNER, web.WIKI_WORD, web.CHAT_MACOS_DESKTOP) && can.page.insertBefore(can, can.user.header(can), sub._output, sub._fields)
|
||||
@ -174,7 +175,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
msg.RunAction(event, can.core.Value(can, chat._OUTPUTS_CURRENT), cmds) || msg.RunAction(event, can, cmds) || can.Update(event, cmds)
|
||||
}}])
|
||||
})
|
||||
can.core.List(args.slice(can.core.List(meta.inputs, function(item) { if (item.type == mdb.TEXT) { return item } }).length), function(item, index) { meta.inputs.push({type: mdb.TEXT, name: "args"+index, value: item}) })
|
||||
can.core.List(args.slice(can.core.List(meta.inputs, function(item) { if (can.base.isIn(item.type, mdb.TEXT, mdb.SELECT)) { return item } }).length), function(item, index) { meta.inputs.push({type: mdb.TEXT, name: "args"+index, value: item}) })
|
||||
function add(item, next) { item = can.base.isString(item)? {type: html.TEXT, name: item}: item, item.type != html.BUTTON && index++
|
||||
return Volcanos(item.name, {_root: can._root, _follow: can.core.Keys(can._follow, item.name),
|
||||
_target: can.onappend.input(can, item, args[index]||opts[item.name], option||can._option), _option: option||can._option, _action: can._action, _output: can._output, _status: can._status,
|
||||
@ -406,6 +407,9 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
||||
},
|
||||
board: function(can, text, target) { text && text.Result && (text = text.Result()); if (!text) { return }
|
||||
var code = can.page.Append(can, target||can._output, [{text: [can.page.Color(text), html.DIV, html.CODE]}]).code
|
||||
can.page.SelectChild(can, code, "iframe", function(target) {
|
||||
can.page.style(can, target, html.HEIGHT, can.ConfHeight(), html.WIDTH, can.ConfWidth())
|
||||
})
|
||||
if (text.indexOf("<fieldset") > 0) {
|
||||
can.page.Select(can, target, html.FIELDSET, function(target) { var data = target.dataset
|
||||
data.index && can.onappend.plugin(can, {index: data.index}, function(sub) {
|
||||
@ -660,7 +664,6 @@ Volcanos(chat.ONMOTION, {_init: function(can, target) {
|
||||
can.user.copy(event, can, target.innerText), can.base.isFunc(cb) && cb(event)
|
||||
can.onkeymap.prevent(event)
|
||||
} },
|
||||
move: function(can, target, layout) { layout && can.page.style(can, target, layout), can.onappend.style(can, "move", target) },
|
||||
hide: function(can, time, cb, target) { target = target||can._target, can.page.style(can, target, html.OPACITY, 1)
|
||||
time = can.base.isObject(time)? time: {value: 10, length: time||20}
|
||||
can.core.Timer(time, function(event, value, index) { can.page.style(can, target, html.OPACITY, 1-(index+1)/time.length) },
|
||||
@ -670,23 +673,20 @@ Volcanos(chat.ONMOTION, {_init: function(can, target) {
|
||||
time = can.base.isObject(time)? time: {interval: 10, length: time||30}
|
||||
can.core.Timer(time, function(event, value, index) { can.page.style(can, target, html.OPACITY, (index+1)/time.length) }, cb)
|
||||
},
|
||||
resize: function(can, _window, cb, top) { var target, begin, action
|
||||
function findTarget(event) { for (var target = event.target; target; target = target.parentNode) { if (target == document.body) { target = null; return }
|
||||
if (can.page.tagis(event.target, html.INPUT, html.TEXTAREA, html.TABLE, html.TR)) { target = null; return }
|
||||
if (can.page.ClassList.has(can, target, "item")) { return }
|
||||
if (can.page.tagis(target, html.FIELDSET) || can.page.ClassList.has(can, target, "move")) { break }
|
||||
} return target }
|
||||
_window.onmousedown = function(event) { target = findTarget(event); if (!target) { return }
|
||||
move: function(can, target, layout) { layout && can.page.style(can, target, layout), can.onmotion.resize(can, target, function() {}) },
|
||||
resize: function(can, target, cb, top) { var begin, action
|
||||
target.onclick = function() { can.onkeymap.prevent(event) }
|
||||
target.onmousedown = function(event) {
|
||||
for (var _target = event.target; _target; _target = _target.parentNode) { if (_target == target) { break }
|
||||
if (can.page.tagis(_target, html.INPUT, html.TEXTAREA, html.TR)) { return }
|
||||
if (can.page.ClassList.has(can, _target, html.ITEM)) { return }
|
||||
}
|
||||
can.onkeymap.prevent(event)
|
||||
begin = {left: target.offsetLeft, top: target.offsetTop, width: target.offsetWidth, height: target.offsetHeight, x: event.x, y: event.y}
|
||||
can.page.SelectChild(can, target.parentNode, html.FIELDSET, function(target) { can.page.style(can, target, "z-index") && can.page.style(can, target, "z-index", 9) }), can.page.style(can, target, "z-index", 10)
|
||||
window._scroll = _window.onmousemove
|
||||
}, _window.onmouseup = function(event) { target = null, begin = {}, delete(window._scroll) }
|
||||
_window.onmousemove = function(event) {
|
||||
if (window._scroll && target) { can.onkeymap.prevent(event)
|
||||
function move() { can.page.style(can, target,
|
||||
html.LEFT, can.base.Min(begin.left + event.x - begin.x, 0, window.innerWidth-target.offsetWidth),
|
||||
html.TOP, can.base.Min(begin.top + event.y - begin.y, top||0, window.innerHeight-html.ACTION_HEIGHT)
|
||||
) }
|
||||
window._mousemove = target.onmousemove
|
||||
}, target.onmouseup = function(event) { begin = null, delete(window._mousemove) }
|
||||
target.onmousemove = function(event) {
|
||||
if (begin) { can.onkeymap.prevent(event)
|
||||
switch (action) {
|
||||
case "left":
|
||||
can.page.style(can, target, html.LEFT, can.base.Min(begin.left + event.x - begin.x, 0, window.innerWidth-target.offsetWidth))
|
||||
@ -702,23 +702,18 @@ Volcanos(chat.ONMOTION, {_init: function(can, target) {
|
||||
case "bottom":
|
||||
cb? cb(begin.height + event.y - begin.y, target.offsetWidth): can.page.style(can, target, html.HEIGHT, begin.height + event.y - begin.y)
|
||||
break
|
||||
default: move()
|
||||
}
|
||||
} else { var _target = findTarget(event); if (!_target) { return }
|
||||
var x = event.x - _target.offsetLeft, y = event.y - _target.offsetTop, margin = 20
|
||||
if (-margin < x && x < margin) { action = "left"
|
||||
can.page.style(can, _target, "cursor", "ew-resize")
|
||||
} else if (_target.offsetWidth-margin < x && x < _target.offsetWidth+margin) { action = "right"
|
||||
can.page.style(can, _target, "cursor", "ew-resize")
|
||||
} else if (_target.offsetHeight-margin < y && y < _target.offsetHeight+margin) { action = "bottom"
|
||||
can.page.style(can, _target, "cursor", "ns-resize")
|
||||
} else if (-margin < y && y < margin) { action = "top"
|
||||
can.page.style(can, _target, "cursor", "ns-resize")
|
||||
} else if (margin < y && y < (can._fields? can.sup: can).onexport.actionHeight(can._fields? can.sup: can)) { action = "top"
|
||||
can.page.style(can, _target, "cursor", "move")
|
||||
} else { action = ""
|
||||
can.page.style(can, _target, "cursor", "")
|
||||
default:
|
||||
can.page.style(can, target,
|
||||
html.LEFT, can.base.Min(begin.left + event.x - begin.x, 0, window.innerWidth-target.offsetWidth),
|
||||
html.TOP, can.base.Min(begin.top + event.y - begin.y, top||0, window.innerHeight-html.ACTION_HEIGHT)
|
||||
)
|
||||
}
|
||||
} else { var p = can.page.position(event, target), margin = 20, cursor = ""
|
||||
if (p.x < margin) { cursor = "ew-resize", action = "left"
|
||||
} else if (target.offsetWidth-margin < p.x) { cursor = "ew-resize", action = "right"
|
||||
} else if (target.offsetHeight-margin < p.y) { cursor = "ns-resize", action = "bottom"
|
||||
} else if (p.y < margin) { cursor = "ns-resize", action = "top"
|
||||
} else { cursor = "", action = "" } can.page.style(can, target, "cursor", cursor)
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -22,6 +22,7 @@ img { margin-bottom:-8px; }
|
||||
/* fieldset */
|
||||
fieldset>legend { margin-right:10px; }
|
||||
fieldset>form.option>div.item { margin-right:10px; }
|
||||
fieldset>form.option>div.item.select>input { min-width:80px; }
|
||||
fieldset>div.action>div.item { margin-right:10px; }
|
||||
fieldset.input>legend { display:none; }
|
||||
fieldset.input.key div.action { display:none; }
|
||||
@ -279,10 +280,11 @@ fieldset.draw div.output svg { margin-bottom:-4px; }
|
||||
fieldset.draw.trend div.output svg { background-color:#1b5b738c; }
|
||||
fieldset.draw.spide div.output svg text { cursor:pointer; }
|
||||
fieldset.draw.spide div.output svg path { stroke-width:1; }
|
||||
fieldset.web.chat.iframe>div.output { overflow:hidden; }
|
||||
// fieldset.web.chat.iframe>div.output { overflow:hidden; }
|
||||
fieldset.web.code.git.status>div.output table.content { width:100%; }
|
||||
fieldset.can.view { font-size:14px; }
|
||||
fieldset.can.data { font-size:14px; }
|
||||
img, iframe { margin-bottom:-4px; }
|
||||
/* scrollbar */
|
||||
div.scrollbar { background-color:#0000ff66; width:10px; position:absolute; right:0; top:0; transition:width .3s 1s; visibility:hidden; }
|
||||
div.scrollbar:hover { width:50px; transition:width .1s;}
|
||||
|
@ -301,11 +301,12 @@ Volcanos("page", {
|
||||
requireDraw: function(can, cb) { can.require(["/plugin/local/wiki/draw.js", "/plugin/local/wiki/draw/path.js"], function() {
|
||||
can.onimport._last_init(can, can.request(), can._output), can.onappend.style(can, wiki.DRAW, can._fields), cb()
|
||||
}) },
|
||||
drawText: function(can, text, size, margin) { text = text.slice(0, 1), size = size||80, margin = margin||10
|
||||
drawText: function(can, text, size, margin, fonts) { text = text.slice(0, 1), size = size||80, margin = margin == undefined? 10: margin
|
||||
var colors = ["rgb(239,150,26)", 'rgb(255,58,201)', "rgb(111,75,255)", "rgb(36,174,34)", "rgb(80,80,80)"]
|
||||
var canvas = can.page.Create(can, html.CANVAS, {width: size, height: size}), ctx = canvas.getContext("2d")
|
||||
ctx.fillStyle = colors[Math.floor(Math.random()*(colors.length))], ctx.fillRect(margin, margin, size-2*margin, size-2*margin)
|
||||
ctx.fillStyle = cli.WHITE, ctx.font = (size/text.length-30)+"px Arial", ctx.textAlign = "center", ctx.textBaseline = "middle", ctx.fillText(text, size/2, size/2)
|
||||
ctx.fillStyle = cli.WHITE, ctx.font = (fonts||can.base.Min(size/text.length-30, 16))+"px Arial", ctx.textAlign = "center", ctx.textBaseline = "middle", ctx.fillText(text, size/2, size/2)
|
||||
return canvas.toDataURL(nfs.IMAGE_PNG, 1)
|
||||
},
|
||||
position: function(event, target) { var p = target.getBoundingClientRect(); return {x: event.clientX - p.x, y: event.clientY - p.y} },
|
||||
})
|
||||
|
@ -14,7 +14,9 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) {
|
||||
}, _init: function(target) { item == mdb.TIME && can.onimport._time(can, target) }}])
|
||||
}) },
|
||||
_avatar: function(can, msg) { can.user.isExtension || can.user.isLocalFile || can.page.Modify(can, "div.state.avatar>img", {src: can.onexport.avatar(can)}) },
|
||||
_background: function(can, msg) { window.parent != window || can.user.isExtension || can.user.isLocalFile || can.onlayout.background(can, can.onexport.background(can)) },
|
||||
_background: function(can, msg) { if (can.user.isExtension || can.user.isLocalFile) { return }
|
||||
window.parent == window? can.onlayout.background(can, can.onexport.background(can)): can.page.style(can, document.body, html.BACKGROUND_COLOR, "transparent")
|
||||
},
|
||||
_search: function(can, msg, target) {
|
||||
can._search = can.onappend.input(can, {type: html.TEXT, name: mdb.SEARCH, onkeydown: function(event) { can.onkeymap.input(event, can)
|
||||
event.key == lang.ENTER && can.onengine.signal(can, chat.ONOPENSEARCH, can.request(event, {type: mdb.FOREACH, word: event.target.value||""}))
|
||||
|
@ -5,7 +5,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg) { can.onmotion.clear(can, can
|
||||
can.onmotion.toggle(can, can._status, can.db.type != mdb.FOREACH) && can.onappend._status(can, can.base.Obj(msg.Option(ice.MSG_STATUS), []).concat({name: mdb.SELECT, value: "0"}))
|
||||
can.onmotion.focus(can, can.ui.filter), msg.Length() == 1 && can.ui.profile.innerHTML == "" && can.page.Select(can, table, html.TD)[0].click()
|
||||
},
|
||||
_size: function(can) { can.getActionSize(function(left, top, width, height) {
|
||||
_size: function(can) { can.ui && can.getActionSize(function(left, top, width, height) {
|
||||
can.page.style(can, can._target, {left: left||0, top: top||0, width: width}), can.page.style(can, can._output, html.MAX_HEIGHT, height -= 2*html.PLUGIN_MARGIN+html.ACTION_HEIGHT+can.onexport.statusHeight(can))
|
||||
can.core.List([can.ui.content, can.ui.display], function(target) { can.page.style(can, target, html.MAX_WIDTH, can.ConfWidth(width-2*html.PLUGIN_MARGIN)) })
|
||||
can.ConfHeight(can.base.Min(height-can.ui.content.offsetHeight-can.ui.display.offsetHeight-html.ACTION_HEIGHT, height/2))
|
||||
@ -21,6 +21,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg) { can.onmotion.clear(can, can
|
||||
},
|
||||
})
|
||||
Volcanos(chat.ONACTION, {_init: function(can) { can.onmotion.hidden(can) }, list: [cli.CLOSE, cli.CLEAR, cli.DONE],
|
||||
onsize: function(can, msg, height, width) { can.onimport._size(can), can.core.List(can._plugins, function(sub) { sub.onimport.size(sub, can.ConfHeight(), can.ConfWidth(), true) }) },
|
||||
onlogin: function(can, msg) { can.ui = can.page.Append(can, can._output, [chat.CONTENT, {view: [[chat.DISPLAY, chat.CONTENT], html.TABLE]}, chat.PROFILE])
|
||||
can.onappend._action(can, (can.Conf(html.ACTION)||can.onaction.list).concat({type: html.TEXT, name: html.FILTER, _init: function(target) { can.ui.filter = target }, onkeydown: function(event) {
|
||||
if (event.key == lang.ESCAPE) { return event.target.blur() }
|
||||
@ -54,6 +55,6 @@ Volcanos(chat.ONACTION, {_init: function(can) { can.onmotion.hidden(can) }, list
|
||||
can.onappend.plugin(can, meta, function(sub) { can._plugins = (can._plugins||[]).concat(sub), sub.onimport.size(sub, can.ConfHeight(), can.ConfWidth()-1, true), sub.Focus() }, can.ui.profile)
|
||||
},
|
||||
})
|
||||
Volcanos(chat.ONEXPORT, {statusHeight: function(can) { return can.db.type == mdb.FOREACH? 0: html.ACTION_HEIGHT },
|
||||
Volcanos(chat.ONEXPORT, {statusHeight: function(can) { return can.db && can.db.type == mdb.FOREACH? 0: html.ACTION_HEIGHT },
|
||||
select: function(can) { return can.page.Select(can, can.ui.display, html.TR, function(tr) { return can.page.Select(can, tr, html.TD, function(td) { return td.innerHTML }) }).slice(1) },
|
||||
})
|
||||
|
@ -1,8 +1,10 @@
|
||||
Volcanos(chat.ONIMPORT, {_init: function(can, msg) {
|
||||
can.current = msg.TableDetail(), can.onimport.layout(can)
|
||||
can.current = msg.TableDetail()
|
||||
can.target = can.page.Appends(can, can._output, [{type: html.IFRAME, src: can.current.link, height: can.ConfHeight(), width: can.ConfWidth(), style: {border: 0}}])._target
|
||||
can.onimport.layout(can)
|
||||
},
|
||||
layout: function(can) { var item = can.current; can.sup.onexport.title(can, item.name||item.link.split(mdb.QS)[0])
|
||||
var target = can.page.Appends(can, can._output, [{type: html.IFRAME, src: item.link, height: can.ConfHeight(), width: can.ConfWidth(), style: {border: 0}}])._target
|
||||
can.page.style(can, can.target, html.HEIGHT, can.ConfHeight(), html.WIDTH, can.ConfWidth())
|
||||
},
|
||||
})
|
||||
Volcanos(chat.ONACTION, {open: function(event, can) { can.user.open(can.current.link) }})
|
||||
|
@ -302,6 +302,7 @@ Volcanos(chat.ONSYNTAX, {_init: function(can, msg, cb) { var key = can.onexport.
|
||||
_index: function(can, msg, cb, parent) { if (can.onsyntax._space(can, msg, cb, parent)) { return }
|
||||
var index = msg.Option(ctx.INDEX).split(mdb.FS), item = {type: chat.STORY, index: index[0], args: index.slice(1)}
|
||||
if (item.index == web.CODE_XTERM && item.args.length > 0) { item.style = html.OUTPUT }
|
||||
if (item.index == web.CHAT_MACOS_SESSION && item.args.length > 0) { item.style = html.OUTPUT }
|
||||
can.onimport.plug(can, item, function(sub) { sub.onimport.size(sub, can.ui.content.offsetHeight, can.ui.content.offsetWidth, true)
|
||||
sub.onimport._open = function(_, msg, arg) {
|
||||
var link = can.misc.ParseURL(can, arg); if (link.pod && arg.indexOf(location.origin) == 0) { can.onimport.tabview(can, "", link.pod, web.SPACE), sub.Update(); return }
|
||||
|
@ -21,7 +21,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb, target) { can.onmotion.cl
|
||||
layout: function(can) {
|
||||
can.page.style(can, can.ui.display, html.WIDTH, can.ConfWidth()-can.ui.project.offsetWidth-1)
|
||||
can.page.style(can, can.ui.project, html.HEIGHT, can.ui.display.offsetHeight)
|
||||
can.page.style(can, can.ui.display, html.WIDTH, "")
|
||||
// can.page.style(can, can.ui.display, html.WIDTH, "")
|
||||
},
|
||||
}, [""])
|
||||
Volcanos(chat.ONFIGURE, {
|
||||
|
@ -82,6 +82,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear(
|
||||
zone._icon(kit.Dict(
|
||||
can.page.unicode.refresh, function(event) { sub.Update(event) },
|
||||
"+", function(event) { sub.Update(event, [ctx.ACTION, mdb.CREATE]) },
|
||||
"=", function() { can.onimport.tabview(can, "", sub._index, ctx.INDEX) },
|
||||
))
|
||||
sub.onexport.output = function(sub, msg) { zone._total(msg.Length()), cb(sub, msg)
|
||||
zone._menu = shy({_trans: sub._trans}, action.concat(can.base.Obj(msg.Option(ice.MSG_ACTION), [])), function(event, button, meta, carte) {
|
||||
|
6
proto.js
6
proto.js
@ -89,13 +89,13 @@ var web = {CHAT: "chat",
|
||||
IMAGE_PNG: "image/png", VIDEO_WEBM: "video/webm",
|
||||
|
||||
CHAT_MACOS_DESKTOP: "web.chat.macos.desktop",
|
||||
CHAT_MACOS_SESSION: "web.chat.macos.session",
|
||||
CODE_GIT_REPOS: "web.code.git.repos", CODE_GIT_STATUS: "web.code.git.status",
|
||||
CHAT_FAVOR: "web.chat.favor",
|
||||
CODE_XTERM: "web.code.xterm", CODE_VIMER: "web.code.vimer", CODE_INNER: "web.code.inner",
|
||||
WIKI_WORD: "web.wiki.word", WIKI_DRAW: "web.wiki.draw", WIKI_FEEL: "web.wiki.feel",
|
||||
TEAM_PLAN: "web.team.plan",
|
||||
UPDATE: "update",
|
||||
HIDDEN: "hidden",
|
||||
UPDATE: "update", TOGGLE: "toggle", HIDDEN: "hidden",
|
||||
}
|
||||
var aaa = {
|
||||
LOGIN: "login", LOGOUT: "logout", INVITE: "invite", TOKEN: "token",
|
||||
@ -384,7 +384,7 @@ try { if (typeof(window) == lang.OBJECT) { var meta = Volcanos.meta
|
||||
}
|
||||
}
|
||||
meta._init = function(can) {
|
||||
window.onmousemove = function(event) { window._scroll && (window._scroll(event)) }
|
||||
window.onmousemove = function(event) { window._mousemove && (window._mousemove(event)) }
|
||||
window.onmouseup = function(event) { delete(window._scroll) }
|
||||
window.ondblclick = function(event) { can.onkeymap.prevent(event) }
|
||||
window.onerror = function(message, source, lineno, colno, error) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user