1
0
mirror of https://shylinux.com/x/volcanos synced 2025-04-26 01:04:06 +08:00
This commit is contained in:
harveyshao 2022-11-04 02:40:50 +08:00
parent accf794358
commit d258e33088
7 changed files with 56 additions and 86 deletions

View File

@ -406,9 +406,9 @@ Volcanos(chat.ONMOTION, {_init: function(can, target) {
delay: function(can, cb, interval) { can.core.Timer(interval||30, cb) },
clear: function(can, target) { return can.page.Modify(can, target||can._output, ""), target },
cache: function(can, next) { var list = can.base.Obj(can.core.List(arguments).slice(2), [can._output])
cache: function(can, next) { var list = can.base.getValid(can.base.Obj(can.core.List(arguments).slice(2)), [can._output])
can.core.List(list, function(target) { target && target._cache_key && can.page.Cache(target._cache_key, target, target.scrollTop+1) })
var key = next(can._cache_data = can._cache_data||{}, arguments[2]._cache_key); return key && can.core.List(list, function(target) { if (!target) { return }
var key = next(can._cache_data = can._cache_data||{}, list[0]._cache_key); return key && can.core.List(list, function(target) { if (!target) { return }
var pos = can.page.Cache(target._cache_key = key, target); if (pos) { target.scrollTo && target.scrollTo(0, pos-1); return target }
}).length > 0
},

View File

@ -209,7 +209,7 @@ Volcanos("user", {info: {}, agent: {
},
toPNG: function(can, name, text, height, width) {
if (text.indexOf("<svg") != 0) { text = '<svg xmlns="http://www.w3.org/2000/svg">'+text+"</svg>" }
can.page.Create(html.IMG, {src: "data:image/svg+xml,"+encodeURIComponent(text), onload: function() {
var img = can.page.Create(can, html.IMG, {src: "data:image/svg+xml,"+encodeURIComponent(text), onload: function() {
var canvas = can.page.Create(can, html.CANVAS, {height: height, width: width}); canvas.getContext("2d").drawImage(img, 0, 0)
can.user.download(can, canvas.toDataURL("image/png"), name, nfs.PNG)
}})

View File

@ -61,7 +61,7 @@ fieldset.Action.cmd>div.output>fieldset.plugin:not(.float):not(.full)>legend { f
fieldset.Action>div.output>fieldset.plugin>legend { box-shadow:4px 4px 20px 4px #626bd0; }
fieldset.plugin>form.option input[type=button][name=close]{ display:none; }
fieldset.plugin.word fieldset.story>form.option input[type=button][name=close]{ display:none; }
// fieldset.plugin.word fieldset.story>form.option input[type=button][name=close]{ display:none; }
fieldset.float>form.option input[type=button][name=close]{ display:block; }
fieldset.full>form.option input[type=button][name=close]{ display:block; }
fieldset.plug>form.option input[type=button][name=close]{ display:block; }

View File

@ -40,7 +40,6 @@ fieldset.Action.flow>div.output>fieldset.plugin { float:left; }
fieldset.Action.free>div.output>fieldset.plugin { position:absolute; }
fieldset.Action.free>div.output>fieldset.plugin.select { display:block; }
fieldset.Action.cmd { overflow:hidden; }
fieldset.panel.cmd>div.output>fieldset.plugin { padding:0; margin:0; }
fieldset.panel.cmd>div.output>fieldset.plugin>legend { padding:0 10px; float:left; }

View File

@ -18,6 +18,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg) { can.onmotion.clear(can)
can.onappend.plugin(can, item, function(sub, meta, skip) { can.onimport._run(can, sub, function(event, cmds, cb) {
return can.runActionCommand(event, sub._index, cmds, cb)
}), can.user.title(meta.name), skip || next() })
can.onlayout._init(can)
},
_run: function(can, sub, cbs) {
sub.run = function(event, cmds, cb) { (!cmds || cmds[0] != ctx.ACTION) && sub.request(event, {height: sub.ConfHeight(), width: sub.ConfWidth()})

View File

@ -13,7 +13,11 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear(
}) }])._target, can.onmotion.delay(can, function() { var target = can.sup.task && can.sup.task._target; target && target.click(), can.Status(mdb.COUNT, msg.Length())
can.user.isMobile || can.isCmdMode() && can.page.Append(can, can._action, [{view: [["item", "time", "select"]], style: {"float": html.RIGHT, "padding": 5, "height": 21}, _init: function(target) {
can.onappend.figure(can, {action: "date"}, target, function(sub, value) { }), target.onmouseenter = target.click
can.core.Timer({interval: 100}, function() { can.page.Appends(can, target, [{text: can.base.Time()}]) })
can.core.Timer({interval: 100}, function() {
window.power? window.power().then(function(value) {
can.page.Appends(can, target, [{text: value+" "+can.base.Time()}])
}): can.page.Appends(can, target, [{text: can.base.Time()}])
})
}}])
})
},
@ -107,12 +111,9 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg, target) { can.onmotion.clear(
layout: function(can) { can.page.styleHeight(can, can._output, can.ConfHeight()), can.page.styleHeight(can, can.ui.project, can.ConfHeight())
var height = can._display_heights[can.sup.task? [can.sup.task.zone, can.sup.task.id].join(ice.FS): ""]||html.ACTION_HEIGHT
if (!can.ui.display.innerHTML || can.ui.display.style.display == html.NONE) { height = 0 }
can.page.styleHeight(can, can.ui.table, can.ConfHeight()-height)
can.page.styleHeight(can, can.ui.content, can.ConfHeight()-height)
can.page.styleHeight(can, can.ui.profile, can.ConfHeight()-height)
can.page.styleWidth(can, can.ui.table, can.ConfWidth()-can.ui.project.offsetWidth-can.ui.profile.offsetWidth)
can.page.styleWidth(can, can.ui.content, can.ConfWidth()-can.ui.project.offsetWidth-can.ui.profile.offsetWidth)
height == 0 || can.core.List(can._plugins_display, function(sub) {
can.page.style(can, can.ui.table, html.HEIGHT, can.ConfHeight()-height, html.WIDTH, can.ConfWidth()-can.ui.project.offsetWidth-can.ui.profile.offsetWidth)
can.page.style(can, can.ui.content, html.HEIGHT, can.ConfHeight()-height, html.WIDTH, can.ConfWidth()-can.ui.project.offsetWidth-can.ui.profile.offsetWidth)
can.page.styleHeight(can, can.ui.profile, can.ConfHeight()-height), height == 0 || can.core.List(can._plugins_display, function(sub) {
sub.onimport.size(sub, height-html.ACTION_HEIGHT-sub.onexport.statusHeight(sub), sub.ConfWidth(can.ConfWidth()-can.ui.project.offsetWidth), true)
})
}

View File

@ -1,57 +1,38 @@
Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, target) {
can.onmotion.clear(can), can.base.isFunc(cb) && cb(msg)
if (msg.Length() > 0) { return can.onappend.table(can, msg) }
can.page.style(can, can._output, html.MAX_WIDTH, can.ConfWidth())
Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, target) { can.onmotion.clear(can)
can.page.Modify(can, target, msg.Result())
can.page.Select(can, target, wiki.STORY_ITEM, function(item) { var data = item.dataset||{}
can.page.style(can, item, can.base.Obj(data.style))
can.core.CallFunc([can.onimport, data.type||item.tagName.toLowerCase()], [can, data, item])
can.page.Select(can, target, wiki.STORY_ITEM, function(target) { var meta = target.dataset||{}
can.core.CallFunc([can.onimport, meta.type||target.tagName.toLowerCase()], [can, meta, target])
can.page.style(can, target, can.base.Obj(meta.style))
})
can.user.isMobile && can.isCmdMode() && can.page.style(can, can._output, html.MAX_HEIGHT, can.ConfHeight()+2*html.ACTION_HEIGHT)
},
navmenu: function(can, data, target) { var nav = can.sup._navmenu
nav = nav||can.page.Append(can, can._fields, [wiki.NAVMENU]).first
can.onmotion.clear(can, nav), can._fields.insertBefore(nav, can._output)
navmenu: function(can, meta, target) { var nav = can.sup._navmenu
nav = can.onmotion.clear(can, nav||can.page.insertBefore(can, [wiki.NAVMENU], can._output)), can.sup._navmenu = nav
can.onimport.list(can, can.base.Obj(data.data), function(event, item) {
can.onimport.list(can, can.base.Obj(meta.data), function(event, item) {
var link = item.meta.link, list = can.core.Split(item.meta.link)
if (can.core.Value(can, list[0])) { return can.core.CallFunc([can, list[0]], list.slice(1)) }
if (!link || link == can.Option(nfs.PATH)) { return false }
if (can.onmotion.cache(can, function() { can.isCmdMode() && can.user.title(item.meta.name); return can.Option(nfs.PATH, link) })) { return }
return can.sup.Update(event, [link])
}, nav), can.sup._navmenu = nav
}, nav)
can.getActionSize(function(msg) {
can.getActionSize(function(msg) {
can.page.style(can, nav, html.HEIGHT, can.ConfHeight()+(can.isCmdMode()? msg.Option(html.MARGIN_Y): 0))
can.ConfWidth(can.ConfWidth()-nav.offsetWidth-21)
can.page.style(can, can._output,
html.HEIGHT, can.sup._navmenu.offsetHeight-20, html.MAX_WIDTH, can.ConfWidth(),
html.FLOAT, html.LEFT, html.CLEAR, html.NONE,
html.PADDING, 10,
can.page.style(can, can._output, html.PADDING, 10, html.FLOAT, html.LEFT, html.CLEAR, html.NONE,
html.HEIGHT, can.sup._navmenu.offsetHeight-20, html.MAX_WIDTH, can.ConfWidth(can.ConfWidth()-nav.offsetWidth-21),
)
})
},
premenu: function(can, data, target) {
can.page.Select(can, can._output, can.page.Keys(wiki.H2, wiki.H3), function(item) {
can.page.Append(can, target, [{text: [item.innerHTML, html.LI, item.tagName], onclick: function() {
item.scrollIntoView()
}}]), item.onclick = function(event) { target.scrollIntoView() }
premenu: function(can, meta, target) {
can.page.Select(can, can._output, can.page.Keys(wiki.H2, wiki.H3), function(_target) {
can.page.Append(can, target, [{text: [_target.innerHTML, html.LI, _target.tagName], onclick: function() {
_target.scrollIntoView()
}}]), _target.onclick = function(event) { target.scrollIntoView() }
})
},
title: function(can, data, target) {
can.isCmdMode() && target.tagName == "H1" && can.user.title(data.text)
},
refer: function(can, data, target) {
can.page.Select(can, target, html.A, function(item) {
item.onclick = function(event) {
can.runAction(event, mdb.CREATE, [mdb.TYPE, "refer", mdb.NAME, item.dataset.name, mdb.TEXT, item.href])
}
})
},
spark: function(can, data, target) {
if (data[mdb.NAME] == chat.FIELD) {
title: function(can, meta, target) { can.isCmdMode() && target.tagName == "H1" && can.user.title(meta.text) },
spark: function(can, meta, target) {
if (meta[mdb.NAME] == chat.FIELD) {
function deep(text) { var d = 0
for (var i = 0; i < text.length; i++) {
switch (text[i]) {
@ -93,45 +74,14 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
return show(list[0], list[0]._index, view.menu, view.list), first.click()
}
if (data[mdb.NAME] == html.INNER) { return can.onmotion.copy(can, target) }
can.page.Select(can, target, html.SPAN, function(item) {
can.onmotion.copy(can, item, function(event) {
can.runAction(event, mdb.CREATE, [mdb.TYPE, "spark", mdb.NAME, "shell", mdb.TEXT, item.innerText], function() {})
})
})
if (meta[mdb.NAME] == html.INNER) { return can.onmotion.copy(can, target) }
can.page.Select(can, target, html.SPAN, function(item) { can.onmotion.copy(can, item) })
},
chart: function(can, data, target) {
can.page.style(can, target, html.MAX_WIDTH, can.ConfWidth(), "overflow", "auto")
if (!data.fg && !data.bg) { target.className.baseVal = "story auto" }
target.onclick = function(event) {
can.runAction(can.request(event, data), "run", [data.index, "find", event.target.innerHTML])
}
target.oncontextmenu = function(event) {
var ui = can.user.carte(event, can, kit.Dict(mdb.EXPORT, function(event, can, button) {
can.user.toimage(event, can, "hi", target)
}), [mdb.EXPORT]); can.page.style(can, ui._target, {left: event.clientX, top: event.clientY})
}
},
table: function(can, data, target) {
can.page.OrderTable(can, target), can.page.ClassList.add(can, target, chat.CONTENT)
can.page.Select(can, target, html.TD, function(item) { can.onmotion.copy(can, item) })
},
image: function(can, data, target) {
// can.page.style(can, target, html.MAX_HEIGHT, can.ConfHeight()/(can.user.isMobile? 2: 1), html.MAX_WIDTH, can.ConfWidth())
can.page.style(can, target, html.MAX_WIDTH, can.ConfWidth())
},
audio: function(can, data, target) {
can.page.insertBefore(can, [{name: "play", value: "play", button: ["play", function(event) {
target.play()
}]}], target)
},
field: function(can, data, target, width) { var item = can.base.Obj(data.meta)
field: function(can, meta, target, width) { var item = can.base.Obj(meta.meta)
can.onappend._init(can, item, [chat.PLUGIN_STATE_JS], function(sub) {
can._plugins = (can._plugins||[]).concat([sub])
sub.run = function(event, cmds, cb, silent) {
can.runAction(event, chat.STORY, can.misc.concat(can, [data.type, data.name, data.text], cmds), cb)
}
can.runAction(event, chat.STORY, can.misc.concat(can, [meta.type, meta.name, meta.text], cmds), cb, true)
}, can._plugins = (can._plugins||[]).concat([sub])
sub.ConfHeight(can.base.Min(300, can.ConfHeight()-300)), sub.ConfWidth(item.width = (width||can.ConfWidth())-(can.user.isWindows? 40: 20))
can.page.style(can, sub._output, html.MAX_WIDTH, sub.ConfWidth())
@ -141,6 +91,25 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
})
}, can._output, target)
},
table: function(can, meta, target) {
can.page.OrderTable(can, target), can.page.ClassList.add(can, target, chat.CONTENT)
can.page.Select(can, target, html.TD, function(item) { can.onmotion.copy(can, item) })
},
chart: function(can, meta, target) {
can.page.style(can, target, html.MAX_WIDTH, can.ConfWidth(), html.OVERFLOW, ice.AUTO)
if (!meta.fg && !meta.bg) { target.className.baseVal = "story auto" }
target.onclick = function(event) { can.runActionCommand(can.request(event, meta), meta.index, [nfs.FIND, event.target.innerHTML]) }
target.oncontextmenu = function(event) {
var ui = can.user.carte(event, can, kit.Dict(mdb.EXPORT, function(event, can, button) {
can.user.toimage(event, can, "hi", target)
})); can.page.style(can, ui._target, {left: event.clientX, top: event.clientY})
}
},
image: function(can, meta, target) { can.page.style(can, target, html.MAX_HEIGHT, can.base.Min(can.ConfHeight(), window.innerHeight/2), html.MAX_WIDTH, can.ConfWidth()) },
video: function(can, meta, target) { can.page.style(can, target, html.MAX_HEIGHT, can.base.Min(can.ConfHeight(), window.innerHeight/2), html.MAX_WIDTH, can.ConfWidth()) },
audio: function(can, meta, target) {},
layout: function(can) {
can.core.List(can._plugins, function(sub) {
sub.ConfHeight(can.base.Min(300, can.ConfHeight()-300)), sub.ConfWidth(can.ConfWidth()-(can.user.isWindows? 40: 20))