diff options
Diffstat (limited to 'js/codeq')
-rw-r--r-- | js/codeq/settings.js | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/js/codeq/settings.js b/js/codeq/settings.js index df704b0..dd844a5 100644 --- a/js/codeq/settings.js +++ b/js/codeq/settings.js @@ -6,7 +6,6 @@ var guiLangSelect = $('#gui_lang_select'), robotAddressInput = $('#robot_address_input'), previousGuiLang = guiLangSelect.val(), - previousRobotAddress = robotAddressInput.val(), closedWithSave = false; guiLangSelect.on("change",function() { @@ -23,15 +22,10 @@ $("#settings_dropdown_menu").on("shown.bs.dropdown", function() { closedWithSave = false; previousGuiLang = codeq.settings['gui_lang']; - previousRobotAddress = robotAddressInput.val(); }).on("hidden.bs.dropdown", function() { if(closedWithSave){ - var guiLang = guiLangSelect.val(), - newSettings = {'robot_address': robotAddressInput.val()}; - if (guiLang in codeq.supportedLangs) { - newSettings['gui_lang'] = guiLang; - } - codeq.comms.updateSettings(newSettings) + codeq.settings['robot_address'] = robotAddressInput.val(); + codeq.comms.updateSettings(codeq.settings) .then(function (data) { if (data.code !== 0) { throw new Error('Updating settings failed, code: ' + data.code + ', message: ' + data.message); @@ -41,7 +35,7 @@ }else{ guiLangSelect.val(previousGuiLang); if (previousGuiLang in codeq.supportedLangs) codeq.setLang(previousGuiLang); - robotAddressInput.val(previousRobotAddress); + robotAddressInput.val(codeq.settings['robot_address']); } }); })(); |