Compare commits

..

No commits in common. "f35fdab202c2382c726a15281bb825a5924cfbe7" and "7e6d85d8a1e7b290cb4d613ddeb57485840fbff9" have entirely different histories.

2 changed files with 26 additions and 117 deletions

View File

@ -1,51 +1,3 @@
: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%;
}
@ -84,29 +36,4 @@ label {
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;
}

View File

@ -7,55 +7,52 @@
<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="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 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>
</div>
<script>
var labelNumRats = document.getElementById("labelNumRats");
var outputFailedChecks = document.getElementById("failedChecks");
var ratSlider = document.getElementById("numRats");
labelNumRats.innerHTML = `Anzahl an Ratten: ` + ratSlider.value;
var outputNumRats = document.getElementById("outputNumRats");
outputNumRats.innerHTML = ratSlider.value;
ratSlider.oninput = function () {
labelNumRats.innerHTML = `Anzahl an Ratten: ` + this.value;
outputNumRats.innerHTML = this.value;
update();
}
// Full floor functions
var fullFloorNum = document.getElementById("numFullFloors");
var fullFloorSlider = document.getElementById("numFullFloors");
var outputNumFullFloors = document.getElementById("outputNumFullFloors");
outputNumFullFloors.innerHTML = fullFloorSlider.value;
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, fullFloorNum.value);
var failed_checks = cageCheck(savicSuiteRoyaleDim, ratSlider.value, fullFloorSlider.value);
var resultsDiv = document.getElementById("resultsDiv");
resultsDiv.innerHTML = `<strong>Ergebnis</strong>`;
resultsDiv.innerHTML = `<strong>Werte</strong>: ${savicSuiteRoyaleDim.toString()} n(rats): ${ratSlider.value}, n(floors): ${fullFloorSlider.value}`;
const ul = document.createElement('ul');
for (const key in failed_checks) {
@ -65,25 +62,10 @@
}
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>