1
0
forked from x/volcanos
This commit is contained in:
harveyshao 2023-02-20 19:17:04 +08:00
parent 1d4df49812
commit 60874e2f3e
6 changed files with 29 additions and 28 deletions

View File

@ -119,7 +119,7 @@ select, input { font-size:1rem; height:31px; } textarea { tab-size:2; height:93p
table.content, div.item, div.code, div.story[data-type=spark] { white-space:pre; text-align:left; }
table.content, div.item, div.code, div.story[data-type=spark] { font-family:monospace; }
div.action>div.tabs { padding:5px; height:31px; }
div.status>div.item { padding:5px; height:30px; }
div.status>div.item { padding:5px; height:30px; float:left; }
div.status>div.item>label { font-size:0.6rem; }
/* display */
fieldset>form.option, fieldset>div.action { display:contents; } form.option.hide, div.action.hide { display:none; }
@ -330,4 +330,4 @@ div.project::-webkit-scrollbar { width:0 !important; height:0 !important; }
div.content::-webkit-scrollbar { width:0 !important; height:0 !important; }
div.carte::-webkit-scrollbar { width:0 !important; height:0 !important; }
div.status::-webkit-scrollbar { width:0 !important; height:0 !important; }
div.toggle::-webkit-scrollbar { width:0 !important; height:0 !important; }
div.toggle::-webkit-scrollbar { width:0 !important; height:0 !important; }

View File

@ -57,7 +57,10 @@ Volcanos("misc", {
msg.Push(ctx.ACTION, can.page.Format(html.INPUT, "", mdb.TYPE, html.BUTTON, mdb.NAME, button, mdb.VALUE, can.user.trans(can, button)))
}); return msg },
Echo: function(res) { msg.result = (msg.result||[]).concat(can.core.List(arguments)); return msg._hand = true, msg },
Dump: function(can) { can = can||msg._can, can.onmotion.clear(can), can.onappend.table(can, msg), can.onappend.board(can, msg), can.onmotion.story.auto(can) },
Dump: function(can) { can = can||msg._can
if (can.user.isNodejs) { return }
can.onmotion.clear(can), can.onappend.table(can, msg), can.onappend.board(can, msg), can.onmotion.story.auto(can)
},
Defer: function(cb) { msg._defer = msg._defer||[]
if (arguments.length == 0) { msg._defer = can.core.List(msg._defer.reverse(), function(cb) { can.base.isFunc(cb) && cb() }) } else { msg._defer.push(cb) }
},

View File

@ -19,6 +19,7 @@ Volcanos("user", {
isMobile: navigator.userAgent.indexOf("Mobile") > -1,
isMacOSX: navigator.userAgent.indexOf("Mac OS X") > -1,
isWindows: navigator.userAgent.indexOf("Windows") > -1,
isNodejs: navigator.userAgent.indexOf("nodejs") > -1,
isIE: navigator.userAgent.indexOf("MSIE") > -1,
isWebview: window.webview != undefined,
isExtension: location && location.protocol && location.protocol == "chrome-extension:",

View File

@ -1,6 +1,6 @@
Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb) { can.onmotion.clear(can), can.onlayout._init(can)
can.page.requireModules(can, ["xterm/css/xterm.css", "xterm", "xterm-addon-fit", "xterm-addon-web-links"], function() {
var item = msg.TableDetail(); item.hash = can.Option(mdb.HASH), item.text && can.onmotion.delay(can, function() { can.onimport._input(can, item.text+ice.NL) })
var item = msg.TableDetail(); item.hash = can.Option(mdb.HASH), item.text && can.onmotion.delay(can, function() { can.onimport._input(can, item.text+ice.NL) }, 500)
can.onimport._connect(can, item), can.onappend.tools(can, msg, function(sub) {
sub.onexport.record = function(_, value, key, line) { can.onimport._input(can, value+ice.NL) }
}), msg.Option(ice.MSG_TOOLKIT, ""), can.base.isFunc(cb) && cb(msg), can.onappend._status(can)

View File

@ -251,14 +251,15 @@ function shy(help, meta, list, cb) { var arg = arguments, i = 0; function next(t
} else if (i < arg.length && (!type || type == typeof arg[i])) { return arg[i++] }
} return cb = typeof arg[arg.length-1] == lang.FUNCTION? arg[arg.length-1]: function() {}, cb.help = next(lang.STRING)||"", cb.meta = next(lang.OBJECT)||{}, cb.list = next(lang.ARRAY)||[], cb
}; var _can_name = "", _can_path = ""
var Volcanos = shy({version: window._version||"", iceberg: "/chat/", volcano: "/frame.js", cache: {}, pack: {}, args: {}}, function(name, can, libs, cb) {
var Volcanos = shy({iceberg: "/chat/", volcano: "/frame.js", cache: {}, pack: {}, args: {}}, function(name, can, libs, cb) {
var meta = arguments.callee.meta, list = arguments.callee.list; if (typeof name == lang.OBJECT) {
if (name.length > 0) { return Volcanos({panels: [{name: chat.HEADER, style: html.HIDE, state: [mdb.TIME, aaa.USERNICK]}, {name: chat.ACTION, style: html.MAIN, tool: name}, {name: chat.FOOTER, style: html.HIDE}]}) }
var Config = name; name = Config.name||ice.CAN, _can_name = "", _can_path = ""
meta.iceberg = Config.iceberg||meta.iceberg, meta.libs = Config.libs||chat.libs, panels = Config.panels||chat.panel_list, delete(Config.panels)
libs = [], panels.forEach(function(p) { p && (libs = libs.concat(p.list = p.list||["/panel/"+p.name+nfs._JS, "/panel/"+p.name+nfs._CSS])) }), libs = libs.concat(Config.plugin||chat.plugin_list)
cb = can||function(can) { can.onengine._init(can, can.Conf(Config), panels, Config._init||meta._init, can._target) }
can = Config, can._path = location.href, can._follow = name, can._target = Config.target||meta.target, can._height = Config.height||meta._height, can._width = Config.width||meta._width
can = Config, can._follow = name, can._target = Config.target||meta.target, can._height = Config.height||meta._height, can._width = Config.width||meta._width
// can._path = location.href,
}
can = kit.proto(can||{}, kit.proto({_path: _can_path, _name: name, _load: function(name, cbs) { var cache = meta.cache[name]||[]
for (list.reverse(); list.length > 0; list) { var sub = list.pop(); sub != can && cache.push(sub), sub._path = name } meta.cache[name] = cache
@ -269,7 +270,10 @@ var Volcanos = shy({version: window._version||"", iceberg: "/chat/", volcano: "/
})
},
require: function(libs, cb, cbs) {
if (!libs || libs.length == 0) { return typeof cb == lang.FUNCTION && setTimeout(function() { cb(can) }, 10) }
if (!libs || libs.length == 0) {
if (navigator.userAgent == "nodejs") { return typeof cb == lang.FUNCTION && cb(can) }
return typeof cb == lang.FUNCTION && setTimeout(function() { cb(can) }, 10)
}
if (libs[0] == undefined) { return can.require(libs.slice(1), cb, cbs) }
if (libs[0] == "") { libs[0] = can._path.replace(nfs._JS, nfs._CSS) }
if (libs[0][0] != ice.PS && libs[0].indexOf(ice.HTTP) != 0) { libs[0] = can._path.slice(0, can._path.lastIndexOf(ice.PS)+1)+libs[0] }
@ -338,6 +342,7 @@ var Volcanos = shy({version: window._version||"", iceberg: "/chat/", volcano: "/
return can.require(can._follow? libs.concat(meta.libs, meta.volcano): libs, cb), can
})
try { if (typeof(window) == lang.OBJECT) { // chrome
Volcanos.meta.version = window._version
Volcanos.meta.target = document.body, Volcanos.meta._height = window.innerHeight, Volcanos.meta._width = window.innerWidth
Volcanos.meta._load = function(url, cb) {
var v = Volcanos.meta.version? Volcanos.meta.version+"&_tt="+(new Date()).getTime(): ""
@ -353,6 +358,7 @@ try { if (typeof(window) == lang.OBJECT) { // chrome
}) }
}
} else { // nodejs
global.location = {}, global.document = {}, global.window = {}, global.navigator = { userAgent: "nodejs" }
global.kit = kit, global.ice = ice
global.ctx = ctx, global.mdb = mdb, global.web = web, global.aaa = aaa
global.lex = lex, global.yac = yac, global.ssh = ssh, global.gdb = gdb

View File

@ -1,25 +1,17 @@
try { if (typeof(global) == lang.OBJECT) { // nodejs
Volcanos.meta._load = function(url, cb) { if (!url) { return }
setTimeout(function() { if (Volcanos.meta.cache[url]) { return cb(Volcanos.meta.cache[url]) }
switch (url.split("?")[0].split(ice.PT).pop().toLowerCase()) {
case nfs.JS:
require(path.isAbsolute(url)? url: path.join(process.cwd(), "usr/volcanos", url))
cb(Volcanos.meta.cache[url])
break
}
}, 100)
Volcanos.meta._load = function(url, cb) { if (!url) { return cb() }
switch (url.split("?")[0].split(ice.PT).pop().toLowerCase()) {
case nfs.JS:
// console.log("require", url)
require(url.indexOf("/src/") == 0? path.join(process.cwd(), url): path.join(process.cwd(), "usr/volcanos", url))
cb(Volcanos.meta.cache[url]); break
}
}
Volcanos.meta._main = function(main) { var res
Volcanos({panels: [], plugin: []}, function(can) { can.require([main], function(can) { var msg = can.request()
can._path = main, can.core.CallFunc(can.onimport._init, {can: can, msg: msg}), res = msg.Result()
}) }); console.log(res); return
}
Volcanos.meta._load(global.plugin, function(cache) {
Volcanos.meta.volcano = "./frame.js", Volcanos({libs: [
"./lib/base.js", "./lib/core.js", "./lib/misc.js", "./lib/page.js", // "./lib/user.js",
], panels: [], plugin: []}, function(can) { can.core.List(cache, function(item) { can[item._name] = item })
Volcanos.meta._load("./publish/client/nodejs/proto.js", function(cache) {
can.core.List(cache, function(item) { can.base.Copy(can[item._name]||{}, item) })
can.onimport._init(can, can.request(), function(msg) { console.log(ice.NL) }, null)
})
})
})
} } catch (e) { console.log(e) }
_can_name = "./frame.js"
@ -30,7 +22,6 @@ Volcanos("onappend", {
max[k] = value[k].length
} }
})
var list = []; msg.Table(function(value, index, array) { var line = []
if (index == 0) {
for (var i = 0; i < msg.append.length; i++) { line.push(msg.append[i])