From c159da144c670ca75533647dd84fb529bf777790 Mon Sep 17 00:00:00 2001 From: Falkvinge Date: Sat, 25 Feb 2017 04:48:10 +0100 Subject: [PATCH 01/40] Style fix for cleaning login --- Site/Security/Login.aspx | 2 +- Site/Style/style-v5.css | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Site/Security/Login.aspx b/Site/Security/Login.aspx index 2af97370..119ac2b9 100644 --- a/Site/Security/Login.aspx +++ b/Site/Security/Login.aspx @@ -48,7 +48,7 @@ - Swarmops Beta- Login + Swarmops Beta - Login diff --git a/Site/Style/style-v5.css b/Site/Style/style-v5.css index f3b58a1e..d912747c 100644 --- a/Site/Style/style-v5.css +++ b/Site/Style/style-v5.css @@ -35,7 +35,7 @@ html, body, input, select /* BASE */ -html, body +body { background-color: #E4ECFF; background-image: url('/Style/Images/background-shader.png'); From 1b8a219410bb794fb780af5dafb20f57b312b367 Mon Sep 17 00:00:00 2001 From: Falkvinge Date: Sat, 25 Feb 2017 05:09:39 +0100 Subject: [PATCH 02/40] Cleaner login looking decent now --- Site/Security/Login.aspx | 70 +++++++++++++++++----------- Site/Security/Login.aspx.designer.cs | 36 ++++++++++++++ 2 files changed, 80 insertions(+), 26 deletions(-) diff --git a/Site/Security/Login.aspx b/Site/Security/Login.aspx index 119ac2b9..6746ba70 100644 --- a/Site/Security/Login.aspx +++ b/Site/Security/Login.aspx @@ -167,6 +167,23 @@ }); } + function toManualLogin() { + $('#divLoginQr').slideUp(); + $('#divLoginManual').slideDown(); + $('#TextLogin').focus(); + $('#paraSwitchManualLogin').hide(); + $('#paraSwitchBitIdLogin').show(); + + // return false; // says we handled the click, don't process further + } + + function toBitIdLogin() { + $('#divLoginQr').slideDown(); + $('#divLoginManual').slideUp(); + $('#paraSwitchManualLogin').show(); + $('#paraSwitchBitIdLogin').hide(); + } + var bitIdUri = ''; var bitIdNonce = ''; @@ -175,42 +192,43 @@ - - -
-
+
+
-
+


Using Manual Password Login?

+ + + + + -
-
- - - - -
  
  
  
-
-
- - - -
-
-

Dev's Cheat Button

-

Since we're running on localhost, on a nonstandard port, with a debugger attached, and under Windows, this is clearly not a production environment. Since it's unlikely that the outside Internet has access to this machine, which means you can't login with BitID, a cheat button has been provided for you.

Press the button below to log on as Sandbox Administrator.

- -
-
-
-
+
+
+

Dev's Cheat Button

+

Since we're running on localhost, on a nonstandard port, with a debugger attached, and under Windows, this is clearly not a production environment. Since it's unlikely that the outside Internet has access to this machine, which means you can't login with BitID, a cheat button has been provided for you.

Press the button below to log on as Sandbox Administrator.

+
+
+
+
+ + diff --git a/Site/Security/Login.aspx.designer.cs b/Site/Security/Login.aspx.designer.cs index 831cad3c..83b622a7 100644 --- a/Site/Security/Login.aspx.designer.cs +++ b/Site/Security/Login.aspx.designer.cs @@ -111,6 +111,15 @@ namespace Swarmops.Pages.Security { /// protected global::System.Web.UI.WebControls.Image ImageBitIdQr; + /// + /// LabelManualLoginHeader control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label LabelManualLoginHeader; + /// /// LiteralCredentialsUser control. /// @@ -138,6 +147,33 @@ namespace Swarmops.Pages.Security { /// protected global::System.Web.UI.WebControls.Literal LiteralCredentials2FA; + /// + /// LabelForgotPassword control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label LabelForgotPassword; + + /// + /// LabelManualLogin control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label LabelManualLogin; + + /// + /// Label1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label Label1; + /// /// PanelCheat control. /// From 796257b0ac66bbab6baa0ab5916b87e3b9610219 Mon Sep 17 00:00:00 2001 From: Falkvinge Date: Sat, 25 Feb 2017 14:00:25 +0100 Subject: [PATCH 03/40] Finalized clean login page --- .../Pages.Security.designer.cs | 26 ++++++++++++++++--- Site/App_GlobalResources/Pages.Security.resx | 15 ++++++++--- Site/Security/Login.aspx | 4 +-- Site/Security/Login.aspx.cs | 4 +++ Site/Security/Login.aspx.designer.cs | 8 +++--- todo.txt | 4 +-- 6 files changed, 46 insertions(+), 15 deletions(-) diff --git a/Site/App_GlobalResources/Pages.Security.designer.cs b/Site/App_GlobalResources/Pages.Security.designer.cs index 60a596fe..0391c621 100644 --- a/Site/App_GlobalResources/Pages.Security.designer.cs +++ b/Site/App_GlobalResources/Pages.Security.designer.cs @@ -314,11 +314,11 @@ namespace Resources.Pages { } /// - /// Looks up a localized string similar to Manual Login. + /// Looks up a localized string similar to Manual Password Login. /// - internal static string Login_ManualLogin { + internal static string Login_ManualLoginHeader { get { - return ResourceManager.GetString("Login_ManualLogin", resourceCulture); + return ResourceManager.GetString("Login_ManualLoginHeader", resourceCulture); } } @@ -341,7 +341,7 @@ namespace Resources.Pages { } /// - /// Looks up a localized string similar to Reset Password. + /// Looks up a localized string similar to Help, I forgot my password!. /// internal static string Login_ResetPassword { get { @@ -376,6 +376,24 @@ namespace Resources.Pages { } } + /// + /// Looks up a localized string similar to Use BitID two-factor authentication?. + /// + internal static string Login_UseBitIdLogin { + get { + return ResourceManager.GetString("Login_UseBitIdLogin", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Use manual password login?. + /// + internal static string Login_UseManualLogin { + get { + return ResourceManager.GetString("Login_UseManualLogin", resourceCulture); + } + } + /// /// Looks up a localized string similar to User. /// diff --git a/Site/App_GlobalResources/Pages.Security.resx b/Site/App_GlobalResources/Pages.Security.resx index 941d22d1..37e7e1e7 100644 --- a/Site/App_GlobalResources/Pages.Security.resx +++ b/Site/App_GlobalResources/Pages.Security.resx @@ -203,8 +203,9 @@ Logging in, please wait... - - Manual Login + + Manual Password Login + Header to manual username/password form Login @@ -213,7 +214,7 @@ Pass - Reset Password + Help, I forgot my password! Sign me up for {0}! @@ -225,6 +226,14 @@ Swarmops doesn't recognize this address. Please log in manually and activate your address before using it to login. + + Use BitID two-factor authentication? + Switches from manual to BitID + + + Use manual password login? + Switches from BitId to Username/Password form + User diff --git a/Site/Security/Login.aspx b/Site/Security/Login.aspx index 6746ba70..30703ea7 100644 --- a/Site/Security/Login.aspx +++ b/Site/Security/Login.aspx @@ -211,8 +211,8 @@ -


Using Manual Password Login?

- +


Using Manual Password Login?

+ diff --git a/Site/Security/Login.aspx.cs b/Site/Security/Login.aspx.cs index 4f0ebff9..2bce1668 100644 --- a/Site/Security/Login.aspx.cs +++ b/Site/Security/Login.aspx.cs @@ -397,6 +397,10 @@ namespace Swarmops.Pages.Security this.LabelSidebarManualLoginHeader.Text = Resources.Pages.Security.Login_ManualLogin; this.LabelHeader.Text = Resources.Pages.Security.Login_Header; this.LabelSidebarResetPassword.Text = Resources.Pages.Security.Login_ResetPassword; */ + this.LabelManualLoginHeader.Text = Resources.Pages.Security.Login_ManualLoginHeader; + this.LabelUseManualLogin.Text = Resources.Pages.Security.Login_UseManualLogin; + this.LabelUseBitIdLogin.Text = Resources.Pages.Security.Login_UseBitIdLogin; + this.LabelForgotPassword.Text = Resources.Pages.Security.Login_ResetPassword; this.LiteralCredentialsUser.Text = Resources.Pages.Security.Login_Username; this.LiteralCredentialsPass.Text = Resources.Pages.Security.Login_Password; this.LiteralCredentials2FA.Text = Resources.Pages.Security.Login_GoogleAuthenticatorCode; diff --git a/Site/Security/Login.aspx.designer.cs b/Site/Security/Login.aspx.designer.cs index 83b622a7..12e2a3a0 100644 --- a/Site/Security/Login.aspx.designer.cs +++ b/Site/Security/Login.aspx.designer.cs @@ -157,22 +157,22 @@ namespace Swarmops.Pages.Security { protected global::System.Web.UI.WebControls.Label LabelForgotPassword; /// - /// LabelManualLogin control. + /// LabelUseManualLogin control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.Label LabelManualLogin; + protected global::System.Web.UI.WebControls.Label LabelUseManualLogin; /// - /// Label1 control. + /// LabelUseBitIdLogin control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.Label Label1; + protected global::System.Web.UI.WebControls.Label LabelUseBitIdLogin; /// /// PanelCheat control. diff --git a/todo.txt b/todo.txt index 2d977912..5c7fb14f 100644 --- a/todo.txt +++ b/todo.txt @@ -45,7 +45,7 @@ SWARMOPS IV [ ] Icons for Validation [X] Favicon New [X] Inspect Ledger header bad -[ ] Clean Login +[X] Clean Login @@ -70,4 +70,4 @@ SWARMOPS VI [ ] Controlify financialtransaction to show on balancetx page [ ] Close ledger year -[ ] Internal TX account type \ No newline at end of file +[X] Internal TX account type \ No newline at end of file From a245a68f92389c01ed0c53eb2dcd31b13262f25c Mon Sep 17 00:00:00 2001 From: Falkvinge Date: Sat, 25 Feb 2017 14:52:27 +0100 Subject: [PATCH 04/40] Fixed line spacing on ListFindPeople --- Site/Pages/v5/Swarm/ListFindPeople.aspx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Site/Pages/v5/Swarm/ListFindPeople.aspx b/Site/Pages/v5/Swarm/ListFindPeople.aspx index f4a05eb8..f3647aba 100644 --- a/Site/Pages/v5/Swarm/ListFindPeople.aspx +++ b/Site/Pages/v5/Swarm/ListFindPeople.aspx @@ -176,7 +176,7 @@
-  
+
+

Tech Malfunctions

+
+
+ Any malfunctions go here
+ Line two
+ (This is under construction) +
+
+ diff --git a/Site/Master-v5.master b/Site/Master-v5.master index af9f6d55..4549421a 100644 --- a/Site/Master-v5.master +++ b/Site/Master-v5.master @@ -145,6 +145,26 @@ }); + // flashing boxes + + function flashOrangeHeader() { + if (!_orangeFlashState) { + $('h2.flashheader').addClass("orangeDark").removeClass("orange"); + _orangeFlashState = true; + setTimeout("flashOrangeHeader();", 250); + } else { + $('h2.flashheader').removeClass("orangeDark").addClass("orange"); + _orangeFlashState = false; + setTimeout("flashOrangeHeader();", 1750); + } + } + + $(document).ready(function() { + flashOrangeHeader(); + }); + + var _orangeFlashState = false; + From a806ad89aa8c3ea2ef07d5c22a0f16fc8563bdc9 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Mon, 27 Feb 2017 15:25:37 -0600 Subject: [PATCH 10/40] Update --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c58b52bc..9ec72f58 100644 --- a/README.md +++ b/README.md @@ -29,8 +29,8 @@ If you're daring enough to install a pilot of Swarmops, you're most welcome to d > `wget -qO- http://packages.swarmops.com/swarmops-packages.gpg.key | apt-key add -` -Then, add the Swarmops repository to your list of software sources: -> `echo deb http://packages.swarmops.com/ squeeze contrib > /etc/apt/sources.list.d/swarmops.list` +Then, add the Swarmops repository to your list of software sources, where [your_distribution] below is xenial (Ubuntu) or stretch (Debian): +> `echo deb http://packages.swarmops.com/ [your_distribution] contrib > /etc/apt/sources.list.d/swarmops.list` Then, run this to install the Swarmops frontend: > `apt-get update; apt-get install swarmops-frontend` From 7eaf0a0c7b22342a3cb2dfca0564acc6b2f37bed Mon Sep 17 00:00:00 2001 From: Falkvinge Date: Thu, 16 Mar 2017 09:39:11 +0100 Subject: [PATCH 11/40] Experimenting with list updates from server --- FrontSocket/FrontendLoop.cs | 27 ++++++++++++++++---- Site/Master-v5.master | 8 +++--- Site/Scripts/Swarmops-v5.js | 51 +++++++++++++++++++++++++++++++++++++ todo.txt | 3 ++- 4 files changed, 78 insertions(+), 11 deletions(-) diff --git a/FrontSocket/FrontendLoop.cs b/FrontSocket/FrontendLoop.cs index c79ac14a..3aaa70c4 100644 --- a/FrontSocket/FrontendLoop.cs +++ b/FrontSocket/FrontendLoop.cs @@ -203,6 +203,9 @@ namespace Swarmops.Frontend.Socket private static int _sandboxDummy1 = 500; private static int _sandboxDummy2 = 50000; + private static int _malfunctionTestCounter = 0; + private static string[] malfunctionStrings = {"One", "Two", "Three", "Four"}; + private static void OnEveryTenSeconds() { SystemSettings.HeartbeatFrontend = DateTime.UtcNow.ToUnix(); @@ -212,12 +215,26 @@ namespace Swarmops.Frontend.Socket _sandboxDummy1 += new Random().Next(10) - 3; _sandboxDummy2 += new Random().Next(1000) - 200; - JObject data = new JObject(); - data["MessageType"] = "SandboxUpdate"; - data["Local"] = _sandboxDummy1.ToString(CultureInfo.InvariantCulture); - data["Profit"] = _sandboxDummy2.ToString(CultureInfo.InvariantCulture); + JObject data1 = new JObject(); + data1["MessageType"] = "SandboxUpdate"; + data1["Local"] = _sandboxDummy1.ToString(CultureInfo.InvariantCulture); + data1["Profit"] = _sandboxDummy2.ToString(CultureInfo.InvariantCulture); - _socketServer.WebSocketServices.Broadcast(data.ToString()); + _socketServer.WebSocketServices.Broadcast(data1.ToString()); + + JArray malfunctionsArray = new JArray(); + for (int loop = 0; loop < _malfunctionTestCounter; loop++) + { + JObject malfunctionObject = new JObject(); + malfunctionObject["Id"] = "Mal" + loop.ToString(); + malfunctionObject["Text"] = malfunctionStrings[loop]; + malfunctionsArray.Add(malfunctionObject); + } + + JObject data2 = new JObject(); + data2["MessageType"] = "Malfunctions"; + data2["MalfunctionsData"] = malfunctionsArray.ToString(); + _socketServer.WebSocketServices.Broadcast(data2.ToString()); } } diff --git a/Site/Master-v5.master b/Site/Master-v5.master index 4549421a..93cadc26 100644 --- a/Site/Master-v5.master +++ b/Site/Master-v5.master @@ -250,12 +250,10 @@ -

Tech Malfunctions

+

Tech Malfunctions

-
- Any malfunctions go here
- Line two
- (This is under construction) +
+
diff --git a/Site/Scripts/Swarmops-v5.js b/Site/Scripts/Swarmops-v5.js index 914fb074..495a67fe 100644 --- a/Site/Scripts/Swarmops-v5.js +++ b/Site/Scripts/Swarmops-v5.js @@ -47,6 +47,10 @@ function _masterInitializeSocket(authenticationTicket) { alertify.log("Bitcoin received: " + message.Currency + " " + message.CentsFormatted); } } + else if (message.MessageType == "Malfunctions") { + console.log(message.MalfunctionsList); + updateListBox($('#divMalfunctionsList'), message.MalfunctionsList); + } else if (message.MessageType == "SandboxUpdate") { if (odoLocalParticipation != undefined) { // Real ugly accessing specific page elements here, but it's temporary odoLocalParticipation.innerHTML = message.Local; @@ -67,6 +71,53 @@ function getMasterSocketAddress() { } } +// ------------------- List updating -------------------------- + + +function updateListBox(box, listData) { + // list is an array of object { id, text } + // box is a div-div-ul-li nest containing the li:s with the id + // the function syncs the box to the list with some nice fades + + // Is the box visible right now? + + var boxVisible = $(box).is(":visible"); + + // Step 1: Iterate through list, build id array + + var idListLookup = {}; + listData.forEach(function(item, index) { + idListLookup[item.id] = item; + }); + + // Step 2: Iterate through box, change texts of matching ids, + // remove items that aren't in list, build id array + + var idBoxLookup = {}; + var listContainer = $(box).firstChild.firstChild; + console.log($(box)); + console.log(listContainer); + var listElements = $(listContainer).children; + + // Step 3: Iterate through list, add missing items + + /* + var newItem = $("
  • Item " + listItem.text + "
  • ").hide(); + $("#mylist").prepend(newItem); + newItem.slideDown();*/ + + // Step 4: Adjust visibility as required + + if (!boxVisible && listData.length > 0) { + box.fadeIn(); + } + else if (boxVisible && listData.length == 0) { + box.fadeOut(); + } +} + + + // ------------------- SwarmopsJS object ---------------------- var SwarmopsJS = (function () { diff --git a/todo.txt b/todo.txt index 5c7fb14f..fe968e51 100644 --- a/todo.txt +++ b/todo.txt @@ -70,4 +70,5 @@ SWARMOPS VI [ ] Controlify financialtransaction to show on balancetx page [ ] Close ledger year -[X] Internal TX account type \ No newline at end of file +[X] Internal TX account type +[ ] Create TX From 30f7a62c6e22198a0af3e46b5aa02bed3f7abbc7 Mon Sep 17 00:00:00 2001 From: Falkvinge Date: Thu, 16 Mar 2017 09:49:37 +0100 Subject: [PATCH 12/40] First debug fix --- FrontSocket/FrontendLoop.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FrontSocket/FrontendLoop.cs b/FrontSocket/FrontendLoop.cs index 3aaa70c4..efb34f2e 100644 --- a/FrontSocket/FrontendLoop.cs +++ b/FrontSocket/FrontendLoop.cs @@ -233,7 +233,7 @@ namespace Swarmops.Frontend.Socket JObject data2 = new JObject(); data2["MessageType"] = "Malfunctions"; - data2["MalfunctionsData"] = malfunctionsArray.ToString(); + data2["MalfunctionsList"] = malfunctionsArray.ToString(); _socketServer.WebSocketServices.Broadcast(data2.ToString()); } } From 5258988ad896c8529f3e07f393d7534fdff10f03 Mon Sep 17 00:00:00 2001 From: Falkvinge Date: Thu, 16 Mar 2017 10:00:38 +0100 Subject: [PATCH 13/40] Trying more --- FrontSocket/FrontendLoop.cs | 5 +++++ Site/Scripts/Swarmops-v5.js | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/FrontSocket/FrontendLoop.cs b/FrontSocket/FrontendLoop.cs index efb34f2e..49190481 100644 --- a/FrontSocket/FrontendLoop.cs +++ b/FrontSocket/FrontendLoop.cs @@ -231,6 +231,11 @@ namespace Swarmops.Frontend.Socket malfunctionsArray.Add(malfunctionObject); } + if (++_malfunctionTestCounter > 4) + { + _malfunctionTestCounter = 0; + } + JObject data2 = new JObject(); data2["MessageType"] = "Malfunctions"; data2["MalfunctionsList"] = malfunctionsArray.ToString(); diff --git a/Site/Scripts/Swarmops-v5.js b/Site/Scripts/Swarmops-v5.js index 495a67fe..5a6af04f 100644 --- a/Site/Scripts/Swarmops-v5.js +++ b/Site/Scripts/Swarmops-v5.js @@ -86,9 +86,11 @@ function updateListBox(box, listData) { // Step 1: Iterate through list, build id array var idListLookup = {}; - listData.forEach(function(item, index) { - idListLookup[item.id] = item; - }); + if (listData.length > 0) { + listData.forEach(function(item, index) { + idListLookup[item.id] = item; + }); + } // Step 2: Iterate through box, change texts of matching ids, // remove items that aren't in list, build id array From b8058ce90ed6e1cf20dd2b7f93a9b232cf9fe681 Mon Sep 17 00:00:00 2001 From: Falkvinge Date: Thu, 16 Mar 2017 10:46:40 +0100 Subject: [PATCH 14/40] Trying more --- Site/Scripts/Swarmops-v5.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Site/Scripts/Swarmops-v5.js b/Site/Scripts/Swarmops-v5.js index 5a6af04f..cd8c3dcf 100644 --- a/Site/Scripts/Swarmops-v5.js +++ b/Site/Scripts/Swarmops-v5.js @@ -85,9 +85,11 @@ function updateListBox(box, listData) { // Step 1: Iterate through list, build id array + console.log(listData); + var idListLookup = {}; if (listData.length > 0) { - listData.forEach(function(item, index) { + Array.from(listData).forEach(function(item, index) { idListLookup[item.id] = item; }); } From db75f6fed7e2ffa9cc4ccd17b718d513d0a5a6f6 Mon Sep 17 00:00:00 2001 From: Falkvinge Date: Thu, 16 Mar 2017 10:56:12 +0100 Subject: [PATCH 15/40] Getting closer, trying some more --- Site/Scripts/Swarmops-v5.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Site/Scripts/Swarmops-v5.js b/Site/Scripts/Swarmops-v5.js index cd8c3dcf..0b3f1d7a 100644 --- a/Site/Scripts/Swarmops-v5.js +++ b/Site/Scripts/Swarmops-v5.js @@ -98,10 +98,10 @@ function updateListBox(box, listData) { // remove items that aren't in list, build id array var idBoxLookup = {}; - var listContainer = $(box).firstChild.firstChild; + var listContainer = $(box).parent.parent; console.log($(box)); console.log(listContainer); - var listElements = $(listContainer).children; + var listElements = $(box).children; // Step 3: Iterate through list, add missing items From b83b325b8677b26ece5fd7cc23c160e2cf34fcc2 Mon Sep 17 00:00:00 2001 From: Falkvinge Date: Thu, 16 Mar 2017 11:06:44 +0100 Subject: [PATCH 16/40] Getting closer, testing more --- Site/Scripts/Swarmops-v5.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Site/Scripts/Swarmops-v5.js b/Site/Scripts/Swarmops-v5.js index 0b3f1d7a..0ad562ea 100644 --- a/Site/Scripts/Swarmops-v5.js +++ b/Site/Scripts/Swarmops-v5.js @@ -48,7 +48,6 @@ function _masterInitializeSocket(authenticationTicket) { } } else if (message.MessageType == "Malfunctions") { - console.log(message.MalfunctionsList); updateListBox($('#divMalfunctionsList'), message.MalfunctionsList); } else if (message.MessageType == "SandboxUpdate") { @@ -85,8 +84,6 @@ function updateListBox(box, listData) { // Step 1: Iterate through list, build id array - console.log(listData); - var idListLookup = {}; if (listData.length > 0) { Array.from(listData).forEach(function(item, index) { @@ -98,7 +95,7 @@ function updateListBox(box, listData) { // remove items that aren't in list, build id array var idBoxLookup = {}; - var listContainer = $(box).parent.parent; + var listContainer = $($(box).parent).parent; console.log($(box)); console.log(listContainer); var listElements = $(box).children; @@ -113,10 +110,10 @@ function updateListBox(box, listData) { // Step 4: Adjust visibility as required if (!boxVisible && listData.length > 0) { - box.fadeIn(); + $(listContainer).fadeIn(); } else if (boxVisible && listData.length == 0) { - box.fadeOut(); + $(listContainer).fadeOut(); } } From 678d7db297d5034fde8ca2c65a441b087b06c98e Mon Sep 17 00:00:00 2001 From: Falkvinge Date: Thu, 16 Mar 2017 11:17:05 +0100 Subject: [PATCH 17/40] Getting even closer, testing even more --- Site/Scripts/Swarmops-v5.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Site/Scripts/Swarmops-v5.js b/Site/Scripts/Swarmops-v5.js index 0ad562ea..03aad680 100644 --- a/Site/Scripts/Swarmops-v5.js +++ b/Site/Scripts/Swarmops-v5.js @@ -95,7 +95,7 @@ function updateListBox(box, listData) { // remove items that aren't in list, build id array var idBoxLookup = {}; - var listContainer = $($(box).parent).parent; + var listContainer = $(box).parent().parent(); console.log($(box)); console.log(listContainer); var listElements = $(box).children; @@ -109,11 +109,14 @@ function updateListBox(box, listData) { // Step 4: Adjust visibility as required + console.log(listData.length); + console.log(listData.length == 0); + if (!boxVisible && listData.length > 0) { - $(listContainer).fadeIn(); + listContainer.fadeIn(); } else if (boxVisible && listData.length == 0) { - $(listContainer).fadeOut(); + $listContainer.fadeOut(); } } From 3e2b42011de8380551065674e7f2b7037b009c03 Mon Sep 17 00:00:00 2001 From: Falkvinge Date: Thu, 16 Mar 2017 11:17:22 +0100 Subject: [PATCH 18/40] Oopsfix --- Site/Scripts/Swarmops-v5.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Site/Scripts/Swarmops-v5.js b/Site/Scripts/Swarmops-v5.js index 03aad680..139512ef 100644 --- a/Site/Scripts/Swarmops-v5.js +++ b/Site/Scripts/Swarmops-v5.js @@ -116,7 +116,7 @@ function updateListBox(box, listData) { listContainer.fadeIn(); } else if (boxVisible && listData.length == 0) { - $listContainer.fadeOut(); + listContainer.fadeOut(); } } From adfab13b7cf74ac025cb56bc096c1af1c487838b Mon Sep 17 00:00:00 2001 From: Falkvinge Date: Thu, 16 Mar 2017 11:27:22 +0100 Subject: [PATCH 19/40] More testing --- Site/Scripts/Swarmops-v5.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Site/Scripts/Swarmops-v5.js b/Site/Scripts/Swarmops-v5.js index 139512ef..e66615bc 100644 --- a/Site/Scripts/Swarmops-v5.js +++ b/Site/Scripts/Swarmops-v5.js @@ -84,9 +84,10 @@ function updateListBox(box, listData) { // Step 1: Iterate through list, build id array + var listArray = Array.from(listData); var idListLookup = {}; if (listData.length > 0) { - Array.from(listData).forEach(function(item, index) { + listArray.forEach(function(item, index) { idListLookup[item.id] = item; }); } @@ -95,7 +96,7 @@ function updateListBox(box, listData) { // remove items that aren't in list, build id array var idBoxLookup = {}; - var listContainer = $(box).parent().parent(); + var listContainer = $(box).parent(); console.log($(box)); console.log(listContainer); var listElements = $(box).children; @@ -109,13 +110,14 @@ function updateListBox(box, listData) { // Step 4: Adjust visibility as required - console.log(listData.length); - console.log(listData.length == 0); - if (!boxVisible && listData.length > 0) { + console.log(listArray.length); + console.log(listArray.length == 0); + + if (!boxVisible && listArray.length > 0) { listContainer.fadeIn(); } - else if (boxVisible && listData.length == 0) { + else if (boxVisible && listArray.length == 0) { listContainer.fadeOut(); } } From 393092800f579b3b2e5bb52c2809e42be254d886 Mon Sep 17 00:00:00 2001 From: Falkvinge Date: Thu, 16 Mar 2017 11:50:48 +0100 Subject: [PATCH 20/40] Another test --- Site/Scripts/Swarmops-v5.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Site/Scripts/Swarmops-v5.js b/Site/Scripts/Swarmops-v5.js index e66615bc..d6e9ca42 100644 --- a/Site/Scripts/Swarmops-v5.js +++ b/Site/Scripts/Swarmops-v5.js @@ -110,9 +110,7 @@ function updateListBox(box, listData) { // Step 4: Adjust visibility as required - - console.log(listArray.length); - console.log(listArray.length == 0); + console.log(listArray == []); if (!boxVisible && listArray.length > 0) { listContainer.fadeIn(); From 4e5dd2e89af4cea510f0b9026e2d19a8f45ea9ba Mon Sep 17 00:00:00 2001 From: Falkvinge Date: Thu, 16 Mar 2017 12:21:45 +0100 Subject: [PATCH 21/40] Yet more testing --- Site/Scripts/Swarmops-v5.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Site/Scripts/Swarmops-v5.js b/Site/Scripts/Swarmops-v5.js index d6e9ca42..37ee5e36 100644 --- a/Site/Scripts/Swarmops-v5.js +++ b/Site/Scripts/Swarmops-v5.js @@ -89,6 +89,7 @@ function updateListBox(box, listData) { if (listData.length > 0) { listArray.forEach(function(item, index) { idListLookup[item.id] = item; + console.log(item.Id); }); } @@ -110,12 +111,13 @@ function updateListBox(box, listData) { // Step 4: Adjust visibility as required - console.log(listArray == []); + var listEmpty = (!$.isArray(siteArray) || !siteArray.length); + console.log(listEmpty); - if (!boxVisible && listArray.length > 0) { + if (!boxVisible && !listEmpty) { listContainer.fadeIn(); } - else if (boxVisible && listArray.length == 0) { + else if (boxVisible && listEmpty) { listContainer.fadeOut(); } } From e7d0a2ec582fd7754d3fa306ef96fd9faefa22f5 Mon Sep 17 00:00:00 2001 From: Falkvinge Date: Thu, 16 Mar 2017 12:37:56 +0100 Subject: [PATCH 22/40] Yet more testing --- Site/Scripts/Swarmops-v5.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Site/Scripts/Swarmops-v5.js b/Site/Scripts/Swarmops-v5.js index 37ee5e36..b950aa26 100644 --- a/Site/Scripts/Swarmops-v5.js +++ b/Site/Scripts/Swarmops-v5.js @@ -111,7 +111,7 @@ function updateListBox(box, listData) { // Step 4: Adjust visibility as required - var listEmpty = (!$.isArray(siteArray) || !siteArray.length); + var listEmpty = (!$.isArray(listArray) || !listArray.length); console.log(listEmpty); if (!boxVisible && !listEmpty) { From 69a3a44132d8f1ba754560415109a5f403bd00b7 Mon Sep 17 00:00:00 2001 From: Falkvinge Date: Thu, 16 Mar 2017 12:51:45 +0100 Subject: [PATCH 23/40] Another test --- Site/Scripts/Swarmops-v5.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Site/Scripts/Swarmops-v5.js b/Site/Scripts/Swarmops-v5.js index b950aa26..a3d2a835 100644 --- a/Site/Scripts/Swarmops-v5.js +++ b/Site/Scripts/Swarmops-v5.js @@ -89,6 +89,7 @@ function updateListBox(box, listData) { if (listData.length > 0) { listArray.forEach(function(item, index) { idListLookup[item.id] = item; + console.log(item); console.log(item.Id); }); } @@ -111,8 +112,10 @@ function updateListBox(box, listData) { // Step 4: Adjust visibility as required + console.log($.isArray(listArray)); var listEmpty = (!$.isArray(listArray) || !listArray.length); console.log(listEmpty); + console.log(listArray.length); if (!boxVisible && !listEmpty) { listContainer.fadeIn(); From e59db646acf1b9359e4a9da944729c0f2a8badf2 Mon Sep 17 00:00:00 2001 From: Falkvinge Date: Thu, 16 Mar 2017 13:06:26 +0100 Subject: [PATCH 24/40] More testing --- FrontSocket/FrontendLoop.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FrontSocket/FrontendLoop.cs b/FrontSocket/FrontendLoop.cs index 49190481..fa829059 100644 --- a/FrontSocket/FrontendLoop.cs +++ b/FrontSocket/FrontendLoop.cs @@ -238,7 +238,7 @@ namespace Swarmops.Frontend.Socket JObject data2 = new JObject(); data2["MessageType"] = "Malfunctions"; - data2["MalfunctionsList"] = malfunctionsArray.ToString(); + data2["MalfunctionsList"] = malfunctionsArray; _socketServer.WebSocketServices.Broadcast(data2.ToString()); } } From e39187fabb9684169ac8ab522e9128c8ba6e54fb Mon Sep 17 00:00:00 2001 From: Falkvinge Date: Thu, 16 Mar 2017 13:18:29 +0100 Subject: [PATCH 25/40] Getting somewhere! --- Site/Master-v5.master | 8 +++++--- Site/Scripts/Swarmops-v5.js | 16 +++++----------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/Site/Master-v5.master b/Site/Master-v5.master index 93cadc26..f598b9d5 100644 --- a/Site/Master-v5.master +++ b/Site/Master-v5.master @@ -250,10 +250,12 @@
    -

    Tech Malfunctions

    -
    -
    +
    +

    Tech Malfunctions

    +
    +
    +
    diff --git a/Site/Scripts/Swarmops-v5.js b/Site/Scripts/Swarmops-v5.js index a3d2a835..a03c175c 100644 --- a/Site/Scripts/Swarmops-v5.js +++ b/Site/Scripts/Swarmops-v5.js @@ -89,8 +89,6 @@ function updateListBox(box, listData) { if (listData.length > 0) { listArray.forEach(function(item, index) { idListLookup[item.id] = item; - console.log(item); - console.log(item.Id); }); } @@ -98,10 +96,9 @@ function updateListBox(box, listData) { // remove items that aren't in list, build id array var idBoxLookup = {}; - var listContainer = $(box).parent(); - console.log($(box)); - console.log(listContainer); - var listElements = $(box).children; + var listContainer = $(box).parent().parent(); + var listElements = $(box).children(); + console.log(listElements); // Step 3: Iterate through list, add missing items @@ -112,16 +109,13 @@ function updateListBox(box, listData) { // Step 4: Adjust visibility as required - console.log($.isArray(listArray)); var listEmpty = (!$.isArray(listArray) || !listArray.length); - console.log(listEmpty); - console.log(listArray.length); if (!boxVisible && !listEmpty) { - listContainer.fadeIn(); + listContainer.fadeIn().slideDown(); } else if (boxVisible && listEmpty) { - listContainer.fadeOut(); + listContainer.fadeOut().slideUp(); } } From 5becb7cee973ab530a24b5ea6920c33faa11c0fc Mon Sep 17 00:00:00 2001 From: Falkvinge Date: Thu, 16 Mar 2017 13:50:00 +0100 Subject: [PATCH 26/40] This won't possibly work --- Site/Scripts/Swarmops-v5.js | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/Site/Scripts/Swarmops-v5.js b/Site/Scripts/Swarmops-v5.js index a03c175c..31dade4d 100644 --- a/Site/Scripts/Swarmops-v5.js +++ b/Site/Scripts/Swarmops-v5.js @@ -88,7 +88,7 @@ function updateListBox(box, listData) { var idListLookup = {}; if (listData.length > 0) { listArray.forEach(function(item, index) { - idListLookup[item.id] = item; + idListLookup[item.Id] = item; }); } @@ -98,14 +98,29 @@ function updateListBox(box, listData) { var idBoxLookup = {}; var listContainer = $(box).parent().parent(); var listElements = $(box).children(); + console.log(listElements); // Step 3: Iterate through list, add missing items + if (listElements.length == 0) + { + $(box).append ($("
      ")); + listElements = $(box).children(); + } + + + listArray.forEach(function(item, index) { + if (idBoxLookup[item.id] != true) { + var newItem = $("
    • " + item.Text + "
    • ").hide(); + $(box).append(newItem); + newItem.slideDown(); + } + }); + + + /* - var newItem = $("
    • Item " + listItem.text + "
    • ").hide(); - $("#mylist").prepend(newItem); - newItem.slideDown();*/ // Step 4: Adjust visibility as required From 85f7864199a0e98a46317b36bfddad2c4bf82367 Mon Sep 17 00:00:00 2001 From: Falkvinge Date: Thu, 16 Mar 2017 14:04:00 +0100 Subject: [PATCH 27/40] Dumbfix 1 --- Site/Scripts/Swarmops-v5.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Site/Scripts/Swarmops-v5.js b/Site/Scripts/Swarmops-v5.js index 31dade4d..9880b8fa 100644 --- a/Site/Scripts/Swarmops-v5.js +++ b/Site/Scripts/Swarmops-v5.js @@ -111,17 +111,14 @@ function updateListBox(box, listData) { listArray.forEach(function(item, index) { - if (idBoxLookup[item.id] != true) { + if (idBoxLookup[item.Id] != true) { var newItem = $("
    • " + item.Text + "
    • ").hide(); - $(box).append(newItem); + $(listElements).append(newItem); newItem.slideDown(); } }); - - /* - // Step 4: Adjust visibility as required var listEmpty = (!$.isArray(listArray) || !listArray.length); From b3c58edec98ab66b690bc948e5b313b34662f974 Mon Sep 17 00:00:00 2001 From: Falkvinge Date: Thu, 16 Mar 2017 22:40:00 +0100 Subject: [PATCH 28/40] Testing maybe final logic of this --- Site/Scripts/Swarmops-v5.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/Site/Scripts/Swarmops-v5.js b/Site/Scripts/Swarmops-v5.js index 9880b8fa..27d67926 100644 --- a/Site/Scripts/Swarmops-v5.js +++ b/Site/Scripts/Swarmops-v5.js @@ -98,13 +98,28 @@ function updateListBox(box, listData) { var idBoxLookup = {}; var listContainer = $(box).parent().parent(); var listElements = $(box).children(); - - console.log(listElements); + + listElements.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(); }); + } + }); // Step 3: Iterate through list, add missing items if (listElements.length == 0) { + // If there's not even an UL element (yet), add one and move the pointer to it, + // so we can add any missing items + $(box).append ($("
        ")); listElements = $(box).children(); } @@ -112,7 +127,7 @@ function updateListBox(box, listData) { listArray.forEach(function(item, index) { if (idBoxLookup[item.Id] != true) { - var newItem = $("
      • " + item.Text + "
      • ").hide(); + var newItem = $("
      • " + item.Text + "
      • ").hide(); $(listElements).append(newItem); newItem.slideDown(); } From 45249b735d1893e3c4b28ee685a7c4c59a340a7d Mon Sep 17 00:00:00 2001 From: Falkvinge Date: Thu, 16 Mar 2017 22:53:50 +0100 Subject: [PATCH 29/40] 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) { From 2fde03f0e0bfaddbcf80564179a6c25b0b59aa35 Mon Sep 17 00:00:00 2001 From: Falkvinge Date: Fri, 17 Mar 2017 05:19:17 +0100 Subject: [PATCH 30/40] Stylefix --- FrontSocket/FrontendLoop.cs | 2 +- Site/Master-v5.master | 2 +- Site/Scripts/Swarmops-v5.js | 10 ++++++---- Site/Style/style-v5.css | 21 +++++++++++++++++++++ 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/FrontSocket/FrontendLoop.cs b/FrontSocket/FrontendLoop.cs index e29604ed..b4d88e02 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] + " (Test code, ignore)"; + malfunctionObject["Text"] = malfunctionStrings[loop] + " (Test code, ignore - and let's make this a multiline point to test flow)"; malfunctionsArray.Add(malfunctionObject); } diff --git a/Site/Master-v5.master b/Site/Master-v5.master index f598b9d5..cd564347 100644 --- a/Site/Master-v5.master +++ b/Site/Master-v5.master @@ -254,7 +254,7 @@

        Tech Malfunctions

        - +
        • Test one (ignore)
        • Test two (ignore too)
        • Test three (you know the drill now)
        diff --git a/Site/Scripts/Swarmops-v5.js b/Site/Scripts/Swarmops-v5.js index 0d2da264..69dd779b 100644 --- a/Site/Scripts/Swarmops-v5.js +++ b/Site/Scripts/Swarmops-v5.js @@ -104,13 +104,15 @@ function updateListBox(box, listData) { console.log($(this)); var elementId = $(this).attr("rel"); console.log(elementId); + var testLookup = idListLookup[elementId]; + console.log(testLookup); - if (typeof idListLookup[elementId] != 'undefined') { + if (testLookup === undefined) { + // displayed item is NOT present in supplied list, and should be removed + $(this).slideUp(400, function () { $(this).remove(); }); + } else { // 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(); }); } }); } diff --git a/Site/Style/style-v5.css b/Site/Style/style-v5.css index d912747c..a7b19ac8 100644 --- a/Site/Style/style-v5.css +++ b/Site/Style/style-v5.css @@ -1146,6 +1146,27 @@ body.rtl .sidebar h2 span.arrow { +/* TODO, MALFUNCTIONS LIST IN SIDEBAR */ + +div#divMalfunctionsList > ul { + list-style: none; +} + +div#divMalfunctionsList > ul > li { + padding-top: 8px; + background: url('/Images/Icons/iconshock-warning-24px.png') no-repeat 0px 3px; + padding-left: 30px; + padding-bottom: 5px; + line-height: 140%; +} + +div#divMalfunctionsList > ul > li+li { + border-top: 1px #476EC7 solid; + margin-top: 5px; +} + +/* TODO: RTL VERSION AND TODO VERSION */ + /* OTHER ELEMENTS */ From 42c8035e5e0f4bfbfa5054129eab7b5526651ee0 Mon Sep 17 00:00:00 2001 From: Falkvinge Date: Fri, 17 Mar 2017 05:35:55 +0100 Subject: [PATCH 31/40] Tech malfunctions starting to look nice --- FrontSocket/FrontendLoop.cs | 5 +++++ Site/Master-v5.master | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/FrontSocket/FrontendLoop.cs b/FrontSocket/FrontendLoop.cs index b4d88e02..bd55c6a5 100644 --- a/FrontSocket/FrontendLoop.cs +++ b/FrontSocket/FrontendLoop.cs @@ -225,6 +225,11 @@ namespace Swarmops.Frontend.Socket JArray malfunctionsArray = new JArray(); for (int loop = 0; loop < _malfunctionTestCounter; loop++) { + if (loop < _malfunctionTestCounter - 2) + { + continue; + } + JObject malfunctionObject = new JObject(); malfunctionObject["Id"] = "Mal" + loop.ToString(); malfunctionObject["Text"] = malfunctionStrings[loop] + " (Test code, ignore - and let's make this a multiline point to test flow)"; diff --git a/Site/Master-v5.master b/Site/Master-v5.master index cd564347..09e78a4a 100644 --- a/Site/Master-v5.master +++ b/Site/Master-v5.master @@ -250,11 +250,10 @@
        -
        + From c4e42238e4600d2c79c05c9d5afbc6d3196b9607 Mon Sep 17 00:00:00 2001 From: Falkvinge Date: Fri, 17 Mar 2017 05:46:19 +0100 Subject: [PATCH 32/40] Dumbfix --- Site/Scripts/Swarmops-v5.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Site/Scripts/Swarmops-v5.js b/Site/Scripts/Swarmops-v5.js index 69dd779b..b30fe165 100644 --- a/Site/Scripts/Swarmops-v5.js +++ b/Site/Scripts/Swarmops-v5.js @@ -100,10 +100,11 @@ function updateListBox(box, listData) { var listElements = $(box).children(); if (listElements.length > 0) { - listElements.children().each(function(index) { + listElements.children().each(function (index) { console.log($(this)); var elementId = $(this).attr("rel"); console.log(elementId); + idBoxLookup[elementId] = true; var testLookup = idListLookup[elementId]; console.log(testLookup); From 39e4c6f56cde09a313173d6eb88ed9f4ea3c35b6 Mon Sep 17 00:00:00 2001 From: Falkvinge Date: Fri, 17 Mar 2017 08:24:41 +0100 Subject: [PATCH 33/40] Some more work on displaying malfunctions --- FrontSocket/Frontend-Socket.csproj | 1 + FrontSocket/FrontendLoop.cs | 15 +- FrontSocket/FrontendMalfunctions.cs | 15 ++ Logic/Logic.csproj | 10 ++ .../Logic.Support.ErrorMessages.Designer.cs | 153 ++++++++++++++++++ .../Logic.Support.ErrorMessages.resx | 150 +++++++++++++++++ Logic/Resources/SourceResourceFiles.txt | 1 + Logic/Support/ErrorMessages.cs | 29 ++++ 8 files changed, 372 insertions(+), 2 deletions(-) create mode 100644 FrontSocket/FrontendMalfunctions.cs create mode 100644 Logic/Resources/Logic.Support.ErrorMessages.Designer.cs create mode 100644 Logic/Resources/Logic.Support.ErrorMessages.resx create mode 100644 Logic/Support/ErrorMessages.cs diff --git a/FrontSocket/Frontend-Socket.csproj b/FrontSocket/Frontend-Socket.csproj index a89d54fa..3f30becb 100644 --- a/FrontSocket/Frontend-Socket.csproj +++ b/FrontSocket/Frontend-Socket.csproj @@ -60,6 +60,7 @@ + diff --git a/FrontSocket/FrontendLoop.cs b/FrontSocket/FrontendLoop.cs index bd55c6a5..d46075cb 100644 --- a/FrontSocket/FrontendLoop.cs +++ b/FrontSocket/FrontendLoop.cs @@ -203,8 +203,9 @@ namespace Swarmops.Frontend.Socket private static int _sandboxDummy1 = 500; private static int _sandboxDummy2 = 50000; + /* private static int _malfunctionTestCounter = 0; - private static string[] malfunctionStrings = {"One", "Two", "Three", "Four"}; + private static string[] malfunctionStrings = {"One", "Two", "Three", "Four"};*/ private static void OnEveryTenSeconds() { @@ -222,6 +223,7 @@ namespace Swarmops.Frontend.Socket _socketServer.WebSocketServices.Broadcast(data1.ToString()); + /* JArray malfunctionsArray = new JArray(); for (int loop = 0; loop < _malfunctionTestCounter; loop++) { @@ -244,7 +246,7 @@ namespace Swarmops.Frontend.Socket JObject data2 = new JObject(); data2["MessageType"] = "Malfunctions"; data2["MalfunctionsList"] = malfunctionsArray; - _socketServer.WebSocketServices.Broadcast(data2.ToString()); + _socketServer.WebSocketServices.Broadcast(data2.ToString());*/ } } @@ -298,11 +300,15 @@ namespace Swarmops.Frontend.Socket public static void OnBackendClose(object sender, CloseEventArgs args) { Console.WriteLine(" - Backend socket closed: " + args.Code + " " + args.Reason); + + // TODO: Try reconnecting } public static void OnBackendError(object sender, ErrorEventArgs args) { Console.WriteLine(" - Backend socket error: " + args.Message); + + // TODO: Try reconnecting } @@ -319,6 +325,11 @@ namespace Swarmops.Frontend.Socket } + public static void BroadcastMalfunctions() + { + + } + // --------------------------------- LEGACY CODE BELOW THIS MARK ------------------------------- diff --git a/FrontSocket/FrontendMalfunctions.cs b/FrontSocket/FrontendMalfunctions.cs new file mode 100644 index 00000000..89bf0a14 --- /dev/null +++ b/FrontSocket/FrontendMalfunctions.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Swarmops.Frontend.Socket +{ + public enum FrontendMalfunctions + { + Unknown = 0, + BackendConnectionFault, + BackendHeartbeatLost + } +} diff --git a/Logic/Logic.csproj b/Logic/Logic.csproj index 5ee14ce2..ff915372 100644 --- a/Logic/Logic.csproj +++ b/Logic/Logic.csproj @@ -156,6 +156,11 @@ True Logic.Structure.Geography.resx + + True + True + Logic.Support.ErrorMessages.resx + True True @@ -191,6 +196,7 @@ + @@ -629,6 +635,10 @@ + + ResXFileCodeGenerator + Logic.Support.ErrorMessages.Designer.cs + diff --git a/Logic/Resources/Logic.Support.ErrorMessages.Designer.cs b/Logic/Resources/Logic.Support.ErrorMessages.Designer.cs new file mode 100644 index 00000000..7fa591ae --- /dev/null +++ b/Logic/Resources/Logic.Support.ErrorMessages.Designer.cs @@ -0,0 +1,153 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Swarmops.Logic.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Logic_Support_ErrorMessages { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Logic_Support_ErrorMessages() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Swarmops.Logic.Resources.Logic.Support.ErrorMessages", typeof(Logic_Support_ErrorMessages).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to The server has lost the connection to the bitcoin blockchain. Bitcoin transactions won't be detected in real time.. + /// + internal static string Backend_BlockchainSocketLost_Text { + get { + return ResourceManager.GetString("Backend_BlockchainSocketLost_Text", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Blockchain Connection Lost. + /// + internal static string Backend_BlockchainSocketLost_Title { + get { + return ResourceManager.GetString("Backend_BlockchainSocketLost_Title", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The web browser is unable to hear the server's heartbeat.. + /// + internal static string Client_ServerHeartbeatLost_Text { + get { + return ResourceManager.GetString("Client_ServerHeartbeatLost_Text", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Heartbeat Failure Level 1. + /// + internal static string Client_ServerHeartbeatLost_Title { + get { + return ResourceManager.GetString("Client_ServerHeartbeatLost_Title", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to connect to the server for real-time updates.. + /// + internal static string Client_SocketConnectionFault_Text { + get { + return ResourceManager.GetString("Client_SocketConnectionFault_Text", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WebSocket Failure. + /// + internal static string Client_SocketConnectionFault_Title { + get { + return ResourceManager.GetString("Client_SocketConnectionFault_Title", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The server is unable to connect to the backend process. Real-time updates will be largely unavailable.. + /// + internal static string Frontend_BackendConnectionFault_Text { + get { + return ResourceManager.GetString("Frontend_BackendConnectionFault_Text", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Backend Connection Failure. + /// + internal static string Frontend_BackendConnectionFault_Title { + get { + return ResourceManager.GetString("Frontend_BackendConnectionFault_Title", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The server cannot hear the heartbeat from the backend process.. + /// + internal static string Frontend_BackendHeartbeatLost_Text { + get { + return ResourceManager.GetString("Frontend_BackendHeartbeatLost_Text", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Heartbeat Failure Level 2. + /// + internal static string Frontend_BackendHeartbeatLost_Title { + get { + return ResourceManager.GetString("Frontend_BackendHeartbeatLost_Title", resourceCulture); + } + } + } +} diff --git a/Logic/Resources/Logic.Support.ErrorMessages.resx b/Logic/Resources/Logic.Support.ErrorMessages.resx new file mode 100644 index 00000000..e6131d64 --- /dev/null +++ b/Logic/Resources/Logic.Support.ErrorMessages.resx @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + The server has lost the connection to the bitcoin blockchain. Bitcoin transactions won't be detected in real time. + + + Blockchain Connection Lost + + + The web browser is unable to hear the server's heartbeat. + + + Heartbeat Failure Level 1 + + + Unable to connect to the server for real-time updates. + + + WebSocket Failure + + + The server is unable to connect to the backend process. Real-time updates will be largely unavailable. + + + Backend Connection Failure + + + The server cannot hear the heartbeat from the backend process. + + + Heartbeat Failure Level 2 + + \ No newline at end of file diff --git a/Logic/Resources/SourceResourceFiles.txt b/Logic/Resources/SourceResourceFiles.txt index 123a1d43..93931b3a 100644 --- a/Logic/Resources/SourceResourceFiles.txt +++ b/Logic/Resources/SourceResourceFiles.txt @@ -9,3 +9,4 @@ Logic.Structure.Geography.resx Logic.Swarm.DashboardTodos.resx Logic.Swarm.ParticipantTitle.resx Logic.Swarm.Position.resx +Logic.Support.ErrorMessages.resx \ No newline at end of file diff --git a/Logic/Support/ErrorMessages.cs b/Logic/Support/ErrorMessages.cs new file mode 100644 index 00000000..57f27cb5 --- /dev/null +++ b/Logic/Support/ErrorMessages.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Resources; +using System.Text; +using System.Threading.Tasks; +using Swarmops.Logic.Resources; + +namespace Swarmops.Logic.Support +{ + public class ErrorMessages + { + public static string Localize(string errorMessage, string culture = null) + { + if (String.IsNullOrEmpty(culture)) + { + return @"" + Logic_Support_ErrorMessages.ResourceManager.GetString(errorMessage + "_Title") + + @": " + + Logic_Support_ErrorMessages.ResourceManager.GetString(errorMessage + "_Text"); + } + else + { + return @"" + Logic_Support_ErrorMessages.ResourceManager.GetString(errorMessage + "_Title", CultureInfo.CreateSpecificCulture(culture)) + + @": " + + Logic_Support_ErrorMessages.ResourceManager.GetString(errorMessage + "_Text", CultureInfo.CreateSpecificCulture(culture)); + } + } +} From a9fa58440cda7ad835e6f2412b383eb076e0620d Mon Sep 17 00:00:00 2001 From: Falkvinge Date: Fri, 17 Mar 2017 13:04:36 +0100 Subject: [PATCH 34/40] More Sandbox testing --- Logic/Support/ErrorMessages.cs | 10 ++++-- Site/Master-v5.master | 9 ++++- Site/Master-v5.master.cs | 14 ++++++++ Site/Scripts/Swarmops-v5.js | 63 +++++++++++++++++++++++++++++----- 4 files changed, 84 insertions(+), 12 deletions(-) diff --git a/Logic/Support/ErrorMessages.cs b/Logic/Support/ErrorMessages.cs index 57f27cb5..59420606 100644 --- a/Logic/Support/ErrorMessages.cs +++ b/Logic/Support/ErrorMessages.cs @@ -11,7 +11,7 @@ namespace Swarmops.Logic.Support { public class ErrorMessages { - public static string Localize(string errorMessage, string culture = null) + public static string Localized(string errorMessage, string culture = null) { if (String.IsNullOrEmpty(culture)) { @@ -21,9 +21,13 @@ namespace Swarmops.Logic.Support } else { - return @"" + Logic_Support_ErrorMessages.ResourceManager.GetString(errorMessage + "_Title", CultureInfo.CreateSpecificCulture(culture)) + + return @"" + + Logic_Support_ErrorMessages.ResourceManager.GetString(errorMessage + "_Title", + CultureInfo.CreateSpecificCulture(culture)) + @": " + - Logic_Support_ErrorMessages.ResourceManager.GetString(errorMessage + "_Text", CultureInfo.CreateSpecificCulture(culture)); + Logic_Support_ErrorMessages.ResourceManager.GetString(errorMessage + "_Text", + CultureInfo.CreateSpecificCulture(culture)); } } + } } diff --git a/Site/Master-v5.master b/Site/Master-v5.master index 09e78a4a..9c7a644a 100644 --- a/Site/Master-v5.master +++ b/Site/Master-v5.master @@ -773,8 +773,15 @@ var _master_bitIdRegisterSuccess = false; + // some localized error messages, used in Swarmops-v5.js (yes, I know it's ugly to split like that, but + // Swarmops-v5.js isn't run through the ASPX filter and therefore not localized) + + var _errorDisplay_clientSocketLost = SwarmopsJS.unescape('<%=this.Localized_ClientError_SocketFail%>'); + var _errorDisplay_clientHeartbeatLost = SwarmopsJS.unescape('<%=this.Localized_ClientError_HeartbeatFail%>'); + - + + diff --git a/Site/Master-v5.master.cs b/Site/Master-v5.master.cs index b29959f8..3814d438 100644 --- a/Site/Master-v5.master.cs +++ b/Site/Master-v5.master.cs @@ -520,6 +520,20 @@ namespace Swarmops.Frontend } + public string Localized_ClientError_SocketFail + { + get + { + return + CommonV5.JavascriptEscape( + ErrorMessages.Localized("Client_ServerConnectionFault")); + } + } + + public string Localized_ClientError_HeartbeatFail + { + get { return CommonV5.JavascriptEscape(ErrorMessages.Localized("Client_ServerHeartbeatLost")); } + } public string GenerateBitIdToken { diff --git a/Site/Scripts/Swarmops-v5.js b/Site/Scripts/Swarmops-v5.js index b30fe165..1c2c516e 100644 --- a/Site/Scripts/Swarmops-v5.js +++ b/Site/Scripts/Swarmops-v5.js @@ -2,6 +2,7 @@ var _masterSocket; var _masterSocketHeartbeatsLost; +var _masterSocketLastHeartbeat; function _masterInitializeSocket(authenticationTicket) { @@ -15,24 +16,35 @@ function _masterInitializeSocket(authenticationTicket) { _masterSocket = new WebSocket(socketUrl); _masterSocket.onopen = function(data) { if (_masterSocketHeartbeatsLost) { - // Reload all edits and the edit pool. If there are discrepancies, we can probably live with them. (Detect editing?) - //alertify.log("Backend connection restored without interruption."); - _masterSocketHeartbeatsLost = false; } + if (_error_ClientSocketLost) { + _error_ClientSocketLost = false; + updateMalfunctions(); + } //watchHeartbeat(); }; - _masterSocket.onclose = function(data) { /* TODO: try reconnecting */ }; - _masterSocket.onerror = function(data) { alertify.error("WARNING: Socket connection error - realtime updates will not be available"); }; - _masterSocket.onmessage = function(data) { + + _masterSocket.onclose = function(data) { + _error_ClientSocketLost = true; + updateMalfunctions(); + }; + _masterSocket.onerror = function (data) { + if (!_error_ClientSocketLost) { + alertify.error("WARNING: Socket connection error - realtime updates will not be available"); + } + }; + + _masterSocket.onmessage = function (data) { console.log(data.data); var message = $.parseJSON(data.data); if (message.MessageType == "Heartbeat") { - //alertify.log("Master socket heartbeat: " + message.Timestamp); + _masterSocketLastHeartbeat = new Date().getTime(); + } else if (message.MessageType == "BitcoinReceived") { // console.log("Currency is " + message.Currency); @@ -44,11 +56,12 @@ function _masterInitializeSocket(authenticationTicket) { } if (!handled) { + // Otherwise make a log note at the bottom right of the screen alertify.log("Bitcoin received: " + message.Currency + " " + message.CentsFormatted); } } else if (message.MessageType == "Malfunctions") { - updateListBox($('#divMalfunctionsList'), message.MalfunctionsList); + updateMalfunctions (message.MalfunctionsList); } else if (message.MessageType == "SandboxUpdate") { if (odoLocalParticipation != undefined) { // Real ugly accessing specific page elements here, but it's temporary @@ -70,6 +83,40 @@ function getMasterSocketAddress() { } } + +function updateMalfunctions(serverList) { + + if (serverList === undefined) { + serverList = _master_LastServerMalfunctionsList; + } else { + _master_LastServerMalfunctionsList = serverList; + } + + var serverArray = Array.from(serverList); + if (_masterSocketHeartbeatsLost) { + serverArray.push(constructMalfunctionData("ClientHeartbeat", _errorDisplay_clientHeartbeatLost)); + } + if (_error_ClientSocketLost) { + serverArray.push(constructMalfunctionData("ClientSocket", _errorDisplay_clientSocketLost)); + } + + updateListBox($('#divMalfunctionsList'), serverArray); +} + +function constructMalfunctionData(id, text, icon, link) { + var newItem = {}; + newItem.Id = id; + newItem.Text = text; + newItem.Icon = icon; + newItem.Link = link; + + return newItem; +} + +var _master_LastServerMalfunctionsList = []; +var _error_ClientSocketLost = false; + + // ------------------- List updating -------------------------- From a586040b51875c95dbbce427891d14d32268bbc7 Mon Sep 17 00:00:00 2001 From: Falkvinge Date: Fri, 17 Mar 2017 13:15:28 +0100 Subject: [PATCH 35/40] More Sandbox testing --- Site/Master-v5.master.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Site/Master-v5.master.cs b/Site/Master-v5.master.cs index 3814d438..29cdb0e5 100644 --- a/Site/Master-v5.master.cs +++ b/Site/Master-v5.master.cs @@ -526,7 +526,7 @@ namespace Swarmops.Frontend { return CommonV5.JavascriptEscape( - ErrorMessages.Localized("Client_ServerConnectionFault")); + ErrorMessages.Localized("Client_SocketConnectionFault")); } } From b32fc50088e859cbac29efcd5ccbf4b3e1b89c17 Mon Sep 17 00:00:00 2001 From: Falkvinge Date: Fri, 17 Mar 2017 19:10:53 +0100 Subject: [PATCH 36/40] Client errors seem to mostly work --- .../Logic.Support.ErrorMessages.Designer.cs | 2 +- .../Logic.Support.ErrorMessages.resx | 2 +- Site/Master-v5.master | 6 +- Site/Scripts/Swarmops-v5.js | 127 +++++++++++++++--- Site/Scripts/jquery-ui.1.11.1.min.js | 13 ++ Site/Scripts/jquery.2.0.3.min.js | 6 + Site/Site.csproj | 2 + todo.txt | 2 +- 8 files changed, 140 insertions(+), 20 deletions(-) create mode 100644 Site/Scripts/jquery-ui.1.11.1.min.js create mode 100644 Site/Scripts/jquery.2.0.3.min.js diff --git a/Logic/Resources/Logic.Support.ErrorMessages.Designer.cs b/Logic/Resources/Logic.Support.ErrorMessages.Designer.cs index 7fa591ae..1897a934 100644 --- a/Logic/Resources/Logic.Support.ErrorMessages.Designer.cs +++ b/Logic/Resources/Logic.Support.ErrorMessages.Designer.cs @@ -79,7 +79,7 @@ namespace Swarmops.Logic.Resources { } /// - /// Looks up a localized string similar to The web browser is unable to hear the server's heartbeat.. + /// Looks up a localized string similar to The web browser is unable to hear the server's heartbeat. Real-time updates may not be available.. /// internal static string Client_ServerHeartbeatLost_Text { get { diff --git a/Logic/Resources/Logic.Support.ErrorMessages.resx b/Logic/Resources/Logic.Support.ErrorMessages.resx index e6131d64..3607ea86 100644 --- a/Logic/Resources/Logic.Support.ErrorMessages.resx +++ b/Logic/Resources/Logic.Support.ErrorMessages.resx @@ -124,7 +124,7 @@ Blockchain Connection Lost - The web browser is unable to hear the server's heartbeat. + The web browser is unable to hear the server's heartbeat. Real-time updates may not be available. Heartbeat Failure Level 1 diff --git a/Site/Master-v5.master b/Site/Master-v5.master index 9c7a644a..c669f5f3 100644 --- a/Site/Master-v5.master +++ b/Site/Master-v5.master @@ -12,8 +12,10 @@ - - + + + + diff --git a/Site/Scripts/Swarmops-v5.js b/Site/Scripts/Swarmops-v5.js index 1c2c516e..24eb8c69 100644 --- a/Site/Scripts/Swarmops-v5.js +++ b/Site/Scripts/Swarmops-v5.js @@ -2,10 +2,24 @@ var _masterSocket; var _masterSocketHeartbeatsLost; -var _masterSocketLastHeartbeat; +var _masterWatchingHeartbeat = false; +var _masterSocketLastHeartbeat = -1; +var _masterAuthenticationTicket = ""; function _masterInitializeSocket(authenticationTicket) { + + // Our first call should always be with an auth ticket; save this for later use + + if (authenticationTicket === undefined) { + authenticationTicket = _masterAuthenticationTicket; + } else { + _masterAuthenticationTicket = authenticationTicket; + } + + // If we're being called to restore communications in case of a heartbeat failure, + // close the channel first or the server will think we're still here + if (_masterSocket != null) { _masterSocket.close(); _masterSocket = null; @@ -13,26 +27,45 @@ function _masterInitializeSocket(authenticationTicket) { var socketUrl = getMasterSocketAddress() + "?Auth=" + authenticationTicket; + // Create instance and open socket + _masterSocket = new WebSocket(socketUrl); + + // Set events + _masterSocket.onopen = function(data) { - if (_masterSocketHeartbeatsLost) { - _masterSocketHeartbeatsLost = false; - } + console.log("MasterSocket.OnOpen();"); + if (_error_ClientSocketLost) { _error_ClientSocketLost = false; updateMalfunctions(); } - //watchHeartbeat(); + // If this is the first .open, start the heartbeat watcher + + if (!_masterWatchingHeartbeat) { + watchHeartbeat(); + } }; - _masterSocket.onclose = function(data) { + _masterSocket.onclose = function (data) { + + console.log("MasterSocket.OnClose();"); _error_ClientSocketLost = true; updateMalfunctions(); + + if (!_masterWatchingHeartbeat) { + watchHeartbeat(); // begin watch heartbeat if open never happened + } }; + _masterSocket.onerror = function (data) { + + console.log("MasterSocket.OnError();"); if (!_error_ClientSocketLost) { alertify.error("WARNING: Socket connection error - realtime updates will not be available"); + _error_ClientSocketLost = true; + updateMalfunctions(); } }; @@ -44,7 +77,13 @@ function _masterInitializeSocket(authenticationTicket) { if (message.MessageType == "Heartbeat") { _masterSocketLastHeartbeat = new Date().getTime(); + console.log("Heartbeat"); + if (_masterSocketHeartbeatsLost) { + console.log(" - receiving heartbeats again"); + _masterSocketHeartbeatsLost = false; + updateMalfunctions(); + } } else if (message.MessageType == "BitcoinReceived") { // console.log("Currency is " + message.Currency); @@ -74,6 +113,43 @@ function _masterInitializeSocket(authenticationTicket) { }; } +function watchHeartbeat() { + console.log("WatchHeartbeat()"); + + _masterWatchingHeartbeat = true; + + // Check again for a new heartbeat in ten seconds + + setTimeout(function () { + watchHeartbeat(); + }, 10000); + + // Have we lost the socket connection? If so, use this to try reconnecting + + if (_error_ClientSocketLost) { + console.log(" - trying to reinit socket"); + _masterInitializeSocket(); + } + + // If we got a heartbeat more than fifteen seconds ago, we've lost the heartbeat + + console.log(" - checking timestamps"); + + if (_masterSocketLastHeartbeat != -1 && !_masterSocketHeartbeatsLost) { // if we've received any at all + var curTime = new Date().getTime(); + var diff = (curTime - _masterSocketLastHeartbeat) / 1000; + console.log(" - last heartbeat was " + diff + " seconds ago"); + if (diff > 15) { + console.log(" - Heartbeats LOST"); + _masterSocketHeartbeatsLost = true; + updateMalfunctions(); + } + } else { + console.log(" - no previous heartbeat received"); + } +} + + function getMasterSocketAddress() { if (location.host.indexOf ("localhost") >= 0) { // Assume dev environment, go for sandbox socket return 'ws://sandbox.swarmops.com/ws/Front'; @@ -86,21 +162,31 @@ function getMasterSocketAddress() { function updateMalfunctions(serverList) { + console.log("UpdateMalfunctions();"); + if (serverList === undefined) { - serverList = _master_LastServerMalfunctionsList; + serverList = JSON.parse(JSON.stringify(_master_LastServerMalfunctionsList)); // deep copy } else { - _master_LastServerMalfunctionsList = serverList; + _master_LastServerMalfunctionsList = JSON.parse(JSON.stringify(serverList)); // deep copy } - var serverArray = Array.from(serverList); - if (_masterSocketHeartbeatsLost) { - serverArray.push(constructMalfunctionData("ClientHeartbeat", _errorDisplay_clientHeartbeatLost)); + if (serverList === undefined) { // init edge case + serverList = []; + _master_LastServerMalfunctionsList = []; } + if (_error_ClientSocketLost) { - serverArray.push(constructMalfunctionData("ClientSocket", _errorDisplay_clientSocketLost)); + console.log("Foo2"); + serverList.push(constructMalfunctionData("ClientSocket", _errorDisplay_clientSocketLost)); + } + else if (_masterSocketHeartbeatsLost) { + console.log("Foo1"); + serverList.push(constructMalfunctionData("ClientHeartbeat", _errorDisplay_clientHeartbeatLost)); } - updateListBox($('#divMalfunctionsList'), serverArray); + console.log("Bar"); + + updateListBox($('#divMalfunctionsList'), serverList); } function constructMalfunctionData(id, text, icon, link) { @@ -125,13 +211,18 @@ function updateListBox(box, listData) { // box is a div-div-ul-li nest containing the li:s with the id // the function syncs the box to the list with some nice fades + console.log("UpdateListBox();"); + // Is the box visible right now? var boxVisible = $(box).is(":visible"); // Step 1: Iterate through list, build id array - var listArray = Array.from(listData); + console.log(" - step 1"); + + var listArray = listData; + console.log(listArray); var idListLookup = {}; if (listData.length > 0) { listArray.forEach(function(item, index) { @@ -142,6 +233,8 @@ function updateListBox(box, listData) { // Step 2: Iterate through box, change texts of matching ids, // remove items that aren't in list, build id array + console.log(" - step 2"); + var idBoxLookup = {}; var listContainer = $(box).parent().parent(); var listElements = $(box).children(); @@ -165,7 +258,9 @@ function updateListBox(box, listData) { }); } -// Step 3: Iterate through list, add missing items + // Step 3: Iterate through list, add missing items + + console.log(" - step 3"); if (listElements.length == 0) { @@ -188,6 +283,8 @@ function updateListBox(box, listData) { // Step 4: Adjust visibility as required + console.log(" - fixing visibility"); + var listEmpty = (!$.isArray(listArray) || !listArray.length); if (!boxVisible && !listEmpty) { diff --git a/Site/Scripts/jquery-ui.1.11.1.min.js b/Site/Scripts/jquery-ui.1.11.1.min.js new file mode 100644 index 00000000..ae0cb71b --- /dev/null +++ b/Site/Scripts/jquery-ui.1.11.1.min.js @@ -0,0 +1,13 @@ +/*! jQuery UI - v1.11.1 - 2014-08-13 +* http://jqueryui.com +* Includes: core.js, widget.js, mouse.js, position.js, accordion.js, autocomplete.js, button.js, datepicker.js, dialog.js, draggable.js, droppable.js, effect.js, effect-blind.js, effect-bounce.js, effect-clip.js, effect-drop.js, effect-explode.js, effect-fade.js, effect-fold.js, effect-highlight.js, effect-puff.js, effect-pulsate.js, effect-scale.js, effect-shake.js, effect-size.js, effect-slide.js, effect-transfer.js, menu.js, progressbar.js, resizable.js, selectable.js, selectmenu.js, slider.js, sortable.js, spinner.js, tabs.js, tooltip.js +* Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */ + +(function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)})(function(e){function t(t,s){var n,a,o,r=t.nodeName.toLowerCase();return"area"===r?(n=t.parentNode,a=n.name,t.href&&a&&"map"===n.nodeName.toLowerCase()?(o=e("img[usemap='#"+a+"']")[0],!!o&&i(o)):!1):(/input|select|textarea|button|object/.test(r)?!t.disabled:"a"===r?t.href||s:s)&&i(t)}function i(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return"hidden"===e.css(this,"visibility")}).length}function s(e){for(var t,i;e.length&&e[0]!==document;){if(t=e.css("position"),("absolute"===t||"relative"===t||"fixed"===t)&&(i=parseInt(e.css("zIndex"),10),!isNaN(i)&&0!==i))return i;e=e.parent()}return 0}function n(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},e.extend(this._defaults,this.regional[""]),this.regional.en=e.extend(!0,{},this.regional[""]),this.regional["en-US"]=e.extend(!0,{},this.regional.en),this.dpDiv=a(e("
        "))}function a(t){var i="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return t.delegate(i,"mouseout",function(){e(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).removeClass("ui-datepicker-next-hover")}).delegate(i,"mouseover",o)}function o(){e.datepicker._isDisabledDatepicker(v.inline?v.dpDiv.parent()[0]:v.input[0])||(e(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),e(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).addClass("ui-datepicker-next-hover"))}function r(t,i){e.extend(t,i);for(var s in i)null==i[s]&&(t[s]=i[s]);return t}function h(e){return function(){var t=this.element.val();e.apply(this,arguments),this._refresh(),t!==this.element.val()&&this._trigger("change")}}e.ui=e.ui||{},e.extend(e.ui,{version:"1.11.1",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({scrollParent:function(t){var i=this.css("position"),s="absolute"===i,n=t?/(auto|scroll|hidden)/:/(auto|scroll)/,a=this.parents().filter(function(){var t=e(this);return s&&"static"===t.css("position")?!1:n.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))}).eq(0);return"fixed"!==i&&a.length?a:e(this[0].ownerDocument||document)},uniqueId:function(){var e=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++e)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(i){return!!e.data(i,t)}}):function(t,i,s){return!!e.data(t,s[3])},focusable:function(i){return t(i,!isNaN(e.attr(i,"tabindex")))},tabbable:function(i){var s=e.attr(i,"tabindex"),n=isNaN(s);return(n||s>=0)&&t(i,!n)}}),e("").outerWidth(1).jquery||e.each(["Width","Height"],function(t,i){function s(t,i,s,a){return e.each(n,function(){i-=parseFloat(e.css(t,"padding"+this))||0,s&&(i-=parseFloat(e.css(t,"border"+this+"Width"))||0),a&&(i-=parseFloat(e.css(t,"margin"+this))||0)}),i}var n="Width"===i?["Left","Right"]:["Top","Bottom"],a=i.toLowerCase(),o={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+i]=function(t){return void 0===t?o["inner"+i].call(this):this.each(function(){e(this).css(a,s(this,t)+"px")})},e.fn["outer"+i]=function(t,n){return"number"!=typeof t?o["outer"+i].call(this,t):this.each(function(){e(this).css(a,s(this,t,!0,n)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e("").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(i){return arguments.length?t.call(this,e.camelCase(i)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.fn.extend({focus:function(t){return function(i,s){return"number"==typeof i?this.each(function(){var t=this;setTimeout(function(){e(t).focus(),s&&s.call(t)},i)}):t.apply(this,arguments)}}(e.fn.focus),disableSelection:function(){var e="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.bind(e+".ui-disableSelection",function(e){e.preventDefault()})}}(),enableSelection:function(){return this.unbind(".ui-disableSelection")},zIndex:function(t){if(void 0!==t)return this.css("zIndex",t);if(this.length)for(var i,s,n=e(this[0]);n.length&&n[0]!==document;){if(i=n.css("position"),("absolute"===i||"relative"===i||"fixed"===i)&&(s=parseInt(n.css("zIndex"),10),!isNaN(s)&&0!==s))return s;n=n.parent()}return 0}}),e.ui.plugin={add:function(t,i,s){var n,a=e.ui[t].prototype;for(n in s)a.plugins[n]=a.plugins[n]||[],a.plugins[n].push([i,s[n]])},call:function(e,t,i,s){var n,a=e.plugins[t];if(a&&(s||e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType))for(n=0;a.length>n;n++)e.options[a[n][0]]&&a[n][1].apply(e.element,i)}};var l=0,u=Array.prototype.slice;e.cleanData=function(t){return function(i){var s,n,a;for(a=0;null!=(n=i[a]);a++)try{s=e._data(n,"events"),s&&s.remove&&e(n).triggerHandler("remove")}catch(o){}t(i)}}(e.cleanData),e.widget=function(t,i,s){var n,a,o,r,h={},l=t.split(".")[0];return t=t.split(".")[1],n=l+"-"+t,s||(s=i,i=e.Widget),e.expr[":"][n.toLowerCase()]=function(t){return!!e.data(t,n)},e[l]=e[l]||{},a=e[l][t],o=e[l][t]=function(e,t){return this._createWidget?(arguments.length&&this._createWidget(e,t),void 0):new o(e,t)},e.extend(o,a,{version:s.version,_proto:e.extend({},s),_childConstructors:[]}),r=new i,r.options=e.widget.extend({},r.options),e.each(s,function(t,s){return e.isFunction(s)?(h[t]=function(){var e=function(){return i.prototype[t].apply(this,arguments)},n=function(e){return i.prototype[t].apply(this,e)};return function(){var t,i=this._super,a=this._superApply;return this._super=e,this._superApply=n,t=s.apply(this,arguments),this._super=i,this._superApply=a,t}}(),void 0):(h[t]=s,void 0)}),o.prototype=e.widget.extend(r,{widgetEventPrefix:a?r.widgetEventPrefix||t:t},h,{constructor:o,namespace:l,widgetName:t,widgetFullName:n}),a?(e.each(a._childConstructors,function(t,i){var s=i.prototype;e.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete a._childConstructors):i._childConstructors.push(o),e.widget.bridge(t,o),o},e.widget.extend=function(t){for(var i,s,n=u.call(arguments,1),a=0,o=n.length;o>a;a++)for(i in n[a])s=n[a][i],n[a].hasOwnProperty(i)&&void 0!==s&&(t[i]=e.isPlainObject(s)?e.isPlainObject(t[i])?e.widget.extend({},t[i],s):e.widget.extend({},s):s);return t},e.widget.bridge=function(t,i){var s=i.prototype.widgetFullName||t;e.fn[t]=function(n){var a="string"==typeof n,o=u.call(arguments,1),r=this;return n=!a&&o.length?e.widget.extend.apply(null,[n].concat(o)):n,a?this.each(function(){var i,a=e.data(this,s);return"instance"===n?(r=a,!1):a?e.isFunction(a[n])&&"_"!==n.charAt(0)?(i=a[n].apply(a,o),i!==a&&void 0!==i?(r=i&&i.jquery?r.pushStack(i.get()):i,!1):void 0):e.error("no such method '"+n+"' for "+t+" widget instance"):e.error("cannot call methods on "+t+" prior to initialization; "+"attempted to call method '"+n+"'")}):this.each(function(){var t=e.data(this,s);t?(t.option(n||{}),t._init&&t._init()):e.data(this,s,new i(n,this))}),r}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"
        ",options:{disabled:!1,create:null},_createWidget:function(t,i){i=e(i||this.defaultElement||this)[0],this.element=e(i),this.uuid=l++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this.bindings=e(),this.hoverable=e(),this.focusable=e(),i!==this&&(e.data(i,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===i&&this.destroy()}}),this.document=e(i.style?i.ownerDocument:i.document||i),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(t,i){var s,n,a,o=t;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof t)if(o={},s=t.split("."),t=s.shift(),s.length){for(n=o[t]=e.widget.extend({},this.options[t]),a=0;s.length-1>a;a++)n[s[a]]=n[s[a]]||{},n=n[s[a]];if(t=s.pop(),1===arguments.length)return void 0===n[t]?null:n[t];n[t]=i}else{if(1===arguments.length)return void 0===this.options[t]?null:this.options[t];o[t]=i}return this._setOptions(o),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,"disabled"===e&&(this.widget().toggleClass(this.widgetFullName+"-disabled",!!t),t&&(this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus"))),this},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_on:function(t,i,s){var n,a=this;"boolean"!=typeof t&&(s=i,i=t,t=!1),s?(i=n=e(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),e.each(s,function(s,o){function r(){return t||a.options.disabled!==!0&&!e(this).hasClass("ui-state-disabled")?("string"==typeof o?a[o]:o).apply(a,arguments):void 0}"string"!=typeof o&&(r.guid=o.guid=o.guid||r.guid||e.guid++);var h=s.match(/^([\w:-]*)\s*(.*)$/),l=h[1]+a.eventNamespace,u=h[2];u?n.delegate(u,l,r):i.bind(l,r)})},_off:function(e,t){t=(t||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.unbind(t).undelegate(t)},_delay:function(e,t){function i(){return("string"==typeof e?s[e]:e).apply(s,arguments)}var s=this;return setTimeout(i,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,i,s){var n,a,o=this.options[t];if(s=s||{},i=e.Event(i),i.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),i.target=this.element[0],a=i.originalEvent)for(n in a)n in i||(i[n]=a[n]);return this.element.trigger(i,s),!(e.isFunction(o)&&o.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,i){e.Widget.prototype["_"+t]=function(s,n,a){"string"==typeof n&&(n={effect:n});var o,r=n?n===!0||"number"==typeof n?i:n.effect||i:t;n=n||{},"number"==typeof n&&(n={duration:n}),o=!e.isEmptyObject(n),n.complete=a,n.delay&&s.delay(n.delay),o&&e.effects&&e.effects.effect[r]?s[t](n):r!==t&&s[r]?s[r](n.duration,n.easing,a):s.queue(function(i){e(this)[t](),a&&a.call(s[0]),i()})}}),e.widget;var d=!1;e(document).mouseup(function(){d=!1}),e.widget("ui.mouse",{version:"1.11.1",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(i){return!0===e.data(i.target,t.widgetName+".preventClickEvent")?(e.removeData(i.target,t.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(t){if(!d){this._mouseStarted&&this._mouseUp(t),this._mouseDownEvent=t;var i=this,s=1===t.which,n="string"==typeof this.options.cancel&&t.target.nodeName?e(t.target).closest(this.options.cancel).length:!1;return s&&!n&&this._mouseCapture(t)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(t)!==!1,!this._mouseStarted)?(t.preventDefault(),!0):(!0===e.data(t.target,this.widgetName+".preventClickEvent")&&e.removeData(t.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return i._mouseMove(e)},this._mouseUpDelegate=function(e){return i._mouseUp(e)},this.document.bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),t.preventDefault(),d=!0,!0)):!0}},_mouseMove:function(t){return e.ui.ie&&(!document.documentMode||9>document.documentMode)&&!t.button?this._mouseUp(t):t.which?this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted):this._mouseUp(t)},_mouseUp:function(t){return this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),d=!1,!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),function(){function t(e,t,i){return[parseFloat(e[0])*(p.test(e[0])?t/100:1),parseFloat(e[1])*(p.test(e[1])?i/100:1)]}function i(t,i){return parseInt(e.css(t,i),10)||0}function s(t){var i=t[0];return 9===i.nodeType?{width:t.width(),height:t.height(),offset:{top:0,left:0}}:e.isWindow(i)?{width:t.width(),height:t.height(),offset:{top:t.scrollTop(),left:t.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:t.outerWidth(),height:t.outerHeight(),offset:t.offset()}}e.ui=e.ui||{};var n,a,o=Math.max,r=Math.abs,h=Math.round,l=/left|center|right/,u=/top|center|bottom/,d=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,p=/%$/,f=e.fn.position;e.position={scrollbarWidth:function(){if(void 0!==n)return n;var t,i,s=e("
        "),a=s.children()[0];return e("body").append(s),t=a.offsetWidth,s.css("overflow","scroll"),i=a.offsetWidth,t===i&&(i=s[0].clientWidth),s.remove(),n=t-i},getScrollInfo:function(t){var i=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),s=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),n="scroll"===i||"auto"===i&&t.widthi?"left":t>0?"right":"center",vertical:0>a?"top":s>0?"bottom":"middle"};d>m&&m>r(t+i)&&(h.horizontal="center"),c>g&&g>r(s+a)&&(h.vertical="middle"),h.important=o(r(t),r(i))>o(r(s),r(a))?"horizontal":"vertical",n.using.call(this,e,h)}),u.offset(e.extend(M,{using:l}))})},e.ui.position={fit:{left:function(e,t){var i,s=t.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=e.left-t.collisionPosition.marginLeft,h=n-r,l=r+t.collisionWidth-a-n;t.collisionWidth>a?h>0&&0>=l?(i=e.left+h+t.collisionWidth-a-n,e.left+=h-i):e.left=l>0&&0>=h?n:h>l?n+a-t.collisionWidth:n:h>0?e.left+=h:l>0?e.left-=l:e.left=o(e.left-r,e.left)},top:function(e,t){var i,s=t.within,n=s.isWindow?s.scrollTop:s.offset.top,a=t.within.height,r=e.top-t.collisionPosition.marginTop,h=n-r,l=r+t.collisionHeight-a-n;t.collisionHeight>a?h>0&&0>=l?(i=e.top+h+t.collisionHeight-a-n,e.top+=h-i):e.top=l>0&&0>=h?n:h>l?n+a-t.collisionHeight:n:h>0?e.top+=h:l>0?e.top-=l:e.top=o(e.top-r,e.top)}},flip:{left:function(e,t){var i,s,n=t.within,a=n.offset.left+n.scrollLeft,o=n.width,h=n.isWindow?n.scrollLeft:n.offset.left,l=e.left-t.collisionPosition.marginLeft,u=l-h,d=l+t.collisionWidth-o-h,c="left"===t.my[0]?-t.elemWidth:"right"===t.my[0]?t.elemWidth:0,p="left"===t.at[0]?t.targetWidth:"right"===t.at[0]?-t.targetWidth:0,f=-2*t.offset[0];0>u?(i=e.left+c+p+f+t.collisionWidth-o-a,(0>i||r(u)>i)&&(e.left+=c+p+f)):d>0&&(s=e.left-t.collisionPosition.marginLeft+c+p+f-h,(s>0||d>r(s))&&(e.left+=c+p+f))},top:function(e,t){var i,s,n=t.within,a=n.offset.top+n.scrollTop,o=n.height,h=n.isWindow?n.scrollTop:n.offset.top,l=e.top-t.collisionPosition.marginTop,u=l-h,d=l+t.collisionHeight-o-h,c="top"===t.my[1],p=c?-t.elemHeight:"bottom"===t.my[1]?t.elemHeight:0,f="top"===t.at[1]?t.targetHeight:"bottom"===t.at[1]?-t.targetHeight:0,m=-2*t.offset[1];0>u?(s=e.top+p+f+m+t.collisionHeight-o-a,e.top+p+f+m>u&&(0>s||r(u)>s)&&(e.top+=p+f+m)):d>0&&(i=e.top-t.collisionPosition.marginTop+p+f+m-h,e.top+p+f+m>d&&(i>0||d>r(i))&&(e.top+=p+f+m))}},flipfit:{left:function(){e.ui.position.flip.left.apply(this,arguments),e.ui.position.fit.left.apply(this,arguments)},top:function(){e.ui.position.flip.top.apply(this,arguments),e.ui.position.fit.top.apply(this,arguments)}}},function(){var t,i,s,n,o,r=document.getElementsByTagName("body")[0],h=document.createElement("div");t=document.createElement(r?"div":"body"),s={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},r&&e.extend(s,{position:"absolute",left:"-1000px",top:"-1000px"});for(o in s)t.style[o]=s[o];t.appendChild(h),i=r||document.documentElement,i.insertBefore(t,i.firstChild),h.style.cssText="position: absolute; left: 10.7432222px;",n=e(h).offset().left,a=n>10&&11>n,t.innerHTML="",i.removeChild(t)}()}(),e.ui.position,e.widget("ui.accordion",{version:"1.11.1",options:{active:0,animate:{},collapsible:!1,event:"click",header:"> li > :first-child,> :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_create:function(){var t=this.options;this.prevShow=this.prevHide=e(),this.element.addClass("ui-accordion ui-widget ui-helper-reset").attr("role","tablist"),t.collapsible||t.active!==!1&&null!=t.active||(t.active=0),this._processPanels(),0>t.active&&(t.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():e()}},_createIcons:function(){var t=this.options.icons;t&&(e("").addClass("ui-accordion-header-icon ui-icon "+t.header).prependTo(this.headers),this.active.children(".ui-accordion-header-icon").removeClass(t.header).addClass(t.activeHeader),this.headers.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.removeClass("ui-accordion-icons").children(".ui-accordion-header-icon").remove()},_destroy:function(){var e;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.removeClass("ui-accordion-header ui-accordion-header-active ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("aria-controls").removeAttr("tabIndex").removeUniqueId(),this._destroyIcons(),e=this.headers.next().removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled").css("display","").removeAttr("role").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeUniqueId(),"content"!==this.options.heightStyle&&e.css("height","")},_setOption:function(e,t){return"active"===e?(this._activate(t),void 0):("event"===e&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(t)),this._super(e,t),"collapsible"!==e||t||this.options.active!==!1||this._activate(0),"icons"===e&&(this._destroyIcons(),t&&this._createIcons()),"disabled"===e&&(this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this.headers.add(this.headers.next()).toggleClass("ui-state-disabled",!!t)),void 0)},_keydown:function(t){if(!t.altKey&&!t.ctrlKey){var i=e.ui.keyCode,s=this.headers.length,n=this.headers.index(t.target),a=!1;switch(t.keyCode){case i.RIGHT:case i.DOWN:a=this.headers[(n+1)%s];break;case i.LEFT:case i.UP:a=this.headers[(n-1+s)%s];break;case i.SPACE:case i.ENTER:this._eventHandler(t);break;case i.HOME:a=this.headers[0];break;case i.END:a=this.headers[s-1]}a&&(e(t.target).attr("tabIndex",-1),e(a).attr("tabIndex",0),a.focus(),t.preventDefault())}},_panelKeyDown:function(t){t.keyCode===e.ui.keyCode.UP&&t.ctrlKey&&e(t.currentTarget).prev().focus()},refresh:function(){var t=this.options;this._processPanels(),t.active===!1&&t.collapsible===!0||!this.headers.length?(t.active=!1,this.active=e()):t.active===!1?this._activate(0):this.active.length&&!e.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(t.active=!1,this.active=e()):this._activate(Math.max(0,t.active-1)):t.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){this.headers=this.element.find(this.options.header).addClass("ui-accordion-header ui-state-default ui-corner-all"),this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").filter(":not(.ui-accordion-content-active)").hide()},_refresh:function(){var t,i=this.options,s=i.heightStyle,n=this.element.parent();this.active=this._findActive(i.active).addClass("ui-accordion-header-active ui-state-active ui-corner-top").removeClass("ui-corner-all"),this.active.next().addClass("ui-accordion-content-active").show(),this.headers.attr("role","tab").each(function(){var t=e(this),i=t.uniqueId().attr("id"),s=t.next(),n=s.uniqueId().attr("id");t.attr("aria-controls",n),s.attr("aria-labelledby",i)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(i.event),"fill"===s?(t=n.height(),this.element.siblings(":visible").each(function(){var i=e(this),s=i.css("position");"absolute"!==s&&"fixed"!==s&&(t-=i.outerHeight(!0))}),this.headers.each(function(){t-=e(this).outerHeight(!0)}),this.headers.next().each(function(){e(this).height(Math.max(0,t-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===s&&(t=0,this.headers.next().each(function(){t=Math.max(t,e(this).css("height","").height())}).height(t))},_activate:function(t){var i=this._findActive(t)[0];i!==this.active[0]&&(i=i||this.active[0],this._eventHandler({target:i,currentTarget:i,preventDefault:e.noop}))},_findActive:function(t){return"number"==typeof t?this.headers.eq(t):e()},_setupEvents:function(t){var i={keydown:"_keydown"};t&&e.each(t.split(" "),function(e,t){i[t]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(t){var i=this.options,s=this.active,n=e(t.currentTarget),a=n[0]===s[0],o=a&&i.collapsible,r=o?e():n.next(),h=s.next(),l={oldHeader:s,oldPanel:h,newHeader:o?e():n,newPanel:r};t.preventDefault(),a&&!i.collapsible||this._trigger("beforeActivate",t,l)===!1||(i.active=o?!1:this.headers.index(n),this.active=a?e():n,this._toggle(l),s.removeClass("ui-accordion-header-active ui-state-active"),i.icons&&s.children(".ui-accordion-header-icon").removeClass(i.icons.activeHeader).addClass(i.icons.header),a||(n.removeClass("ui-corner-all").addClass("ui-accordion-header-active ui-state-active ui-corner-top"),i.icons&&n.children(".ui-accordion-header-icon").removeClass(i.icons.header).addClass(i.icons.activeHeader),n.next().addClass("ui-accordion-content-active")))},_toggle:function(t){var i=t.newPanel,s=this.prevShow.length?this.prevShow:t.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=i,this.prevHide=s,this.options.animate?this._animate(i,s,t):(s.hide(),i.show(),this._toggleComplete(t)),s.attr({"aria-hidden":"true"}),s.prev().attr("aria-selected","false"),i.length&&s.length?s.prev().attr({tabIndex:-1,"aria-expanded":"false"}):i.length&&this.headers.filter(function(){return 0===e(this).attr("tabIndex")}).attr("tabIndex",-1),i.attr("aria-hidden","false").prev().attr({"aria-selected":"true",tabIndex:0,"aria-expanded":"true"})},_animate:function(e,t,i){var s,n,a,o=this,r=0,h=e.length&&(!t.length||e.index()",delay:300,options:{icons:{submenu:"ui-icon-carat-1-e"},items:"> *",menus:"ul",position:{my:"left-1 top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().addClass("ui-menu ui-widget ui-widget-content").toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length).attr({role:this.options.role,tabIndex:0}),this.options.disabled&&this.element.addClass("ui-state-disabled").attr("aria-disabled","true"),this._on({"mousedown .ui-menu-item":function(e){e.preventDefault()},"click .ui-menu-item":function(t){var i=e(t.target);!this.mouseHandled&&i.not(".ui-state-disabled").length&&(this.select(t),t.isPropagationStopped()||(this.mouseHandled=!0),i.has(".ui-menu").length?this.expand(t):!this.element.is(":focus")&&e(this.document[0].activeElement).closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(t){var i=e(t.currentTarget);i.siblings(".ui-state-active").removeClass("ui-state-active"),this.focus(t,i)},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(e,t){var i=this.active||this.element.find(this.options.items).eq(0);t||this.focus(e,i)},blur:function(t){this._delay(function(){e.contains(this.element[0],this.document[0].activeElement)||this.collapseAll(t)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(e){this._closeOnDocumentClick(e)&&this.collapseAll(e),this.mouseHandled=!1 +}})},_destroy:function(){this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeClass("ui-menu ui-widget ui-widget-content ui-menu-icons ui-front").removeAttr("role").removeAttr("tabIndex").removeAttr("aria-labelledby").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-disabled").removeUniqueId().show(),this.element.find(".ui-menu-item").removeClass("ui-menu-item").removeAttr("role").removeAttr("aria-disabled").removeUniqueId().removeClass("ui-state-hover").removeAttr("tabIndex").removeAttr("role").removeAttr("aria-haspopup").children().each(function(){var t=e(this);t.data("ui-menu-submenu-carat")&&t.remove()}),this.element.find(".ui-menu-divider").removeClass("ui-menu-divider ui-widget-content")},_keydown:function(t){function i(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}var s,n,a,o,r,h=!0;switch(t.keyCode){case e.ui.keyCode.PAGE_UP:this.previousPage(t);break;case e.ui.keyCode.PAGE_DOWN:this.nextPage(t);break;case e.ui.keyCode.HOME:this._move("first","first",t);break;case e.ui.keyCode.END:this._move("last","last",t);break;case e.ui.keyCode.UP:this.previous(t);break;case e.ui.keyCode.DOWN:this.next(t);break;case e.ui.keyCode.LEFT:this.collapse(t);break;case e.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(t);break;case e.ui.keyCode.ENTER:case e.ui.keyCode.SPACE:this._activate(t);break;case e.ui.keyCode.ESCAPE:this.collapse(t);break;default:h=!1,n=this.previousFilter||"",a=String.fromCharCode(t.keyCode),o=!1,clearTimeout(this.filterTimer),a===n?o=!0:a=n+a,r=RegExp("^"+i(a),"i"),s=this.activeMenu.find(this.options.items).filter(function(){return r.test(e(this).text())}),s=o&&-1!==s.index(this.active.next())?this.active.nextAll(".ui-menu-item"):s,s.length||(a=String.fromCharCode(t.keyCode),r=RegExp("^"+i(a),"i"),s=this.activeMenu.find(this.options.items).filter(function(){return r.test(e(this).text())})),s.length?(this.focus(t,s),s.length>1?(this.previousFilter=a,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter):delete this.previousFilter}h&&t.preventDefault()},_activate:function(e){this.active.is(".ui-state-disabled")||(this.active.is("[aria-haspopup='true']")?this.expand(e):this.select(e))},refresh:function(){var t,i,s=this,n=this.options.icons.submenu,a=this.element.find(this.options.menus);this.element.toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length),a.filter(":not(.ui-menu)").addClass("ui-menu ui-widget ui-widget-content ui-front").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var t=e(this),i=t.parent(),s=e("").addClass("ui-menu-icon ui-icon "+n).data("ui-menu-submenu-carat",!0);i.attr("aria-haspopup","true").prepend(s),t.attr("aria-labelledby",i.attr("id"))}),t=a.add(this.element),i=t.find(this.options.items),i.not(".ui-menu-item").each(function(){var t=e(this);s._isDivider(t)&&t.addClass("ui-widget-content ui-menu-divider")}),i.not(".ui-menu-item, .ui-menu-divider").addClass("ui-menu-item").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),i.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!e.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(e,t){"icons"===e&&this.element.find(".ui-menu-icon").removeClass(this.options.icons.submenu).addClass(t.submenu),"disabled"===e&&this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this._super(e,t)},focus:function(e,t){var i,s;this.blur(e,e&&"focus"===e.type),this._scrollIntoView(t),this.active=t.first(),s=this.active.addClass("ui-state-focus").removeClass("ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",s.attr("id")),this.active.parent().closest(".ui-menu-item").addClass("ui-state-active"),e&&"keydown"===e.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),i=t.children(".ui-menu"),i.length&&e&&/^mouse/.test(e.type)&&this._startOpening(i),this.activeMenu=t.parent(),this._trigger("focus",e,{item:t})},_scrollIntoView:function(t){var i,s,n,a,o,r;this._hasScroll()&&(i=parseFloat(e.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(e.css(this.activeMenu[0],"paddingTop"))||0,n=t.offset().top-this.activeMenu.offset().top-i-s,a=this.activeMenu.scrollTop(),o=this.activeMenu.height(),r=t.outerHeight(),0>n?this.activeMenu.scrollTop(a+n):n+r>o&&this.activeMenu.scrollTop(a+n-o+r))},blur:function(e,t){t||clearTimeout(this.timer),this.active&&(this.active.removeClass("ui-state-focus"),this.active=null,this._trigger("blur",e,{item:this.active}))},_startOpening:function(e){clearTimeout(this.timer),"true"===e.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(e)},this.delay))},_open:function(t){var i=e.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(t.parents(".ui-menu")).hide().attr("aria-hidden","true"),t.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(i)},collapseAll:function(t,i){clearTimeout(this.timer),this.timer=this._delay(function(){var s=i?this.element:e(t&&t.target).closest(this.element.find(".ui-menu"));s.length||(s=this.element),this._close(s),this.blur(t),this.activeMenu=s},this.delay)},_close:function(e){e||(e=this.active?this.active.parent():this.element),e.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false").end().find(".ui-state-active").not(".ui-state-focus").removeClass("ui-state-active")},_closeOnDocumentClick:function(t){return!e(t.target).closest(".ui-menu").length},_isDivider:function(e){return!/[^\-\u2014\u2013\s]/.test(e.text())},collapse:function(e){var t=this.active&&this.active.parent().closest(".ui-menu-item",this.element);t&&t.length&&(this._close(),this.focus(e,t))},expand:function(e){var t=this.active&&this.active.children(".ui-menu ").find(this.options.items).first();t&&t.length&&(this._open(t.parent()),this._delay(function(){this.focus(e,t)}))},next:function(e){this._move("next","first",e)},previous:function(e){this._move("prev","last",e)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(e,t,i){var s;this.active&&(s="first"===e||"last"===e?this.active["first"===e?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[e+"All"](".ui-menu-item").eq(0)),s&&s.length&&this.active||(s=this.activeMenu.find(this.options.items)[t]()),this.focus(i,s)},nextPage:function(t){var i,s,n;return this.active?(this.isLastItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return i=e(this),0>i.offset().top-s-n}),this.focus(t,i)):this.focus(t,this.activeMenu.find(this.options.items)[this.active?"last":"first"]())),void 0):(this.next(t),void 0)},previousPage:function(t){var i,s,n;return this.active?(this.isFirstItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return i=e(this),i.offset().top-s+n>0}),this.focus(t,i)):this.focus(t,this.activeMenu.find(this.options.items).first())),void 0):(this.next(t),void 0)},_hasScroll:function(){return this.element.outerHeight()",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,_create:function(){var t,i,s,n=this.element[0].nodeName.toLowerCase(),a="textarea"===n,o="input"===n;this.isMultiLine=a?!0:o?!1:this.element.prop("isContentEditable"),this.valueMethod=this.element[a||o?"val":"text"],this.isNewMenu=!0,this.element.addClass("ui-autocomplete-input").attr("autocomplete","off"),this._on(this.element,{keydown:function(n){if(this.element.prop("readOnly"))return t=!0,s=!0,i=!0,void 0;t=!1,s=!1,i=!1;var a=e.ui.keyCode;switch(n.keyCode){case a.PAGE_UP:t=!0,this._move("previousPage",n);break;case a.PAGE_DOWN:t=!0,this._move("nextPage",n);break;case a.UP:t=!0,this._keyEvent("previous",n);break;case a.DOWN:t=!0,this._keyEvent("next",n);break;case a.ENTER:this.menu.active&&(t=!0,n.preventDefault(),this.menu.select(n));break;case a.TAB:this.menu.active&&this.menu.select(n);break;case a.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(n),n.preventDefault());break;default:i=!0,this._searchTimeout(n)}},keypress:function(s){if(t)return t=!1,(!this.isMultiLine||this.menu.element.is(":visible"))&&s.preventDefault(),void 0;if(!i){var n=e.ui.keyCode;switch(s.keyCode){case n.PAGE_UP:this._move("previousPage",s);break;case n.PAGE_DOWN:this._move("nextPage",s);break;case n.UP:this._keyEvent("previous",s);break;case n.DOWN:this._keyEvent("next",s)}}},input:function(e){return s?(s=!1,e.preventDefault(),void 0):(this._searchTimeout(e),void 0)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(e){return this.cancelBlur?(delete this.cancelBlur,void 0):(clearTimeout(this.searching),this.close(e),this._change(e),void 0)}}),this._initSource(),this.menu=e("