2024-07-18 17:51:24 +00:00
|
|
|
<!DOCTYPE html>
|
2024-07-18 22:24:38 +00:00
|
|
|
<html lang="en" xmlns="http://www.w3.org/1999/html">
|
2024-07-18 17:51:24 +00:00
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<title>Knastrechner</title>
|
|
|
|
<link rel="stylesheet" href="assets/css/style.css">
|
|
|
|
<script src="assets/calculator.js"></script>
|
|
|
|
</head>
|
|
|
|
<body>
|
2024-07-18 21:22:31 +00:00
|
|
|
|
2024-07-18 21:43:57 +00:00
|
|
|
<h1>Käfigrechner</h1>
|
|
|
|
<div class="content">
|
|
|
|
<div class="container-form">
|
2024-07-18 22:24:38 +00:00
|
|
|
<div class="cage-selector">
|
|
|
|
<div class="card-photo">
|
|
|
|
<input type="checkbox" id="savic-xl"/>
|
|
|
|
<label for="savic-95">
|
|
|
|
<img src="assets/img/savic-xl.jpeg">
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="card-photo">
|
|
|
|
<input type="checkbox" id="savic-95"/>
|
|
|
|
<label for="savic-95">
|
|
|
|
<img src="assets/img/savic-95-double.jpg">
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-07-18 21:43:57 +00:00
|
|
|
<div class="input-element">
|
|
|
|
<div class="slidecontainer">
|
|
|
|
<label for="numRats" id="labelNumRats">Anzahl an Ratten ?</label>
|
|
|
|
<input type="range" min="1" max="20" value="4" class="slider" id="numRats">
|
|
|
|
</div>
|
2024-07-18 21:58:42 +00:00
|
|
|
</div>
|
2024-07-18 21:43:57 +00:00
|
|
|
|
2024-07-18 21:58:42 +00:00
|
|
|
<div class="input-element">
|
|
|
|
<label for="numFullFloors">Vollebenen</label>
|
|
|
|
<div class="ncontainer">
|
|
|
|
<div class="input-group">
|
|
|
|
<button onclick="decreaseFloorNum()">-</button>
|
|
|
|
<input type="text" id="numFullFloors" value="3" readonly>
|
|
|
|
<button onclick="increaseFloorNum()">+</button>
|
2024-07-18 21:43:57 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2024-07-18 21:58:42 +00:00
|
|
|
</div>
|
|
|
|
<div class="container output-element" id="resultsDiv">
|
2024-07-18 21:22:31 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2024-07-18 17:51:24 +00:00
|
|
|
|
2024-07-18 21:59:08 +00:00
|
|
|
<script>
|
2024-07-18 17:51:24 +00:00
|
|
|
|
2024-07-18 21:59:08 +00:00
|
|
|
var labelNumRats = document.getElementById("labelNumRats");
|
2024-07-18 17:51:24 +00:00
|
|
|
|
2024-07-18 21:59:08 +00:00
|
|
|
var ratSlider = document.getElementById("numRats");
|
2024-07-18 21:43:57 +00:00
|
|
|
|
2024-07-18 21:59:08 +00:00
|
|
|
labelNumRats.innerHTML = `Anzahl an Ratten: ` + ratSlider.value;
|
2024-07-18 17:51:24 +00:00
|
|
|
|
2024-07-18 21:59:08 +00:00
|
|
|
ratSlider.oninput = function () {
|
|
|
|
labelNumRats.innerHTML = `Anzahl an Ratten: ` + this.value;
|
|
|
|
update();
|
|
|
|
}
|
2024-07-18 17:51:24 +00:00
|
|
|
|
2024-07-18 21:59:08 +00:00
|
|
|
// Full floor functions
|
|
|
|
var fullFloorNum = document.getElementById("numFullFloors");
|
2024-07-18 17:51:24 +00:00
|
|
|
|
|
|
|
|
2024-07-18 21:59:08 +00:00
|
|
|
var savicSuiteRoyaleDim = new Dimensions(1, 0.5, 1);
|
2024-07-18 17:51:24 +00:00
|
|
|
|
2024-07-18 21:59:08 +00:00
|
|
|
function getResultFromChecks(checks) {
|
|
|
|
console.log(checks.length)
|
|
|
|
if (Object.keys(checks).length > 0) {
|
|
|
|
const ul = document.createElement('ul');
|
|
|
|
for (const key in checks) {
|
|
|
|
const li = document.createElement('li');
|
|
|
|
li.textContent = `❌` + checks[key];
|
|
|
|
ul.appendChild(li);
|
|
|
|
}
|
|
|
|
return ul;
|
|
|
|
} else {
|
|
|
|
const p = document.createElement('p');
|
|
|
|
p.innerHTML = "✅ Der Käfig erfüllt alle Kriterien!"
|
|
|
|
return p;
|
|
|
|
}
|
2024-07-18 17:51:24 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2024-07-18 21:59:08 +00:00
|
|
|
function update() {
|
|
|
|
var failed_checks = cageCheck(savicSuiteRoyaleDim, ratSlider.value, fullFloorNum.value);
|
|
|
|
var resultsDiv = document.getElementById("resultsDiv");
|
|
|
|
resultsDiv.innerHTML = `<strong>Ergebnis</strong>`;
|
2024-07-18 17:51:24 +00:00
|
|
|
|
2024-07-18 21:59:08 +00:00
|
|
|
const result = getResultFromChecks(failed_checks);
|
2024-07-18 17:51:24 +00:00
|
|
|
|
2024-07-18 21:59:08 +00:00
|
|
|
resultsDiv.appendChild(result);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function decreaseFloorNum() {
|
|
|
|
var input = document.getElementById('numFullFloors');
|
|
|
|
var value = parseInt(input.value);
|
|
|
|
if (value > 0) {
|
|
|
|
input.value = value - 1;
|
|
|
|
}
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
|
|
|
|
function increaseFloorNum() {
|
|
|
|
var input = document.getElementById('numFullFloors');
|
|
|
|
var value = parseInt(input.value);
|
|
|
|
input.value = value + 1;
|
|
|
|
update();
|
2024-07-18 21:22:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
update();
|
2024-07-18 21:59:08 +00:00
|
|
|
</script>
|
2024-07-18 17:51:24 +00:00
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|