Commit 2fce9529 authored by Christoffer Ackelman's avatar Christoffer Ackelman

Web: More cleanup.

parent 6623271c
...@@ -21,7 +21,6 @@ class Appl { ...@@ -21,7 +21,6 @@ class Appl {
command(cmd) { command(cmd) {
console.log("Command: " + cmd); console.log("Command: " + cmd);
let local_cmd = false;
if (!this.graph.isAuthorized(Access.AllRt)) { if (!this.graph.isAuthorized(Access.AllRt)) {
console.log("Not authorized"); console.log("Not authorized");
...@@ -37,15 +36,17 @@ class Appl { ...@@ -37,15 +36,17 @@ class Appl {
let cli = new Cli(cliTable); let cli = new Cli(cliTable);
let command = cli.parse(cmd); let command = cli.parse(cmd);
if (odd(cli.status)) { if (odd(cli.status)) {
if (command === ("OPEN")) { let getQualIfExists = (qual) => (cli.qualifierFound(qual)) ? cli.getQualValue(qual) : null;
if (cli.qualifierFound("cli_arg1")) {
if (command === ("OPEN")) {
let cli_arg1 = getQualIfExists("cli_arg1");
if (cli_arg1) {
let jgraph = "JGRAPH"; let jgraph = "JGRAPH";
let graph = "GRAPH"; let graph = "GRAPH";
let url = "URL"; let url = "URL";
let trend = "TREND"; let trend = "TREND";
let fast = "FAST"; let fast = "FAST";
let cli_arg1 = cli.getQualValue("cli_arg1").toUpperCase(); cli_arg1 = cli_arg1.toUpperCase();
if (jgraph.length >= cli_arg1.length && if (jgraph.length >= cli_arg1.length &&
jgraph.substring(0, cli_arg1.length) === cli_arg1) { jgraph.substring(0, cli_arg1.length) === cli_arg1) {
// Command is "OPEN JGRAPH" // Command is "OPEN JGRAPH"
...@@ -53,17 +54,14 @@ class Appl { ...@@ -53,17 +54,14 @@ class Appl {
} else if (graph.length >= cli_arg1.length && } else if (graph.length >= cli_arg1.length &&
graph.substring(0, cli_arg1.length) === cli_arg1) { graph.substring(0, cli_arg1.length) === cli_arg1) {
// Command is "OPEN GRAPH" // Command is "OPEN GRAPH"
let graphName = null; let objectValue = getQualIfExists("/OBJECT");
let instanceValue = null; if (objectValue) {
let classGraph = false;
let objectValue = null;
if (cli.qualifierFound("/OBJECT")) {
objectValue = cli.getQualValue("/OBJECT");
return 1; return 1;
} }
if (cli.qualifierFound("/INSTANCE")) {
instanceValue = cli.getQualValue("/INSTANCE"); let instanceValue = getQualIfExists("/INSTANCE");
let classGraph = false;
if (instanceValue) {
classGraph = cli.qualifierFound("/CLASSGRAPH"); classGraph = cli.qualifierFound("/CLASSGRAPH");
let parent = cli.qualifierFound("/PARENT"); let parent = cli.qualifierFound("/PARENT");
if (parent) { if (parent) {
...@@ -81,31 +79,23 @@ class Appl { ...@@ -81,31 +79,23 @@ class Appl {
GdhOp.GET_OP_METHOD_OBJECTGRAPH, this.open_objectgraph_cb, GdhOp.GET_OP_METHOD_OBJECTGRAPH, this.open_objectgraph_cb,
newwindow); newwindow);
} else { } else {
if (!cli.qualifierFound("cli_arg2")) { let graphName = cli.getQualValue("cli_arg2").toLowerCase();
if (!graphName) {
console.log("Syntax error"); console.log("Syntax error");
return 0; return 0;
} }
graphName = cli.getQualValue("cli_arg2").toLowerCase(); graphName = graphName.toLowerCase();
if (graphName.charAt(".pwg") === -1) { if (graphName.charAt(".pwg") === -1) {
graphName += ".pwg"; graphName += ".pwg";
} }
let href; let href = "ge.html?graph=" + graphName;
if (this.graph.frame.nogdh) { if (instanceValue) {
if (instanceValue === null) { href += "&instance=" + instanceValue
href = "ge.html?graph=" + graphName + "&instance=no&gdh=no";
} else {
href = "ge.html?graph=" + graphName + "&instance=" +
instanceValue + "&gdh=no";
}
} else {
if (instanceValue === null) {
href = "ge.html?graph=" + graphName;
} else {
href =
"ge.html?graph=" + graphName + "&instance=" + instanceValue;
} }
if (this.graph.frame.nogdh) {
href += "&gdh=no";
} }
console.log("Cmd found: open graph", graphName, instanceValue); console.log("Cmd found: open graph", graphName, instanceValue);
let newwindow = window.open(href, "_blank"); let newwindow = window.open(href, "_blank");
...@@ -117,18 +107,9 @@ class Appl { ...@@ -117,18 +107,9 @@ class Appl {
let frameName = null; let frameName = null;
let urlValue = cli.getQualValue("cli_arg2"); let urlValue = cli.getQualValue("cli_arg2");
if (urlValue.substring(0, 5) === "pwrb_" || let arrTmp = ["pwrb", "pwrs", "nmps", "profibus", "otherio", "opc",
urlValue.substring(0, 5) === "pwrs_" || "basecomponent", "abb", "siemens", "ssabox"];
urlValue.substring(0, 5) === "nmps_" || if (arrTmp.some(e => urlValue.startsWith(e + "_"))) { // Object reference manual
urlValue.substring(0, 9) === "profibus_" ||
urlValue.substring(0, 8) === "otherio_" ||
urlValue.substring(0, 4) === "opc_" ||
urlValue.substring(0, 14) === "basecomponent_" ||
urlValue.substring(0, 4) === "abb_" ||
urlValue.substring(0, 8) === "siemens_" ||
urlValue.substring(0, 7) === "ssabox_")
// Object reference manual
{
urlValue = "$pwr_doc/" + getLang() + "/orm/" + urlValue; urlValue = "$pwr_doc/" + getLang() + "/orm/" + urlValue;
} }
...@@ -147,39 +128,27 @@ class Appl { ...@@ -147,39 +128,27 @@ class Appl {
} }
} }
} else if (command === ("SET")) { } else if (command === ("SET")) {
if (cli.qualifierFound("cli_arg1")) { let cli_arg1 = getQualIfExists("cli_arg1");
let cli_arg1 = cli.getQualValue("cli_arg1").toUpperCase(); if (cli_arg1) {
let cli_arg1 = cli_arg1.toUpperCase();
let subwindow = "SUBWINDOW"; let subwindow = "SUBWINDOW";
if (subwindow.length >= cli_arg1.length && if (subwindow.length >= cli_arg1.length &&
subwindow.substring(0, cli_arg1.length) === (cli_arg1)) { subwindow.substring(0, cli_arg1.length) === (cli_arg1)) {
// Command is "SET SUBWINDOW" // Command is "SET SUBWINDOW"
let name = getQualIfExists("/NAME");
let name; if (!name) {
let graphstr; console.log("Cmd: Name is missing\n");
let source;
let object;
let sts;
local_cmd = true;
if (cli.qualifierFound("/NAME")) {
name = cli.getQualValue("/NAME");
} else {
console.log("Cmd: name is missing\n");
return 0; return 0;
} }
if (cli.qualifierFound("/SOURCE")) { let source = getQualIfExists("/SOURCE");
source = cli.getQualValue("/SOURCE"); if (!source) {
} else {
console.log("Cmd: source is missing\n"); console.log("Cmd: source is missing\n");
return 0; return 0;
} }
if (cli.qualifierFound("/OBJECT")) { let object = getQualIfExists("/OBJECT");
object = cli.getQualValue("/OBJECT"); let graphstr = getQualIfExists("cli_arg2");
} else { if (graphstr) {
object = null; graphstr = graphstr.toLowerCase();
}
if (cli.qualifierFound("cli_arg2")) {
graphstr = cli.getQualValue("cli_arg2").toLowerCase();
} else { } else {
console.log("Syntax error"); console.log("Syntax error");
return 0; return 0;
...@@ -200,115 +169,76 @@ class Appl { ...@@ -200,115 +169,76 @@ class Appl {
fileName = this.pwrHost + "xtt_version_help_version.html"; fileName = this.pwrHost + "xtt_version_help_version.html";
this.openURL(fileName, null); this.openURL(fileName, null);
} else { } else {
if (cli.qualifierFound("/BASE")) if (cli.qualifierFound("/BASE")) { // Not language dependent !! TODO
// Not language dependent !! TODO
{
fileName = this.pwrHost + "help/xtt_help_"; fileName = this.pwrHost + "help/xtt_help_";
} else {
fileName = "xtt_help_";
} }
if (cli.qualifierFound("cli_arg1")) { for (let i = 0; i < 4; i++) {
fileName += cli.getQualValue("cli_arg1").toLowerCase(); let tmp = getQualIfExists("cli_arg" + String(i+1));
} fileName += tmp ? tmp.toLowerCase() : "";
if (cli.qualifierFound("cli_arg2")) {
fileName += "_" + cli.getQualValue("cli_arg2").toLowerCase();
}
if (cli.qualifierFound("cli_arg3")) {
fileName += "_" + cli.getQualValue("cli_arg3").toLowerCase();
}
if (cli.qualifierFound("cli_arg4")) {
fileName += "_" + cli.getQualValue("cli_arg4").toLowerCase();
} }
if (fileName.substring(0, 5) === "pwrb_" || let arrTmp = ["pwrb", "pwrs", "nmps", "profibus", "otherio", "opc",
fileName.substring(0, 5) === "pwrs_" || "basecomponent", "abb", "siemens", "ssabox"];
fileName.substring(0, 5) === "nmps_" || if (arrTmp.some(e => fileName.startsWith(e + "_"))) { // Object reference manual
fileName.substring(0, 9) === "profibus_" ||
fileName.substring(0, 8) === "otherio_" ||
fileName.substring(0, 4) === "opc_" ||
fileName.substring(0, 14) === "basecomponent_" ||
fileName.substring(0, 4) === "abb_" ||
fileName.substring(0, 8) === "siemens_" ||
fileName.substring(0, 7) === "ssabox_")
// Object reference manual
{
fileName = "$pwr_doc/orm/" + fileName; fileName = "$pwr_doc/orm/" + fileName;
} }
if (cli.qualifierFound("/BOOKMARK")) { bookmarkValue = getQualIfExists("/BOOKMARK");
bookmarkValue = cli.getQualValue("/BOOKMARK");
}
fileName += ".html"; fileName += ".html";
console.log("Loading helpfile \"" + fileName + "\""); console.log("Loading helpfile \"" + fileName + "\"");
this.openURL(fileName, bookmarkValue); this.openURL(fileName, bookmarkValue);
} }
local_cmd = true;
} else if (command === ("CHECK")) { } else if (command === ("CHECK")) {
if (cli.qualifierFound("cli_arg1")) { let cli_arg1 = getQualIfExists("cli_arg1");
if (cli_arg1) {
let methodstr = "METHOD"; let methodstr = "METHOD";
let isattributestr = "ISATTRIBUTE"; let isattributestr = "ISATTRIBUTE";
let cli_arg1 = cli.getQualValue("cli_arg1").toUpperCase(); cli_arg1 = cli_arg1.toUpperCase();
if (methodstr.length >= cli_arg1.length && if (methodstr.length >= cli_arg1.length &&
methodstr.substring(0, cli_arg1.length) === (cli_arg1)) { methodstr.substring(0, cli_arg1.length) === (cli_arg1)) {
// Command is "CHECK METHOD" // Command is "CHECK METHOD"
let method; let method = getQualIfExists("/METHOD");
let object; if (!method) {
if (cli.qualifierFound("/METHOD")) {
method = cli.getQualValue("/METHOD");
} else {
console.log("Cmd: Method is missing\n"); console.log("Cmd: Method is missing\n");
return 0; return 0;
} }
if (cli.qualifierFound("/OBJECT")) { let object = getQualIfExists("/OBJECT");
object = cli.getQualValue("/OBJECT"); if (!object) {
} else {
console.log("Cmd: Object is missing\n"); console.log("Cmd: Object is missing\n");
return 0; return 0;
} }
} else if (isattributestr.length >= cli_arg1.length && } else if (isattributestr.length >= cli_arg1.length &&
isattributestr.substring(0, cli_arg1.length) === (cli_arg1)) { isattributestr.substring(0, cli_arg1.length) === (cli_arg1)) {
// Command is "CHECK ISATTRIBUTE" // Command is "CHECK ISATTRIBUTE"
let method; let object = getQualIfExists("/OBJECT");
let object; if (!object) {
if (cli.qualifierFound("/OBJECT")) {
object = cli.getQualValue("/OBJECT");
} else {
console.log("Cmd: Object is missing\n"); console.log("Cmd: Object is missing\n");
return 0; return 0;
} }
} }
} else if (command === ("CALL")) { } else if (command === ("CALL")) {
if (cli.qualifierFound("cli_arg1")) { let cli_arg1 = getQualIfExists("cli_arg1");
if (cli_arg1) {
let parameter = "METHOD"; let parameter = "METHOD";
let cli_arg1 = cli.getQualValue("cli_arg1").toUpperCase(); cli_arg1 = cli_arg1.toUpperCase();
if (parameter.length >= cli_arg1.length && if (parameter.length >= cli_arg1.length &&
parameter.substring(0, cli_arg1.length) === (cli_arg1)) { parameter.substring(0, cli_arg1.length) === (cli_arg1)) {
// Command is "CHECK METHOD" // Command is "CHECK METHOD"
let method; let method = getQualIfExists("/METHOD");
let object; if (!method) {
if (cli.qualifierFound("/METHOD")) {
method = cli.getQualValue("/METHOD");
} else {
console.log("Cmd: Method is missing\n"); console.log("Cmd: Method is missing\n");
return 0; return 0;
} }
if (cli.qualifierFound("/OBJECT")) { let object = getQualIfExists("/OBJECT");
object = cli.getQualValue("/OBJECT"); if (!object) {
} else {
console.log("Cmd: Object is missing\n"); console.log("Cmd: Object is missing\n");
return 0; return 0;
} }
} }
} }
} else if (command === ("SET")) { } else if (command === ("SET")) {
return 1; return 1;
...@@ -331,8 +261,7 @@ class Appl { ...@@ -331,8 +261,7 @@ class Appl {
} }
openConfirmDialog(dyn, text, object) { openConfirmDialog(dyn, text, object) {
let res = confirm(text); if (confirm(text)) {
if (res) {
dyn.confirmedAction(Event.MB1Click, object); dyn.confirmedAction(Event.MB1Click, object);
} }
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -37,6 +37,31 @@ class LocalSub { ...@@ -37,6 +37,31 @@ class LocalSub {
} }
} }
const strToTypeId = {
"boolean": Type.Boolean,
"float32": Type.Float32,
"float64": Type.Float64,
"char": Type.Char,
"int8": Type.Int8,
"int16": Type.Int16,
"int32": Type.Int32,
"int64": Type.Int64,
"uint8": Type.UInt8,
"uint16": Type.UInt16,
"uint32": Type.UInt32,
"uint64": Type.UInt64,
"objid": Type.Objid,
"time": Type.Time,
"deltatime": Type.DeltaTime,
"attrref": Type.AttrRef,
"status": Type.Status,
"netstatus": Type.NetStatus,
"enum": Type.Enum,
"mask": Type.Mask,
"bit": Type.Bit,
"string": Type.String
};
class GraphLocalDb { class GraphLocalDb {
subscriptions = []; subscriptions = [];
subscriptionCount = 1; subscriptionCount = 1;
...@@ -58,38 +83,32 @@ class GraphLocalDb { ...@@ -58,38 +83,32 @@ class GraphLocalDb {
if (id === -1) { if (id === -1) {
id = this.subscriptionCount; id = this.subscriptionCount;
sub = new LocalSub(owner, name, typeId, id); sub = new LocalSub(owner, name, typeId, id);
sub.ref();
this.subscriptions[id] = sub; this.subscriptions[id] = sub;
this.subscriptionCount++; this.subscriptionCount++;
return id;
} else { } else {
sub = this.subscriptions[id]; sub = this.subscriptions[id];
}
sub.ref(); sub.ref();
return id; return id;
} }
}
unrefObjectInfo(id) { unrefObjectInfo(id) {
let sub = this.subscriptions[id]; let sub = this.subscriptions[id];
if (sub === null) { if (sub) {
return;
}
sub.unref(); sub.unref();
if (sub.getRefCount() <= 0) { if (sub.getRefCount() <= 0) {
this.subscriptions[id] = null; this.subscriptions[id] = null;
} }
} }
}
getObjectRefInfo(id) { getObjectRefInfo(id) {
let sub = this.subscriptions[id]; let sub = this.subscriptions[id];
if (sub === null) { if (sub) {
return 0; return (sub.value || 0);
} }
if (typeof sub.value === 'undefined') {
return 0; return 0;
} }
return sub.value;
}
getObjectInfo(owner, attributeName) { getObjectInfo(owner, attributeName) {
let name = this.getName(attributeName); let name = this.getName(attributeName);
...@@ -97,10 +116,7 @@ class GraphLocalDb { ...@@ -97,10 +116,7 @@ class GraphLocalDb {
if (id === -1) { if (id === -1) {
return new CdhrNumber(0, 2); return new CdhrNumber(0, 2);
} }
if (typeof this.subscriptions[id].value === 'undefined') { return new CdhrNumber(this.subscriptions[id].value || 0, 1);
return new CdhrNumber(0, 1);
}
return new CdhrNumber(this.subscriptions[id].value, 1);
} }
setObjectInfo(owner, attributeName, value) { setObjectInfo(owner, attributeName, value) {
...@@ -125,14 +141,10 @@ class GraphLocalDb { ...@@ -125,14 +141,10 @@ class GraphLocalDb {
} }
nameToId(owner, name) { nameToId(owner, name) {
for (let i = 0; i < this.subscriptions.length; i++) { return this.subscriptions.findIndex(function (sub) {
let sub = this.subscriptions[i]; return (sub !== null && owner === sub.owner &&
if (sub !== null && owner === sub.owner && name.toUpperCase() === sub.name.toUpperCase());
name.toUpperCase() === sub.name.toUpperCase()) { });
return i;
}
}
return -1;
} }
getName(attrName) { getName(attrName) {
...@@ -166,52 +178,12 @@ class GraphLocalDb { ...@@ -166,52 +178,12 @@ class GraphLocalDb {
} else { } else {
suffix = attrName.substring(idx1, idx2).toUpperCase(); suffix = attrName.substring(idx1, idx2).toUpperCase();
} }
if (suffix === "BOOLEAN") {
return Type.Boolean; suffix = suffix.toLowerCase();
} if (strToTypeId.hasOwnProperty(suffix)) {
if (suffix === "FLOAT32") { return strToTypeId[suffix];
return Type.Float32;
}
if (suffix === "INT32") {
return Type.Int32;
}
if (suffix === "UINT32") {
return Type.UInt32;
}
if (suffix === "INT16") {
return Type.Int16;
}
if (suffix === "UINT16") {
return Type.UInt16;
}
if (suffix === "INT8") {
return Type.Int8;
}
if (suffix === "UINT8") {
return Type.UInt8;
}
if (suffix === "CHAR") {
return Type.Char;
}
if (suffix === "FLOAT64") {
return Type.Float64;
}
if (suffix === "OBJID") {
return Type.Objid;
}
if (suffix === "STRING") {
return Type.String;
}
if (suffix === "TIME") {
return Type.Time;
}
if (suffix === "DELTATIME") {
return Type.DeltaTime;
}
if (suffix === "ATTRREF") {
return Type.AttrRef;
} }
if (suffix.substring(0, 6) === "STRING") { if (suffix.startsWith("string")) {
return Type.String; return Type.String;
} }
return 0; return 0;
...@@ -286,11 +258,7 @@ class Graph { ...@@ -286,11 +258,7 @@ class Graph {
login_cb(id, data, sts, result) { login_cb(id, data, sts, result) {
console.log("Login:", sts, result); console.log("Login:", sts, result);
if (sts & 1) { this.priv = (sts & 1) ? result : 0;
this.priv = result;
} else {
this.priv = 0;
}
} }
trace_connected(id, sts) { trace_connected(id, sts) {
...@@ -329,34 +297,20 @@ class Graph { ...@@ -329,34 +297,20 @@ class Graph {
} }
growUserdataOpen(lines, row, ctx, type) { growUserdataOpen(lines, row, ctx, type) {
let dyn;
let ret = new UserdataCbReturn(); let ret = new UserdataCbReturn();
switch (type) { if (type === UserdataCbType.Ctx || type === UserdataCbType.Node || type === UserdataCbType.NodeClass) {
case UserdataCbType.Ctx: if (type === UserdataCbType.Ctx && lines[row] !== "1") {
if (lines[row] === "1") {
dyn = new Dyn(this);
dyn.userdata = this;
ret.userdata = dyn;
ret.row = dyn.open(lines, row);
} else {
ret.row = row - 1; ret.row = row - 1;
ret.userdata = null; ret.userdata = null;
return ret;
} }
break; let dyn = new Dyn(this);
case UserdataCbType.Node: if (type !== UserdataCbType.NodeClass) {
dyn = new Dyn(this);
dyn.userdata = this; dyn.userdata = this;
}
ret.userdata = dyn; ret.userdata = dyn;
ret.row = dyn.open(lines, row); ret.row = dyn.open(lines, row);
break;
case UserdataCbType.NodeClass:
dyn = new Dyn(this);
ret.row = dyn.open(lines, row);
ret.userdata = dyn;
break;
default:
break;
} }
return ret; return ret;
} }
...@@ -389,9 +343,7 @@ class Graph { ...@@ -389,9 +343,7 @@ class Graph {
} }
let old_size = list.size(); let old_size = list.size();
list = this.ctx.get_object_list(); list = this.ctx.get_object_list();
if (old_size !== list.size()) if (old_size !== list.size()) { // Something is deleted
// Something is deleted
{
break; break;
} }
} }
...@@ -495,70 +447,12 @@ class Graph { ...@@ -495,70 +447,12 @@ class Graph {
if ((idx = str.indexOf('#')) !== -1) { if ((idx = str.indexOf('#')) !== -1) {
str = str.substring(0, idx); str = str.substring(0, idx);
} }
if (str.toLowerCase() === "boolean") {
return Type.Boolean; str = str.toLowerCase();
} if (strToTypeId.hasOwnProperty(str)) {
if (str.toLowerCase() === "float32") { return strToTypeId[str];
return Type.Float32;
}
if (str.toLowerCase() === "float64") {
return Type.Float64;
}
if (str.toLowerCase() === "char") {
return Type.Char;
}
if (str.toLowerCase() === "int8") {
return Type.Int8;
}
if (str.toLowerCase() === "int16") {
return Type.Int16;
}
if (str.toLowerCase() === "int32") {
return Type.Int32;
}
if (str.toLowerCase() === "int64") {
return Type.Int64;
}
if (str.toLowerCase() === "uint8") {
return Type.UInt8;
}
if (str.toLowerCase() === "uint16") {
return Type.UInt16;
}
if (str.toLowerCase() === "uint32") {
return Type.UInt32;
}
if (str.toLowerCase() === "uint64") {
return Type.UInt64;
}
if (str.toLowerCase() === "objid") {
return Type.Objid;
}
if (str.toLowerCase() === "time") {
return Type.Time;
}
if (str.toLowerCase() === "deltatime") {
return Type.DeltaTime;
}
if (str.toLowerCase() === "attrref") {
return Type.AttrRef;
}
if (str.toLowerCase() === "status") {
return Type.Status;
}
if (str.toLowerCase() === "netstatus") {
return Type.NetStatus;
}
if (str.toLowerCase() === "enum") {
return Type.Enum;
}
if (str.toLowerCase() === "mask") {
return Type.Mask;
}
if (str.toLowerCase() === "bit") {
return Type.Bit;
} }
if (str.length >= 6 && str.substring(0, 6).toLowerCase() === "string") { if (str.startsWith("string")) {
return Type.String; return Type.String;
} }
return 0; return 0;
...@@ -566,11 +460,9 @@ class Graph { ...@@ -566,11 +460,9 @@ class Graph {
stringToIndex(str) { stringToIndex(str) {
let idx1, idx2; let idx1, idx2;
let index;
if ((idx1 = str.indexOf('[')) !== -1 && (idx2 = str.indexOf(']')) !== -1 && if ((idx1 = str.indexOf('[')) !== -1 && (idx2 = str.indexOf(']')) !== -1 &&
idx2 > idx1) { idx2 > idx1) {
index = parseInt(str.substring(idx1 + 1, idx2), 10); let index = parseInt(str.substring(idx1 + 1, idx2), 10);
if (isNaN(index)) { if (isNaN(index)) {
console.log("Element syntax error, " + str); console.log("Element syntax error, " + str);
return 1; return 1;
...@@ -797,13 +689,13 @@ class Graph { ...@@ -797,13 +689,13 @@ class Graph {
openValueInputDialog(dyn, text, elem) { openValueInputDialog(dyn, text, elem) {
let value = prompt(text, ""); let value = prompt(text, "");
if (value !== null) { if (value) {
dyn.valueInputAction(elem, value); dyn.valueInputAction(elem, value);
} }
} }
openConfirmDialog(dyn, text, object) { openConfirmDialog(dyn, text, object) {
if (appl !== null) { if (appl) {
appl.openConfirmDialog(dyn, text, object); appl.openConfirmDialog(dyn, text, object);
} }
} }
...@@ -817,21 +709,18 @@ class Graph { ...@@ -817,21 +709,18 @@ class Graph {
} }
getAnimationScanTime() { getAnimationScanTime() {
if (this.scan_time < this.animation_scan_time) { return Math.min(this.scan_time, this.animation_scan_time);
return this.scan_time;
}
return this.animation_scan_time;
} }
command(cmd) { command(cmd) {
if (this.appl !== null) { if (this.appl) {
return this.appl.command(cmd); return this.appl.command(cmd);
} }
return 0; return 0;
} }
script(script) { script(script) {
if (this.appl !== null) { if (this.appl) {
return this.appl.script(script); return this.appl.script(script);
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment