mirror of
https://shylinux.com/x/volcanos
synced 2025-04-25 08:48:06 +08:00
add some
This commit is contained in:
parent
533d4cbf5f
commit
1e2dce32ad
3
const.js
3
const.js
@ -259,6 +259,7 @@ var code = {
|
|||||||
}
|
}
|
||||||
var wiki = {
|
var wiki = {
|
||||||
DRAW: "draw", WORD: "word", PORTAL: "portal",
|
DRAW: "draw", WORD: "word", PORTAL: "portal",
|
||||||
|
FEEL: "feel",
|
||||||
TITLE: "title", BRIEF: "brief", REFER: "refer", SPARK: "spark", SHELL: "shell",
|
TITLE: "title", BRIEF: "brief", REFER: "refer", SPARK: "spark", SHELL: "shell",
|
||||||
ORDER: "order", TABLE: "table", CHART: "chart", IMAGE: "image", VIDEO: "video",
|
ORDER: "order", TABLE: "table", CHART: "chart", IMAGE: "image", VIDEO: "video",
|
||||||
FIELD: "field", LOCAL: "local", PARSE: "parse",
|
FIELD: "field", LOCAL: "local", PARSE: "parse",
|
||||||
@ -467,6 +468,8 @@ var icon = {
|
|||||||
expire: "bi bi-clock-history",
|
expire: "bi bi-clock-history",
|
||||||
|
|
||||||
name: "bi bi-sort-alpha-down",
|
name: "bi bi-sort-alpha-down",
|
||||||
|
time: "bi bi-clock-history",
|
||||||
|
size: "bi bi-calculator",
|
||||||
sess: "bi bi-telephone-forward",
|
sess: "bi bi-telephone-forward",
|
||||||
path: "bi bi-folder2", file: "bi bi-file-earmark-text", line: "bi bi-sort-numeric-down",
|
path: "bi bi-folder2", file: "bi bi-file-earmark-text", line: "bi bi-sort-numeric-down",
|
||||||
start: "bi bi-play-circle", stop: "bi bi-stop-circle",
|
start: "bi bi-play-circle", stop: "bi bi-stop-circle",
|
||||||
|
12
frame.js
12
frame.js
@ -266,11 +266,12 @@ Volcanos(chat.ONAPPEND, {
|
|||||||
}})
|
}})
|
||||||
}
|
}
|
||||||
can.core.List(list, function(item) {
|
can.core.List(list, function(item) {
|
||||||
|
item.value = can.sup && can.sup.onexport.session && can.sup.onexport.session(can.sup, "action:"+item.name||item[0]) || item.value
|
||||||
can.base.isUndefined(item) || can.onappend.input(can, item == ""? /* 1.空白 */ {type: html.BR}:
|
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) {
|
can.base.isString(item)? /* 2.按键 */ {type: html.BUTTON, name: item, value: can.user.trans(can, item, meta._trans), onclick: function(event) {
|
||||||
run(event, item)
|
run(event, item)
|
||||||
}}: item.length > 0? /* 3.列表 */ {type: html.SELECT, name: item[0], values: item.slice(1), onchange: function(event) { can.misc.Event(event, can, function(msg) {
|
}}: item.length > 0? /* 3.列表 */ {type: html.SELECT, name: item[0], value: item.value, values: item.slice(1), onchange: function(event) { can.misc.Event(event, can, function(msg) {
|
||||||
var button = event.target.value; can.onexport.session && can.onexport.session(can, "action:"+item[0], button)
|
var button = event.target.value; can.onexport.session && can.onexport.session(can, "action:"+(item.name||item[0]), button)
|
||||||
can.onaction._select && can.onaction._select(event, can, item[0], button)
|
can.onaction._select && can.onaction._select(event, can, item[0], button)
|
||||||
meta[item[0]]? can.core.CallFunc(meta[item[0]], [event, can, item[0], button]):
|
meta[item[0]]? can.core.CallFunc(meta[item[0]], [event, can, item[0], button]):
|
||||||
meta[button]? can.core.CallFunc(meta[button], [event, can, button]): can.Action(item[0], button)
|
meta[button]? can.core.CallFunc(meta[button], [event, can, button]): can.Action(item[0], button)
|
||||||
@ -1150,7 +1151,12 @@ Volcanos(chat.ONMOTION, {
|
|||||||
can.user.toast(can, "filter out "+count+" lines")
|
can.user.toast(can, "filter out "+count+" lines")
|
||||||
}, 300)
|
}, 300)
|
||||||
},
|
},
|
||||||
cacheClear: function(can, key) { delete(can._cache_data[key])
|
cacheClear: function(can, key) {
|
||||||
|
if (!key) {
|
||||||
|
delete(can._cache_data), delete(can._output._cache)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
delete(can._cache_data[key])
|
||||||
can.core.List(arguments, function(target, index) { index > 1 && target && target._cache && delete(target._cache[key]) })
|
can.core.List(arguments, function(target, index) { index > 1 && target && target._cache && delete(target._cache[key]) })
|
||||||
},
|
},
|
||||||
cache: function(can, next) { var list = can.base.getValid(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])
|
||||||
|
@ -232,7 +232,7 @@ div.project div.item.filter>input { padding:0 25px; width:100% !important; }
|
|||||||
div.project div.item.search { padding:0; width:100%; }
|
div.project div.item.search { padding:0; width:100%; }
|
||||||
div.project div.item.search>input { padding:0 25px; width:100%; }
|
div.project div.item.search>input { padding:0 25px; width:100%; }
|
||||||
div.project div.item img { height:var(--action-height); width:var(--action-height); }
|
div.project div.item img { height:var(--action-height); width:var(--action-height); }
|
||||||
div.project div.item img { margin:0; }
|
div.project div.item img { margin:0; flex-shrink:0; }
|
||||||
div.project div.item>div.name { padding:0 var(--input-padding); }
|
div.project div.item>div.name { padding:0 var(--input-padding); }
|
||||||
div.project div.item>div.icon { position:absolute; right:var(--input-padding); }
|
div.project div.item>div.icon { position:absolute; right:var(--input-padding); }
|
||||||
div.project div.item>div.icon:hover { background-color:var(--hover-bg-color); }
|
div.project div.item>div.icon:hover { background-color:var(--hover-bg-color); }
|
||||||
@ -992,7 +992,7 @@ fieldset.Action>div.output>fieldset.ssh.cloud.profile:hover { box-shadow:none; }
|
|||||||
fieldset.Action>div.output>fieldset.ssh.cloud.profile>div.output { background-color:transparent; }
|
fieldset.Action>div.output>fieldset.ssh.cloud.profile>div.output { background-color:transparent; }
|
||||||
fieldset.Action:not(.horizon):not(.grid)>fieldset.plugin>form.option>div.item.text.path>input { width:var(--project-width); }
|
fieldset.Action:not(.horizon):not(.grid)>fieldset.plugin>form.option>div.item.text.path>input { width:var(--project-width); }
|
||||||
body:not(.debug) fieldset.plugin.can._notfound { display:none; }
|
body:not(.debug) fieldset.plugin.can._notfound { display:none; }
|
||||||
body:not(.cmd) fieldset.Action>div.output>fieldset.plugin>legend { border-top:var(--item-notice); border-top-left-radius:0; margin-right:var(--legend-margin); }
|
body:not(.cmd) fieldset.Action>div.output>fieldset.plugin>legend { border-top:var(--box-notice3); border-top-left-radius:0; margin-right:var(--legend-margin); }
|
||||||
body:not(.cmd) fieldset.Action>div.output>fieldset.plugin>legend:not(:hover) { background-color:var(--output-bg-color); }
|
body:not(.cmd) fieldset.Action>div.output>fieldset.plugin>legend:not(:hover) { background-color:var(--output-bg-color); }
|
||||||
body:not(.dark) fieldset.draw.trends div.output svg { background-color:#1b5b738c; }
|
body:not(.dark) fieldset.draw.trends div.output svg { background-color:#1b5b738c; }
|
||||||
body.width6 fieldset.plugin.word>form.option>div.item.text>input { width:var(--project-width); }
|
body.width6 fieldset.plugin.word>form.option>div.item.text>input { width:var(--project-width); }
|
||||||
|
@ -35,7 +35,9 @@ Volcanos("base", {
|
|||||||
} return to === from
|
} return to === from
|
||||||
},
|
},
|
||||||
|
|
||||||
Ext: function(path) { return path.split("?")[0].split(nfs.PS).pop().split(nfs.PT).pop().toLowerCase() },
|
Ext: function(path) {
|
||||||
|
return (path||"").split("?")[0].split("#")[0].split("/").pop().split(".").pop().toLowerCase()
|
||||||
|
},
|
||||||
Dir: function(path) { return path.endsWith(nfs.PS)? path: path.slice(0, path.lastIndexOf(nfs.PS)+1) },
|
Dir: function(path) { return path.endsWith(nfs.PS)? path: path.slice(0, path.lastIndexOf(nfs.PS)+1) },
|
||||||
|
|
||||||
Path: function(path) { var res = "", arg = arguments; for (var i = 0; i < arg.length; i++) { if (!arg[i]) { continue }
|
Path: function(path) { var res = "", arg = arguments; for (var i = 0; i < arg.length; i++) { if (!arg[i]) { continue }
|
||||||
|
53
lib/misc.js
53
lib/misc.js
@ -73,6 +73,28 @@ Volcanos("misc", {
|
|||||||
res._option && (msg._option = res._option) && res._option.forEach(function(key) { res[key] && (msg[key] = res[key]) })
|
res._option && (msg._option = res._option) && res._option.forEach(function(key) { res[key] && (msg[key] = res[key]) })
|
||||||
return msg
|
return msg
|
||||||
},
|
},
|
||||||
|
Sort: function(key, swap) { var n = msg.Length()
|
||||||
|
key = key||msg.append[0], swap = swap||function(i, j) { return msg[key][i] > msg[key][j] }
|
||||||
|
switch (swap) {
|
||||||
|
case "str": swap = function(i, j) { return msg[key][i] > msg[key][j] }; break
|
||||||
|
case "str_r": swap = function(i, j) { return msg[key][i] < msg[key][j] }; break
|
||||||
|
case "int": swap = function(i, j) { return can.base.ParseSize(msg[key][i]) > can.base.ParseSize(msg[key][j]) }; break
|
||||||
|
case "int_r": swap = function(i, j) { return can.base.ParseSize(msg[key][i]) < can.base.ParseSize(msg[key][j]) }; break
|
||||||
|
}
|
||||||
|
for (var i = 0; i < n-1; i++) {
|
||||||
|
for (var j = i+1; j < n; j++) { var _swap = swap(i, j)
|
||||||
|
if (_swap === true) {
|
||||||
|
can.core.List(msg.append, function(k) {
|
||||||
|
var temp = msg[k][i]; msg[k][i] = msg[k][j], msg[k][j] = temp
|
||||||
|
})
|
||||||
|
} else if (_swap === false) {
|
||||||
|
continue
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
Push: function(key, value, detail) {
|
Push: function(key, value, detail) {
|
||||||
if (can.base.isObject(key)) { can.core.List(value||msg.append||can.base.Obj(msg.Option(ice.MSG_FIELDS))||can.core.Item(key), function(item) {
|
if (can.base.isObject(key)) { can.core.List(value||msg.append||can.base.Obj(msg.Option(ice.MSG_FIELDS))||can.core.Item(key), function(item) {
|
||||||
detail? msg.Push(mdb.KEY, item).Push(mdb.VALUE, key[item]||""): msg.Push(item, key[item]||"")
|
detail? msg.Push(mdb.KEY, item).Push(mdb.VALUE, key[item]||""): msg.Push(item, key[item]||"")
|
||||||
@ -278,6 +300,9 @@ Volcanos("misc", {
|
|||||||
return dir+file+(ext? nfs.PT+ext: "")
|
return dir+file+(ext? nfs.PT+ext: "")
|
||||||
},
|
},
|
||||||
isDebug: function(can) { return can.misc.Search(can, log.DEBUG) == ice.TRUE },
|
isDebug: function(can) { return can.misc.Search(can, log.DEBUG) == ice.TRUE },
|
||||||
|
isImage: function(can, path) { return can.base.isIn(can.base.Ext(path), "png", "jpg", "jpeg") },
|
||||||
|
isVideo: function(can, path) { return can.base.isIn(can.base.Ext(path), "mp4", "m4v", "mov", "webm") },
|
||||||
|
isAudio: function(can, path) { return can.base.isIn(can.base.Ext(path), "mp3") },
|
||||||
Search: function(can, key, value) { var args = this.ParseURL(can, location.href)
|
Search: function(can, key, value) { var args = this.ParseURL(can, location.href)
|
||||||
if (can.base.isUndefined(key)) { return args } else if (can.base.isObject(key)) {
|
if (can.base.isUndefined(key)) { return args } else if (can.base.isObject(key)) {
|
||||||
can.core.Item(key, function(k, v) { v === ""? delete(args[k]): (args[k] = v) })
|
can.core.Item(key, function(k, v) { v === ""? delete(args[k]): (args[k] = v) })
|
||||||
@ -292,10 +317,9 @@ Volcanos("misc", {
|
|||||||
SearchHash: function(can) { var hash = location.hash
|
SearchHash: function(can) { var hash = location.hash
|
||||||
if (arguments.length > 1) {
|
if (arguments.length > 1) {
|
||||||
hash = can.core.List(arguments, function(item) {
|
hash = can.core.List(arguments, function(item) {
|
||||||
if (can.base.isArray(item)) {
|
if (can.base.isArray(item)) { return item.join(nfs.DF) }
|
||||||
return item.join(nfs.DF)
|
return can.base.replaceAll(item, ":", "%3A")
|
||||||
}
|
}).slice(1).join(nfs.DF)
|
||||||
return can.base.replaceAll(item, ":", "%3A") }).slice(1).join(nfs.DF)
|
|
||||||
if (can.isCmdMode() || can._name == "River" || can._name == "Action") { location.hash = hash }
|
if (can.isCmdMode() || can._name == "River" || can._name == "Action") { location.hash = hash }
|
||||||
}
|
}
|
||||||
return can.core.List(can.core.Split(can.base.trimPrefix(location.hash, "#"), nfs.DF)||[], function(item) { return decodeURIComponent(item) })
|
return can.core.List(can.core.Split(can.base.trimPrefix(location.hash, "#"), nfs.DF)||[], function(item) { return decodeURIComponent(item) })
|
||||||
@ -313,10 +337,6 @@ Volcanos("misc", {
|
|||||||
} can.base.isUndefined(value) || set(key, value)
|
} can.base.isUndefined(value) || set(key, value)
|
||||||
var val = (new RegExp(key+"=([^;]*);?")).exec(document.cookie); return val && val.length > 1? val[1]: ""
|
var val = (new RegExp(key+"=([^;]*);?")).exec(document.cookie); return val && val.length > 1? val[1]: ""
|
||||||
},
|
},
|
||||||
localStorage: function(can, key, value) {
|
|
||||||
if (can.base.isUndefined(key)) { var res = {}; can.core.Item(localStorage, function(name, value) { can.base.isFunc(value) || name == "length" || (res[name] = value) }); return res }
|
|
||||||
if (!can.base.isUndefined(value)) { if (value === "") { return localStorage.removeItem(key) } localStorage.setItem(key, value) } return can.base.Obj(localStorage.getItem(key))
|
|
||||||
},
|
|
||||||
sessionStorage: function(can, key, value) {
|
sessionStorage: function(can, key, value) {
|
||||||
if (can.base.isUndefined(key)) { var res = {}; can.core.Item(sessionStorage, function(name, value) { can.base.isFunc(value) || name == "length" || (res[name] = value) }); return res }
|
if (can.base.isUndefined(key)) { var res = {}; can.core.Item(sessionStorage, function(name, value) { can.base.isFunc(value) || name == "length" || (res[name] = value) }); return res }
|
||||||
if (can.base.isArray(key)) { key = key.join(":") }
|
if (can.base.isArray(key)) { key = key.join(":") }
|
||||||
@ -324,17 +344,17 @@ Volcanos("misc", {
|
|||||||
if (value === "") { return sessionStorage.removeItem(key) } sessionStorage.setItem(key, value)
|
if (value === "") { return sessionStorage.removeItem(key) } sessionStorage.setItem(key, value)
|
||||||
} return can.base.Obj(sessionStorage.getItem(key))||sessionStorage.getItem(key)
|
} return can.base.Obj(sessionStorage.getItem(key))||sessionStorage.getItem(key)
|
||||||
},
|
},
|
||||||
Log: function() {
|
localStorage: function(can, key, value) {
|
||||||
var args = this._args("", arguments)
|
if (can.base.isUndefined(key)) { var res = {}; can.core.Item(localStorage, function(name, value) { can.base.isFunc(value) || name == "length" || (res[name] = value) }); return res }
|
||||||
|
if (!can.base.isUndefined(value)) { if (value === "") { return localStorage.removeItem(key) } localStorage.setItem(key, value) } return can.base.Obj(localStorage.getItem(key))
|
||||||
|
},
|
||||||
|
Log: function() { var args = this._args("", arguments)
|
||||||
if (arguments[0].indexOf && arguments[0].indexOf("on") == 0) { args[1] = this.FileLine((arguments[0] == "onremote"? 1: 1)+this._skip) }
|
if (arguments[0].indexOf && arguments[0].indexOf("on") == 0) { args[1] = this.FileLine((arguments[0] == "onremote"? 1: 1)+this._skip) }
|
||||||
for (var i in arguments) { var arg = arguments[i]; if (arg && arg.Option && arg.Option("log.caller")) { args[1] = arg.Option("log.caller") } }
|
for (var i in arguments) { var arg = arguments[i]; if (arg && arg.Option && arg.Option("log.caller")) { args[1] = arg.Option("log.caller") } }
|
||||||
console.log.apply(console, args), this._signal(args)
|
console.log.apply(console, args), this._signal(args)
|
||||||
},
|
},
|
||||||
Info: function() { var args = this._args(log.INFO, arguments); console.info.apply(console, args), this._signal(args) },
|
Info: function() { var args = this._args(log.INFO, arguments); console.info.apply(console, args), this._signal(args) },
|
||||||
Warn: function() {
|
Warn: function() { var args = this._args(log.WARN, arguments); console.warn.apply(console, args), this._signal(args); },
|
||||||
var args = this._args(log.WARN, arguments); console.warn.apply(console, args), this._signal(args);
|
|
||||||
// debugger
|
|
||||||
},
|
|
||||||
Error: function() { var args = this._args(log.ERROR, arguments); args.push(lex.NL, this._stacks().slice(1).join(lex.NL)), console.error.apply(console, args), this._signal(args); debugger },
|
Error: function() { var args = this._args(log.ERROR, arguments); args.push(lex.NL, this._stacks().slice(1).join(lex.NL)), console.error.apply(console, args), this._signal(args); debugger },
|
||||||
Debug: function() { var args = this._args(log.DEBUG, arguments); args.push(lex.NL, this._stacks().slice(1, 4).join(lex.NL)), console.debug.apply(console, args), this._signal(args) },
|
Debug: function() { var args = this._args(log.DEBUG, arguments); args.push(lex.NL, this._stacks().slice(1, 4).join(lex.NL)), console.debug.apply(console, args), this._signal(args) },
|
||||||
Trace: function() { var output = false
|
Trace: function() { var output = false
|
||||||
@ -355,7 +375,8 @@ Volcanos("misc", {
|
|||||||
},
|
},
|
||||||
_stacks: function(n, s) { var list = ((s||(new Error())).stack||"").split(lex.NL).slice(typeof n == "undefined"? 2: n)
|
_stacks: function(n, s) { var list = ((s||(new Error())).stack||"").split(lex.NL).slice(typeof n == "undefined"? 2: n)
|
||||||
for (var i = 0; i < list.length; i++) { var ls = list[i].trim().split(lex.SP)
|
for (var i = 0; i < list.length; i++) { var ls = list[i].trim().split(lex.SP)
|
||||||
list[i] = ls.pop().trim(); if (list[i][0] == "(") { list[i] = list[i].slice(1, -1) }
|
list[i] = ls.pop().trim()
|
||||||
|
if (list[i][0] == "(") { list[i] = list[i].slice(1, -1) } // ")"
|
||||||
list[i] = " "+list[i]; if (ls.length > 1) { list[i] += " "+ls.pop() }
|
list[i] = " "+list[i]; if (ls.length > 1) { list[i] += " "+ls.pop() }
|
||||||
list[i] = list[i].replace(/\?[^:]+/, "").replace(location.origin, "")
|
list[i] = list[i].replace(/\?[^:]+/, "").replace(location.origin, "")
|
||||||
} return list
|
} return list
|
||||||
@ -372,5 +393,3 @@ Volcanos("misc", {
|
|||||||
},
|
},
|
||||||
_signal: function(args) { this._list.push(args) }, _list: [], _skip: navigator && navigator.userAgent.indexOf("Chrome") > -1? 3: 3,
|
_signal: function(args) { this._list.push(args) }, _list: [], _skip: navigator && navigator.userAgent.indexOf("Chrome") > -1? 3: 3,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
32
lib/page.js
32
lib/page.js
@ -273,8 +273,9 @@ Volcanos("page", {
|
|||||||
],
|
],
|
||||||
Color: function(text) { if (typeof text != code.STRING) { return "" } text = text.replace(/\\n/g, "<br>")
|
Color: function(text) { if (typeof text != code.STRING) { return "" } text = text.replace(/\\n/g, "<br>")
|
||||||
if (text.indexOf(ice.HTTP) == 0 && text.length > 10) { var ls = text.split(lex.SP); text = "<a href='"+ls[0]+"' target='_blank'>"+decodeURI(ls[0])+"</a>"+ls.slice(1).join(lex.SP) }
|
if (text.indexOf(ice.HTTP) == 0 && text.length > 10) { var ls = text.split(lex.SP); text = "<a href='"+ls[0]+"' target='_blank'>"+decodeURI(ls[0])+"</a>"+ls.slice(1).join(lex.SP) }
|
||||||
if (text.indexOf("export ctx_dev=") == 0 && text.length > 10) { return "<div class='story' data-type='spark' data-name='shell'><div>"+"<span>"+text+"</span>"+"</div></div>" }
|
if (text.indexOf("export ctx_dev=") == 0 && text.length > 10) {
|
||||||
if (text.indexOf("\033\[") == -1) { return text }
|
return "<div class='story' data-type='spark' data-name='shell'><div>"+"<span>"+text+"</span>"+"</div></div>"
|
||||||
|
} if (text.indexOf("\033\[") == -1) { return text }
|
||||||
text = text.replace(/\033\[41m/g, "<span style='background-color:#f00'>")
|
text = text.replace(/\033\[41m/g, "<span style='background-color:#f00'>")
|
||||||
text = text.replace(/\033\[31m/g, "<span style='color:#f00'>")
|
text = text.replace(/\033\[31m/g, "<span style='color:#f00'>")
|
||||||
text = text.replace(/\033\[32m/g, "<span style='color:#0f0'>")
|
text = text.replace(/\033\[32m/g, "<span style='color:#0f0'>")
|
||||||
@ -287,7 +288,7 @@ Volcanos("page", {
|
|||||||
text = text.replace(/\033\[1m/g, "<span style='font-weight:bold'>")
|
text = text.replace(/\033\[1m/g, "<span style='font-weight:bold'>")
|
||||||
text = text.replace(/\033\[0m/g, "</span>")
|
text = text.replace(/\033\[0m/g, "</span>")
|
||||||
text = text.replace(/\033\[m/g, "</span>")
|
text = text.replace(/\033\[m/g, "</span>")
|
||||||
return text
|
return text // }
|
||||||
},
|
},
|
||||||
Keys: function() { var list = []; /* FS SP GT PT */ for (var i = 0; i < arguments.length; i++) { var v = arguments[i]; if (typeof v == code.OBJECT) {
|
Keys: function() { var list = []; /* FS SP GT PT */ for (var i = 0; i < arguments.length; i++) { var v = arguments[i]; if (typeof v == code.OBJECT) {
|
||||||
for (var j = 0; j < v.length; j++) { if (typeof v[j] == code.OBJECT) {
|
for (var j = 0; j < v.length; j++) { if (typeof v[j] == code.OBJECT) {
|
||||||
@ -363,7 +364,9 @@ Volcanos("page", {
|
|||||||
favor: "\u2606",
|
favor: "\u2606",
|
||||||
help: "\u2753",
|
help: "\u2753",
|
||||||
},
|
},
|
||||||
inputs: function(can, list, type) { var _list = []; for (var i = 0; i < list.length; i++) { switch (list[i]) {
|
inputs: function(can, list, type) {
|
||||||
|
var _list = []; for (var i = 0; i < list.length; i++) {
|
||||||
|
switch (list[i]) {
|
||||||
case "": _list.push(""); break
|
case "": _list.push(""); break
|
||||||
case ice.AUTO:
|
case ice.AUTO:
|
||||||
_list.push({type: html.BUTTON, name: ice.LIST})
|
_list.push({type: html.BUTTON, name: ice.LIST})
|
||||||
@ -386,16 +389,21 @@ Volcanos("page", {
|
|||||||
}})
|
}})
|
||||||
_list.push(mdb.NEXT, mdb.PREV)
|
_list.push(mdb.NEXT, mdb.PREV)
|
||||||
break
|
break
|
||||||
default:
|
default: (function() { var item = can.core.SplitInput(list[i], type||html.BUTTON)
|
||||||
(function() { var item = can.core.SplitInput(list[i], type||html.BUTTON)
|
if (item.type == html.SELECT) {
|
||||||
if (item.type == html.SELECT) { item._init = function(target) { target.value = item.value||item.values[0], target.onchange = function(event) { can.misc.Event(event, can, function(msg) {
|
item._init = function(target) { target.value = item.value||item.values[0]
|
||||||
can.run(event)
|
target.onchange = function(event) { can.misc.Event(event, can, function(msg) { can.run(event) }) }
|
||||||
}) } } } item.action && (function() { item._init = function(target) {
|
}
|
||||||
|
}
|
||||||
|
item.action && (function() { item._init = function(target) {
|
||||||
can.onappend.figure(can, item, target, function() { can.Update({}, ) })
|
can.onappend.figure(can, item, target, function() { can.Update({}, ) })
|
||||||
} })()
|
} })()
|
||||||
_list.push(item), type = item.type
|
_list.push(item), type = item.type
|
||||||
})()
|
})()
|
||||||
} } return _list },
|
}
|
||||||
|
}
|
||||||
|
return _list
|
||||||
|
},
|
||||||
input: function(can, item, value) { var input = {type: html.INPUT, name: item.name, data: item, style: item.style||{}, dataset: {}, _init: item._init}
|
input: function(can, item, value) { var input = {type: html.INPUT, name: item.name, data: item, style: item.style||{}, dataset: {}, _init: item._init}
|
||||||
item.value == ice.AUTO && (item.value = "", item.action = ice.AUTO), item.action == ice.AUTO && (input.dataset.action = ice.AUTO)
|
item.value == ice.AUTO && (item.value = "", item.action = ice.AUTO), item.action == ice.AUTO && (input.dataset.action = ice.AUTO)
|
||||||
switch (item.type = item.type||html.TEXT) {
|
switch (item.type = item.type||html.TEXT) {
|
||||||
@ -419,10 +427,10 @@ input: function(can, item, value) { var input = {type: html.INPUT, name: item.na
|
|||||||
} return input
|
} return input
|
||||||
},
|
},
|
||||||
icons: function(can, name, space) { if (!name) { return }
|
icons: function(can, name, space) { if (!name) { return }
|
||||||
if (can.base.contains(name, ".ico", ".png", ".jpg")) { return {img: can.misc.Resource(can, (name.indexOf(nfs.PS) == -1? nfs.USR_ICONS: "")+name, space)} }
|
if (can.base.contains(name, "/") && can.misc.isImage(can, name)) { return {img: can.misc.Resource(can, name, space)} }
|
||||||
// if (can.page.unicode[name]) { return {text: [can.page.unicode[name], "", "icon"]} }
|
// if (can.page.unicode[name]) { return {text: [can.page.unicode[name], "", "icon"]} }
|
||||||
if (name == mdb.DELETE) { return {icon: "bi bi-trash"} }
|
|
||||||
if (can.base.beginWith(name, "bi ")) { return {icon: name} }
|
if (can.base.beginWith(name, "bi ")) { return {icon: name} }
|
||||||
|
if (name == mdb.DELETE) { return {icon: "bi bi-trash"} }
|
||||||
var _icon = can.base.getValid(can.Conf("_icons."+name), can.Conf("_trans.icons."+name), can.core.Value(can.onaction, ["_trans.icons."+name]), icon[name])
|
var _icon = can.base.getValid(can.Conf("_icons."+name), can.Conf("_trans.icons."+name), can.core.Value(can.onaction, ["_trans.icons."+name]), icon[name])
|
||||||
if (_icon) { return {icon: _icon} }
|
if (_icon) { return {icon: _icon} }
|
||||||
},
|
},
|
||||||
|
@ -174,7 +174,8 @@ Volcanos("user", {
|
|||||||
var _style = can.page.buttonStyle(can, item)
|
var _style = can.page.buttonStyle(can, item)
|
||||||
return {
|
return {
|
||||||
view: [[html.ITEM, item, _style]],
|
view: [[html.ITEM, item, _style]],
|
||||||
list: [can.page.icons(can, item), {text: [can.user.trans(can, item, trans), "", "name"]}],
|
// list: [can.page.icons(can, item), {text: [can.user.trans(can, item, trans), "", "name"]}],
|
||||||
|
list: [{text: [can.user.trans(can, item, trans), "", "name"]}],
|
||||||
onclick: function(event) { click(event, item, index) },
|
onclick: function(event) { click(event, item, index) },
|
||||||
onmouseenter: function(event) { remove_sub(carte) },
|
onmouseenter: function(event) { remove_sub(carte) },
|
||||||
}
|
}
|
||||||
@ -184,7 +185,7 @@ Volcanos("user", {
|
|||||||
can.onimport && can.onimport[item[0]]? can.onimport[item[0]](can, button, event): click(event, button, index)
|
can.onimport && can.onimport[item[0]]? can.onimport[item[0]](can, button, event): click(event, button, index)
|
||||||
}, carte, trans); carte._sub = sub }
|
}, carte, trans); carte._sub = sub }
|
||||||
return {view: html.ITEM, list: [
|
return {view: html.ITEM, list: [
|
||||||
can.page.icons(can, item[0]),
|
// can.page.icons(can, item[0]),
|
||||||
{text: [can.user.trans(can, item[0], trans), "", "name"]},
|
{text: [can.user.trans(can, item[0], trans), "", "name"]},
|
||||||
{text: [lex.SP+can.page.unicode.next, "", [html.ICON, "next"]]}
|
{text: [lex.SP+can.page.unicode.next, "", [html.ICON, "next"]]}
|
||||||
], onmouseenter: subs, onclick: subs}
|
], onmouseenter: subs, onclick: subs}
|
||||||
|
@ -2,7 +2,10 @@ Volcanos(chat.ONACTION, {
|
|||||||
run: function(event, can) { can.run(can.request(event, {_method: http.POST})) }, refresh: function(event, can) { can.run(can.request(event, {_method: http.GET})) },
|
run: function(event, can) { can.run(can.request(event, {_method: http.POST})) }, refresh: function(event, can) { can.run(can.request(event, {_method: http.GET})) },
|
||||||
list: function(event, can) { can.sup.isSimpleMode() || can.run(can.request(event, {_toast: event.isTrusted? ice.PROCESS: "" , _method: http.GET})) }, back: function(event, can) { can.sup.onimport.back(event, can.sup) },
|
list: function(event, can) { can.sup.isSimpleMode() || can.run(can.request(event, {_toast: event.isTrusted? ice.PROCESS: "" , _method: http.GET})) }, back: function(event, can) { can.sup.onimport.back(event, can.sup) },
|
||||||
onclick: function(event, can) { can.Conf(mdb.TYPE) == html.BUTTON && can.run(event, [ctx.ACTION, can.Conf(mdb.NAME)].concat(can.sup.Input())), can.onkeymap.prevent(event) },
|
onclick: function(event, can) { can.Conf(mdb.TYPE) == html.BUTTON && can.run(event, [ctx.ACTION, can.Conf(mdb.NAME)].concat(can.sup.Input())), can.onkeymap.prevent(event) },
|
||||||
onchange: function(event, can) { can.Conf(mdb.TYPE) == html.SELECT && can.run(event) },
|
onchange: function(event, can) { if (can.Conf(mdb.TYPE) != html.SELECT) { return }
|
||||||
|
can.sup.onexport.session && can.sup.onexport.session(can.sup, "action:"+can.Conf(mdb.NAME), event.target.value)
|
||||||
|
can.run(event)
|
||||||
|
},
|
||||||
onkeydown: function(event, can) { can.onkeymap.input(event, can, event.target); if (can.Conf(mdb.TYPE) == html.TEXTAREA && !event.ctrlKey) { return }
|
onkeydown: function(event, can) { can.onkeymap.input(event, can, event.target); if (can.Conf(mdb.TYPE) == html.TEXTAREA && !event.ctrlKey) { return }
|
||||||
if (event.key == code.ENTER) { return can.onkeymap.prevent(event), can.run(event), can.onmotion.focus(can, event.target) }
|
if (event.key == code.ENTER) { return can.onkeymap.prevent(event), can.run(event), can.onmotion.focus(can, event.target) }
|
||||||
if (!event.ctrlKey) { return } switch (event.key) {
|
if (!event.ctrlKey) { return } switch (event.key) {
|
||||||
|
@ -1,30 +1,34 @@
|
|||||||
// fieldset.feel>form.option div.item.file input { width:var(--project-width); }
|
fieldset.feel:not(.cmd)>form.option>div.item.file { display:none; }
|
||||||
fieldset.feel:not(.cmd)>form.option div.item.file { display:none; }
|
body.mobile fieldset.feel>form.option>div.item.file { display:none; }
|
||||||
fieldset.feel>div.output>div.project div.item span.name { flex-grow:1; overflow:hidden; }
|
fieldset.feel>div.output>div.project>div.item.select { border-width:3px; }
|
||||||
fieldset.feel>div.output>div.project div.item span.progress { color:var(--notice-bg-color); margin-left:10px; }
|
fieldset.feel>div.output>div.project>div.item>img { padding:5px; }
|
||||||
fieldset.feel>div.output>div.project div.item span.size { color:var(--disable-fg-color); font-size:var(--status-font-size); margin-left:10px; }
|
fieldset.feel>div.output>div.project>div.item>span.name { flex-grow:1; overflow:hidden; }
|
||||||
fieldset.feel>div.output>div.layout>div.display { position:relative; overflow:hidden; }
|
fieldset.feel>div.output>div.project>div.item>span.progress { color:var(--notice-bg-color); margin-left:10px; }
|
||||||
|
fieldset.feel>div.output>div.project>div.item>span.size { color:var(--disable-fg-color); font-size:var(--status-font-size); margin-left:10px; }
|
||||||
|
fieldset.feel>div.output>div.layout>div.display { overflow:hidden; position:relative; }
|
||||||
fieldset.feel>div.output>div.layout>div.display:not(.hide) { height:100px; display:flex; justify-content:center; align-items:center; gap:10px; }
|
fieldset.feel>div.output>div.layout>div.display:not(.hide) { height:100px; display:flex; justify-content:center; align-items:center; gap:10px; }
|
||||||
fieldset.feel>div.output>div.layout>div.display>.select { border:var(--box-notice); }
|
fieldset.feel>div.output>div.layout>div.display>.select { border:var(--box-notice); border-width:3px; }
|
||||||
fieldset.feel>div.output>div.layout>div.display>img { height:98px; width:100px; object-fit:cover; }
|
fieldset.feel>div.output>div.layout>div.display>img { height:100px; width:100px; object-fit:cover; }
|
||||||
fieldset.feel>div.output>div.layout>div.display>video { height:98px; width:100px; object-fit:cover; }
|
fieldset.feel>div.output>div.layout>div.display>video { height:100px; width:100px; object-fit:cover; }
|
||||||
fieldset.feel>div.output>div.layout>div.display>div.audio { word-break:break-all; height:100%; width:100px; display:flex; align-items:center; }
|
fieldset.feel>div.output>div.layout>div.display>div.audio { word-break:break-all; height:100px; width:100px; display:flex; align-items:center; }
|
||||||
fieldset.feel>div.output>div.layout>div.display>div.audio:not(.select) { border:var(--box-border); }
|
fieldset.feel>div.output>div.layout>div.display>div.audio:not(.select) { border:var(--box-border); }
|
||||||
|
fieldset.feel>div.output>div.layout>div.display>div.audio img.cover { height:94px; width:94px; position:absolute; }
|
||||||
|
fieldset.feel>div.output>div.layout>div.display>div.audio span.name { z-index:5; }
|
||||||
fieldset.feel>div.output>div.layout>div.display>img:hover { cursor:pointer; }
|
fieldset.feel>div.output>div.layout>div.display>img:hover { cursor:pointer; }
|
||||||
fieldset.feel>div.output>div.layout>div.display>video:hover { cursor:pointer; }
|
fieldset.feel>div.output>div.layout>div.display>video:hover { cursor:pointer; }
|
||||||
fieldset.feel>div.output>div.layout>div.display>div.audio:hover { background-color:var(--hover-bg-color); cursor:pointer; }
|
fieldset.feel>div.output>div.layout>div.display>div.audio:hover { cursor:pointer; }
|
||||||
fieldset.feel>div.output>div.layout>div.display>div.toggle { font-size:32px; padding:5px; padding-top:32px; height:100px; position:absolute; }
|
fieldset.feel>div.output>div.layout>div.display>div.toggle { font-size:32px; padding:5px; padding-top:32px; height:100px; position:absolute; }
|
||||||
fieldset.feel>div.output>div.layout>div.display>div.toggle.prev { left:0; }
|
fieldset.feel>div.output>div.layout>div.display>div.toggle.prev { left:0; }
|
||||||
fieldset.feel>div.output>div.layout>div.display>div.toggle.next { right:0; }
|
fieldset.feel>div.output>div.layout>div.display>div.toggle.next { right:0; }
|
||||||
fieldset.feel>div.output>div.layout>div.layout>div.content { overflow:hidden; padding:0; }
|
fieldset.feel>div.output>div.layout>div.layout>div.content { padding:0; overflow:hidden; }
|
||||||
fieldset.feel>div.output>div.layout>div.layout>div.content>img { object-fit:scale-down; cursor:pointer; }
|
fieldset.feel>div.output>div.layout>div.layout>div.content>img { height:100%; width:100%; object-fit:scale-down; cursor:pointer; }
|
||||||
fieldset.feel>div.output>div.layout>div.layout>div.content>img { height:100%; width:100%; }
|
|
||||||
fieldset.feel>div.output>div.layout>div.layout>div.content>video { height:100%; width:100%; }
|
fieldset.feel>div.output>div.layout>div.layout>div.content>video { height:100%; width:100%; }
|
||||||
fieldset.feel>div.output>div.layout>div.layout>div.content>div.audio { height:100%; width: 100%; display:flex; flex-direction:column; justify-content:center; align-items:center; }
|
fieldset.feel>div.output>div.layout>div.layout>div.content>div.audio { height:100%; width: 100%; display:flex; flex-direction:column; justify-content:center; align-items:center; }
|
||||||
|
fieldset.feel>div.output>div.layout>div.layout>div.content>div.audio img.cover { height:calc(100% - 120px); }
|
||||||
|
fieldset.feel>div.output>div.layout>div.layout>div.content>div.audio span.name { padding:10px; }
|
||||||
|
fieldset.feel>div.output>div.layout>div.layout>div.content>div.progress { background-color:var(--notice-bg-color); height:3px; position:absolute; bottom:2px; }
|
||||||
fieldset.feel>div.output>div.layout>div.layout>div.content>div.toggle { font-size:32px; padding:5px; padding-top:32px; height:100px; top:40%; z-index:5; }
|
fieldset.feel>div.output>div.layout>div.layout>div.content>div.toggle { font-size:32px; padding:5px; padding-top:32px; height:100px; top:40%; z-index:5; }
|
||||||
fieldset.feel>div.output>div.layout>div.layout>div.content>div.toggle.next { right:0; }
|
fieldset.feel>div.output>div.layout>div.layout>div.content>div.toggle.next { right:0; }
|
||||||
fieldset.feel>div.output>div.layout>div.layout>div.content>div.toggle.prev { left:0; }
|
fieldset.feel>div.output>div.layout>div.layout>div.content>div.toggle.prev { left:0; }
|
||||||
fieldset.feel>div.output>div.layout>div.layout>div.content>div.progress { background-color:var(--notice-bg-color); height:3px; position:absolute; bottom:2px; }
|
div.toggle { -webkit-user-select:none; }
|
||||||
// body:not(.mobile) fieldset.feel>div.output>div.layout>div.layout>div.content:not(:hover)>div.toggle { display:none; }
|
img { -webkit-user-select:none; }
|
||||||
// body:not(.mobile) fieldset.feel>div.output>div.layout>div.display:not(:hover)>div.toggle { display:none; }
|
|
||||||
// body.mobile fieldset.feel>div.output>div.project { overflow-x:hidden; }
|
|
@ -1,39 +1,46 @@
|
|||||||
Volcanos(chat.ONIMPORT, {
|
Volcanos(chat.ONIMPORT, {
|
||||||
_init: function(can, msg, cb) {
|
_init: function(can, msg, cb) { can.onappend.style(can, wiki.FEEL)
|
||||||
can.ui = can.onappend.layout(can), can.onimport._project(can, msg)
|
can.user.isMobile && (can.onaction.list = ["upload"])
|
||||||
cb && cb(msg), can.onimport.page(can, can.db.list, can.db.begin = 0)
|
can.ui = can.onappend.layout(can), cb && cb(msg)
|
||||||
|
if (can.Action("sort") != mdb.TIME) {
|
||||||
|
can.onaction.sort({}, can, "sort", can.Action("sort"))
|
||||||
|
} else {
|
||||||
|
can.onimport._project(can, msg)
|
||||||
|
}
|
||||||
|
can.onimport.page(can, can.db.list, can.db.begin = 0)
|
||||||
can.onmotion.toggle(can, can.ui.display, true), can.onimport.layout(can)
|
can.onmotion.toggle(can, can.ui.display, true), can.onimport.layout(can)
|
||||||
},
|
},
|
||||||
_project: function(can, msg) { can.db.list = [], can.db.dir_root = msg.Option(nfs.DIR_ROOT)
|
_project: function(can, msg) { can.db.list = [], can.db.dir_root = msg.Option(nfs.DIR_ROOT)
|
||||||
msg.Table(function(item) { item.name = can.base.trimPrefix(item.path, can.Option(nfs.PATH))
|
msg.Table(function(item) { item.name = can.base.trimPrefix(item.path, can.Option(nfs.PATH))
|
||||||
|
can.base.endWith(item.path, "/") && (item.nick = [{img: can.misc.Resource(can, "usr/icons/dir.png")}, {text: [item.name, "", mdb.NAME]}])
|
||||||
can.base.endWith(item.path, nfs.PS)? can.onimport.item(can, item, function(event) { can.Option(nfs.PATH, item.path) && can.Update(event) }): can.db.list.push(item)
|
can.base.endWith(item.path, nfs.PS)? can.onimport.item(can, item, function(event) { can.Option(nfs.PATH, item.path) && can.Update(event) }): can.db.list.push(item)
|
||||||
})
|
})
|
||||||
can.core.List(can.db.list, function(item, index) { var last = can.onexport.progress(can, "p."+can.onimport._file(can, item.path))
|
can.core.List(can.db.list, function(item, index) { var last = can.onexport.progress(can, "p."+item.path)
|
||||||
item.nick = [{text: [item.name, "", mdb.NAME]}, last && {text: [last, "", "progress"]}, {text: [item.size, "", nfs.SIZE]}]
|
item.nick = [item.cover? {img: can.misc.Resource(can, item.cover)}:
|
||||||
|
can.misc.isImage(can, item.path)? {img: can.misc.Resource(can, item.path)}:
|
||||||
|
can.misc.isVideo(can, item.path)? {img: can.misc.Resource(can, "usr/icons/QuickTime Player.png")}:
|
||||||
|
can.misc.isAudio(can, item.path)? {img: can.misc.Resource(can, "usr/icons/Music.png")}: null,
|
||||||
|
{text: [item.name, "", mdb.NAME]}, last && {text: [last, "", "progress"]}, {text: [item.size, "", nfs.SIZE]},
|
||||||
|
]
|
||||||
item._hash = item.path, item._title = item.path.split("/").pop()
|
item._hash = item.path, item._title = item.path.split("/").pop()
|
||||||
var target = can.onimport.item(can, item, function(event, item, show, target) { can.onimport._content(can, item, index, target) }); item._target = target
|
item._target = can.onimport.item(can, item, function(event, item, show, target) { can.onimport._content(can, item, index, target) })
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
_content: function(can, item, index, target) { var progress
|
_content: function(can, item, index, target) { can.Option(nfs.FILE, item.name), can.Status(item)
|
||||||
can.Option(nfs.FILE, can.base.trimPrefix(item.path, can.Option(nfs.PATH)))
|
if (can.onexport.progress(can, "p."+item.path) == "100%") { can.onexport.progress(can, "p."+item.path, ""), can.onexport.progress(can, item.path, "") }
|
||||||
if (can.onexport.progress(can, "p."+item._path) == "100%") {
|
if (!can.onmotion.cache(can, function() { return item.path }, can.ui.content)) { var progress
|
||||||
can.onexport.progress(can, "p."+item._path, ""), can.onexport.progress(can, item._path, 0)
|
item._cb = function(event) { can.ui.video = event.target
|
||||||
}
|
var p = parseInt(event.target.currentTime*100/event.target.duration)
|
||||||
if (!can.onmotion.cache(can, function() { return item.path }, can.ui.content)) {
|
can.page.Select(can, target, "span.progress", function(target) { target.innerText = p+"%" })
|
||||||
item._cb = function(event) { can.ui.video = event.target, can.Status(item), can.onexport.storage(can, "last", item.path)
|
if (!progress) { progress = can.page.Append(can, can.ui.content, ["progress"])._target } can.page.style(can, progress, html.WIDTH, can.ui.content.offsetWidth*p/100)
|
||||||
var p = parseInt(event.target.currentTime*100/event.target.duration); item.nick[1] = {text: [p+"%", "", "progress"]}, can.page.Appends(can, target, item.nick)
|
|
||||||
if (!progress) { progress = can.page.Append(can, can.ui.content, ["progress"])._target }
|
|
||||||
can.page.style(can, progress, html.WIDTH, can.ui.content.offsetWidth*p/100)
|
|
||||||
}
|
}
|
||||||
var _target = can.onimport.file(can, item.path, item, index, can.ui.content, true); _target.focus()
|
var _target = can.onimport.file(can, item.path, item, index, can.ui.content, true); _target.focus()
|
||||||
// _target.onclick = function() { can.page.tagis(_target, html.IMG) && can.ondetail._init(can, index) }
|
|
||||||
can.onappend._toggle(can, can.ui.content, function() {
|
can.onappend._toggle(can, can.ui.content, function() {
|
||||||
index == 0? can.user.toast(can, "已经是第一页了"): target.previousSibling.click()
|
target.previousSibling? target.previousSibling.click(): can.user.toast(can, "已经是第一页了")
|
||||||
}, function() {
|
}, function() {
|
||||||
try { target.nextSibling.click() } catch (e) { can.user.toast(can, "已经是最后一页了") }
|
target.nextSibling? target.nextSibling.click(): can.user.toast(can, "已经是最后一页了")
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
can.Status(item)
|
|
||||||
if (index < can.db.begin || index >= can.db.begin+can.db.limit) {
|
if (index < can.db.begin || index >= can.db.begin+can.db.limit) {
|
||||||
can.onimport.page(can, can.db.list, can.db.begin = index-index%can.db.limit)
|
can.onimport.page(can, can.db.list, can.db.begin = index-index%can.db.limit)
|
||||||
} can.onmotion.select(can, can.ui.display, "*", item._display)
|
} can.onmotion.select(can, can.ui.display, "*", item._display)
|
||||||
@ -43,58 +50,57 @@ Volcanos(chat.ONIMPORT, {
|
|||||||
},
|
},
|
||||||
file: function(can, path, item, index, target, auto) { item._path = path = can.onimport._file(can, path)
|
file: function(can, path, item, index, target, auto) { item._path = path = can.onimport._file(can, path)
|
||||||
var cb = can.onfigure[can.base.Ext(path)]||can.onfigure[wiki.IMAGE]
|
var cb = can.onfigure[can.base.Ext(path)]||can.onfigure[wiki.IMAGE]
|
||||||
return cb && can.page.Append(can, target||can.ui.display, [cb(can, path, item, index, auto)])._target
|
return cb && can.page.Append(can, target||can.ui.display, [cb(can, item, auto)])._target
|
||||||
},
|
},
|
||||||
page: function(can, list, begin) { can.onmotion.clear(can, can.ui.display)
|
page: function(can, list, begin) { can.onmotion.clear(can, can.ui.display)
|
||||||
begin = parseInt(begin||can.db.begin||0), can.db.limit = (parseInt(can.ui.display.offsetWidth/110)||5)-1
|
begin = parseInt(begin||can.db.begin||0), can.db.limit = can.base.Min((parseInt(can.ui.display.offsetWidth/110)||5)-1, 3)
|
||||||
for (var i = begin; i < begin+can.db.limit; i++) {
|
for (var i = begin; i < begin+can.db.limit; i++) { if (list && list[i]) { list[i]._display = can.onimport.file(can, list[i].path, list[i], i) } }
|
||||||
if (list && list[i]) {
|
|
||||||
list[i]._display = can.onimport.file(can, list[i].path, list[i], i)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
can.onappend._toggle(can, can.ui.display, function(event) { can.onaction.prev(event, can) }, function(event) { can.onaction.next(event, can) })
|
can.onappend._toggle(can, can.ui.display, function(event) { can.onaction.prev(event, can) }, function(event) { can.onaction.next(event, can) })
|
||||||
can.Status({begin: begin, limit: can.db.limit, total: list.length})
|
can.Status({begin: begin, limit: can.db.limit, total: list.length})
|
||||||
},
|
},
|
||||||
}, [""])
|
}, [""])
|
||||||
Volcanos(chat.ONFIGURE, {
|
Volcanos(chat.ONFIGURE, {
|
||||||
png: function(can, path, item, index) { return can.onfigure.image(can, path, item, index) },
|
png: function(can, item) { return can.onfigure.image(can, item) },
|
||||||
jpg: function(can, path, item, index) { return can.onfigure.image(can, path, item, index) },
|
jpg: function(can, item) { return can.onfigure.image(can, item) },
|
||||||
jpeg: function(can, path, item, index) { return can.onfigure.image(can, path, item, index) },
|
jpeg: function(can, item) { return can.onfigure.image(can, item) },
|
||||||
image: function(can, path, item, index) { return {img: path, onclick: function(event) { item._target.click() }} },
|
image: function(can, item) { return {img: item._path, onclick: function(event) { item._target.click() }} },
|
||||||
audio: function(can, path, item, index, auto) {
|
video: function(can, item, auto) { var init, last = can.onexport.progress(can, item.path)||0
|
||||||
var meta = can.onfigure.video(can, path, item, index, auto); meta.type = html.AUDIO;
|
return {type: html.VIDEO, data: {src: item._path, controls: auto, autoplay: auto},
|
||||||
return {view: html.AUDIO, list: [{text: item.name}, meta], onclick: meta.onclick}
|
|
||||||
},
|
|
||||||
video: function(can, path, item, index, auto) {
|
|
||||||
var cb = item._cb||function cb(event) {}
|
|
||||||
var init, last = can.onexport.progress(can, path)||0
|
|
||||||
// preload: auto? "auto": "metadata",
|
|
||||||
return {type: html.VIDEO, data: {src: path, controls: auto? "controls": "", autoplay: auto, playbackRate: 1},
|
|
||||||
onclick: function(event) { item._target.click(), can.onkeymap.prevent(event) },
|
onclick: function(event) { item._target.click(), can.onkeymap.prevent(event) },
|
||||||
onratechange: function(event) { can.onexport.storage(can, "rate", event.target.playbackRate) },
|
onratechange: function(event) { can.onexport.storage(can, "rate", event.target.playbackRate) },
|
||||||
onvolumechange: function(event) { can.onexport.storage(can, "volume", event.target.volume) },
|
onvolumechange: function(event) { can.onexport.storage(can, "volume", event.target.volume) },
|
||||||
onloadedmetadata: function(event) {
|
onloadedmetadata: function(event) {
|
||||||
event.target.volume = can.onexport.storage(can, "volume")||1
|
event.target.volume = can.onexport.storage(can, "volume")||0.5
|
||||||
event.target.playbackRate = can.onexport.storage(can, "rate")||1
|
event.target.playbackRate = can.onexport.storage(can, "rate")||1
|
||||||
},
|
},
|
||||||
ontimeupdate: function(event) { if (event.target.currentTime == 0) { return } cb(event)
|
ontimeupdate: function(event) { if (event.target.currentTime == 0) { return } item._cb && item._cb(event)
|
||||||
can.Status("position", can.onexport.position(can, event.target.currentTime-1, event.target.duration))
|
can.Status("position", can.onexport.position(can, event.target.currentTime-1, event.target.duration))
|
||||||
can.onexport.progress(can, "p."+path, parseInt(event.target.currentTime*100/event.target.duration)+"%")
|
can.onexport.progress(can, "p."+item.path, parseInt(event.target.currentTime*100/event.target.duration)+"%")
|
||||||
can.onexport.progress(can, path, event.target.currentTime)
|
can.onexport.progress(can, item.path, event.target.currentTime)
|
||||||
if (!init) { init = true, event.target.currentTime = last }
|
if (!init) { init = true, event.target.currentTime = last }
|
||||||
},
|
},
|
||||||
onended: function(event) { var next = item._target.nextSibling
|
onended: function(event) { var next = item._target.nextSibling
|
||||||
if (next) { can.onmotion.delay(can, function() { next.click() }, 3000), can.user.toast(can, "3s 后即将播放下一个", "", 3000) }
|
next && can.onmotion.delay(can, function() { next.click() }, 300)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
webm: function(can, path, item, index, auto) { return can.onfigure.video(can, path, item, index, auto) },
|
audio: function(can, item, auto) { var meta = can.onfigure.video(can, item, auto); meta.type = html.AUDIO
|
||||||
mov: function(can, path, item, index, auto) { return can.onfigure.video(can, path, item, index, auto) },
|
return {view: html.AUDIO, list: [{img: can.misc.Resource(can, item.cover, can.ConfSpace()), className: "cover"}, {text: [item.name, "", mdb.NAME]}, meta], onclick: meta.onclick}
|
||||||
m4v: function(can, path, item, index, auto) { return can.onfigure.video(can, path, item, index, auto) },
|
},
|
||||||
mp4: function(can, path, item, index, auto) { return can.onfigure.video(can, path, item, index, auto) },
|
webm: function(can, item, auto) { return can.onfigure.video(can, item, auto) },
|
||||||
mp3: function(can, path, item, index, auto) { return can.onfigure.audio(can, path, item, index, auto) },
|
mov: function(can, item, auto) { return can.onfigure.video(can, item, auto) },
|
||||||
|
m4v: function(can, item, auto) { return can.onfigure.video(can, item, auto) },
|
||||||
|
mp4: function(can, item, auto) { return can.onfigure.video(can, item, auto) },
|
||||||
|
mp3: function(can, item, auto) { return can.onfigure.audio(can, item, auto) },
|
||||||
})
|
})
|
||||||
Volcanos(chat.ONACTION, {
|
Volcanos(chat.ONACTION, {
|
||||||
|
_trans: {
|
||||||
|
"fullscreen": "全屏",
|
||||||
|
icons: {
|
||||||
|
"fullscreen": "bi bi-fullscreen",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
list: ["upload", "record1", "record2", "fullscreen", ["sort", "time", "path", "size"]],
|
||||||
record0: function(event, can, name, cb) { can.user.input(event, can, [{name: nfs.FILE, value: name}], function(list) { var height = window.innerHeight
|
record0: function(event, can, name, cb) { can.user.input(event, can, [{name: nfs.FILE, value: name}], function(list) { var height = window.innerHeight
|
||||||
navigator.mediaDevices.getDisplayMedia({video: {height: height}}).then(function(stream) {
|
navigator.mediaDevices.getDisplayMedia({video: {height: height}}).then(function(stream) {
|
||||||
can.core.Next([3, 2, 1], function(item, next) { can.user.toast(can, item + "s 后开始截图"), can.onmotion.delay(can, next, 1000) }, function() { can.user.toast(can, "现在开始截图")
|
can.core.Next([3, 2, 1], function(item, next) { can.user.toast(can, item + "s 后开始截图"), can.onmotion.delay(can, next, 1000) }, function() { can.user.toast(can, "现在开始截图")
|
||||||
@ -119,30 +125,17 @@ Volcanos(chat.ONACTION, {
|
|||||||
var show = can.onmotion.toggle(can, can.ui.project); can.onmotion.toggle(can, can.ui.display, show), can.onimport.layout(can)
|
var show = can.onmotion.toggle(can, can.ui.project); can.onmotion.toggle(can, can.ui.display, show), can.onimport.layout(can)
|
||||||
can.page.ClassList.set(can, can.ui.content, html.FLOAT, !show)
|
can.page.ClassList.set(can, can.ui.content, html.FLOAT, !show)
|
||||||
},
|
},
|
||||||
|
sort: function(event, can, button, value) {
|
||||||
|
switch (value) {
|
||||||
|
case mdb.TIME: can._msg.Sort(value, "str_r"); break
|
||||||
|
case nfs.PATH: can._msg.Sort(value, "str"); break
|
||||||
|
case nfs.SIZE: can._msg.Sort(value, "int_r"); break
|
||||||
|
}
|
||||||
|
can.onmotion.clear(can, can.ui.project), can.ui.filter = can.onappend.filter(can, can.ui.project), can.onimport._project(can, can._msg)
|
||||||
|
},
|
||||||
prev: function(event, can) { if (can.db.begin > 0) { can.db.begin -= can.db.limit, can.onimport.page(can, can.db.list) } else { can.user.toast(can, "已经是第一页了") } },
|
prev: function(event, can) { if (can.db.begin > 0) { can.db.begin -= can.db.limit, can.onimport.page(can, can.db.list) } else { can.user.toast(can, "已经是第一页了") } },
|
||||||
next: function(event, can) { if (can.db.begin + can.db.limit < can.db.list.length) { can.db.begin += can.db.limit, can.onimport.page(can, can.db.list) } else { can.user.toast(can, "已经是最后一页了") } },
|
next: function(event, can) { if (can.db.begin + can.db.limit < can.db.list.length) { can.db.begin += can.db.limit, can.onimport.page(can, can.db.list) } else { can.user.toast(can, "已经是最后一页了") } },
|
||||||
})
|
})
|
||||||
Volcanos(chat.ONDETAIL, {list: ["关闭", "上一个", "下一个", "设置头像", "设置背景", "复制链接", "下载", "删除"],
|
|
||||||
_init: function(can, index) {
|
|
||||||
can.onappend._init(can, {type: "story feel play float"}, [], function(sub) { can.sub = sub, sub._legend.innerHTML = can._legend.innerHTML, sub._legend.onclick = can._legend.onclick, can.onappend.style(can, html.FLEX, sub._output)
|
|
||||||
can.getActionSize(function(msg, left, top, width, height) { sub.onappend._action(can, can.ondetail.list, sub._action, can.ondetail), sub.onappend._status(sub, ["begin", nfs.FILE])
|
|
||||||
sub.page.style(sub, sub._target, {left: left||0, top: top||0}), sub.page.style(sub, sub._output, html.HEIGHT, height-2*html.ACTION_HEIGHT, html.WIDTH, width)
|
|
||||||
can.order = index, can.show = function(order) { path = can.onimport._file(can, can.db.list[order].path); var cb = can.onfigure[can.base.Ext(path)]||can.onfigure[wiki.IMAGE]
|
|
||||||
sub.page.Appends(sub, sub._output, [can.base.Copy(cb(can, path, index), {height: "", style: kit.Dict(html.MAX_WIDTH, width, html.MAX_HEIGHT, height-2*html.ACTION_HEIGHT)})])
|
|
||||||
sub.Status(cli.BEGIN, order+1+nfs.PS+can.db.list.length), sub.Status(nfs.FILE, path)
|
|
||||||
}, can.show(can.order)
|
|
||||||
}), sub.run = function(can, cmds, cb) { can.run(can, cmds, cb, true) }
|
|
||||||
}, can._root._target)
|
|
||||||
},
|
|
||||||
"关闭": function(event, can) { can.page.Remove(can, can.sub._target) },
|
|
||||||
"上一个": function(event, can) { can.order > 0? can.show(--can.order): can.user.toast(can, "已经是第一张啦!") },
|
|
||||||
"下一个": function(event, can) { can.order < can.db.list.length-1? can.show(++can.order): can.user.toast(can, "已经是最后一张啦!") },
|
|
||||||
"设置头像": function(event, can) { can.setHeader(aaa.AVATAR, can.onimport._file(can, can.db.list[can.order].path)) },
|
|
||||||
"设置背景": function(event, can) { can.setHeader(aaa.BACKGROUND, can.onimport._file(can, can.db.list[can.order].path)) },
|
|
||||||
"复制链接": function(event, can) { can.onmotion.share(event, can, [], [web.LINK, can.user.copy(event, can, can.misc.MergeURL(can, {_path: can.onimport._file(can, can.db.list[can.order].path)}, true)) ]) },
|
|
||||||
"下载": function(event, can) { can.user.download(can, path = can.onimport._file(can, can.db.list[can.order].path)) },
|
|
||||||
"删除": function(event, can) { can.runAction(event, nfs.TRASH, [can.db.list[can.order].path], function(msg) { can.user.toastSuccess(can, "删除成功") }, true) },
|
|
||||||
})
|
|
||||||
Volcanos(chat.ONEXPORT, {list: [cli.BEGIN, mdb.LIMIT, mdb.TOTAL, mdb.NAME, nfs.SIZE, mdb.TIME, "position"],
|
Volcanos(chat.ONEXPORT, {list: [cli.BEGIN, mdb.LIMIT, mdb.TOTAL, mdb.NAME, nfs.SIZE, mdb.TIME, "position"],
|
||||||
progress: function(can, path, time) { return can.onexport.storage(can, path.split("?")[0], time) },
|
progress: function(can, path, time) { return can.onexport.storage(can, path.split("?")[0], time) },
|
||||||
position: function(can, index, total) { total = total || can.max; return parseInt((index+1)*100/total)+"%"+" = "+(parseInt(index)+1)+nfs.PS+parseInt(total) },
|
position: function(can, index, total) { total = total || can.max; return parseInt((index+1)*100/total)+"%"+" = "+(parseInt(index)+1)+nfs.PS+parseInt(total) },
|
||||||
@ -150,7 +143,7 @@ Volcanos(chat.ONEXPORT, {list: [cli.BEGIN, mdb.LIMIT, mdb.TOTAL, mdb.NAME, nfs.S
|
|||||||
Volcanos(chat.ONKEYMAP, {
|
Volcanos(chat.ONKEYMAP, {
|
||||||
_mode: {
|
_mode: {
|
||||||
plugin: {
|
plugin: {
|
||||||
Escape: function(event, can) { can.onaction.full(event, can) },
|
Escape: function(event, can) { can.onaction.fullscreen(event, can) },
|
||||||
ArrowLeft: function(event, can) { can.ui.video.currentTime -= 15 },
|
ArrowLeft: function(event, can) { can.ui.video.currentTime -= 15 },
|
||||||
ArrowRight: function(event, can) { can.ui.video.currentTime += 15 },
|
ArrowRight: function(event, can) { can.ui.video.currentTime += 15 },
|
||||||
ArrowDown: function(event, can) { try { can.user.toast(can, "volume: "+parseInt((can.ui.video.volume -= 0.1)*100)) } catch (e) {} },
|
ArrowDown: function(event, can) { try { can.user.toast(can, "volume: "+parseInt((can.ui.video.volume -= 0.1)*100)) } catch (e) {} },
|
||||||
|
@ -344,7 +344,7 @@ Volcanos(chat.ONEXPORT, {
|
|||||||
return can.misc.sessionStorage(can, [can.ConfSpace()||can.misc.Search(can, ice.POD), can.ConfIndex(), key, location.pathname], value)
|
return can.misc.sessionStorage(can, [can.ConfSpace()||can.misc.Search(can, ice.POD), can.ConfIndex(), key, location.pathname], value)
|
||||||
},
|
},
|
||||||
storage: function(can, key, value) { if (value) { value = JSON.stringify(value) }
|
storage: function(can, key, value) { if (value) { value = JSON.stringify(value) }
|
||||||
return can.misc.localStorage(can, [can.ConfSpace()||can.misc.Search(can, ice.POD), can.ConfIndex(), key, location.pathname], value)
|
return can.misc.localStorage(can, [can.ConfSpace()||can.misc.Search(can, ice.POD), can.ConfIndex(), key], value)
|
||||||
},
|
},
|
||||||
hash: function(can, hash) {
|
hash: function(can, hash) {
|
||||||
can.misc.SearchHash(can, hash), can.onexport.storage(can, "hash", hash)
|
can.misc.SearchHash(can, hash), can.onexport.storage(can, "hash", hash)
|
||||||
@ -352,9 +352,7 @@ Volcanos(chat.ONEXPORT, {
|
|||||||
},
|
},
|
||||||
title: function(can, title) { if (!can.isCmdMode()) { return }
|
title: function(can, title) { if (!can.isCmdMode()) { return }
|
||||||
var list = []; function push(p) { p && list.indexOf(p) == -1 && list.push(p) }
|
var list = []; function push(p) { p && list.indexOf(p) == -1 && list.push(p) }
|
||||||
if (!can.base.isIn(can.ConfIndex(), web.PORTAL)) {
|
if (!can.base.isIn(can.ConfIndex(), web.PORTAL)) { push(can.user.trans(can, can.ConfIndex(), can.Conf("help"))) }
|
||||||
push(can.user.trans(can, can.ConfIndex(), can.Conf("help")))
|
|
||||||
}
|
|
||||||
can.core.List(arguments, function(title, index) { index > 0 && push(title) }), push(can.ConfSpace()||can.misc.Search(can, ice.POD))
|
can.core.List(arguments, function(title, index) { index > 0 && push(title) }), push(can.ConfSpace()||can.misc.Search(can, ice.POD))
|
||||||
can.user.title(list.join(" "))
|
can.user.title(list.join(" "))
|
||||||
},
|
},
|
||||||
|
@ -341,3 +341,4 @@ Volcanos(chat.ONINPUTS, {
|
|||||||
},
|
},
|
||||||
dream: function(event, can, msg, target, name) { can.sup.sub.oninputs._nameicon(event, can, msg, target, name) },
|
dream: function(event, can, msg, target, name) { can.sup.sub.oninputs._nameicon(event, can, msg, target, name) },
|
||||||
})
|
})
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user