mirror of
https://shylinux.com/x/volcanos
synced 2025-04-25 08:48:06 +08:00
add chat.script
This commit is contained in:
parent
b37f8302fb
commit
66dda357b1
5
const.js
5
const.js
@ -66,6 +66,7 @@ var mdb = {FOREACH: "*", RANDOMS: "%",
|
|||||||
KEY: "key", VALUE: "value", STATUS: "status", EXPIRE: "expire", EXTRA: "extra",
|
KEY: "key", VALUE: "value", STATUS: "status", EXPIRE: "expire", EXTRA: "extra",
|
||||||
SHORT: "short", FIELD: "field", COUNT: "count", TOTAL: "total", INDEX: "index", LIMIT: "limit",
|
SHORT: "short", FIELD: "field", COUNT: "count", TOTAL: "total", INDEX: "index", LIMIT: "limit",
|
||||||
DATA: "data", VIEW: "view", ORDER: "order",
|
DATA: "data", VIEW: "view", ORDER: "order",
|
||||||
|
ENABLE: "enable", DISABLE: "disable",
|
||||||
INPUTS: "inputs", CREATE: "create", REMOVE: "remove", UPDATE: "update",
|
INPUTS: "inputs", CREATE: "create", REMOVE: "remove", UPDATE: "update",
|
||||||
INSERT: "insert", DELETE: "delete", MODIFY: "modify", SELECT: "select",
|
INSERT: "insert", DELETE: "delete", MODIFY: "modify", SELECT: "select",
|
||||||
PRUNES: "prunes", EXPORT: "export", IMPORT: "import",
|
PRUNES: "prunes", EXPORT: "export", IMPORT: "import",
|
||||||
@ -187,6 +188,7 @@ var cli = {
|
|||||||
BEGIN: "begin", END: "end", START: "start", RESTART: "restart", STOP: "stop", OPEN: "open", CLOSE: "close",
|
BEGIN: "begin", END: "end", START: "start", RESTART: "restart", STOP: "stop", OPEN: "open", CLOSE: "close",
|
||||||
REBOOT: "reboot",
|
REBOOT: "reboot",
|
||||||
DELAY: "delay",
|
DELAY: "delay",
|
||||||
|
PLAY: "play", STEP: "step",
|
||||||
QRCODE: "qrcode", COLOR: "color", BLACK: "black", WHITE: "white", BLUE: "blue", RED: "red", GRAY: "gray", CYAN: "cyan", GREEN: "green", PURPLE: "purple", YELLOW: "yellow",
|
QRCODE: "qrcode", COLOR: "color", BLACK: "black", WHITE: "white", BLUE: "blue", RED: "red", GRAY: "gray", CYAN: "cyan", GREEN: "green", PURPLE: "purple", YELLOW: "yellow",
|
||||||
MAGENTA: "magenta", SILVER: "silver", ALICEBLUE: "aliceblue", TRANSPARENT: "transparent",
|
MAGENTA: "magenta", SILVER: "silver", ALICEBLUE: "aliceblue", TRANSPARENT: "transparent",
|
||||||
LINUX: "linux", DARWIN: "darwin", WINDOWS: "windows",
|
LINUX: "linux", DARWIN: "darwin", WINDOWS: "windows",
|
||||||
@ -368,7 +370,7 @@ var icon = {
|
|||||||
save: "bi bi-floppy", trash: "bi bi-trash",
|
save: "bi bi-floppy", trash: "bi bi-trash",
|
||||||
push: "bi bi-cloud-upload", pull: "bi bi-cloud-download",
|
push: "bi bi-cloud-upload", pull: "bi bi-cloud-download",
|
||||||
upload: "bi bi-box-arrow-in-up", download: "bi bi-box-arrow-down",
|
upload: "bi bi-box-arrow-in-up", download: "bi bi-box-arrow-down",
|
||||||
record1: "bi bi-images", record2: "bi bi-record-circle",
|
record1: "bi bi-images", record2: "bi bi-record-circle", record: "bi bi-record-circle",
|
||||||
full: "bi bi-arrows-fullscreen", open: "bi bi-box-arrow-up-right",
|
full: "bi bi-arrows-fullscreen", open: "bi bi-box-arrow-up-right",
|
||||||
search: "bi bi-search", favor: "bi bi-star", qrcode: "bi bi-qr-code",
|
search: "bi bi-search", favor: "bi bi-star", qrcode: "bi bi-qr-code",
|
||||||
notifications: "bi bi-chat-right-text",
|
notifications: "bi bi-chat-right-text",
|
||||||
@ -384,6 +386,7 @@ var icon = {
|
|||||||
compile: "bi bi-tools", publish: "bi bi-send-check", version: "bi bi-tags", upgrade: "bi bi-rocket-takeoff",
|
compile: "bi bi-tools", publish: "bi bi-send-check", version: "bi bi-tags", upgrade: "bi bi-rocket-takeoff",
|
||||||
vimer: "bi bi-code-slash", repos: "bi bi-git", build: "bi bi-tools", tag: "bi bi-tags",
|
vimer: "bi bi-code-slash", repos: "bi bi-git", build: "bi bi-tools", tag: "bi bi-tags",
|
||||||
xterm: "bi bi-terminal", cmds: "bi bi-terminal",
|
xterm: "bi bi-terminal", cmds: "bi bi-terminal",
|
||||||
|
enable: "bi bi-toggle-off", disable: "bi bi-toggle-on",
|
||||||
}
|
}
|
||||||
var svg = {
|
var svg = {
|
||||||
GROUP: "group", PID: "pid", GRID: "grid",
|
GROUP: "group", PID: "pid", GRID: "grid",
|
||||||
|
11
frame.js
11
frame.js
@ -124,7 +124,8 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
|||||||
},
|
},
|
||||||
Option: function(key, value) { value && (value = can.user.trans(sub, value, null, html.INPUT)); return can.page.SelectArgs(can, option, key, value)[0] },
|
Option: function(key, value) { value && (value = can.user.trans(sub, value, null, html.INPUT)); return can.page.SelectArgs(can, option, key, value)[0] },
|
||||||
Update: function(event, cmds, cb, silent) { event = event||{}
|
Update: function(event, cmds, cb, silent) { event = event||{}
|
||||||
if (event.isTrusted && cmds && cmds.length > 0 && cmds[0] == ctx.ACTION) { can.onengine.signal(can, "onrecord", can.request({}, {cmds: [sub.ConfIndex()].concat(cmds||[])})) }
|
if (event.isTrusted && cmds && cmds.length > 0 && cmds[0] == ctx.ACTION) {
|
||||||
|
can.onengine.signal(can, "onrecord", can.request({}, {cmds: [sub.ConfSpace(), sub.ConfIndex()].concat(cmds||[])})) }
|
||||||
sub.request(event, can.core.Value(sub, "sub.db._checkbox"))._caller(),
|
sub.request(event, can.core.Value(sub, "sub.db._checkbox"))._caller(),
|
||||||
sub.onappend._output0(sub, sub.Conf(), event||{}, cmds||sub.Input([], !silent), cb, silent); return true },
|
sub.onappend._output0(sub, sub.Conf(), event||{}, cmds||sub.Input([], !silent), cb, silent); return true },
|
||||||
Focus: function() { can.page.SelectOne(can, option, html.INPUT_ARGS, function(target) { target.focus() }) },
|
Focus: function() { can.page.SelectOne(can, option, html.INPUT_ARGS, function(target) { target.focus() }) },
|
||||||
@ -441,7 +442,15 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
|
|||||||
if (key == mdb.HASH && can.ConfIndex() == web.TOKEN) { _value = value.slice(0, 4)+"****" }
|
if (key == mdb.HASH && can.ConfIndex() == web.TOKEN) { _value = value.slice(0, 4)+"****" }
|
||||||
if (key == web.TOKEN && value) { _value = value.slice(0, 4)+"****" }
|
if (key == web.TOKEN && value) { _value = value.slice(0, 4)+"****" }
|
||||||
if (key == aaa.PASSWORD && value) { _value = "********" }
|
if (key == aaa.PASSWORD && value) { _value = "********" }
|
||||||
|
function onclick() { return false }
|
||||||
|
if (key == mdb.STATUS && value == mdb.DISABLE) { _value = `<i class="${icon.enable}">`
|
||||||
|
function onclick() { run(event, mdb.MODIFY, [mdb.STATUS, mdb.ENABLE]); return true }
|
||||||
|
}
|
||||||
|
if (key == mdb.STATUS && value == mdb.ENABLE) { _value = `<i class="${icon.disable}">`
|
||||||
|
function onclick() { run(event, mdb.MODIFY, [mdb.STATUS, mdb.DISABLE]); return true }
|
||||||
|
}
|
||||||
return {text: [msg.IsDetail() && key == mdb.KEY? can.user.trans(can, _value, null, html.INPUT): can.user.trans(can, _value, null, html.VALUE), html.TD], onclick: function(event) { var target = event.target
|
return {text: [msg.IsDetail() && key == mdb.KEY? can.user.trans(can, _value, null, html.INPUT): can.user.trans(can, _value, null, html.VALUE), html.TD], onclick: function(event) { var target = event.target
|
||||||
|
if (onclick()) { return }
|
||||||
if (key == cli.QRCODE && can.page.tagis(event.target, html.IMG)) { can.user.opens(event.target.title) }
|
if (key == cli.QRCODE && can.page.tagis(event.target, html.IMG)) { can.user.opens(event.target.title) }
|
||||||
if (can.page.tagis(target, html.INPUT) && target.type == html.BUTTON) { can.requestAction(event, target.name)
|
if (can.page.tagis(target, html.INPUT) && target.type == html.BUTTON) { can.requestAction(event, target.name)
|
||||||
meta && meta[target.name]? can.user.input(event, can, meta[target.name], function(args) { run(event, target.name, args) }, data): run(event, target.name)
|
meta && meta[target.name]? can.user.input(event, can, meta[target.name], function(args) { run(event, target.name, args) }, data): run(event, target.name)
|
||||||
|
@ -93,6 +93,7 @@ table.content.full { width:100%; }
|
|||||||
body.mobile table.content.detail { word-break:break-all; white-space:unset; }
|
body.mobile table.content.detail { word-break:break-all; white-space:unset; }
|
||||||
table.content thead { position:sticky; top:2px; }
|
table.content thead { position:sticky; top:2px; }
|
||||||
table.content tr.disable { color:var(--disable-fg-color); }
|
table.content tr.disable { color:var(--disable-fg-color); }
|
||||||
|
table.content tr.danger { background-color:var(--danger-bg-color) !important; color:var(--danger-fg-color) !important; }
|
||||||
table.content tr.offline { color:var(--disable-fg-color); }
|
table.content tr.offline { color:var(--disable-fg-color); }
|
||||||
table.content tr.offline a { color:var(--disable-fg-color); }
|
table.content tr.offline a { color:var(--disable-fg-color); }
|
||||||
table.content th { font-family:var(--input-font-family); padding:var(--input-padding) 24px; box-shadow:var(--box-shadow); }
|
table.content th { font-family:var(--input-font-family); padding:var(--input-padding) 24px; box-shadow:var(--box-shadow); }
|
||||||
@ -265,6 +266,8 @@ body div.tabs { font-family:var(--code-font-family); }
|
|||||||
body div.path { font-family:var(--code-font-family); }
|
body div.path { font-family:var(--code-font-family); }
|
||||||
body div.carte { font-family:var(--code-font-family); }
|
body div.carte { font-family:var(--code-font-family); }
|
||||||
/* icon */
|
/* icon */
|
||||||
|
i.bi.bi-toggle-on { color:var(--notice-bg-color); }
|
||||||
|
i.bi.bi-toggle-on:hover { color:var(--notice-bg-color); }
|
||||||
fieldset>legend>i { margin-right:var(--input-margin); }
|
fieldset>legend>i { margin-right:var(--input-margin); }
|
||||||
form.option>div.item.icon { position:relative; height:var(--action-height); overflow:hidden; }
|
form.option>div.item.icon { position:relative; height:var(--action-height); overflow:hidden; }
|
||||||
form.option>div.item.icon { font-size:var(--icon-font-size); padding:0 var(--input-padding); }
|
form.option>div.item.icon { font-size:var(--icon-font-size); padding:0 var(--input-padding); }
|
||||||
|
@ -53,7 +53,8 @@ Volcanos(chat.ONACTION, {_init: function(can) {},
|
|||||||
onremote: function(can, msg) { can.core.CallFunc(can.onimport.ncmd, {can: can, msg: msg}) },
|
onremote: function(can, msg) { can.core.CallFunc(can.onimport.ncmd, {can: can, msg: msg}) },
|
||||||
onunload: function(can) { can._wss && can._wss.close() },
|
onunload: function(can) { can._wss && can._wss.close() },
|
||||||
onrecord: function(can, msg) {
|
onrecord: function(can, msg) {
|
||||||
can.runAction(can.request(), nfs.SCRIPT, msg.cmds[0])
|
var zone = can.misc.sessionStorage(can, "web.chat.script:zone")
|
||||||
|
zone && can.runAction(can.request(), nfs.SCRIPT, [zone].concat(msg.cmds[0]))
|
||||||
},
|
},
|
||||||
onaction_cmd: function(can) { can.onappend.style(can, html.HIDE) },
|
onaction_cmd: function(can) { can.onappend.style(can, html.HIDE) },
|
||||||
oncommand_focus: function(can) { can.page.Select(can, can._output, ["div.cmd", html.INPUT], function(target) { can.onmotion.focus(can, target) }) },
|
oncommand_focus: function(can) { can.page.Select(can, can._output, ["div.cmd", html.INPUT], function(target) { can.onmotion.focus(can, target) }) },
|
||||||
|
2
proto.js
2
proto.js
@ -102,7 +102,7 @@ var Volcanos = shy({iceberg: "", volcano: "", frame: chat.FRAME_JS, _cache: {},
|
|||||||
isAutoMode: function() { return can.Mode() == "" },
|
isAutoMode: function() { return can.Mode() == "" },
|
||||||
Mode: function(value) { return can.Conf(ice.MODE, value) },
|
Mode: function(value) { return can.Conf(ice.MODE, value) },
|
||||||
ConfDefault: function(value) { can.core.Item(value, function(k, v) { can.Conf(k) || can.Conf(k, v) }) },
|
ConfDefault: function(value) { can.core.Item(value, function(k, v) { can.Conf(k) || can.Conf(k, v) }) },
|
||||||
ConfSpace: function() { return can.Conf(web.SPACE)||can.Conf("_space") },
|
ConfSpace: function() { return can.Conf(web.SPACE)||can.Conf("_space")||"" },
|
||||||
ConfIndex: function() { return can.Conf("_command")||can.Conf(ctx.INDEX)||can.Conf("_index") },
|
ConfIndex: function() { return can.Conf("_command")||can.Conf(ctx.INDEX)||can.Conf("_index") },
|
||||||
ConfHeight: function(value) { return can.Conf(html.HEIGHT, value) },
|
ConfHeight: function(value) { return can.Conf(html.HEIGHT, value) },
|
||||||
ConfWidth: function(value) { return can.Conf(html.WIDTH, value) },
|
ConfWidth: function(value) { return can.Conf(html.WIDTH, value) },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user