add comments
This commit is contained in:
parent
0cac807528
commit
d0930b0fd9
@ -182,7 +182,7 @@
|
||||
<radialGradient id="b-9766374505327868956" cx="3.092062742589107" cy="49.999999999999986"
|
||||
r="74.29397814585104"
|
||||
gradientTransform="matrix(0.013460041,0,0,0.013460041,-0.041619292,-0.173002055)">
|
||||
<stop stop-color="#46d8c1" offset="0"/>
|
||||
<stop stop-color="#46d8c1" offset="0" />
|
||||
<stop offset="0.305328" stop-color="#3ecbc7" stop-opacity="0.849" />
|
||||
<stop offset="0.569672" stop-color="#3cc7c9" stop-opacity="0.806" />
|
||||
<stop offset="1" stop-color="#1eb457" stop-opacity="0.711" />
|
||||
|
||||
20
spacetaxi.js
20
spacetaxi.js
@ -24,7 +24,7 @@ function init() {
|
||||
|
||||
}
|
||||
|
||||
// Methode die n-Mal die Funktion, um ein Stern erstellen, aufruft
|
||||
// Methode die n-Mal die Funktion, um ein Stern zu erstellen, aufruft
|
||||
function create_star_field(n)
|
||||
{
|
||||
for (let i = 0; i < n; i++)
|
||||
@ -64,6 +64,7 @@ function create_star()
|
||||
star.style.top = `${y}px`;
|
||||
}
|
||||
|
||||
// JS Logik um auf Client Seite zu prüfen, ob das Passwort der Norm entspricht
|
||||
function check_password(e) {
|
||||
password = e.target.value;
|
||||
|
||||
@ -74,6 +75,8 @@ function check_password(e) {
|
||||
}
|
||||
}
|
||||
|
||||
// JS Logik um auf Client Seite zu prüfen, ob der Username der Norm entspricht
|
||||
// Wenn der Username zu lang ist, ist die Feedbackseite verzerrt
|
||||
function check_username(e) {
|
||||
username = e.target.value;
|
||||
|
||||
@ -84,6 +87,7 @@ function check_username(e) {
|
||||
}
|
||||
}
|
||||
|
||||
// Finale JS Logik um vor dem Abschicken alle wichtige Felder zu prüfen
|
||||
function check_after_submitting(e)
|
||||
{
|
||||
form = e.target;
|
||||
@ -124,6 +128,7 @@ function check_after_submitting(e)
|
||||
|
||||
}
|
||||
|
||||
// Visuelles Feedback, falls Planet ausgewählt worden ist
|
||||
function printClicked(e) {
|
||||
const planet_id = e.currentTarget.id;
|
||||
const svg_element = e.currentTarget;
|
||||
@ -141,10 +146,14 @@ function printClicked(e) {
|
||||
list_id[planet_index] = 1;
|
||||
}
|
||||
|
||||
// Falls ja, änder dynamisch den Score
|
||||
update_score()
|
||||
}
|
||||
|
||||
// Ändere den Score, wenn Event Listener ein bestimmtes Event registiert
|
||||
function update_score() {
|
||||
|
||||
// Erhalte eine Referenz zum Score Element
|
||||
planet_sum = document.getElementById("planetensum");
|
||||
dauer_sum = document.getElementById("dauersum");
|
||||
kosten_sum = document.getElementById("kostensum");
|
||||
@ -152,7 +161,7 @@ function update_score() {
|
||||
current_sum = 0;
|
||||
id_sum = 0;
|
||||
|
||||
|
||||
// Zähle, wie viele Planeten ausgewählt worden sind
|
||||
for (let a = 0; a < 5; a++) {
|
||||
if (list_id[a] == 1) {
|
||||
current_sum += 1;
|
||||
@ -160,14 +169,14 @@ function update_score() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
dauer_sum.textContent = Math.round(id_sum / 2) + "y";
|
||||
//dauer_sum.textContent += "d";
|
||||
|
||||
planet_sum.textContent = current_sum;
|
||||
let rocket_factor = 1.0;
|
||||
let rocket_selected = document.querySelectorAll("form")[0].spaceship.value;
|
||||
|
||||
// Wähle Preisfaktor aus - abhängig von der ausgewählten Rakete
|
||||
switch (rocket_selected) {
|
||||
case "rocket1": rocket_factor = 1.5; break;
|
||||
case "rocket2": rocket_factor = 0.75; break;
|
||||
@ -175,8 +184,11 @@ function update_score() {
|
||||
default: rocket_factor = 0; break;
|
||||
}
|
||||
|
||||
// Berechne schließlich Kosten
|
||||
kosten_sum.textContent = Math.round(id_sum * rocket_factor) + "M$";
|
||||
|
||||
|
||||
// Setze die Werte jeweils in die HTML Elemente ein
|
||||
document.getElementById("planete").value = planet_sum.textContent;
|
||||
document.getElementById("dauer").value = dauer_sum.textContent;
|
||||
document.getElementById("kosten").value = kosten_sum.textContent;
|
||||
|
||||
@ -14,12 +14,12 @@ switch($rocket)
|
||||
|
||||
//Austattungsoptionen
|
||||
$optionen = "";
|
||||
if (($_POST["option1"])) $optionen .= "UV-Blenden, ";
|
||||
if (($_POST["option2"])) $optionen .= "einer Mikrowelle, ";
|
||||
if (($_POST["option3"])) $optionen .= "einer Schwebepizza, ";
|
||||
if (($_POST["option4"])) $optionen .= "einem Marsweckle, ";
|
||||
if (($_POST["option5"])) $optionen .= "einem Rover, ";
|
||||
if (($_POST["option6"])) $optionen .= "einem PV-Panel, ";
|
||||
if (isset($_POST["option1"])) $optionen .= "UV-Blenden, ";
|
||||
if (isset($_POST["option2"])) $optionen .= "einer Mikrowelle, ";
|
||||
if (isset($_POST["option3"])) $optionen .= "einer Schwebepizza, ";
|
||||
if (isset($_POST["option4"])) $optionen .= "einem Marsweckle, ";
|
||||
if (isset($_POST["option5"])) $optionen .= "einem Rover, ";
|
||||
if (isset($_POST["option6"])) $optionen .= "einem PV-Panel, ";
|
||||
$optionen .= "einem blauen Lichtschwert";
|
||||
|
||||
//Scores
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user