diff --git a/dist/js/bootstrap-plusmin.js b/dist/js/bootstrap-plusmin.js new file mode 100644 index 0000000..a3c3fe7 --- /dev/null +++ b/dist/js/bootstrap-plusmin.js @@ -0,0 +1,68 @@ +$('.btn-number').click(function (e) { + e.preventDefault(); + + let fieldName = $(this).attr('data-field'); + let type = $(this).attr('data-type'); + const input = $("input[name='" + fieldName + "']"); + const currentVal = parseInt(input.val()); + + if (!isNaN(currentVal)) { + if (type === 'minus') { + if (currentVal > input.attr('min')) { + input.val(currentVal - 1).change(); + } + + if (input.val() == input.attr('min')) { + $(this).attr('disabled', true); + } + } else if (type === 'plus') { + if (currentVal < input.attr('max')) { + input.val(currentVal + 1).change(); + } + + if (input.val() == input.attr('max')) { + $(this).attr('disabled', true); + } + } + } else { + input.val(0); + } +}); + +$('.input-number').focusin(function () { + $(this).data('oldValue', $(this).val()); +}).change(function () { + minValue = parseInt($(this).attr('min')); + maxValue = parseInt($(this).attr('max')); + valueCurrent = parseInt($(this).val()); + + name = $(this).attr('name'); + + if (valueCurrent >= minValue) { + $(".btn-number[data-type='minus'][data-field='" + name + "']").removeAttr('disabled') + } else { + alert('Sorry, the minimum value was reached.'); + $(this).val($(this).data('oldValue')); + } + + if (valueCurrent <= maxValue) { + $(".btn-number[data-type='plus'][data-field='" + name + "']").removeAttr('disabled') + } else { + alert('Sorry, the maximum value was reached.'); + $(this).val($(this).data('oldValue')); + } +}).keydown(function (e) { + // Allow: backspace, delete, tab, escape, enter and . + if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 190]) !== -1 || + // Allow: Ctrl+A + (e.keyCode === 65 && e.ctrlKey === true) || + // Allow: home, end, left, right + (e.keyCode >= 35 && e.keyCode <= 39)) { + // let it happen, don't do anything + return; + } + // Ensure that it is a number and stop the keypress + if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) { + e.preventDefault(); + } +}); \ No newline at end of file diff --git a/index.html b/index.html index 3d3199b..7b55834 100644 --- a/index.html +++ b/index.html @@ -10,11 +10,14 @@ href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.0.0-beta3/css/bootstrap.min.css" integrity="sha512-N415hCJJdJx+1UBfULt+i+ihvOn42V/kOjOpp1UTh4CZ70Hx5bDlKryWaqEKfY/8EYOu/C2MuyaluJryK1Lb5Q==" crossorigin="anonymous"/> +
-
+

Volmit Software - Damage calculator

Simply calculate the damage values for your texture pack.


@@ -22,65 +25,123 @@ creates the .json file for you.

-
- +
+
-
- - + -
- - -
-
Output JSON:
-
Fill in the form above to get an output.
- Download +
Fill in the form above to get an output.
+ + Download
+ + \ No newline at end of file