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 @@
- + MB
- + %
diff --git a/resources/views/admin/nodes/view.blade.php b/resources/views/admin/nodes/view.blade.php index e56a22174..a200bc74a 100644 --- a/resources/views/admin/nodes/view.blade.php +++ b/resources/views/admin/nodes/view.blade.php @@ -183,7 +183,7 @@
- + MB
@@ -197,7 +197,7 @@
- + MB
diff --git a/resources/views/admin/servers/new.blade.php b/resources/views/admin/servers/new.blade.php index 8aa499f4f..8db93ffcd 100644 --- a/resources/views/admin/servers/new.blade.php +++ b/resources/views/admin/servers/new.blade.php @@ -118,14 +118,14 @@
- + MB
- + MB
@@ -150,7 +150,7 @@
- + MB
diff --git a/resources/views/admin/servers/view.blade.php b/resources/views/admin/servers/view.blade.php index cb429ebe9..a3ec84e1f 100644 --- a/resources/views/admin/servers/view.blade.php +++ b/resources/views/admin/servers/view.blade.php @@ -228,14 +228,14 @@
- + MB
- + MB

Setting this to 0 will disable swap space on this server.