Skip to content

Commit 7b34dab

Browse files
committed
Attempt again to load egg settings
1 parent 4c26d09 commit 7b34dab

File tree

1 file changed

+17
-20
lines changed

1 file changed

+17
-20
lines changed

resources/themes/pterodactyl/admin/servers/view/startup.blade.php

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -133,28 +133,8 @@
133133
@parent
134134
{!! Theme::js('vendor/lodash/lodash.js') !!}
135135
<script>
136-
$(window).on('load', function () {
137-
$('#pNestId').change();
138-
});
139136
$(document).ready(function () {
140137
$('#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-
158138
$('#pEggId').select2({placeholder: 'Select a Nest Egg'}).on('change', function () {
159139
var selectedEgg = _.isNull($(this).val()) ? $(this).find('option').first().val() : $(this).val();
160140
var parentChain = _.get(Pterodactyl.nests, $("#pNestId").val());
@@ -210,6 +190,23 @@
210190
$('#appendVariablesTo').append(dataAppend).find('#egg_variable_' + item.env_variable).val(setValue);
211191
});
212192
});
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();
213210
});
214211
</script>
215212
@endsection

0 commit comments

Comments
 (0)