| 5631 | select2ChoiceClickSubscribe($('#world_info'), target => { | 5631 | select2ChoiceClickSubscribe($('#world_info'), target => { |
| 5632 | const name = $(target).text(); | 5632 | const name = $(target).text(); |
| 5633 | const selectedIndex = world_names.indexOf(name); | 5633 | const selectedIndex = world_names.indexOf(name); |
| 5634 | if (selectedIndex !== -1) { | 5634 | const alreadySelectedInEditor = $('#world_editor_select option:selected').text() === name; |
| | 5635 | if (selectedIndex !== -1 && !alreadySelectedInEditor) { |
| 5635 | $('#world_editor_select').val(selectedIndex).trigger('change'); | 5636 | $('#world_editor_select').val(selectedIndex).trigger('change'); |
| 5636 | console.log('Quick selection of world', name); | 5637 | console.log('Quick selection of world', name); |
| | 5638 | } else { |
| | 5639 | console.warn('lets not reload an already loaded list yes?'); |
| 5637 | } | 5640 | } |
| 5638 | }, { buttonStyle: true, closeDrawer: true }); | 5641 | }, { buttonStyle: true, closeDrawer: true }); |
| 5639 | } | 5642 | } |