From 45249b735d1893e3c4b28ee685a7c4c59a340a7d Mon Sep 17 00:00:00 2001 From: Falkvinge Date: Thu, 16 Mar 2017 22:53:50 +0100 Subject: [PATCH] Testing maybe final logic of this --- FrontSocket/FrontendLoop.cs | 2 +- Site/Scripts/Swarmops-v5.js | 28 +++++++++++++++------------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/FrontSocket/FrontendLoop.cs b/FrontSocket/FrontendLoop.cs index fa829059..e29604ed 100644 --- a/FrontSocket/FrontendLoop.cs +++ b/FrontSocket/FrontendLoop.cs @@ -227,7 +227,7 @@ namespace Swarmops.Frontend.Socket { JObject malfunctionObject = new JObject(); malfunctionObject["Id"] = "Mal" + loop.ToString(); - malfunctionObject["Text"] = malfunctionStrings[loop]; + malfunctionObject["Text"] = malfunctionStrings[loop] + " (Test code, ignore)"; malfunctionsArray.Add(malfunctionObject); } diff --git a/Site/Scripts/Swarmops-v5.js b/Site/Scripts/Swarmops-v5.js index 27d67926..0d2da264 100644 --- a/Site/Scripts/Swarmops-v5.js +++ b/Site/Scripts/Swarmops-v5.js @@ -99,21 +99,23 @@ function updateListBox(box, listData) { var listContainer = $(box).parent().parent(); var listElements = $(box).children(); - listElements.each(function(index) { - console.log($(this)); - var elementId = $(this).attr("rel"); - console.log(elementId); + if (listElements.length > 0) { + listElements.children().each(function(index) { + console.log($(this)); + var elementId = $(this).attr("rel"); + console.log(elementId); - if (typeof idListLookup[elementId] != 'undefined') { - // displayed item is present in supplied list - // TODO: update text - } else { - // displayed item is NOT present in supplied list, and should be removed - $(this).slideUp(400, function() { $(this).remove(); }); - } - }); + if (typeof idListLookup[elementId] != 'undefined') { + // displayed item is present in supplied list + // TODO: update text + } else { + // displayed item is NOT present in supplied list, and should be removed + $(this).slideUp(400, function() { $(this).remove(); }); + } + }); + } - // Step 3: Iterate through list, add missing items +// Step 3: Iterate through list, add missing items if (listElements.length == 0) {