1
0
mirror of https://shylinux.com/x/volcanos synced 2025-04-25 16:58:06 +08:00
This commit is contained in:
shaoying 2023-02-04 10:00:43 +08:00
parent 4cab052f01
commit 672f5fc594
3 changed files with 9 additions and 18 deletions

View File

@ -9,29 +9,20 @@ Volcanos("base", {
} catch (e) { return val&&val.split&&val.split(ice.FS) || def } } catch (e) { return val&&val.split&&val.split(ice.FS) || def }
}, },
Copy: function(to, from, merge) { if (!from) { return to } Copy: function(to, from, merge) { if (!from) { return to }
if (arguments.length == 2 || typeof merge == lang.BOOLEAN) { if (arguments.length == 2 || typeof merge == lang.BOOLEAN) { for (var k in from) { if (k == undefined) { continue }
for (var k in from) { if (k == undefined) { continue }
if (merge && to.hasOwnProperty(k) && to[k] != undefined && to[k] != "") { continue } if (merge && to.hasOwnProperty(k) && to[k] != undefined && to[k] != "") { continue }
if (from[k] === "") { delete(to[k]) } else { to[k] = from[k] } if (from[k] === "") { delete(to[k]) } else { to[k] = from[k] }
} return to } return to } for (var i = 2; i < arguments.length; i++) { var k = arguments[i]; 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 } 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 } 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 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 } } for (var k in to) { if (k != skip && !call(to[k], from[k])) { return false } } return true
return true
} return to === from } return to === from
}, },
Dir: function(path) { Dir: function(path) { return path.endsWith(ice.PS)? path: path.slice(0, path.lastIndexOf(ice.PS)+1) },
if (path.endsWith(ice.PS)) {
return path
} else {
return path.slice(0, path.lastIndexOf(ice.PS)+1)
}
},
Ext: function(path) { return path.split(ice.PS).pop().split(ice.PT).pop().toLowerCase() }, 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 } 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() res += (arguments[i][0]==ice.PS || res=="" || res[res.length-1]==ice.PS? "": ice.PS) + arguments[i].trim()
} return res } return res

View File

@ -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) } 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) 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], Volcanos(chat.ONACTION, {_init: function(can) { can.onmotion.hidden(can) }, list: [cli.CLOSE, cli.CLEAR, cli.DONE],

View File

@ -10,7 +10,7 @@ var kit = {proto: function(sub, sup) { return sub.__proto__ = sup, sub },
} return res }, } return res },
} }
var ice = { 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", OK: "ok", TRUE: "true", FALSE: "false", SUCCESS: "success", FAILURE: "failure", PROCESS: "process",
AUTO: "auto", AUTO: "auto",