Commit 5d4e1cd6 authored by Christoffer Ackelman's avatar Christoffer Ackelman

JS: Change from fuzzy to strict equality checks.

parent 285b780d
......@@ -93,7 +93,7 @@ function Cli(cliTable) {
var c = cmd.charAt(i);
switch (state) {
case CliC.STATE_INIT:
if (c == CliC.SPACE || c == CliC.TAB) {
if (c === CliC.SPACE || c === CliC.TAB) {
break;
} else {
state = CliC.STATE_VERB;
......@@ -101,20 +101,20 @@ function Cli(cliTable) {
}
break;
case CliC.STATE_SPACE:
if (c == CliC.SPACE || c == CliC.TAB) {
if (c === CliC.SPACE || c === CliC.TAB) {
break;
}
if (c == '/') {
if (c === '/') {
state = CliC.STATE_QUAL;
start_pos = i;
} else if (c == '=') {
} else if (c === '=') {
if (this.qualifierCount === 0) {
state = CliC.STATE_ERROR;
this.status = CliC.SYNTAX_ERROR;
break;
}
state = CliC.STATE_EQUAL;
} else if (c == '"') {
} else if (c === '"') {
state = CliC.STATE_QUOTE_VERB;
break;
} else {
......@@ -123,8 +123,8 @@ function Cli(cliTable) {
}
break;
case CliC.STATE_VERB:
if (c == CliC.SPACE || c == CliC.TAB) {
if (this.verbCount == CliC.VERB_VECT_SIZE) {
if (c === CliC.SPACE || c === CliC.TAB) {
if (this.verbCount === CliC.VERB_VECT_SIZE) {
state = CliC.STATE_ERROR;
break;
}
......@@ -135,8 +135,8 @@ function Cli(cliTable) {
this.verb[this.verbCount++] = cmd.substring(start_pos, i);
}
state = CliC.STATE_SPACE;
} else if (c == '/') {
if (this.verbCount == CliC.VERB_VECT_SIZE) {
} else if (c === '/') {
if (this.verbCount === CliC.VERB_VECT_SIZE) {
state = CliC.STATE_ERROR;
break;
}
......@@ -147,8 +147,8 @@ function Cli(cliTable) {
}
break;
case CliC.STATE_VERB_EXACT:
if (c == '"') {
if (this.verbCount == CliC.VERB_VECT_SIZE) {
if (c === '"') {
if (this.verbCount === CliC.VERB_VECT_SIZE) {
state = CliC.STATE_ERROR;
break;
}
......@@ -157,15 +157,15 @@ function Cli(cliTable) {
}
break;
case CliC.STATE_QUAL:
if (c == CliC.SPACE || c == CliC.TAB) {
if (c === CliC.SPACE || c === CliC.TAB) {
this.qualifier[this.qualifierCount++] =
cmd.substring(start_pos, i).toUpperCase();
state = CliC.STATE_SPACE;
} else if (c == '=') {
} else if (c === '=') {
this.qualifier[this.qualifierCount++] =
cmd.substring(start_pos, i).toUpperCase();
state = CliC.STATE_EQUAL;
} else if (c == '/') {
} else if (c === '/') {
this.qualifier[this.qualifierCount++] =
cmd.substring(start_pos, i).toUpperCase();
state = CliC.STATE_QUAL;
......@@ -173,11 +173,11 @@ function Cli(cliTable) {
}
break;
case CliC.STATE_QUALVALUE:
if (c == CliC.SPACE || c == CliC.TAB) {
if (c === CliC.SPACE || c === CliC.TAB) {
this.qualValue[this.qualifierCount - 1] =
cmd.substring(start_pos, i);
state = CliC.STATE_SPACE;
} else if (c == '/') {
} else if (c === '/') {
this.qualValue[this.qualifierCount - 1] =
cmd.substring(start_pos, i);
state = CliC.STATE_QUAL;
......@@ -185,7 +185,7 @@ function Cli(cliTable) {
}
break;
case CliC.STATE_QUALVALUE_EXACT:
if (c == '"') {
if (c === '"') {
this.qualValue[this.qualifierCount - 1] =
cmd.substring(start_pos, i);
state = CliC.STATE_SPACE;
......@@ -200,10 +200,10 @@ function Cli(cliTable) {
start_pos = i;
break;
case CliC.STATE_EQUAL:
if (c == CliC.SPACE || c == CliC.TAB) {
if (c === CliC.SPACE || c === CliC.TAB) {
break;
}
if (c == '"') {
if (c === '"') {
state = CliC.STATE_QUOTE_QUALVALUE;
} else {
state = CliC.STATE_QUALVALUE;
......@@ -212,7 +212,7 @@ function Cli(cliTable) {
break;
}
if (state == CliC.STATE_ERROR) {
if (state === CliC.STATE_ERROR) {
break;
}
}
......@@ -221,7 +221,7 @@ function Cli(cliTable) {
case CliC.STATE_ERROR:
return "";
case CliC.STATE_VERB:
if (this.verbCount == CliC.VERB_VECT_SIZE) {
if (this.verbCount === CliC.VERB_VECT_SIZE) {
state = CliC.STATE_ERROR;
break;
}
......@@ -233,7 +233,7 @@ function Cli(cliTable) {
}
break;
case CliC.STATE_VERB_EXACT:
if (this.verbCount == CliC.VERB_VECT_SIZE) {
if (this.verbCount === CliC.VERB_VECT_SIZE) {
state = CliC.STATE_ERROR;
break;
}
......@@ -272,7 +272,7 @@ function Cli(cliTable) {
if (this.verb[0].length > this.cliTable[i].command.length) {
continue;
}
if (this.verb[0] ==
if (this.verb[0] ===
(this.cliTable[i].command.substring(0, this.verb[0].length))) {
this.verb[0] = this.cliTable[i].command;
found = true;
......@@ -291,19 +291,19 @@ function Cli(cliTable) {
if (this.cliTable[this.cliTableIndex].qualifier[i] === null) {
break;
}
if (this.cliTable[this.cliTableIndex].qualifier[i] == ("cli_arg1")) {
if (this.cliTable[this.cliTableIndex].qualifier[i] === ("cli_arg1")) {
this.configuredVerbs++;
}
if (this.cliTable[this.cliTableIndex].qualifier[i] == ("cli_arg2")) {
if (this.cliTable[this.cliTableIndex].qualifier[i] === ("cli_arg2")) {
this.configuredVerbs++;
}
if (this.cliTable[this.cliTableIndex].qualifier[i] == ("cli_arg3")) {
if (this.cliTable[this.cliTableIndex].qualifier[i] === ("cli_arg3")) {
this.configuredVerbs++;
}
if (this.cliTable[this.cliTableIndex].qualifier[i] == ("cli_arg4")) {
if (this.cliTable[this.cliTableIndex].qualifier[i] === ("cli_arg4")) {
this.configuredVerbs++;
}
if (this.cliTable[this.cliTableIndex].qualifier[i] == ("cli_arg5")) {
if (this.cliTable[this.cliTableIndex].qualifier[i] === ("cli_arg5")) {
this.configuredVerbs++;
}
}
......@@ -319,7 +319,7 @@ function Cli(cliTable) {
this.cliTable[this.cliTableIndex].qualifier[i].length) {
continue;
}
if (this.qualifier[j] ==
if (this.qualifier[j] ===
(this.cliTable[this.cliTableIndex].qualifier[i].substring(0,
this.qualifier[j].length))) {
this.cliQualifierIndex[j] = i;
......@@ -346,32 +346,20 @@ function Cli(cliTable) {
*/
this.qualifierFound = function (qual) {
if (qual == ("cli_arg1")) {
if (this.verbCount < 2 || this.configuredVerbs < 1) {
return false;
}
return true;
if (qual === ("cli_arg1")) {
return !(this.verbCount < 2 || this.configuredVerbs < 1);
}
if (qual == ("cli_arg2")) {
if (this.verbCount < 3 || this.configuredVerbs < 2) {
return false;
}
return true;
if (qual === ("cli_arg2")) {
return !(this.verbCount < 3 || this.configuredVerbs < 2);
}
if (qual == ("cli_arg3")) {
if (this.verbCount < 4 || this.configuredVerbs < 3) {
return false;
}
return true;
if (qual === ("cli_arg3")) {
return !(this.verbCount < 4 || this.configuredVerbs < 3);
}
if (qual == ("cli_arg4")) {
if (this.verbCount < 5 || this.configuredVerbs < 4) {
return false;
}
return true;
if (qual === ("cli_arg4")) {
return !(this.verbCount < 5 || this.configuredVerbs < 4);
}
for (var i = 0; i < this.qualifierCount; i++) {
if (qual == (this.qualifier[i])) {
if (qual === (this.qualifier[i])) {
return true;
}
}
......@@ -384,31 +372,31 @@ function Cli(cliTable) {
* @return Returns the value of the qualifier.
*/
this.getQualValue = function (qual) {
if (qual == ("cli_arg1")) {
if (qual === ("cli_arg1")) {
if (this.verbCount < 2 || this.configuredVerbs < 1) {
return "";
}
return this.verb[1];
}
if (qual == ("cli_arg2")) {
if (qual === ("cli_arg2")) {
if (this.verbCount < 3 || this.configuredVerbs < 2) {
return "";
}
return this.verb[2];
}
if (qual == ("cli_arg3")) {
if (qual === ("cli_arg3")) {
if (this.verbCount < 4 || this.configuredVerbs < 3) {
return this.verb[3];
}
}
if (qual == ("cli_arg4")) {
if (qual === ("cli_arg4")) {
if (this.verbCount < 5 || this.configuredVerbs < 4) {
return "";
}
return this.verb[4];
}
for (var i = 0; i < this.qualifierCount; i++) {
if (qual == (this.qualifier[i])) {
if (qual === (this.qualifier[i])) {
if (this.qualValue[i] === null) {
return "";
} else {
......
......@@ -200,7 +200,7 @@ function Gdh() {
};
this.ws.onmessage = function (e) {
if (typeof e.data == "string") {
if (typeof e.data === "string") {
console.log("String message received", e, e.data);
} else {
if (e.data instanceof ArrayBuffer) {
......@@ -322,7 +322,7 @@ function Gdh() {
var esize = dv.getUint32(j);
j += 4;
var sub = this.gdh.sub[eid];
if (typeof sub == 'undefined') {
if (typeof sub === 'undefined') {
j += esize;
} else {
var value;
......@@ -333,7 +333,7 @@ function Gdh() {
j += 1;
} else {
var elements = esize;
if (elements != sub.elements) {
if (elements !== sub.elements) {
console.log("Subscription size error", elements,
sub.elements, eid);
}
......@@ -350,7 +350,7 @@ function Gdh() {
j += 4;
} else {
var elements = esize / 4;
if (elements != sub.elements) {
if (elements !== sub.elements) {
console.log("Subscription size error", elements,
sub.elements, eid);
}
......@@ -377,7 +377,7 @@ function Gdh() {
j += 4;
} else {
var elements = esize / 4;
if (elements != sub.elements) {
if (elements !== sub.elements) {
console.log("Subscription size error", elements,
sub.elements, eid);
}
......@@ -403,7 +403,7 @@ function Gdh() {
value = String.fromCharCode.apply(null, iarr);
} else {
var elements = sub.elements;
if (elements != sub.elements) {
if (elements !== sub.elements) {
console.log("Subscription size error", elements,
sub.elements, eid);
}
......@@ -425,7 +425,7 @@ function Gdh() {
this.gdh.sub[eid].value = value;
}
}
if (typeof this.gdh.pending[id] == 'undefined') {
if (typeof this.gdh.pending[id] === 'undefined') {
console.log("** GetObjectRefInfoAll received removed", id);
break;
}
......@@ -953,9 +953,7 @@ function Gdh() {
sub.elements = elements;
this.sub[this.subscriptionCount] = sub;
this.subscriptionCount++;
if (!this.listSent) {
return sub.refid;
} else {
if (this.listSent) {
var size = 0;
var len = 0;
......@@ -997,6 +995,8 @@ function Gdh() {
this.next_id++;
return sub.refid;
} else {
return sub.refid;
}
};
......
......@@ -108,7 +108,7 @@ var Plow = {
eEvent_ObjectDeleted: 10,
RELATIVE_POSITION: 1,
NEXT_RELATIVE_POSITION: 2
}
};
function PlowGeometry() {
this.ll_x = 0;
......@@ -127,7 +127,7 @@ function PlowNodeClass(ctx) {
this.draw = function (g, p, node, highlight) {
this.a.draw(g, p, node, highlight);
}
};
this.insert = function (elem) {
this.a.add(elem);
......@@ -140,10 +140,10 @@ function PlowArray(ctx) {
this.add = function (elem) {
this.a.push(elem);
}
};
this.insertNode = function (elem, destination, code) {
var idx = this.find(elem);
if (idx != -1) {
if (idx !== -1) {
return;
}
......@@ -160,13 +160,13 @@ function PlowArray(ctx) {
}
} else {
var dest_idx = this.find(destination);
if (dest_idx == -1) {
if (dest_idx === -1) {
return;
}
switch (code) {
case Plow.DEST_INTOFIRST:
if (dest_idx == this.a.length - 1) {
if (dest_idx === this.a.length - 1) {
this.a.push(elem);
} else {
this.a.splice(dest_idx + 1, 0, elem);
......@@ -174,7 +174,7 @@ function PlowArray(ctx) {
elem.level = destination.level + 1;
break;
case Plow.DEST_INTOLAST: {
if (dest_idx == this.a.length - 1) {
if (dest_idx === this.a.length - 1) {
this.a.push(elem);
} else {
idx = this.a.length;
......@@ -184,7 +184,7 @@ function PlowArray(ctx) {
break;
}
}
if (idx == this.a.length) {
if (idx === this.a.length) {
this.a.push(elem);
} else {
this.a.splice(idx, 0, elem);
......@@ -194,7 +194,7 @@ function PlowArray(ctx) {
break;
}
case Plow.DEST_AFTER: {
if (dest_idx == this.a.length - 1) {
if (dest_idx === this.a.length - 1) {
this.a.push(elem);
} else {
var i;
......@@ -217,42 +217,42 @@ function PlowArray(ctx) {
break;
}
}
}
};
this.remove = function (elem) {
var idx = this.find(elem);
if (idx == -1) {
if (idx === -1) {
return;
}
this.ctx.event_cb(Plow.eEvent_ObjectDeleted, this.a[idx + 1], 0, 0);
this.a.splice(idx, 1);
}
};
this.size = function () {
return this.a.length;
}
};
this.get = function (idx) {
return this.a[idx];
}
};
this.draw = function (g, p, node, highlight) {
for (var i = 0; i < this.a.length; i++) {
this.a[i].draw(g, p, node, highlight);
}
}
};
this.set_borders = function (node) {
for (var i = 0; i < this.a.length; i++) {
this.a[i].set_borders(node);
}
}
};
this.configure = function () {
for (var i = 0; i < this.a.length; i++) {
this.a[i].pos.x = this.a[i].level * 1.0;
this.a[i].pos.y = i * 1.0;
}
}
};
this.close_node = function (node) {
var idx = this.find(node);
if (idx == -1) {
if (idx === -1) {
return;
}
var level = node.level;
......@@ -263,21 +263,21 @@ function PlowArray(ctx) {
}
}
var next_idx = i;
if (next_idx == idx + 1) {
if (next_idx === idx + 1) {
return;
}
for (i = idx + 1; i < next_idx; i++) {
// Event backcall
if (ctx.select_object == this.a[idx + 1]) {
if (ctx.select_object === this.a[idx + 1]) {
ctx.select_object = null;
}
this.ctx.event_cb(Plow.eEvent_ObjectDeleted, this.a[idx + 1], 0, 0);
this.a.splice(idx + 1, 1);
}
}
};
this.get_parent_object = function (node) {
var idx = this.find(node);
if (idx == -1) {
if (idx === -1) {
return null;
}
......@@ -287,15 +287,15 @@ function PlowArray(ctx) {
}
}
return null;
}
};
this.get_first_child = function (node) {
var idx = this.find(node);
if (idx == -1) {
if (idx === -1) {
return null;
}
if (this.a.length == idx - 1) {
if (this.a.length === idx - 1) {
return null;
}
......@@ -303,17 +303,17 @@ function PlowArray(ctx) {
return this.a[idx + 1];
}
return null;
}
};
this.get_next_sibling = function (node) {
var found = false;
for (var i = 0; i < this.a.length; i++) {
if (this.a[i] == node) {
if (this.a[i] === node) {
found = true;
continue;
}
if (found) {
if (this.a[i].level == node.level) {
if (this.a[i].level === node.level) {
return this.a[i];
}
if (this.a[i].level < node.level) {
......@@ -322,46 +322,46 @@ function PlowArray(ctx) {
}
}
return null;
}
};
this.get_next_object = function (node) {
for (var i = 0; i < this.a.length; i++) {
if (this.a[i] == node) {
if (i == this.a.length - 1) {
if (this.a[i] === node) {
if (i === this.a.length - 1) {
return null;
}
return this.a[i + 1];
}
}
return null;
}
};
this.get_previous_object = function (node) {
for (var i = 0; i < this.a.length; i++) {
if (this.a[i] == node) {
if (i == 0) {
if (this.a[i] === node) {
if (i === 0) {
return null;
}
return this.a[i - 1];
}
}
return null;
}
};
this.get_first_object = function () {
if (this.a.length == 0) {
if (this.a.length === 0) {
return null;
}
return this.a[0];
}
};
this.get_last_object = function () {
if (this.a.length == 0) {
if (this.a.length === 0) {
return null;
}
return this.a[this.a.length - 1];
}
};
this.find = function (elem) {
for (var i = 0; i < this.a.length; i++) {
if (this.a[i] == elem) {
if (this.a[i] === elem) {
return i;
}
}
......@@ -402,16 +402,16 @@ function PlowNode(ctx, nc, level) {
return;
}
this.annotv[number] = text;
}
};
this.set_annotation_pixmap = function (number, pixmap) {
if (number >= 10) {
return;
}
this.pixmapv[number] = pixmap;
}
};
this.draw_object = function () {
this.draw(this.ctx.gdraw.gctx, null, null, false);
}
};
this.draw = function (g, p, node, highlight) {
var x = this.x_left * this.ctx.zoom_factor;
var y = this.y_low * this.ctx.zoom_factor - 1;
......@@ -424,43 +424,39 @@ function PlowNode(ctx, nc, level) {
g.fillRect(x, y, width, height);
this.nc.draw(g, this.pos, this, this.highlight);
}
};
this.connect = function () {
if (this.trace_object == "" || this.trace_attribute == "") {
if (this.trace_object === "" || this.trace_attribute === "") {
return;
}
var n = this.trace_attribute.indexOf('#');
if (n != -1) {
if (n !== -1) {
this.trace_attribute = this.trace_attribute.substring(0, n);
}
var o = this.trace_object + "." + this.trace_attribute;
this.p = ctx.gdh.refObjectInfo(o, this.trace_attr_type);
console.log("connecting", o, this.p);
}
};
this.scan = function () {
if (this.p == 0) {
if (this.p === 0) {
return;
}
var v1 = ctx.gdh.getRefObjectInfo(this.p);
var evaluate = true;
if (this.first_scan) {
this.first_scan = false;
} else if (v1 == this.old_value) {
} else if (v1 === this.old_value) {
return;
}
if (v1) {
this.highlight = true;
} else {
this.highlight = false;
}
this.highlight = !!v1;
this.old_value = v1;
this.draw_object();
}
};
this.set_borders = function () {
this.x_left = 1e37;
......@@ -468,7 +464,7 @@ function PlowNode(ctx, nc, level) {
this.y_low = 1e37;
this.y_high = -1e37;
nc.a.set_borders(this);
}
};
this.event_handler = function (event, x, y) {
if ((x - this.ctx.offset_x) / this.ctx.zoom_factor >= this.x_left &&
......@@ -479,7 +475,7 @@ function PlowNode(ctx, nc, level) {
return 1;
}
return 0;
}
};
this.set_select = function (select) {
if (select) {
......@@ -487,31 +483,29 @@ function PlowNode(ctx, nc, level) {
this.ctx.select_object = this;
} else {
this.select = false;
if (this.ctx.select_object == this) {
if (this.ctx.select_object === this) {
this.ctx.select_object = null;
}
}
if (select != this.select) {
if (select !== this.select) {
this.draw_object();
}
}
};
this.set_invert = function (invert) {
this.invert = invert;
this.draw_object();
}
};
this.set_userdata = function (userdata) {
this.userdata = userdata;
}
};
this.get_userdata = function () {
return this.userdata;
}
};
this.in_icon = function (x, y) {
if (x >= this.x_left * this.ctx.zoom_factor &&
x <= (this.x_left + 1.75) * this.ctx.zoom_factor) {
return true;
}
return false;
}
return x >= this.x_left * this.ctx.zoom_factor && x <=
(this.x_left + 1.75) * this.ctx.zoom_factor;
};
this.measure = function () {
var geom = new PlowGeometry();
geom.ll_x = this.x_left * this.ctx.zoom_factor;
......@@ -598,7 +592,7 @@ function PlowAnnot(ctx, x, y, text_size, text_color, annot_type, number) {
var x = (this.p.x + p0.x) * this.ctx.zoom_factor;
var y = (this.p.y + p0.y) * this.ctx.zoom_factor - tsize / 4;
if ((this.annot_type & Plow.RELATIVE_POSITION) != 0) {
if ((this.annot_type & Plow.RELATIVE_POSITION) !== 0) {
var rel_x = (p0.x + node.relative_position + this.RELATIVE_OFFSET) *
this.ctx.zoom_factor;
if (x < rel_x) {
......@@ -611,13 +605,13 @@ function PlowAnnot(ctx, x, y, text_size, text_color, annot_type, number) {
g.fillText(tokens[i], x, y);
y += tsize * 1.4;
}
if ((this.annot_type & Plow.NEXT_RELATIVE_POSITION) != 0 ||
(this.annot_type & Plow.RELATIVE_POSITION) != 0) {
if ((this.annot_type & Plow.NEXT_RELATIVE_POSITION) !== 0 ||
(this.annot_type & Plow.RELATIVE_POSITION) !== 0) {
node.relative_position =
(x + g.measureText(node.annotv[this.number]).width) /
this.ctx.zoom_factor - p0.x;
}
}
};
this.set_borders = function (node) {
}
}
......@@ -656,14 +650,14 @@ function PlowAnnotPixmap(ctx, x, y, number) {
Bitmaps.pending[bix] = null;
}
} else {
if (!img.complete) {
Bitmaps.pending[bix].push(new PlowPoint(this.ctx, x, y));
} else {
if (img.complete) {
gctx.drawImage(img, x, y);
} else {
Bitmaps.pending[bix].push(new PlowPoint(this.ctx, x, y));
}
}
}
};
this.set_borders = function (node) {
}
}
......@@ -734,7 +728,7 @@ function PlowRect(ctx, x, y, width, height, fill_color, border_color, fill,
}
g.fillRect(x, y, width, height);
}
}
};
this.set_borders = function (node) {
if (this.ll.x + node.pos.x < node.x_left) {
node.x_left = this.ll.x + node.pos.x;
......@@ -816,12 +810,12 @@ function PlowCtx() {
for (var i = 0; i < this.a.size(); i++) {
if (this.a.get(i) instanceof PlowNode) {
sts = this.a.get(i).event_handler(event, x, y);
if (sts == 1) {
if (sts === 1) {
break;
}
}
}
if (sts == 1) {
if (sts === 1) {
this.event_cb(event, this.event_object, x, y);
this.draw();
}
......@@ -864,7 +858,7 @@ function PlowCtx() {
this.a.insertNode(n, destination, destCode);
};
this.remove = function (n) {
if (this.select_object == n) {
if (this.select_object === n) {
this.select_object = null;
}
this.a.remove(n);
......@@ -875,9 +869,7 @@ function PlowCtx() {
this.configure = function () {
this.a.configure();
this.a.set_borders();
var height = this.a.a.length * 1.0 * this.zoom_factor;
this.gdraw.canvas.height = height;
this.gdraw.canvas.height = this.a.a.length * 1.0 * this.zoom_factor;
};
this.get_parent_object = function (o) {
return this.a.get_parent_object(o);
......@@ -898,13 +890,11 @@ function PlowCtx() {
this.a.close_node(o);
};
this.is_visible = function (o) {
if ((o.y_high * this.zoom_factor <= window.pageYOffset +
window.innerHeight - this.gdraw.offset_top) &&
return (o.y_high * this.zoom_factor <= window.pageYOffset +
window.innerHeight - this.gdraw.offset_top) &&
(o.y_low * this.zoom_factor >= window.pageYOffset -
this.gdraw.offset_top)) {
return true;
}
return false;
this.gdraw.offset_top);
};
this.scroll = function (y, factor) {
window.scrollTo(window.scrollX, y * this.zoom_factor - window.innerHeight *
......
......@@ -17,7 +17,7 @@ function PwrtStatus(sts) {
return (sts % 2 === 0);
};
this.oddSts = function () {
return (sts % 2 == 1);
return (sts % 2 === 1);
};
this.getSts = function () {
return sts;
......@@ -178,7 +178,7 @@ function CdhrNumber(value, sts) {
return (sts % 2 === 0);
};
this.oddSts = function () {
return (sts % 2 == 1);
return (sts % 2 === 1);
};
this.getSts = function () {
return sts;
......
......@@ -84,7 +84,6 @@ function Ev() {
document.title = "Event List";
break;
default:
;
}
this.priv = sessionStorage.getItem("pwr_privilege");
......@@ -97,7 +96,7 @@ function Ev() {
this.ctx.gdh = new Gdh();
this.ctx.gdh.open_cb = this.gdh_init_cb;
this.ctx.gdh.init()
this.ctx.gdh.init();
this.ctx.gdraw.canvas.addEventListener("click", function (event) {
var y = event.pageY - self.ctx.gdraw.offset_top;
......@@ -109,33 +108,33 @@ function Ev() {
}
});
document.addEventListener("keydown", function (event) {
if (event.keyCode == 40) {
if (event.keyCode === 40) {
self.ctx.event_handler(Plow.eEvent_Key_Down);
event.preventDefault();
} else if (event.keyCode == 39) {
} else if (event.keyCode === 39) {
if (event.shiftKey) {
self.ctx.event_handler(Plow.eEvent_Key_ShiftRight);
} else {
self.ctx.event_handler(Plow.eEvent_Key_Right);
}
event.preventDefault();
} else if (event.keyCode == 37) {
} else if (event.keyCode === 37) {
self.ctx.event_handler(Plow.eEvent_Key_Left);
event.preventDefault();
} else if (event.keyCode == 38) {
} else if (event.keyCode === 38) {
self.ctx.event_handler(Plow.eEvent_Key_Up);
event.preventDefault();
} else if (event.keyCode == 82) {
} else if (event.keyCode === 82) {
if (event.ctrlKey) {
self.ctx.event_handler(Plow.eEvent_Key_CtrlR);
}
event.preventDefault();
} else if (event.keyCode == 76) {
} else if (event.keyCode === 76) {
if (event.ctrlKey) {
self.ctx.event_handler(Plow.eEvent_Key_CtrlL);
}
event.preventDefault();
} else if (event.keyCode == 71) {
} else if (event.keyCode === 71) {
if (event.ctrlKey) {
self.ctx.event_handler(Plow.eEvent_Key_CtrlG);
}
......@@ -261,11 +260,11 @@ function Ev() {
}
});
}
};
this.is_authorized = function (access) {
return (this.priv & access) ? true : false;
}
return !!(this.priv & access);
};
this.gdh_init_cb = function () {
if (self.priv == null) {
......@@ -276,7 +275,7 @@ function Ev() {
self.ctx.gdh.listSent = true;
self.trace_cyclic();
}
};
this.login_cb = function (id, data, sts, result) {
console.log("Login:", sts, result);
......@@ -296,7 +295,7 @@ function Ev() {
return;
}
if (self.type == EvC.eType_AlarmList) {
if (self.type === EvC.eType_AlarmList) {
self.ctx.set_nodraw();
for (var i = result.length - 1; i >= 0; i--) {
......@@ -348,7 +347,7 @@ function Ev() {
self.ctx.configure();
self.ctx.reset_nodraw();
self.ctx.draw();
} else if (self.type == EvC.eType_EventList) {
} else if (self.type === EvC.eType_EventList) {
self.ctx.set_nodraw();
for (var i = result.length - 1; i >= 0; i--) {
var e = result[i];
......@@ -372,17 +371,17 @@ function Ev() {
for (var o = this.ctx.get_first_object(); o !== null;
o = this.ctx.get_next_object(o)) {
var item = o.get_userdata();
if (item.e.eventId.nix == event_id.nix &&
item.e.eventId.idx == event_id.idx) {
if (item.e.eventId.nix === event_id.nix &&
item.e.eventId.idx === event_id.idx) {
return item;
}
}
return null;
}
};
this.is_authorized = function (access) {
return (this.priv & access) ? true : false;
}
return !!(this.priv & access);
};
this.ack = function () {
if (!this.is_authorized(Pwr.mAccess_RtEventsAck)) {
......@@ -408,26 +407,28 @@ function Ev() {
}
this.ctx.configure();
this.ctx.draw();
}
};
this.ack_cb = function (id, data, sts) {
console.log("ack sts", sts);
}
};
this.open_objectgraph_cb = function (id, data, sts, result) {
if ((sts & 1) != 0) {
if ((sts & 1) === 0) {
data.document.write("Error status " + sts);
} else {
data.location.href =
"ge.html?graph=" + result.param1 + "&instance=" + result.fullname;
data.document.title = result.fullname;
} else {
data.document.write("Error status " + sts);
}
}
};
this.open_graph_cb = function (id, data, sts, result) {
if ((sts & 1) != 0) {
if ((sts & 1) === 0) {
data.document.write("Error status " + sts);
} else {
var idx = result.param1.indexOf('.');
if (idx != -1) {
if (idx !== -1) {
result.param1 = result.param1.substring(0, idx);
}
......@@ -438,18 +439,18 @@ function Ev() {
data.location.href = "ge.html?graph=" + result.param1 + instancestr;
data.document.title = result.param1;
} else {
data.document.write("Error status " + sts);
}
}
};
this.open_plc_cb = function (id, data, sts, result) {
if ((sts & 1) != 0) {
if ((sts & 1) === 0) {
data.document.write("Error status " + sts);
} else {
var param1;
if (result.param1 !== "") {
param1 = "&obj=" + result.param1;
} else {
if (result.param1 === "") {
param1 = "";
} else {
param1 = "&obj=" + result.param1;
}
console.log("flow.html?vid=" + result.objid.vid + "&oix=" +
result.objid.oix + param1);
......@@ -457,61 +458,59 @@ function Ev() {
"flow.html?vid=" + result.objid.vid + "&oix=" + result.objid.oix +
param1;
data.document.title = "Trace " + result.fullname;
} else {
data.document.write("Error status " + sts);
}
}
};
this.open_navigator_cb = function (id, data, sts, result) {
console.log("Open navigator", sts);
if ((sts & 1) != 0) {
if ((sts & 1) === 0) {
console.log("Error status " + sts);
} else {
localStorage.setItem("XttMethodNavigator", result.fullname);
console.log("storage", localStorage.getItem("XttMethodNavigator"));
} else {
console.log("Error status " + sts);
}
}
};
this.open_objectgraph_cb = function (id, data, sts, result) {
if ((sts & 1) != 0) {
if ((sts & 1) === 0) {
data.document.write("Error status " + sts);
} else {
var classname = result.classname.toLowerCase();
if (classname.substring(0, 1) == "$") {
if (classname.substring(0, 1) === "$") {
classname = classname.substring(1);
}
var graphname = "pwr_c_" + classname;
data.location.href =
"ge.html?graph=" + graphname + "&instance=" + result.fullname;
data.document.title = graphname + " " + result.fullname;
} else {
data.document.write("Error status " + sts);
}
}
};
this.open_helpclass_cb = function (id, data, sts, result) {
if ((sts & 1) != 0) {
console.log("open_helpclass", result.param1);
var url = location.protocol + "//" + location.host + result.param1;
data.location.href = url;
} else {
if ((sts & 1) === 0) {
data.document.write("Error status " + sts);
} else {
console.log("open_helpclass", result.param1);
data.location.href =
location.protocol + "//" + location.host + result.param1;
}
}
};
this.methods_init = function () {
localStorage.setItem("EvMethodNavigator", "");
}
};
this.collapse = function () {
this.ctx.set_nodraw();
for (var i = 0; i < this.ctx.a.size(); i++) {
var node = this.ctx.a.get(i);
if (node.level == 0) {
if (node.level === 0) {
node.userdata.close(this);
}
}
this.ctx.reset_nodraw();
this.ctx.draw();
}
};
this.trace_cyclic = function () {
self.ctx.gdh.mhSync(self.mhSyncIdx, self.sync_cb, self);
......@@ -650,7 +649,11 @@ function Ev() {
break;
case Plow.eEvent_Key_Down: {
var o = self.ctx.get_select();
if (o != null) {
if (o == null) {
o = self.ctx.a.a[0];
o.set_select(true);
o.set_invert(true);
} else {
var next = self.ctx.get_next_object(o);
if (next != null) {
o.set_select(false);
......@@ -661,10 +664,6 @@ function Ev() {
self.ctx.scroll(next.y_low, 0.10);
}
}
} else {
o = self.ctx.a.a[0];
o.set_select(true);
o.set_invert(true);
}
break;
......@@ -732,9 +731,9 @@ function Ev() {
var vars = query.split('&');
var typestr = vars[0].substring(5);
if (typestr == "event") {
if (typestr === "event") {
type = EvC.eType_EventList;
} else if (typestr == "block") {
} else if (typestr === "block") {
type = EvC.eType_BlockList;
} else {
type = EvC.eType_AlarmList;
......
......@@ -204,7 +204,7 @@ var Flow = {
eSave_Arrow_p1: 1405,
eSave_Arrow_p2: 1406,
eSave_Triangle_rect_part: 2000
}
};
function GDraw(ctx) {
this.ctx = ctx;
......@@ -216,7 +216,7 @@ function GDraw(ctx) {
this.rect = function (x, y, width, height) {
this.gctx.strokeRect(x, y, width, height);
}
};
this.line = function (x1, y1, x2, y2) {
this.gctx.beginPath();
this.gctx.moveTo(x1, y1);
......@@ -231,13 +231,13 @@ function FlowArray(ctx) {
this.add = function (elem) {
this.a.push(elem);
}
};
this.size = function () {
return this.a.length;
}
};
this.get = function (idx) {
return this.a[idx];
}
};
this.open = function (lines, row) {
var end = false;
var i;
......@@ -335,14 +335,14 @@ function FlowArray(ctx) {
for (var i = 0; i < this.a.length; i++) {
this.a[i].draw(g, p, node, highlight);
}
}
};
this.search_by_name = function (name) {
var uname = name.toUpperCase();
for (var i = 0; i < this.a.length; i++) {
if (this.a[i] instanceof FlowNode) {
console.log("Search", this.a[i].n_name, name);
if (this.a[i].n_name.toUpperCase() == uname) {
if (this.a[i].n_name.toUpperCase() === uname) {
return this.a[i];
}
}
......@@ -360,7 +360,7 @@ function FlowNodeClass(ctx) {
this.draw = function (g, p, node, highlight) {
this.a.draw(g, p, node, highlight);
}
};
this.open = function (lines, row) {
var end = false;
......@@ -396,7 +396,7 @@ function FlowNodeClass(ctx) {
}
}
return i;
}
};
this.event_handler = function (x, y) {
return 0;
......@@ -563,7 +563,7 @@ function FlowLine(ctx) {
g.setLineDash([]);
break;
}
}
};
this.open = function (lines, row) {
var end = false;
for (var i = row; i < lines.length; i++) {
......@@ -656,9 +656,9 @@ function FlowRect(ctx) {
}
}
return i;
}
};
this.draw = function (g, p, node, highlight) {
if ((this.display_level & this.ctx.display_level) == 0) {
if ((this.display_level & this.ctx.display_level) === 0) {
return;
}
......@@ -705,7 +705,7 @@ function FlowArc(ctx) {
var r = (this.ur.x - this.ll.x) / 2 * this.ctx.zoom_factor;
var x = (this.ll.x + p.x) * this.ctx.zoom_factor + r;
var y = (this.ll.y + p.y) * this.ctx.zoom_factor + r;
if (this.angel1 == 90 || this.angel1 == 270) {
if (this.angel1 === 90 || this.angel1 === 270) {
var a1 = (this.angel1 + 90) / 180 * Math.PI;
} else {
var a1 = (this.angel1 - 90) / 180 * Math.PI;
......@@ -722,10 +722,10 @@ function FlowArc(ctx) {
g.strokeStyle = "red";
}
g.beginPath()
g.beginPath();
g.arc(x, y, r, a1, a2, false);
g.stroke();
}
};
this.open = function (lines, row) {
var end = false;
for (var i = row; i < lines.length; i++) {
......@@ -826,7 +826,7 @@ function FlowText(ctx) {
g.fillStyle = "red";
}
g.fillText(this.text, x, y);
}
};
this.open = function (lines, row) {
var end = false;
for (var i = row; i < lines.length; i++) {
......@@ -901,13 +901,13 @@ function FlowArrow(ctx) {
if (highlight) {
g.fillStyle = "red";
}
g.beginPath()
g.beginPath();
g.moveTo(x1, y1);
g.lineTo(x2, y2);
g.lineTo(x3, y3);
g.lineTo(x1, y1);
g.fill();
}
};
this.open = function (lines, row) {
var end = false;
......@@ -974,11 +974,11 @@ function FlowTriangle(ctx) {
}
var dtype = this.prototype.draw_type;
if (dtype == Flow.eDrawType_Inherit && node != null) {
if (dtype === Flow.eDrawType_Inherit && node != null) {
dtype = node.fill_color;
}
if (this.prototype.fill == 1) {
if (this.prototype.fill === 1) {
switch (dtype) {
case Flow.eDrawType_LineRed:
g.fillStyle = "red";
......@@ -1008,7 +1008,7 @@ function FlowTriangle(ctx) {
g.lineTo(x1, y2);
g.stroke();
}
}
};
this.open = function (lines, row) {
var end = false;
for (var i = row; i < lines.length; i++) {
......@@ -1047,7 +1047,7 @@ function FlowConPoint(ctx) {
this.ctx = ctx;
this.draw = function (g, p, node, highlight) {
}
};
this.open = function (lines, row) {
var end = false;
for (var i = row; i < lines.length; i++) {
......@@ -1107,7 +1107,7 @@ function FlowAnnot(ctx) {
if (node.annotv[this.number] == null) {
return;
}
if ((this.display_level & this.ctx.display_level) == 0) {
if ((this.display_level & this.ctx.display_level) === 0) {
return;
}
......@@ -1169,7 +1169,7 @@ function FlowAnnot(ctx) {
g.fillText(tokens[i], x, y);
y += tsize * 1.4;
}
}
};
this.open = function (lines, row) {
var end = false;
for (var i = row; i < lines.length; i++) {
......@@ -1249,8 +1249,8 @@ function FlowCon(ctx) {
var p = new FlowPoint(ctx);
p.x = 0;
p.y = 0;
if (this.temporary_ref != 0 ||
this.cc.con_type == Flow.eConType_Reference) {
if (this.temporary_ref !== 0 ||
this.cc.con_type === Flow.eConType_Reference) {
this.ref_a.draw(g, p, null, highlight);
} else {
this.line_a.draw(g, p, null, highlight);
......@@ -1258,7 +1258,7 @@ function FlowCon(ctx) {
this.arrow_a.draw(g, p, null, highlight);
}
this.redraw = false;
}
};
this.open = function (lines, row) {
var end = false;
for (var i = row; i < lines.length; i++) {
......@@ -1385,9 +1385,9 @@ function FlowCon(ctx) {
}
}
return i;
}
};
this.connect = function () {
}
};
this.scan = function () {
}
}
......@@ -1420,7 +1420,7 @@ function FlowNode(ctx) {
return;
}
if (this.nc.group != Flow.eNodeGroup_Document) {
if (this.nc.group !== Flow.eNodeGroup_Document) {
var x = this.x_left * this.ctx.zoom_factor;
var y = this.y_low * this.ctx.zoom_factor - 1;
var width = (this.x_right - this.x_left) * this.ctx.zoom_factor;
......@@ -1434,7 +1434,7 @@ function FlowNode(ctx) {
this.nc.draw(g, this.pos, this, this.highlight);
this.redraw = false;
}
};
this.open = function (lines, row) {
var end = false;
......@@ -1522,7 +1522,7 @@ function FlowNode(ctx) {
break;
}
sb.push(c);
if (k == lines[i].length - 1) {
if (k === lines[i].length - 1) {
sb.push('\n');
}
}
......@@ -1569,18 +1569,18 @@ function FlowNode(ctx) {
}
console.log("Node", this.trace_attr_type, this.n_name);
return i;
}
};
this.connect = function () {
if (this.trace_object == "" || this.trace_attribute == "") {
if (this.trace_object === "" || this.trace_attribute === "") {
return;
}
if (this.trace_attr_type == Flow.eTraceType_User) {
if (this.trace_attr_type === Flow.eTraceType_User) {
return;
}
var n = this.trace_attribute.indexOf('#');
if (n != -1) {
if (n !== -1) {
this.trace_attribute = this.trace_attribute.substring(0, n);
}
......@@ -1602,9 +1602,9 @@ function FlowNode(ctx) {
this.p = this.ctx.gdh.refObjectInfo(o, pwr_type, 1);
console.log("connecting", o, this.p);
}
};
this.scan = function () {
if (this.p == 0) {
if (this.p === 0) {
return;
}
......@@ -1612,19 +1612,15 @@ function FlowNode(ctx) {
var evaluate = true;
if (this.first_scan) {
this.first_scan = false;
} else if (v1 == this.old_value) {
} else if (v1 === this.old_value) {
return;
}
if (v1) {
this.highlight = true;
} else {
this.highlight = false;
}
this.highlight = !!v1;
this.old_value = v1;
this.redraw = true;
}
};
this.event_handler = function (x, y) {
var zx = x / this.ctx.zoom_factor + ctx.x_left;
......@@ -1643,10 +1639,10 @@ function FlowNode(ctx) {
return 1;
}
return 0;
}
};
this.set_select = function (select) {
if (select != this.select) {
if (select !== this.select) {
this.select = select;
this.redraw = true;
if (this.select) {
......@@ -1679,7 +1675,7 @@ function FlowCtx() {
this.draw = function () {
this.a.draw(this.gdraw.gctx, null, null, false);
}
};
this.open = function (lines, row) {
var end = false;
for (var i = row; i < lines.length; i++) {
......@@ -1770,27 +1766,27 @@ function FlowCtx() {
for (var i = 0; i < this.a.size(); i++) {
this.a.get(i).connect();
}
}
};
this.scan = function () {
for (var i = 0; i < this.a.size(); i++) {
this.a.get(i).scan();
}
}
};
this.event_handler = function (x, y) {
var sts = 0;
for (var i = 0; i < this.a.size(); i++) {
if (this.a.get(i) instanceof FlowNode) {
sts = this.a.get(i).event_handler(x, y);
if (sts == 1) {
if (sts === 1) {
break;
}
}
}
if (sts == 1) {
if (sts === 1) {
this.draw();
}
}
};
this.set_select = function (select) {
for (var i = 0; i < this.a.size(); i++) {
......@@ -1798,7 +1794,7 @@ function FlowCtx() {
this.a.get(i).set_select(select);
}
}
}
};
this.search_object = function (name) {
console.log("Searching for ", name);
......@@ -1807,7 +1803,7 @@ function FlowCtx() {
console.log("Found", name);
}
return node;
}
};
this.center_object = function (o) {
console.log("center_object", o.pos.x * this.zoom_factor + this.offset_x,
window.innerWidth, o.pos.x * this.zoom_factor + this.offset_x -
......@@ -1845,7 +1841,7 @@ function FlowFrame() {
req.read_cb(lines, 0);
});
req.send(null);
}
};
this.read_func = function (lines, row) {
......@@ -1906,7 +1902,7 @@ function FlowFrame() {
o.set_select(true);
}
}
}
};
this.flow_open = function () {
console.log("flow_open");
......@@ -1914,17 +1910,17 @@ function FlowFrame() {
self.ctx.connect();
self.ctx.gdh.refObjectInfoList(self.ctx.gdh.refObjectInfoListReply);
self.timer = setTimeout(self.flow_cyclic, 1000);
}
};
this.flow_scan = function () {
self.ctx.scan();
}
};
this.flow_cyclic = function () {
self.ctx.gdh.getRefObjectInfoAll(self.flow_scan);
self.ctx.draw();
self.timer = setTimeout(self.flow_cyclic, 1000);
}
};
this.flow_close = function () {
console.log("Close function", self.timer);
......@@ -1932,7 +1928,7 @@ function FlowFrame() {
for (var i in self.ctx.gdh.pending) {
delete self.ctx.gdh.pending[i];
}
}
};
this.get_filename = function () {
var query = window.location.search.substring(1);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -19,7 +19,7 @@ function JopCrypt() {
0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x20, 0x21, 0x22, 0x23, 0x24,
0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30,
0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C,
0x3D, 0x3E, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00,];
0x3D, 0x3E, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00];
this.shifts2 =
[false, false, true, true, true, true, true, true, false, true, true, true,
......@@ -36,7 +36,7 @@ function JopCrypt() {
0x20080800, 0x20080810, 0x00090800, 0x00090810, 0x20090800, 0x20090810,
0x00080020, 0x00080030, 0x20080020, 0x20080030, 0x00090020, 0x00090030,
0x20090020, 0x20090030, 0x00080820, 0x00080830, 0x20080820, 0x20080830,
0x00090820, 0x00090830, 0x20090820, 0x20090830,],
0x00090820, 0x00090830, 0x20090820, 0x20090830],
[/* for C bits (numbered as per FIPS 46) 7 8 10 11 12 13 */
0x00000000, 0x02000000, 0x00002000, 0x02002000, 0x00200000, 0x02200000,
0x00202000, 0x02202000, 0x00000004, 0x02000004, 0x00002004, 0x02002004,
......@@ -48,7 +48,7 @@ function JopCrypt() {
0x10002004, 0x12002004, 0x10200004, 0x12200004, 0x10202004, 0x12202004,
0x10000400, 0x12000400, 0x10002400, 0x12002400, 0x10200400, 0x12200400,
0x10202400, 0x12202400, 0x10000404, 0x12000404, 0x10002404, 0x12002404,
0x10200404, 0x12200404, 0x10202404, 0x12202404,],
0x10200404, 0x12200404, 0x10202404, 0x12202404],
[/* for C bits (numbered as per FIPS 46) 14 15 16 17 19 20 */
0x00000000, 0x00000001, 0x00040000, 0x00040001, 0x01000000, 0x01000001,
0x01040000, 0x01040001, 0x00000002, 0x00000003, 0x00040002, 0x00040003,
......@@ -60,7 +60,7 @@ function JopCrypt() {
0x08040002, 0x08040003, 0x09000002, 0x09000003, 0x09040002, 0x09040003,
0x08000200, 0x08000201, 0x08040200, 0x08040201, 0x09000200, 0x09000201,
0x09040200, 0x09040201, 0x08000202, 0x08000203, 0x08040202, 0x08040203,
0x09000202, 0x09000203, 0x09040202, 0x09040203,],
0x09000202, 0x09000203, 0x09040202, 0x09040203],
[/* for C bits (numbered as per FIPS 46) 21 23 24 26 27 28 */
0x00000000, 0x00100000, 0x00000100, 0x00100100, 0x00000008, 0x00100008,
0x00000108, 0x00100108, 0x00001000, 0x00101000, 0x00001100, 0x00101100,
......@@ -72,7 +72,7 @@ function JopCrypt() {
0x00021100, 0x00121100, 0x00021008, 0x00121008, 0x00021108, 0x00121108,
0x04020000, 0x04120000, 0x04020100, 0x04120100, 0x04020008, 0x04120008,
0x04020108, 0x04120108, 0x04021000, 0x04121000, 0x04021100, 0x04121100,
0x04021008, 0x04121008, 0x04021108, 0x04121108,],
0x04021008, 0x04121008, 0x04021108, 0x04121108],
[/* for D bits (numbered as per FIPS 46) 1 2 3 4 5 6 */
0x00000000, 0x10000000, 0x00010000, 0x10010000, 0x00000004, 0x10000004,
0x00010004, 0x10010004, 0x20000000, 0x30000000, 0x20010000, 0x30010000,
......@@ -84,7 +84,7 @@ function JopCrypt() {
0x20011000, 0x30011000, 0x20001004, 0x30001004, 0x20011004, 0x30011004,
0x00101000, 0x10101000, 0x00111000, 0x10111000, 0x00101004, 0x10101004,
0x00111004, 0x10111004, 0x20101000, 0x30101000, 0x20111000, 0x30111000,
0x20101004, 0x30101004, 0x20111004, 0x30111004,],
0x20101004, 0x30101004, 0x20111004, 0x30111004],
[/* for D bits (numbered as per FIPS 46) 8 9 11 12 13 14 */
0x00000000, 0x08000000, 0x00000008, 0x08000008, 0x00000400, 0x08000400,
0x00000408, 0x08000408, 0x00020000, 0x08020000, 0x00020008, 0x08020008,
......@@ -96,7 +96,7 @@ function JopCrypt() {
0x02020008, 0x0A020008, 0x02020400, 0x0A020400, 0x02020408, 0x0A020408,
0x02000001, 0x0A000001, 0x02000009, 0x0A000009, 0x02000401, 0x0A000401,
0x02000409, 0x0A000409, 0x02020001, 0x0A020001, 0x02020009, 0x0A020009,
0x02020401, 0x0A020401, 0x02020409, 0x0A020409,],
0x02020401, 0x0A020401, 0x02020409, 0x0A020409],
[/* for D bits (numbered as per FIPS 46) 16 17 18 19 20 21 */
0x00000000, 0x00000100, 0x00080000, 0x00080100, 0x01000000, 0x01000100,
0x01080000, 0x01080100, 0x00000010, 0x00000110, 0x00080010, 0x00080110,
......@@ -108,7 +108,7 @@ function JopCrypt() {
0x00080210, 0x00080310, 0x01000210, 0x01000310, 0x01080210, 0x01080310,
0x00200200, 0x00200300, 0x00280200, 0x00280300, 0x01200200, 0x01200300,
0x01280200, 0x01280300, 0x00200210, 0x00200310, 0x00280210, 0x00280310,
0x01200210, 0x01200310, 0x01280210, 0x01280310,],
0x01200210, 0x01200310, 0x01280210, 0x01280310],
[/* for D bits (numbered as per FIPS 46) 22 23 24 25 27 28 */
0x00000000, 0x04000000, 0x00040000, 0x04040000, 0x00000002, 0x04000002,
0x00040002, 0x04040002, 0x00002000, 0x04002000, 0x00042000, 0x04042000,
......@@ -120,7 +120,7 @@ function JopCrypt() {
0x00042800, 0x04042800, 0x00002802, 0x04002802, 0x00042802, 0x04042802,
0x00000820, 0x04000820, 0x00040820, 0x04040820, 0x00000822, 0x04000822,
0x00040822, 0x04040822, 0x00002820, 0x04002820, 0x00042820, 0x04042820,
0x00002822, 0x04002822, 0x00042822, 0x04042822,],];
0x00002822, 0x04002822, 0x00042822, 0x04042822]];
this.SPtrans = [[/* nibble 0 */
0x00820200, 0x00020000, 0x80800000, 0x80820200, 0x00800000, 0x80020200,
......@@ -133,7 +133,7 @@ function JopCrypt() {
0x00020200, 0x80800000, 0x80020200, 0x80000000, 0x80800000, 0x00820000,
0x80820200, 0x00020200, 0x00820000, 0x80800200, 0x00800000, 0x80000200,
0x80020000, 0x00000000, 0x00020000, 0x00800000, 0x80800200, 0x00820200,
0x80000000, 0x80820000, 0x00000200, 0x80020200,], [/* nibble 1 */
0x80000000, 0x80820000, 0x00000200, 0x80020200], [/* nibble 1 */
0x10042004, 0x00000000, 0x00042000, 0x10040000, 0x10000004, 0x00002004,
0x10002000, 0x00042000, 0x00002000, 0x10040004, 0x00000004, 0x10002000,
0x00040004, 0x10042000, 0x10040000, 0x00000004, 0x00040000, 0x10002004,
......@@ -144,7 +144,7 @@ function JopCrypt() {
0x00040000, 0x10040004, 0x00002000, 0x10000000, 0x00042004, 0x10002004,
0x10042000, 0x00002000, 0x00000000, 0x10000004, 0x00000004, 0x10042004,
0x00042000, 0x10040000, 0x10040004, 0x00040000, 0x00002004, 0x10002000,
0x10002004, 0x00000004, 0x10040000, 0x00042000,], [/* nibble 2 */
0x10002004, 0x00000004, 0x10040000, 0x00042000], [/* nibble 2 */
0x41000000, 0x01010040, 0x00000040, 0x41000040, 0x40010000, 0x01000000,
0x41000040, 0x00010040, 0x01000040, 0x00010000, 0x01010000, 0x40000000,
0x41010040, 0x40000040, 0x40000000, 0x41010000, 0x00000000, 0x40010000,
......@@ -155,7 +155,7 @@ function JopCrypt() {
0x00010040, 0x41010000, 0x40010000, 0x01000000, 0x41010040, 0x40000000,
0x40010040, 0x41000000, 0x01000000, 0x41010040, 0x00010000, 0x01000040,
0x41000040, 0x00010040, 0x01000040, 0x00000000, 0x41010000, 0x40000040,
0x41000000, 0x40010040, 0x00000040, 0x01010000,], [/* nibble 3 */
0x41000000, 0x40010040, 0x00000040, 0x01010000], [/* nibble 3 */
0x00100402, 0x04000400, 0x00000002, 0x04100402, 0x00000000, 0x04100000,
0x04000402, 0x00100002, 0x04100400, 0x04000002, 0x04000000, 0x00000402,
0x04000002, 0x00100402, 0x00100000, 0x04000000, 0x04100002, 0x00100400,
......@@ -166,7 +166,7 @@ function JopCrypt() {
0x00000400, 0x00100002, 0x00000000, 0x04100002, 0x04100400, 0x00000400,
0x04000000, 0x04100402, 0x00100402, 0x00100000, 0x04100402, 0x00000002,
0x04000400, 0x00100402, 0x00100002, 0x00100400, 0x04100000, 0x04000402,
0x00000402, 0x04000000, 0x04000002, 0x04100400,], [/* nibble 4 */
0x00000402, 0x04000000, 0x04000002, 0x04100400], [/* nibble 4 */
0x02000000, 0x00004000, 0x00000100, 0x02004108, 0x02004008, 0x02000100,
0x00004108, 0x02004000, 0x00004000, 0x00000008, 0x02000008, 0x00004100,
0x02000108, 0x02004008, 0x02004100, 0x00000000, 0x00004100, 0x02000000,
......@@ -177,7 +177,7 @@ function JopCrypt() {
0x02004108, 0x00000000, 0x00004108, 0x02000000, 0x00000100, 0x00004008,
0x02000108, 0x00000100, 0x00000000, 0x02004108, 0x02004008, 0x02004100,
0x00000108, 0x00004000, 0x00004100, 0x02004008, 0x02000100, 0x00000108,
0x00000008, 0x00004108, 0x02004000, 0x02000008,], [/* nibble 5 */
0x00000008, 0x00004108, 0x02004000, 0x02000008], [/* nibble 5 */
0x20000010, 0x00080010, 0x00000000, 0x20080800, 0x00080010, 0x00000800,
0x20000810, 0x00080000, 0x00000810, 0x20080810, 0x00080800, 0x20000000,
0x20000800, 0x20000010, 0x20080000, 0x00080810, 0x00080000, 0x20000810,
......@@ -188,7 +188,7 @@ function JopCrypt() {
0x20080010, 0x00080000, 0x00080010, 0x20080810, 0x00080800, 0x00000010,
0x20080810, 0x00080800, 0x00080000, 0x20000810, 0x20000010, 0x20080000,
0x00080810, 0x00000000, 0x00000800, 0x20000010, 0x20000810, 0x20080800,
0x20080000, 0x00000810, 0x00000010, 0x20080010,], [/* nibble 6 */
0x20080000, 0x00000810, 0x00000010, 0x20080010], [/* nibble 6 */
0x00001000, 0x00000080, 0x00400080, 0x00400001, 0x00401081, 0x00001001,
0x00001080, 0x00000000, 0x00400000, 0x00400081, 0x00000081, 0x00401000,
0x00000001, 0x00401080, 0x00401000, 0x00000081, 0x00400081, 0x00001000,
......@@ -199,7 +199,7 @@ function JopCrypt() {
0x00001080, 0x00000000, 0x00000080, 0x00400001, 0x00000001, 0x00400080,
0x00000000, 0x00400081, 0x00400080, 0x00001080, 0x00000081, 0x00001000,
0x00401081, 0x00400000, 0x00401080, 0x00000001, 0x00001001, 0x00401081,
0x00400001, 0x00401080, 0x00401000, 0x00001001,], [/* nibble 7 */
0x00400001, 0x00401080, 0x00401000, 0x00001001], [/* nibble 7 */
0x08200020, 0x08208000, 0x00008020, 0x00000000, 0x08008000, 0x00200020,
0x08200000, 0x08208020, 0x00000020, 0x08000000, 0x00208000, 0x00008020,
0x00208020, 0x08008020, 0x08000020, 0x08200000, 0x00008000, 0x00208020,
......@@ -224,7 +224,7 @@ function JopCrypt() {
var value = Math.floor(b);
return (value >= 0 ? value : value + 256);
}
};
this.fourBytesToInt = function (b, offset) {
var value;
......@@ -235,14 +235,14 @@ function JopCrypt() {
value |= (this.byteToUnsigned(b[offset++]) << 24);
return value;
}
};
this.intToFourBytes = function (iValue, b, offset) {
b[offset++] = ((iValue) & 0xff);
b[offset++] = ((iValue >>> 8) & 0xff);
b[offset++] = ((iValue >>> 16) & 0xff);
b[offset++] = ((iValue >>> 24) & 0xff);
}
};
this.PERM_OP = function (a, b, n, m, results) {
var t;
......@@ -253,7 +253,7 @@ function JopCrypt() {
results[0] = a;
results[1] = b;
}
};
this.HPERM_OP = function (a, n, m) {
var t;
......@@ -262,7 +262,7 @@ function JopCrypt() {
a = a ^ t ^ (t >>> (16 - n));
return (a);
}
};
this.des_set_key = function (key) {
var schedule = new Array(this.ITERATIONS * 2);
......@@ -329,7 +329,7 @@ function JopCrypt() {
schedule[j++] = s & 0xffffffff;
}
return schedule;
}
};
this.D_ENCRYPT = function (L, R, S, E0, E1, s) {
var t, u, v;
......@@ -347,7 +347,7 @@ function JopCrypt() {
this.SPtrans[4][(u >>> 16) & 0x3f] | this.SPtrans[6][(u >>> 24) & 0x3f];
return L;
}
};
this.body = function (schedule, Eswap0, Eswap1) {
var left = 0;
......@@ -400,7 +400,7 @@ function JopCrypt() {
out[1] = right;
return (out);
}
};
this.crypt = function (salt, original) {
while (salt.length < 2) {
......@@ -441,13 +441,13 @@ function JopCrypt() {
for (var j = 0, c = 0; j < 6; j++) {
c <<= 1;
if ((b[y] & u) != 0) {
if ((b[y] & u) !== 0) {
c |= 1;
}
u >>>= 1;
if (u == 0) {
if (u === 0) {
y++;
u = 0x80;
}
......
......@@ -12,7 +12,7 @@ function OpWindMenu() {
this.init = function () {
this.host = window.location.hostname;
if (this.host == "") {
if (this.host === "") {
this.host = "localhost";
}
......@@ -22,8 +22,8 @@ function OpWindMenu() {
};
this.is_authorized = function (access) {
return (this.priv & access) ? true : false;
}
return !!(this.priv & access);
};
this.get_opplace = function () {
var query = window.location.search.substring(1);
......@@ -69,7 +69,7 @@ function OpWindMenu() {
document.getElementById("login_button")
.addEventListener("click", function (event) {
if (document.getElementById("login_frame").style.visibility ==
if (document.getElementById("login_frame").style.visibility ===
'hidden') {
document.getElementById("login_user").value = "";
document.getElementById("login_passw").value = "";
......@@ -85,7 +85,7 @@ function OpWindMenu() {
.addEventListener("click", function (event) {
var user = document.getElementById("login_user").value;
var passwd = document.getElementById("login_passw").value;
if (user.trim() == "") {
if (user.trim() === "") {
return;
}
document.getElementById("login_frame").style.visibility = 'hidden';
......@@ -150,66 +150,64 @@ function OpWindMenu() {
this.button_cb = function (text) {
if (self.info.enable_language && text == "Language") {
if (self.info.enable_language && text === "Language") {
console.log("Language activated");
} else if (self.info.enable_alarmlist && text == "AlarmList") {
} else if (self.info.enable_alarmlist && text === "AlarmList") {
console.log("AlarmList activated");
if (!(self.is_authorized(Pwr.mAccess_RtRead | Pwr.mAccess_RtWrite |
if (self.is_authorized(Pwr.mAccess_RtRead | Pwr.mAccess_RtWrite |
Pwr.mAccess_AllOperators | Pwr.mAccess_System |
Pwr.mAccess_Maintenance | Pwr.mAccess_Process |
Pwr.mAccess_Instrument))) {
window.alert("Not authorized for this operation");
} else {
Pwr.mAccess_Instrument)) {
window.open("ev.html?list=alarm", "_blank");
} else {
window.alert("Not authorized for this operation");
}
} else if (self.info.enable_alarmlist && text == "EventList") {
} else if (self.info.enable_alarmlist && text === "EventList") {
console.log("EventList activated");
if (!(self.is_authorized(Pwr.mAccess_RtRead | Pwr.mAccess_RtWrite |
if (self.is_authorized(Pwr.mAccess_RtRead | Pwr.mAccess_RtWrite |
Pwr.mAccess_AllOperators | Pwr.mAccess_System |
Pwr.mAccess_Maintenance | Pwr.mAccess_Process |
Pwr.mAccess_Instrument))) {
window.alert("Not authorized for this operation");
} else {
Pwr.mAccess_Instrument)) {
window.open("ev.html?list=event", "_blank");
} else {
window.alert("Not authorized for this operation");
}
} else if (self.info.enable_eventlog && text == "EventLog") {
} else if (self.info.enable_eventlog && text === "EventLog") {
console.log("EventLog activated");
if (!(self.is_authorized(Pwr.mAccess_RtRead | Pwr.mAccess_RtWrite |
if (self.is_authorized(Pwr.mAccess_RtRead | Pwr.mAccess_RtWrite |
Pwr.mAccess_AllOperators | Pwr.mAccess_System |
Pwr.mAccess_Maintenance | Pwr.mAccess_Process |
Pwr.mAccess_Instrument))) {
window.alert("Not authorized for this operation");
} else {
Pwr.mAccess_Instrument)) {
window.alert("Not yet implemented");
} else {
window.alert("Not authorized for this operation");
}
} else if (self.info.enable_navigator && text == "Navigator") {
} else if (self.info.enable_navigator && text === "Navigator") {
console.log("Navigator activated");
if (!(self.is_authorized(Pwr.mAccess_RtNavigator | Pwr.mAccess_System |
if (self.is_authorized(Pwr.mAccess_RtNavigator | Pwr.mAccess_System |
Pwr.mAccess_Maintenance | Pwr.mAccess_Process |
Pwr.mAccess_Instrument))) {
window.alert("Not authorized for this operation");
} else {
Pwr.mAccess_Instrument)) {
window.open("xtt.html", "_blank");
} else {
window.alert("Not authorized for this operation");
}
} else if (!self.info.disable_help && text == "Help") {
} else if (!self.info.disable_help && text === "Help") {
console.log("Help activated");
window.open("xtt_help_index.html", "_blank");
} else if (!self.info.disable_proview && text == "ProviewR") {
} else if (!self.info.disable_proview && text === "ProviewR") {
console.log("ProviewR activated");
window.open("http://www.proview.se", "_blank");
} else {
if (!(self.is_authorized(Pwr.mAccess_RtRead | Pwr.mAccess_RtWrite |
if (self.is_authorized(Pwr.mAccess_RtRead | Pwr.mAccess_RtWrite |
Pwr.mAccess_AllOperators | Pwr.mAccess_System |
Pwr.mAccess_Maintenance | Pwr.mAccess_Process |
Pwr.mAccess_Instrument))) {
window.alert("Not authorized for this operation");
} else {
Pwr.mAccess_Instrument)) {
for (var i = 0; i < self.info.buttons.length; i++) {
if (self.info.buttons[i].text == text) {
if (self.info.buttons[i].text === text) {
console.log("Found", self.info.buttons[i].text);
var name = self.info.buttons[i].name;
var n = name.indexOf(".pwg");
if (n != -1) {
if (n !== -1) {
name = name.substring(0, n);
}
var url = "ge.html?graph=" + name;
......@@ -218,6 +216,8 @@ function OpWindMenu() {
break;
}
}
} else {
window.alert("Not authorized for this operation");
}
}
};
......
......@@ -28,7 +28,7 @@ function Xtt() {
this.ctx.gdh = new Gdh();
this.ctx.gdh.open_cb = this.gdh_init_cb;
this.ctx.gdh.init()
this.ctx.gdh.init();
this.ctx.gdraw.canvas.addEventListener("click", function (event) {
var y = event.pageY - self.ctx.gdraw.offset_top;
......@@ -40,33 +40,33 @@ function Xtt() {
}
});
document.addEventListener("keydown", function (event) {
if (event.keyCode == 40) {
if (event.keyCode === 40) {
self.ctx.event_handler(Plow.eEvent_Key_Down);
event.preventDefault();
} else if (event.keyCode == 39) {
} else if (event.keyCode === 39) {
if (event.shiftKey) {
self.ctx.event_handler(Plow.eEvent_Key_ShiftRight);
} else {
self.ctx.event_handler(Plow.eEvent_Key_Right);
}
event.preventDefault();
} else if (event.keyCode == 37) {
} else if (event.keyCode === 37) {
self.ctx.event_handler(Plow.eEvent_Key_Left);
event.preventDefault();
} else if (event.keyCode == 38) {
} else if (event.keyCode === 38) {
self.ctx.event_handler(Plow.eEvent_Key_Up);
event.preventDefault();
} else if (event.keyCode == 82) {
} else if (event.keyCode === 82) {
if (event.ctrlKey) {
self.ctx.event_handler(Plow.eEvent_Key_CtrlR);
}
event.preventDefault();
} else if (event.keyCode == 76) {
} else if (event.keyCode === 76) {
if (event.ctrlKey) {
self.ctx.event_handler(Plow.eEvent_Key_CtrlL);
}
event.preventDefault();
} else if (event.keyCode == 71) {
} else if (event.keyCode === 71) {
if (event.ctrlKey) {
self.ctx.event_handler(Plow.eEvent_Key_CtrlG);
}
......@@ -105,7 +105,7 @@ function Xtt() {
} else if (o.userdata instanceof XttItemCrr) {
var idx = o.userdata.name.lastIndexOf('-');
var ostring = "";
if (idx != -1) {
if (idx !== -1) {
ostring = "&obj=" + o.userdata.name.substring(idx + 1);
}
console.log("flow.html?vid=" + o.userdata.objid.vid + "&oix=" +
......@@ -154,18 +154,18 @@ function Xtt() {
});
window.addEventListener("storage", function (event) {
if (event.newValue == "") {
if (event.newValue === "") {
return;
}
localStorage.setItem("XttMethodNavigator", "");
self.display_object(event.newValue);
});
}
};
this.is_authorized = function (access) {
return (this.priv & access) ? true : false;
}
return !!(this.priv & access);
};
this.gdh_init_cb = function () {
if (self.priv == null) {
......@@ -178,7 +178,7 @@ function Xtt() {
self.ctx.gdh.listSent = true;
self.trace_cyclic();
}
};
this.login_cb = function (id, data, sts, result) {
console.log("Login:", sts, result);
......@@ -204,14 +204,14 @@ function Xtt() {
self.ctx.configure();
if (data.open_next != null) {
if (data.open_next.length == 0) {
if (data.open_next.length === 0) {
self.ctx.reset_nodraw();
return;
}
var child = self.ctx.a.get_first_child(data.node);
while (child != null) {
if (child.userdata.name == data.open_next[0]) {
if (data.open_next.length == 1) {
if (child.userdata.name === data.open_next[0]) {
if (data.open_next.length === 1) {
child.set_select(true);
child.set_invert(true);
if (!self.ctx.is_visible(child)) {
......@@ -220,7 +220,7 @@ function Xtt() {
window.focus(); // Doesn't work
} else {
data.open_next.splice(0, 1);
if (data.open_next[0] == '.') {
if (data.open_next[0] === '.') {
data.open_next.splice(0, 1);
child.userdata.open_attributes(self, data.open_next);
} else {
......@@ -235,16 +235,16 @@ function Xtt() {
self.ctx.reset_nodraw();
self.ctx.draw();
}
};
this.open_attributes_cb = function (id, data, sts, result) {
self.ctx.set_nodraw();
for (var i = 0; i < result.length; i++) {
result[i].objid = data.node.userdata.objid;
result[i].full_name = data.node.userdata.full_name + "." + result[i].name;
if ((result[i].flags & Pwr.mAdef_array) != 0) {
if ((result[i].flags & Pwr.mAdef_array) !== 0) {
new XttItemAttrArray(self, result[i], data.node, Plow.DEST_INTOLAST);
} else if ((result[i].flags & Pwr.mAdef_class) != 0) {
} else if ((result[i].flags & Pwr.mAdef_class) !== 0) {
new XttItemAttrObject(self, result[i], data.node, Plow.DEST_INTOLAST);
} else {
new XttItemAttr(self, result[i], data.node, Plow.DEST_INTOLAST);
......@@ -254,14 +254,14 @@ function Xtt() {
self.ctx.configure();
if (data.open_next != null) {
if (data.open_next.length == 0) {
if (data.open_next.length === 0) {
self.ctx.reset_nodraw();
return;
}
var child = self.ctx.a.get_first_child(data.node);
while (child != null) {
if (child.userdata.name == data.open_next[0]) {
if (data.open_next.length == 1) {
if (child.userdata.name === data.open_next[0]) {
if (data.open_next.length === 1) {
child.set_select(true);
child.set_invert(true);
if (!self.ctx.is_visible(child)) {
......@@ -280,15 +280,17 @@ function Xtt() {
self.ctx.reset_nodraw();
self.ctx.draw();
}
};
this.open_plc_cb = function (id, data, sts, result) {
if ((sts & 1) != 0) {
if ((sts & 1) === 0) {
data.document.write("Error status " + sts);
} else {
var param1;
if (result.param1 !== "") {
param1 = "&obj=" + result.param1;
} else {
if (result.param1 === "") {
param1 = "";
} else {
param1 = "&obj=" + result.param1;
}
console.log("flow.html?vid=" + result.objid.vid + "&oix=" +
result.objid.oix + param1);
......@@ -296,25 +298,25 @@ function Xtt() {
"flow.html?vid=" + result.objid.vid + "&oix=" + result.objid.oix +
param1;
data.document.title = "Trace " + result.fullname;
} else {
data.document.write("Error status " + sts);
}
}
};
this.open_objectgraph_cb = function (id, data, sts, result) {
if ((sts & 1) != 0) {
if ((sts & 1) === 0) {
data.document.write("Error status " + sts);
} else {
data.location.href =
"ge.html?graph=" + result.param1 + "&instance=" + result.fullname;
data.document.title = result.fullname;
} else {
data.document.write("Error status " + sts);
}
}
};
this.open_graph_cb = function (id, data, sts, result) {
if ((sts & 1) != 0) {
if ((sts & 1) === 0) {
data.document.write("Error status " + sts);
} else {
var idx = result.param1.indexOf('.');
if (idx != -1) {
if (idx !== -1) {
result.param1 = result.param1.substring(0, idx);
}
......@@ -325,27 +327,25 @@ function Xtt() {
data.location.href = "ge.html?graph=" + result.param1 + instancestr;
data.document.title = result.param1;
} else {
data.document.write("Error status " + sts);
}
}
};
this.open_crr_cb = function (id, node, sts, crrdata) {
if ((sts & 1) == 0) {
if ((sts & 1) === 0) {
return;
}
node.userdata.open_crossreferences(self, crrdata);
}
};
this.open_helpclass_cb = function (id, data, sts, result) {
if ((sts & 1) != 0) {
console.log("open_helpclass", result.param1);
var url = location.protocol + "//" + location.host + result.param1;
data.location.href = url;
} else {
if ((sts & 1) === 0) {
data.document.write("Error status " + sts);
} else {
console.log("open_helpclass", result.param1);
data.location.href =
location.protocol + "//" + location.host + result.param1;
}
}
};
this.plow_event = function (event, object, x, y) {
......@@ -383,7 +383,11 @@ function Xtt() {
break;
case Plow.eEvent_Key_Down: {
var o = self.ctx.get_select();
if (o != null) {
if (o == null) {
o = self.ctx.a.a[0];
o.set_select(true);
o.set_invert(true);
} else {
var next = self.ctx.get_next_object(o);
if (next != null) {
o.set_select(false);
......@@ -394,10 +398,6 @@ function Xtt() {
self.ctx.scroll(next.y_low, 0.10);
}
}
} else {
o = self.ctx.a.a[0];
o.set_select(true);
o.set_invert(true);
}
break;
......@@ -461,7 +461,7 @@ function Xtt() {
} else if (o.userdata instanceof XttItemCrr) {
var idx = o.userdata.name.lastIndexOf('-');
var ostring = "";
if (idx != -1) {
if (idx !== -1) {
ostring = "&obj=" + o.userdata.name.substring(idx + 1);
}
window.open("flow.html?vid=" + o.userdata.objid.vid + "&oix=" +
......@@ -481,7 +481,7 @@ function Xtt() {
break;
}
}
}
};
this.createNodeClasses = function () {
var r1 = new PlowRect(this.ctx, 0, 0, 50, 1.0, Plow.COLOR_WHITE,
......@@ -501,29 +501,31 @@ function Xtt() {
this.ncObject.insert(a12);
this.ncObject.insert(p1);
this.ctx.insert_nc(this.ncObject);
}
};
this.methods_init = function () {
localStorage.setItem("XttMethodNavigator", "");
}
};
this.collapse = function () {
this.ctx.set_nodraw();
for (var i = 0; i < this.ctx.a.size(); i++) {
var node = this.ctx.a.get(i);
if (node.level == 0) {
if (node.level === 0) {
node.userdata.close(this);
}
}
this.ctx.reset_nodraw();
this.ctx.draw();
}
};
this.display_object = function (name) {
var i = name.indexOf('.');
var attr = null;
var path;
if (i != -1) {
if (i === -1) {
path = name.split('-');
} else {
attr = name.substring(i + 1);
name = name.substring(0, i);
var p1 = name.split('-');
......@@ -537,16 +539,14 @@ function Xtt() {
for (j = 0; j < p2.length; j++) {
path[j + p1.length + 1] = p2[j];
}
} else {
path = name.split('-');
}
var idx = 0;
this.collapse();
for (var j = idx; j < this.ctx.a.size(); j++) {
if (this.ctx.a.get(j).userdata.name == path[0]) {
if (j == this.ctx.a.size() - 1) {
if (this.ctx.a.get(j).userdata.name === path[0]) {
if (j === this.ctx.a.size() - 1) {
var node = this.ctx.a.get(j);
node.set_select(true);
node.set_invert(true);
......@@ -561,7 +561,7 @@ function Xtt() {
break;
}
}
}
};
this.trace_cyclic = function () {
self.ctx.gdh.getRefObjectInfoAll(self.trace_scan);
......@@ -615,7 +615,7 @@ function XttItemObject(xtt, object_info, destination, destCode) {
}
this.open_children = function (xtt, open_next) {
if (this.node.node_open != 0) {
if (this.node.node_open !== 0) {
this.close(xtt);
} else if (!this.has_children) {
this.open_attributes(xtt, null);
......@@ -625,25 +625,23 @@ function XttItemObject(xtt, object_info, destination, destCode) {
this.node.node_open |= Plow.OPEN_CHILDREN;
this.node.set_annotation_pixmap(0, Bitmaps.openmap);
}
}
};
this.open_attributes = function (xtt, open_next) {
if (this.node.node_open != 0) {
this.close(xtt);
} else {
if (this.node.node_open === 0) {
xtt.ctx.gdh.getAllClassAttributes(this.cid, this.objid,
xtt.open_attributes_cb, new XttOpenChildrenData(this.node, open_next));
this.node.node_open |= Plow.OPEN_ATTRIBUTES;
xtt.ctx.configure();
xtt.ctx.draw();
} else {
this.close(xtt);
}
}
};
this.open_crossreferences = function (xtt, crrdata) {
if (this.node.node_open != 0) {
this.close(xtt);
} else {
if (this.node.node_open === 0) {
for (var i = 0; i < crrdata.length; i++) {
new XttItemCrr(xtt, crrdata[i], this.node, Plow.DEST_INTOLAST);
}
......@@ -651,8 +649,10 @@ function XttItemObject(xtt, object_info, destination, destCode) {
this.node.node_open |= Plow.OPEN_CROSSREFERENCES;
xtt.ctx.configure();
xtt.ctx.draw();
} else {
this.close(xtt);
}
}
};
this.close = function (xtt) {
if (this.node.node_open & Plow.OPEN_CHILDREN) {
......@@ -739,7 +739,7 @@ function XttItemAttr(xtt, info, destination, destCode) {
};
this.open_attributes = function (xtt, open_next) {
}
};
this.close = function (xtt) {
var parent = xtt.ctx.get_parent_object(this.node);
......@@ -748,14 +748,14 @@ function XttItemAttr(xtt, info, destination, destCode) {
parent.set_select(true);
parent.set_invert(true);
}
}
};
this.scan = function (xtt) {
if (!this.refid) {
return;
}
var value = xtt.ctx.gdh.getObjectRefInfo(this.refid);
if (this.firstScan || value != this.old_value) {
if (this.firstScan || value !== this.old_value) {
var value_str;
switch (this.type) {
......@@ -787,7 +787,7 @@ function XttItemAttr(xtt, info, destination, destCode) {
xtt.scan_update = true;
}
this.firstScan = false;
}
};
this.scan_close = function (xtt) {
xtt.ctx.gdh.unrefObjectInfo(this.refid);
};
......@@ -809,7 +809,7 @@ function XttItemAttrArray(xtt, info, destination, destCode) {
this.open_children = function (xtt, open_next) {
this.open_attributes(xtt, open_next);
}
};
this.open_attributes = function (xtt, open_next) {
var info = new AttributeInfo();
......@@ -819,17 +819,17 @@ function XttItemAttrArray(xtt, info, destination, destCode) {
info.flags = this.flags & ~Pwr.mAdef_array;
info.size = this.size / this.elements;
info.elements = 1;
info.name = ""
info.full_name = ""
info.classname = ""
info.name = "";
info.full_name = "";
info.classname = "";
xtt.ctx.set_nodraw();
for (var i = 0; i < this.elements; i++) {
info.name = this.name + "[" + i + "]";
info.full_name = this.full_name + "[" + i + "]";
if ((info.flags & Pwr.mAdef_array) != 0) {
if ((info.flags & Pwr.mAdef_array) !== 0) {
new XttItemAttrArray(xtt, info, this.node, Plow.DEST_INTOLAST);
} else if ((info.flags & Pwr.mAdef_class) != 0) {
} else if ((info.flags & Pwr.mAdef_class) !== 0) {
new XttItemAttrObject(xtt, info, this.node, Plow.DEST_INTOLAST);
} else {
new XttItemAttr(xtt, info, this.node, Plow.DEST_INTOLAST);
......@@ -876,18 +876,18 @@ function XttItemAttrObject(xtt, info, destination, destCode) {
this.open_children = function (xtt, open_next) {
this.open_attributes(xtt, null);
}
};
this.open_attributes = function (xtt, open_next) {
if (this.node.node_open != 0) {
this.close(xtt);
} else {
if (this.node.node_open === 0) {
xtt.ctx.gdh.getAllClassAttributes(this.cid, this.objid,
xtt.open_attributes_cb, new XttOpenChildrenData(this.node, open_next))
xtt.open_attributes_cb, new XttOpenChildrenData(this.node, open_next));
this.node.node_open |= Plow.OPEN_ATTRIBUTES;
} else {
this.close(xtt);
}
}
};
this.close = function (xtt) {
if (this.node.node_open & Plow.OPEN_ATTRIBUTES) {
......
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