From 2bc5c8b990d6799669f491136278c7b127c5de00 Mon Sep 17 00:00:00 2001 From: Rob L Date: Mon, 25 Jul 2016 12:52:06 -0400 Subject: [PATCH] Don't regenerate all fields if we just need the one - find by select --- js/GUI.Utils.js | 47 ++++++++++++++++++++++++++--------------------- webviewgl.htm | 2 +- 2 files changed, 27 insertions(+), 22 deletions(-) diff --git a/js/GUI.Utils.js b/js/GUI.Utils.js index 1367a81..168a8ec 100644 --- a/js/GUI.Utils.js +++ b/js/GUI.Utils.js @@ -26,7 +26,8 @@ $(document).ready(function() { drawline(grabPositionByName($('#pointa option:selected').text()),grabPositionByName($('#pointb option:selected').text())); } }); - + $('#cbs').click(function() {populateFBSelect(); }); + $('#cbp').click(function() {populateFBSelect(); }); $("#pointa").focus(function() { lastInputBox = "pointa"; // console.log('Updating last touched box to : ' + lastInputBox) @@ -44,26 +45,8 @@ $(document).ready(function() { function populateUserFields() { - //Populate find by select dropdown - var types = []; - var checkboxes = document.getElementsByName("objtype"); - for (var type in checkboxes) { - if(checkboxes[type].checked) { - types[type] = checkboxes[type].value; - } - - } - var option = ''; - for (var type in types) { - var keys = Object.keys(listobjects(types[type])); - keys.sort().forEach(function(element, index, array){ - option += ''; - }); - - } - - $('#findbyselect').html(option); - + // Populate findby box + populateFBSelect(); // Populate pointa and pointb dropdowns var types = ['planets','stations']; option = ""; @@ -81,6 +64,28 @@ function populateUserFields() { $('#pointa').html(option); $('#pointb').html(option); +} +function populateFBSelect() { + //Populate find by select dropdown + var types = []; + var checkboxes = document.getElementsByName("objtype"); + for (var type in checkboxes) { + if(checkboxes[type].checked) { + types[type] = checkboxes[type].value; + } + + } + var option = ''; + for (var type in types) { + var keys = Object.keys(listobjects(types[type])); + keys.sort().forEach(function(element, index, array){ + option += ''; + }); + + } + + $('#findbyselect').html(option); + } function openTab(evt,tabName) { diff --git a/webviewgl.htm b/webviewgl.htm index 0a1599b..ab9705b 100644 --- a/webviewgl.htm +++ b/webviewgl.htm @@ -123,7 +123,7 @@
- +