diff --git a/js/defaults_dialog.js b/js/defaults_dialog.js index bcbdd8ad..cfc30508 100644 --- a/js/defaults_dialog.js +++ b/js/defaults_dialog.js @@ -49,54 +49,57 @@ helper.defaultsDialog = (function (data) { }, - privateScope.wizard = function (selectedDefaultPreset, wizardStep) { + privateScope.wizard = function (selectedDefaultPreset, wizardStep) { - const steps = selectedDefaultPreset.wizardPages; - const stepsCount = selectedDefaultPreset.wizardPages.length; - const stepName = steps[wizardStep]; + const steps = selectedDefaultPreset.wizardPages; + const stepsCount = selectedDefaultPreset.wizardPages.length; + const stepName = steps[wizardStep]; - console.log(steps[wizardStep], wizardStep, stepsCount); + console.log(steps[wizardStep], wizardStep, stepsCount); - if (wizardStep >= stepsCount - 1) { - //This is the last step, time to finalize - $container.hide(); - privateScope.saveAndReboot(); - } else { - const $content = $container.find('.defaults-dialog__wizard'); + if (wizardStep >= stepsCount) { + //This is the last step, time to finalize + $container.hide(); + privateScope.saveAndReboot(); + } else { + const $content = $container.find('.defaults-dialog__wizard'); - $.get("./wizard/" + stepName + ".html", function (data) { + $content.unbind(); + + $.get("./wizard/" + stepName + ".html", function (data) { + $content.html(""); + $(data).appendTo($content); + + $.get("./wizard/buttons.html", function (data) { $(data).appendTo($content); - $.get("./wizard/buttons.html", function (data) { - $(data).appendTo($content); - - $container.on('click', '#wizard-next', function () { - privateScope.saveWizardStep(selectedDefaultPreset, wizardStep); - }); - - $container.on('click', '#wizard-skip', function () { - privateScope.wizard(selectedDefaultPreset, wizardStep + 1); - }); - - if (stepName == "receiver") { - privateScope.handleTabLoadReceiver($container); - } - - Settings.configureInputs().then( - function () { - console.log('configure done'); - $container.find('.defaults-dialog__content').hide(); - $container.find('.defaults-dialog__wizard').show(); - - savingDefaultsModal.close(); - $container.show(); - } - ); + $content.on('click', '#wizard-next', function () { + privateScope.saveWizardStep(selectedDefaultPreset, wizardStep); }); - }); - } - }; + $content.on('click', '#wizard-skip', function () { + privateScope.wizard(selectedDefaultPreset, wizardStep + 1); + }); + + if (stepName == "receiver") { + privateScope.handleTabLoadReceiver($content); + } + + Settings.configureInputs().then( + function () { + console.log('configure done'); + $container.find('.defaults-dialog__content').hide(); + $container.find('.defaults-dialog__wizard').show(); + + savingDefaultsModal.close(); + $container.show(); + } + ); + }); + }); + } + + }; privateScope.saveAndReboot = function () { GUI.tab_switch_cleanup(function () { diff --git a/js/defaults_dialog_entries.js b/js/defaults_dialog_entries.js index 8269c79d..438e1078 100644 --- a/js/defaults_dialog_entries.js +++ b/js/defaults_dialog_entries.js @@ -1,24 +1,5 @@ var helper = helper || {}; -helper.defaultsDialogReceivers = { - 0: "SPEK1024", - 1: "SPEK2048", - 2: "SBUS", - 3: "SUMD", - 4: "SUMH", - 5: "XB-B", - 6: "XB-B-RJ01", - 7: "IBUS", - 8: "JETIEXBUS", - 9: "CRSF", - 10: "FPORT", - 11: "SBUS_FAST", - 12: "FPORT2", - 13: "SRXL2", - 14: "GHST", - 15: "MAVLINK" -} - helper.defaultsDialogData = [ { "title": 'Test',