Compare commits
4 Commits
7e6d85d8a1
...
f35fdab202
Author | SHA1 | Date | |
---|---|---|---|
f35fdab202 | |||
d51fb299e9 | |||
5165ef485f | |||
df97239ae8 |
@ -1,3 +1,51 @@
|
||||
:root {
|
||||
--primary-light-one: #5daa68;
|
||||
--primary-light-two: #4a9455;
|
||||
--primary-semidark-one: #356c3c;
|
||||
--primary-dark-one: #17311b;
|
||||
--secondary-light-one: #faf1cf;
|
||||
--secondary-light-two: #e1d7b5;
|
||||
--background-one: var(--primary-light-one);
|
||||
--background-two: var(--primary-light-two);
|
||||
--background-three: var(--secondary-light-one);
|
||||
--background-four: var(--primary-dark-one);
|
||||
--highlight-one: var(--primary-dark-one);
|
||||
--highlight-one-text: var(--secondary-light-one);
|
||||
--highlight-two: var(--primary-semidark-one);
|
||||
--text-one: var(--secondary-light-one);
|
||||
--shadow-one: var(--primary-dark-one);
|
||||
--text-two: var(--primary-dark-one);
|
||||
--text-three: var(--primary-light-one);
|
||||
--shadow-three: var(--primary-dark-one);
|
||||
}
|
||||
|
||||
body {
|
||||
background: var(--background-one);
|
||||
color: var(--text-two);
|
||||
}
|
||||
|
||||
h1, h2 {
|
||||
word-wrap: break-word;
|
||||
color: var(--text-one);
|
||||
text-shadow: 2px 2px var(--shadow-one);
|
||||
}
|
||||
|
||||
.container-form {
|
||||
background: var(--background-three);
|
||||
color: var(--text-two);
|
||||
border-radius: 10px;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.input-element {
|
||||
margin: 20px;
|
||||
}
|
||||
|
||||
label {
|
||||
font-weight: bold;
|
||||
|
||||
}
|
||||
|
||||
.slidecontainer {
|
||||
width: 100%;
|
||||
}
|
||||
@ -36,4 +84,29 @@
|
||||
background: url('/src/assetssets/img/logo_transparent.png');
|
||||
background-size: 100% 100%;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.input-group {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.input-group button {
|
||||
padding: 10px;
|
||||
border: none;
|
||||
background-color: var(--primary-dark-one);
|
||||
color: white;
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.input-group input {
|
||||
width: 50px;
|
||||
text-align: center;
|
||||
font-size: 16px;
|
||||
border: 1px solid #ccc;
|
||||
background-color: var(--secondary-light-one);
|
||||
height: 36px;
|
||||
}
|
@ -7,52 +7,55 @@
|
||||
<script src="assets/calculator.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>Käfigrechner</h1>
|
||||
<div class="content">
|
||||
<div class="container-form">
|
||||
<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>
|
||||
|
||||
<div class="slidecontainer">
|
||||
<input type="range" min="1" max="20" value="4" class="slider" id="numRats">
|
||||
<label for="numRats">Anzahl an Ratten
|
||||
<div id="outputNumRats"></div>
|
||||
</label>
|
||||
|
||||
|
||||
<input type="range" min="1" max="4" value="2" class="slider" id="numFullFloors">
|
||||
<label for="numFullFloors">Vollebenen
|
||||
<div id="outputNumFullFloors"></div>
|
||||
</label>
|
||||
<div class="container" id="resultsDiv">
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container" id="resultsDiv">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
var outputFailedChecks = document.getElementById("failedChecks");
|
||||
var labelNumRats = document.getElementById("labelNumRats");
|
||||
|
||||
var ratSlider = document.getElementById("numRats");
|
||||
var outputNumRats = document.getElementById("outputNumRats");
|
||||
outputNumRats.innerHTML = ratSlider.value;
|
||||
|
||||
labelNumRats.innerHTML = `Anzahl an Ratten: ` + ratSlider.value;
|
||||
|
||||
ratSlider.oninput = function () {
|
||||
outputNumRats.innerHTML = this.value;
|
||||
labelNumRats.innerHTML = `Anzahl an Ratten: ` + this.value;
|
||||
update();
|
||||
}
|
||||
|
||||
// Full floor functions
|
||||
var fullFloorSlider = document.getElementById("numFullFloors");
|
||||
var outputNumFullFloors = document.getElementById("outputNumFullFloors");
|
||||
outputNumFullFloors.innerHTML = fullFloorSlider.value;
|
||||
var fullFloorNum = document.getElementById("numFullFloors");
|
||||
|
||||
fullFloorSlider.oninput = function () {
|
||||
outputNumFullFloors.innerHTML = this.value;
|
||||
update();
|
||||
}
|
||||
|
||||
var savicSuiteRoyaleDim = new Dimensions(1, 0.5, 1);
|
||||
|
||||
function update() {
|
||||
var failed_checks = cageCheck(savicSuiteRoyaleDim, ratSlider.value, fullFloorSlider.value);
|
||||
var failed_checks = cageCheck(savicSuiteRoyaleDim, ratSlider.value, fullFloorNum.value);
|
||||
var resultsDiv = document.getElementById("resultsDiv");
|
||||
resultsDiv.innerHTML = `<strong>Werte</strong>: ${savicSuiteRoyaleDim.toString()} n(rats): ${ratSlider.value}, n(floors): ${fullFloorSlider.value}`;
|
||||
resultsDiv.innerHTML = `<strong>Ergebnis</strong>`;
|
||||
|
||||
const ul = document.createElement('ul');
|
||||
for (const key in failed_checks) {
|
||||
@ -62,10 +65,25 @@
|
||||
}
|
||||
|
||||
resultsDiv.appendChild(ul);
|
||||
outputFailedChecks.innerHTML = failed_checks;
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
}
|
||||
update();
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
Loading…
Reference in New Issue
Block a user