1
0
forked from x/volcanos

opt action

This commit is contained in:
shaoying 2021-01-11 00:07:54 +08:00
parent 53d933332a
commit 4dd16f3496
7 changed files with 45 additions and 36 deletions

View File

@ -462,8 +462,8 @@ Volcanos("onlayout", {help: "页面布局", list: [], _init: function(can, targe
]}
]}] }])
},
display: function(can, target) {
can.ui = can.page.Appends(can, target, [{type: "table", list: [
display: function(can, target) { target = target || can._target
return can.page.Appends(can, target, [{type: "table", list: [
{type: "tr", list: [{view: "content"}]},
{type: "tr", list: [{view: "display"}]},
]}])

View File

@ -335,8 +335,7 @@ Volcanos("page", {help: "网页模块",
delete(cache[name])
return list.data
},
Toggle: function(can, target, show, hide) {
var status = target.style.display == "none"
Toggle: function(can, target, show, hide) { var status = target.style.display == "none"
can.page.Modify(can, target, {style: {display: status? "": "none"}})
status? typeof show == "function" && show(): typeof hide == "function" && hide()
return status

View File

@ -2,10 +2,10 @@ fieldset.Action {
min-width:160px;
background-color:#a2dceab3;
}
fieldset.Action div.action {
fieldset.Action>div.action {
display:none;
}
fieldset.Action div.action.tabs {
fieldset.Action>div.action.tabs {
width:-webkit-fill-available;
background-color:#159cc7b0;
display:block; height:28px;
@ -13,15 +13,15 @@ fieldset.Action div.action.tabs {
position:absolute;
z-index:10;
}
fieldset.Action div.action div.item {
fieldset.Action>div.action div.item {
padding:4px; margin:0;
}
fieldset.Action div.action div.item:hover {
fieldset.Action>div.action div.item:hover {
border-bottom:solid 2px red;
background-color:#2e515f;
cursor:pointer;
}
fieldset.Action div.action div.item.select {
fieldset.Action>div.action div.item.select {
border-bottom:solid 2px red;
background-color:#2e515f;
}

View File

@ -27,8 +27,12 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
}, silent)
}
can.page.Modify(can, plugin._target, {style: {"max-width": value.width}})
can.onengine.listen(can, "action.resize", function(width, height) {
can.page.Modify(can, plugin._target, {style: {"max-width": value.width = width}})
})
can._plugins = (can._plugins||[]).concat([plugin])
can.onmotion.move(can, plugin._target, {width: plugin.Conf("width"), height: plugin.Conf("height")})
can.page.Append(can, can._action, [{view: ["item", "div", value.name], onclick: function(event) {
can.onmotion.select(can, can._output, "fieldset.plugin", value.target)
can.onmotion.select(can, can._action, "div.item", event.target)
@ -97,9 +101,9 @@ Volcanos("onaction", {help: "交互操作", list: [], _init: function(can, msg,
})
can._target.ontouchstart = function(event) { can.onengine.trigger(can, {}, "action.touch") }
can.Conf({width: can._output.offsetWidth-34, height: window.innerHeight})
can.onengine.listen(can, "resize", function(width, height) {
can.Conf({width: width-6, height: height})
can.Conf({width: can._output.offsetWidth-33, height: window.innerHeight})
can.onengine.listen(can, "resize", function(width, height) { can.Conf({width: width, height: height})
can.onengine.trigger(can, can.request({}, {width: width, height: height}), "action.resize")
})
can.onengine.listen(can, "search", function(msg, word) {

View File

@ -5,8 +5,14 @@ fieldset.feel div.action {
fieldset.feel div.output {
min-height:100px;
}
fieldset.feel div.output div.content {
max-height:200px;
overflow:auto;
fieldset.feel div.output img {
display:block;
float:left;
}
fieldset.feel div.output video {
display:block;
float:left;
}
fieldset.feel div.output {
min-height:100px;
}

View File

@ -4,10 +4,12 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
value.path.endsWith("/")? can.path.Push(value): can.list.push(value)
})
can.onlayout.display(can, target)
can.onappend.table(can, can.path, can.ui.content, "table", function(value, key, index, line, array) {
can.ui = can.onlayout.display(can, target)
can.onappend.table(can, can.path, can.ui.content, "table", function(value, key) {
return {type: "td", inner: value, onclick: function(event) {
can.sup.onaction.change(event, can.sup, key, value)
can.sup.onaction.change(event, can.sup, key, value, function(msg) {
can.onimport._init(can, msg, list, cb, target)
})
}}
})
@ -15,7 +17,7 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
can.page.Modify(can, can._action, {style: {display: "none"}})
typeof cb == "function" && cb(msg)
can.Action("倍速", can.rate = 1)
can.Action("倍速", can.rate = parseInt(msg.Option("rate"))||feature["rate"]||1)
can.Action("起始", can.begin = parseInt(msg.Option("begin"))||feature["begin"]||0)
can.Action("数量", can.limit = parseInt(msg.Option("limit"))||feature["limit"]||6)
can.Action("高度", can.height = parseInt(msg.Option("height"))||feature["height"]||100)
@ -33,7 +35,7 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
return path
},
file: function(can, path, index) { path = can.onimport._file(can, path, index)
var cb = can.onfigure[can.base.Ext(path)]; can.Status("文件", path)
var cb = can.onfigure[can.base.Ext(path)]; can.Status("file", path)
typeof cb == "function" && can.page.Append(can, can.ui.display, [cb(can, path, index)])
},
}, ["/plugin/local/wiki/feel.css"])
@ -61,20 +63,21 @@ Volcanos("onfigure", {help: "组件菜单", list: [],
var order = index; function show(order) {
path = can.onimport._file(can, can.list[order].path)
sub.page.Appends(sub, sub._output, [{img: path, height: height-55}])
sub.core.Timer(100, function() { sub.Status("位置", order+1+"/"+can.list.length), sub.Status("文件", path) })
sub.core.Timer(100, function() { sub.Status("位置", order+1+"/"+can.list.length), sub.Status("file", path) })
}; show(order)
sub.onappend._action(sub, ["关闭", "上一个", "设置背景", "下一个"], sub._action, {
sub.onappend._action(sub, ["关闭", "下载", "上一个", "下一个", "设置背景"], sub._action, {
"关闭": function(event) { sub.page.Remove(sub, sub._target) },
"下载": function(event) { can.user.download(can, path) },
"上一个": function(event) { order > 0? show(--order): show(order = can.list.length-1) },
"下一个": function(event) { order < can.list.length-1? show(++order): show(order = 0) },
"设置背景": function(event) { var msg = can.request(event, {url: can.onimport._file(can, can.list[order].path)})
sub.run(event, ["search", "Header.onimport.background"])
},
"下一个": function(event) { order < can.list.length-1? show(++order): show(order = 0) },
}), sub.onappend._status(can, ["文件"], sub._status)
})
}, document.body)
}, _init: function(target) { can.Status("文件", path) },
onmouseover: function(event) { can.Status("文件", path) },
}, _init: function(target) { can.Status("file", path) },
onmouseover: function(event) { can.Status("file", path) },
} },
video: function(can, path) { var auto = true, loop = true, total = 0
@ -82,13 +85,11 @@ Volcanos("onfigure", {help: "组件菜单", list: [],
return {className: "preview", type: "video", style: {height: can.height},
data: {src: path, controls: "controls", autoplay: auto, loop: loop, playbackRate: can.rate},
oncontextmenu: cb, onplay: cb, onpause: cb, onended: cb,
onmouseover: function(event) {
can.Status("文件", path)
},
onmouseover: function(event) { can.Status("file", path) },
onloadedmetadata: function(event) { total = event.timeStamp
event.target.currentTime = can._msg.currentTime || 0
}, onloadeddata: cb, ontimeupdate: function(event) {
can.Status("文件") == path && can.Status("position", can.onexport.position(can, (can._msg.currentTime=event.target.currentTime)-1, event.target.duration))
can.Status("file") == path && can.Status("position", can.onexport.position(can, (can._msg.currentTime=event.target.currentTime)-1, event.target.duration))
},
}
},
@ -113,10 +114,9 @@ Volcanos("onaction", {help: "组件菜单", list: [
"下一页": function(event, can, key, value) {
can.begin + can.limit < can.list.length && (can.begin += can.limit, can.onimport._page(can, can.list, can.begin, can.limit))
},
"下载": function(event, can) { can.user.download(can, can.Status("文件")) },
"参数": function(event, can) {
can.page.Modify(can, can._action, {style: {display: can._action.style.display=="none"? "block": "none"}})
can.page.Toggle(can, can._action)
},
"数量": function(event, can, key, value) {
can.limit = parseInt(value), can.onimport._page(can, can.list, can.begin, can.limit)
@ -128,7 +128,7 @@ Volcanos("onaction", {help: "组件菜单", list: [
can.rate = parseInt(value), can.onimport._page(can, can.list, can.begin, can.limit)
},
})
Volcanos("onexport", {help: "导出数据", list: ["begin", "limit", "total", "position", "文件"],
Volcanos("onexport", {help: "导出数据", list: ["begin", "limit", "total", "position", "file"],
position: function(can, index, total) { total = total || can.max
return parseInt((index+1)*100/total)+"%"+" = "+(parseInt(index)+1)+"/"+parseInt(total)
},

View File

@ -72,7 +72,7 @@ Volcanos("onaction", {help: "交互操作", list: [], _init: function(can, msg,
change: function(event, can, name, value, cb) {
can.page.Select(can, can._option, "input.args", function(input) {
if (input.name == name && value != input.value) { input.value = value;
var data = input.dataset || {}; data.action == "auto" && can.run(event)
var data = input.dataset || {}; data.action == "auto" && can.run(event, can.Pack(), cb)
}
})
},