Compare commits

..

No commits in common. "5ce6dc6d3e5adf46765f239f319b4224a7ef9693" and "98733d1ad524038c4a0e6a6dfd48946acb176d64" have entirely different histories.

View File

@ -17,7 +17,7 @@ var ui_HadHighlight = false;
var ui_status_height = 25; var ui_status_height = 25;
var ui_StatusText = ""; var ui_StatusText = "";
var ui_HighlightArray = []; var ui_HighlightArray = [];
var translator = new Language("en"); var translator = new Language('en');
//The user interface mode. 0=network, 1=network information, 2=puzzle-selection menu //The user interface mode. 0=network, 1=network information, 2=puzzle-selection menu
var uiMode=1; var uiMode=1;
@ -182,7 +182,7 @@ function PrintScreen(WhatPassedIn=-1)
//console.log("We have something selected."); //console.log("We have something selected.");
var tmp_select = returnHighlightShape("selectbox", ui_selectRect, "green", "none", 0.8); var tmp_select = returnHighlightShape("selectbox", ui_selectRect, "green", "none", 0.8);
drawshape(tmp_select); drawshape(tmp_select);
} }
drawSelectMenu(); drawSelectMenu();
PrintAllNetworkLinks(); PrintAllNetworkLinks();
@ -191,8 +191,7 @@ function PrintScreen(WhatPassedIn=-1)
else if(what == 1) //PuzzleDescription/Info else if(what == 1) //PuzzleDescription/Info
{ {
//Display the text about the puzzle //Display the text about the puzzle
console.log("Using language: " + ui_language); textMenuPrint(puzzle.en_message);
textMenuPrint(eval('puzzle.' + ui_language + '_message'));
} }
else if(what == 2) //PuzzleSelect else if(what == 2) //PuzzleSelect
{ {
@ -688,22 +687,23 @@ function makeLine(x1, y1, x2, y2, offsetx = 0, offsety = 0) {
} }
//Make a structure to hold all our data //Make a structure to hold all our data
class actionStruct { function actionStruct(shapeText, shapePoints, theObject=null, funcLeftClick=null, funcRightClick=null, funcMouseover=null) {
constructor(shapeText, shapePoints, theObject=null, funcLeftClick=null, funcRightClick=null, funcMouseover=null) { var struct = {
shapeText: shapeText,
this.shapeText= shapeText shapePoints: structuredClone(shapePoints),
this.shapePoints= structuredClone(shapePoints) theObject: theObject,
this.shapePoints.shapeText = shapeText; funcLeftClick: funcLeftClick,
this.theObject= theObject funcRightClick: funcRightClick,
this.funcLeftClick= funcLeftClick funcMouseover: funcMouseover,
this.funcRightClick= funcRightClick
this.funcMouseover= funcMouseover
} }
//if (shapeText == "line") console.log("Creating a line: " + JSON.stringify(struct));
shapePoints.shapeText = shapeText;
return struct;
} }
function registerActionStruct(shapeText, shapePoints, theObject=null, funcLeftClick=null, funcRightClick=null, funcMouseover=null) { function registerActionStruct(shapeText, shapePoints, theObject=null, funcLeftClick=null, funcRightClick=null, funcMouseover=null) {
//Make an object with all the data //Make an object with all the data
var what = new actionStruct(shapeText, shapePoints, theObject, funcLeftClick, funcRightClick, funcMouseover); var what = actionStruct(shapeText, shapePoints, theObject, funcLeftClick, funcRightClick, funcMouseover);
//console.log("Pushing an action: " + shapeText); //console.log("Pushing an action: " + shapeText);
//Push it onto the uiActions list //Push it onto the uiActions list
uiActions.unshift(what); //Put it at the beginning of the list uiActions.unshift(what); //Put it at the beginning of the list
@ -880,9 +880,9 @@ function device_clickOn(point, actionrec) {
//here we get all the problem statements and combine them //here we get all the problem statements and combine them
errors = returnProblemStrings(actionrec.theObject); errors = returnProblemStrings(actionrec.theObject);
additional = " " + errors.join(' - '); additional = " " + errors.join(' - ');
} }
} }
} }
setStatus(actionrec.theObject.hostname + additional); setStatus(actionrec.theObject.hostname + additional);
//We probably do not want to do printecreen here, but we are doing it here now... //We probably do not want to do printecreen here, but we are doing it here now...
@ -890,18 +890,17 @@ function device_clickOn(point, actionrec) {
} }
} }
function Language(lang = null) { function Language(lang) {
var __construct = function () { var __construct = function () {
if (lang == null) { if (eval('typeof ' + lang) == 'undefined') {
lang = "en"; lang = "en";
} }
//console.log("Defining language:" + lang); ui_language = 'language.' + lang;
ui_language = lang;
return; return;
}() }()
this.getStr = function (str, defaultStr) { this.getStr = function (str, defaultStr) {
var toget = 'language.' + ui_language + "." + str + ".value"; var toget = ui_language + "." + str + ".value";
//console.log("Translating: " + toget); //console.log("Translating: " + toget);
var retStr = eval(toget); var retStr = eval(toget);
if (typeof retStr != 'undefined') { if (typeof retStr != 'undefined') {