diff --git a/public/js/admin.min.js b/public/js/admin.min.js index b6ed01f4c..54179cd27 100755 --- a/public/js/admin.min.js +++ b/public/js/admin.min.js @@ -46,4 +46,24 @@ $(document).ready(function () { centerModal($(this)); }); $(window).on('resize', centerModal); + + // Idea code for multiplicators submitted by @Taronyuu on Github + // https://github.com/Pterodactyl/Panel/issues/154#issuecomment-257116078 + $('input[data-multiplicator="true"]').on('change', function () { + var value = $(this).val(); + if (!/^\d+$/.test(value)) { + var multiplicator = value.replace(/[0-9]/g, '').toLowerCase(); + value = value.replace(/\D/g, ''); + + if (multiplicator === 't') { + value = value * (1024 * 1024); + } + + if (multiplicator === 'g') { + value = value * 1024; + } + } + + $(this).val(value); + }); }); diff --git a/resources/views/admin/nodes/new.blade.php b/resources/views/admin/nodes/new.blade.php index 3278a006f..952850cb3 100644 --- a/resources/views/admin/nodes/new.blade.php +++ b/resources/views/admin/nodes/new.blade.php @@ -92,14 +92,14 @@
Setting this to 0
will disable swap space on this server.