|
133 | 133 | @parent |
134 | 134 | {!! Theme::js('vendor/lodash/lodash.js') !!} |
135 | 135 | <script> |
136 | | - $(window).on('load', function () { |
137 | | - $('#pNestId').change(); |
138 | | - }); |
139 | 136 | $(document).ready(function () { |
140 | 137 | $('#pPackId').select2({placeholder: 'Select a Service Pack'}); |
141 | | - $('#pNestId').select2({placeholder: 'Select a Nest'}).on('change', function () { |
142 | | - $('#pEggId').html('').select2({ |
143 | | - data: $.map(_.get(Pterodactyl.nests, $(this).val() + '.eggs', []), function (item) { |
144 | | - return { |
145 | | - id: item.id, |
146 | | - text: item.name, |
147 | | - }; |
148 | | - }), |
149 | | - }); |
150 | | -
|
151 | | - if (_.isObject(_.get(Pterodactyl.nests, $(this).val() + '.eggs.' + Pterodactyl.server.egg_id))) { |
152 | | - $('#pEggId').val(Pterodactyl.server.egg_id); |
153 | | - } |
154 | | -
|
155 | | - $('#pEggId').change(); |
156 | | - }); |
157 | | -
|
158 | 138 | $('#pEggId').select2({placeholder: 'Select a Nest Egg'}).on('change', function () { |
159 | 139 | var selectedEgg = _.isNull($(this).val()) ? $(this).find('option').first().val() : $(this).val(); |
160 | 140 | var parentChain = _.get(Pterodactyl.nests, $("#pNestId").val()); |
|
210 | 190 | $('#appendVariablesTo').append(dataAppend).find('#egg_variable_' + item.env_variable).val(setValue); |
211 | 191 | }); |
212 | 192 | }); |
| 193 | +
|
| 194 | + $('#pNestId').select2({placeholder: 'Select a Nest'}).on('change', function () { |
| 195 | + $('#pEggId').html('').select2({ |
| 196 | + data: $.map(_.get(Pterodactyl.nests, $(this).val() + '.eggs', []), function (item) { |
| 197 | + return { |
| 198 | + id: item.id, |
| 199 | + text: item.name, |
| 200 | + }; |
| 201 | + }), |
| 202 | + }); |
| 203 | +
|
| 204 | + if (_.isObject(_.get(Pterodactyl.nests, $(this).val() + '.eggs.' + Pterodactyl.server.egg_id))) { |
| 205 | + $('#pEggId').val(Pterodactyl.server.egg_id); |
| 206 | + } |
| 207 | +
|
| 208 | + $('#pEggId').change(); |
| 209 | + }).change(); |
213 | 210 | }); |
214 | 211 | </script> |
215 | 212 | @endsection |
0 commit comments