mirror of
https://shylinux.com/x/volcanos
synced 2025-04-25 08:48:06 +08:00
opt some
This commit is contained in:
parent
4cab052f01
commit
672f5fc594
23
lib/base.js
23
lib/base.js
@ -9,29 +9,20 @@ Volcanos("base", {
|
||||
} catch (e) { return val&&val.split&&val.split(ice.FS) || def }
|
||||
},
|
||||
Copy: function(to, from, merge) { if (!from) { return to }
|
||||
if (arguments.length == 2 || typeof merge == lang.BOOLEAN) {
|
||||
for (var k in from) { if (k == undefined) { continue }
|
||||
if (merge && to.hasOwnProperty(k) && to[k] != undefined && to[k] != "") { continue }
|
||||
if (from[k] === "") { delete(to[k]) } else { to[k] = from[k] }
|
||||
} return to
|
||||
} for (var i = 2; i < arguments.length; i++) { var k = arguments[i]; to[k] = from[k] } return to
|
||||
if (arguments.length == 2 || typeof merge == lang.BOOLEAN) { for (var k in from) { if (k == undefined) { continue }
|
||||
if (merge && to.hasOwnProperty(k) && to[k] != undefined && to[k] != "") { continue }
|
||||
if (from[k] === "") { delete(to[k]) } else { to[k] = from[k] }
|
||||
} return to } for (var i = 2; i < arguments.length; i++) { var k = arguments[i]; to[k] = from[k] } return to
|
||||
},
|
||||
Eq: function(to, from, skip) { var call = arguments.callee; if (typeof to != typeof from) { return false }
|
||||
if (typeof to == lang.OBJECT) { if (to.length != from.length) { return false }
|
||||
for (var i = 0; i < to.length; i++) { if (!call(to[i], from[i])) { return false } }
|
||||
for (var k in to) { if (k != skip && !call(to[k], from[k])) { return false } }
|
||||
return true
|
||||
for (var k in to) { if (k != skip && !call(to[k], from[k])) { return false } } return true
|
||||
} return to === from
|
||||
},
|
||||
Dir: function(path) {
|
||||
if (path.endsWith(ice.PS)) {
|
||||
return path
|
||||
} else {
|
||||
return path.slice(0, path.lastIndexOf(ice.PS)+1)
|
||||
}
|
||||
},
|
||||
Dir: function(path) { return path.endsWith(ice.PS)? path: path.slice(0, path.lastIndexOf(ice.PS)+1) },
|
||||
Ext: function(path) { return path.split(ice.PS).pop().split(ice.PT).pop().toLowerCase() },
|
||||
Path: function(path) { var res = ""
|
||||
Path: function(path) { var res = "", arg = arguments
|
||||
for (var i = 0; i < arguments.length; i++) { if (!arguments[i]) { continue }
|
||||
res += (arguments[i][0]==ice.PS || res=="" || res[res.length-1]==ice.PS? "": ice.PS) + arguments[i].trim()
|
||||
} return res
|
||||
|
@ -17,7 +17,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg) { can.onmotion.clear(can, can
|
||||
},
|
||||
select: function(can, msg, cmds, cb) { can.ui.filter.value = cmds[1], can.ui.input = function(event, word) { cmds[1] = word||cmds[1]; can.onimport._input(can, msg, cmds, fields) }
|
||||
var fields = (cmds[2]||msg.Option(ice.MSG_FIELDS)||"ctx,cmd,type,name,text").split(ice.FS); can.page.Appends(can, can.ui.display, [{th: fields}]), can.onmotion.hidden(can, can.ui.display), can.onmotion.clear(can, can.ui.profile)
|
||||
can.ui.done = function() { can.base.isFunc(cb) && cb(can.onexport.select(can)), can.onmotion.hide(can) }, can.db = {}, can._plugins = [], can.onimport._input(can, msg, cmds, fields)
|
||||
can.ui.done = function() { can.base.isFunc(cb) && cb(can.onexport.select(can)), can.onmotion.hidden(can) }, can.db = {}, can._plugins = [], can.onimport._input(can, msg, cmds, fields)
|
||||
},
|
||||
})
|
||||
Volcanos(chat.ONACTION, {_init: function(can) { can.onmotion.hidden(can) }, list: [cli.CLOSE, cli.CLEAR, cli.DONE],
|
||||
|
2
proto.js
2
proto.js
@ -10,7 +10,7 @@ var kit = {proto: function(sub, sup) { return sub.__proto__ = sup, sub },
|
||||
} return res },
|
||||
}
|
||||
var ice = {
|
||||
TB: "\t", SP: " ", DF: ":", EQ: "=", AT: "@", PS: "/", PT: ".", FS: ",", NL: "\n", LT: "<", GT: ">",
|
||||
TB: "\t", SP: " ", DF: ":", EQ: "=", AT: "@", PS: "/", PT: ".", FS: ",", QS: "?", NL: "\n", LT: "<", GT: ">",
|
||||
OK: "ok", TRUE: "true", FALSE: "false", SUCCESS: "success", FAILURE: "failure", PROCESS: "process",
|
||||
|
||||
AUTO: "auto",
|
||||
|
Loading…
x
Reference in New Issue
Block a user