+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
\ No newline at end of file
diff --git a/script.js b/script.js
new file mode 100644
index 0000000..d8eb212
--- /dev/null
+++ b/script.js
@@ -0,0 +1,64 @@
+
+//range slider
+var $element = $('input[type="range"]');
+
+$element
+ .rangeslider({
+ polyfill: false,
+ onInit: function() {
+ var $handle = $('.rangeslider__handle', this.$range);
+ updateHandle($handle[0], this.value);
+ }
+ })
+ .on('input', function(e) {
+ var $handle = $('.rangeslider__handle', e.target.nextSibling);
+ updateHandle($handle[0], this.value);
+ });
+
+function updateHandle(el, val) {
+ el.textContent = val;
+}
+
+//calculator
+
+$(document).ready(function() {
+ //calculate values automatically
+ sum();
+ $("#ram-total, #ram-reserved, #ram-buffer, #process-size").on("keydown keyup change", function() {
+ sum();
+ });
+});
+
+function sum() {
+ //inputs
+ var ramtotal = document.getElementById('ram-total').value;
+ var ramreserved = document.getElementById('ram-reserved').value;
+ var rambuffer = document.getElementById('ram-buffer').value;
+ var processsize = document.getElementById('process-size').value;
+
+
+
+ var buffer = 1 - (rambuffer / 100) ;
+
+ //[Total Available RAM] – [Reserved RAM] – [10% buffer] = [Available RAM for PHP]
+ var availableram = Math.round(((ramtotal - ramreserved) * buffer) * 10) / 10;
+ var availablerammb = Math.round(availableram * 1024);
+
+ // [Average Process Size] / [Available RAM for PHP]= [max_children]
+ var maxchildren = Math.floor(availablerammb / processsize);
+ var startservers = Math.floor(maxchildren * 0.25);
+ var minspare = Math.floor(maxchildren * 0.25);
+ var maxspare = Math.floor(maxchildren * 0.75);
+
+
+ if (!isNaN(availableram)) {
+ //Outputs
+ //document.getElementById('ram-buffer-percent').value = buffer;
+ document.getElementById('ram-available').value = availableram;
+ document.getElementById('ram-available-mb').value = Math.round(availableram * 1024);
+ document.getElementById('max-children').value = maxchildren;
+ document.getElementById('start-servers').value = startservers;
+ document.getElementById('min-spare').value = minspare;
+ document.getElementById('max-spare').value = maxspare;
+ }
+ }
\ No newline at end of file
diff --git a/styles.css b/styles.css
new file mode 100644
index 0000000..b101aa5
--- /dev/null
+++ b/styles.css
@@ -0,0 +1,39 @@
+
+body {
+ padding:20px;
+}
+
+.bootstrap-iso .formden_header h2, .bootstrap-iso .formden_header p, .bootstrap-iso form {
+ font-family: Arial, Helvetica, sans-serif;
+ color: black;
+}
+
+.bootstrap-iso form button, .bootstrap-iso form button:hover {
+ color: white !important;
+}
+
+.rangeslider,
+input[type='range'] {
+ max-width: 400px;
+}
+
+.rangeslider__handle {
+ border-radius: 22px;
+ min-width: 62px;
+ line-height: 42px;
+ text-align: center;
+ background-image: none!important;
+}
+
+.card {
+ padding: 15px;
+}
+
+.form-container {
+ padding: 25px;
+
+}
+
+.footer .github {
+ float:right;
+}
\ No newline at end of file