From 9631507b5a05f9f5b38b2f1e81ac9d4a3fcb83e0 Mon Sep 17 00:00:00 2001
From: cbowser36 <72530740+cbowser36@users.noreply.github.com>
Date: Wed, 28 Oct 2020 18:54:25 -0500
Subject: [PATCH 1/4] update script.js
added all additional code to make this website meet all requirements
---
script.js | 94 ++++++++++++++++++++++++++++++++++++++++++++++++-------
1 file changed, 83 insertions(+), 11 deletions(-)
diff --git a/script.js b/script.js
index 8d2e0821..7bfd82cc 100644
--- a/script.js
+++ b/script.js
@@ -1,13 +1,85 @@
// Write your JavaScript code here!
-/* This block of code shows how to format the HTML once you fetch some planetary JSON!
-
Mission Destination
-
- Name: ${}
- Diameter: ${}
- Star: ${}
- Distance from Earth: ${}
- Number of Moons: ${}
-
-
-*/
+// {/* /* This block of code shows how to format the HTML once you fetch some planetary JSON!
+function randomizer(max){
+ return Math.floor(Math.random() * Math.floor(max));
+}
+
+window.addEventListener("load",function() {
+ let form = document.getElementById("launchForm")
+ form.addEventListener("submit",function(event){
+ fetch("https://handlers.education.launchcode.org/static/planets.json").then( function(response) {
+ response.json().then( function(json) {
+ let i = randomizer(6);
+ const div = document.getElementById("missionTarget");
+ div.innerHTML= `
+ Mission Destination
+
+ Name: ${json[i].name}
+ Diameter: ${json[i].diameter}
+ Star: ${json[i].star}
+ Distance from Earth: ${json[i].distance}
+ Number of Moons: ${json[i].moons}
+
+ `
+ });
+ });
+let pilot = document.querySelector("input[name=pilotName]");
+let copilot = document.querySelector("input[name=copilotName]");
+let fuel = document.querySelector("input[name=fuelLevel]");
+let cargo =document.querySelector("input[name=cargoMass]");
+
+ if (pilot.value === "" || copilot.value === "" || fuel.value === "" || cargo.value === ""){
+ window.alert("All Fields are Required!");
+ event.preventDefault();
+ }else if(isNaN(fuel.value)||isNaN(cargo.value)){
+ window.alert("Please Enter a Number for Cargo and Fuel Levels!");
+ event.preventDefault();
+ }else if(isNaN(pilot.value) === false ||isNaN(copilot.value) === false){
+ window.alert("Please Enter a Valid Name for the Pilot and Copilot");
+ event.preventDefault();
+ }
+ });
+ form.addEventListener("submit",function(event){
+ let pilot = document.querySelector("input[name=pilotName]");
+ let copilot = document.querySelector("input[name=copilotName]");
+ let fuel = document.querySelector("input[name=fuelLevel]");
+ let cargo =document.querySelector("input[name=cargoMass]");
+
+ if (fuel.value < 10000 && fuel.value > 0){
+ launchStatus.innerHTML = "Shuttle not ready for launch"
+ faultyItems.style.visibility = 'visible';
+ launchStatus.style.color = 'red';
+ faultyItems.innerHTML= `
+
+ Pilot: ${pilot.value} Ready
+ Co-pilot: ${copilot.value} Ready
+ Fuel is too low for launch
+ Cargo mass low enough for launch
+
+
+`;
+event.preventDefault();
+} else if (cargo.value > 10000){
+ launchStatus.innerHTML = "Shuttle not ready for launch"
+ faultyItems.style.visibility = 'visible';
+ launchStatus.style.color = 'red';
+ faultyItems.innerHTML= `
+
+ Pilot: ${pilot.value} Ready
+ Co-pilot: ${copilot.value} Ready
+ Fuel high enough for launch
+ Cargo mass too high for launch
+
+
+`;
+event.preventDefault();
+ }
+ if( fuel.value > 10000 && cargo.value < 10000 ) {
+ launchStatus.innerHTML = "Shuttle is ready for launch";
+ launchStatus.style.color = "green";
+ faultyItems.style.visibility ='hidden';
+ event.preventDefault();
+ }
+ });
+ });
From d0b10bbdd9d9a9a2a0d8fd896cc0e1e5a8ab8da4 Mon Sep 17 00:00:00 2001
From: cbowser36 <72530740+cbowser36@users.noreply.github.com>
Date: Wed, 28 Oct 2020 19:05:04 -0500
Subject: [PATCH 2/4] Add files via upload
---
index.html | 85 +++++++++++++++++++++++++++---------------------------
1 file changed, 43 insertions(+), 42 deletions(-)
diff --git a/index.html b/index.html
index bc185ad2..322154f3 100644
--- a/index.html
+++ b/index.html
@@ -1,42 +1,43 @@
-
-
-
- Launch Checklist
-
-
-
-
- Launch Checklist Form
-
-
-
-
-
-
Awaiting Information Before Launch
-
-
- Pilot Ready
- Co-pilot Ready
- Fuel level high enough for launch
- Cargo mass low enough for launch
-
-
-
-
-
+
+
+
+ Launch Checklist
+
+
+
+
+ Launch Checklist Form
+
+
+
+
+
+
+
Awaiting Information Before Launch
+
+
+ Pilot Ready
+ Co-pilot Ready
+ Fuel level high enough for launch
+ Cargo mass low enough for launch
+
+
+
+
+
From b0f69f54c919503f5d21ddcac09ec6be4b3d9c5c Mon Sep 17 00:00:00 2001
From: cbowser36 <72530740+cbowser36@users.noreply.github.com>
Date: Wed, 28 Oct 2020 19:06:21 -0500
Subject: [PATCH 3/4] Add files via upload
---
styles.css | 106 ++++++++++++++++++++++++++---------------------------
1 file changed, 53 insertions(+), 53 deletions(-)
diff --git a/styles.css b/styles.css
index a2f31807..40d1f26f 100644
--- a/styles.css
+++ b/styles.css
@@ -1,53 +1,53 @@
-h1 {
- text-align: center;
-}
-
-div {
- text-align: left;
-}
-
-#faultyItems {
- visibility: hidden;
-}
-
-#launchForm {
- background-color: #ECF0F1;
- text-align: center;
- margin: auto;
- width: 25%;
- border: 3px solid black;
- padding: 10px;
-}
-
-#launchStatusCheck {
- background-color: #ECF0F1;
- text-align: center;
- margin: 50px auto;
- width: 50%;
- border: 3px solid black;
- padding: 10px;
-}
-
-#missionTarget img {
- max-width: 40%;
- max-height: 250px;
-}
-
-#missionTarget {
- background-color: #ECF0F1;
- text-align: center;
- margin: 50px auto;
- width: 50%;
- border: 3px solid black;
- padding: 10px;
-}
-
-button {
- background-color: #419f6a;
- border: none;
- color: white;
- border-radius: 8px;
- width: 25%;
- height: 30px;
- margin: 10px 0;
-}
+h1 {
+ text-align: center;
+}
+
+div {
+ text-align: left;
+}
+
+#faultyItems {
+ visibility: hidden;
+}
+
+#launchForm {
+ background-color: #ECF0F1;
+ text-align: center;
+ margin: auto;
+ width: 25%;
+ border: 3px solid black;
+ padding: 10px;
+}
+
+#launchStatusCheck {
+ background-color: #ECF0F1;
+ text-align: center;
+ margin: 50px auto;
+ width: 50%;
+ border: 3px solid black;
+ padding: 10px;
+}
+
+#missionTarget img {
+ max-width: 40%;
+ max-height: 250px;
+}
+
+#missionTarget {
+ background-color: #ECF0F1;
+ text-align: center;
+ margin: 50px auto;
+ width: 50%;
+ border: 3px solid black;
+ padding: 10px;
+}
+
+button {
+ background-color: #419f6a;
+ border: none;
+ color: white;
+ border-radius: 8px;
+ width: 25%;
+ height: 30px;
+ margin: 10px 0;
+}
From bacc660702e400ec3f1265467be4afe5a8bf52e2 Mon Sep 17 00:00:00 2001
From: cbowser36 <72530740+cbowser36@users.noreply.github.com>
Date: Wed, 28 Oct 2020 19:22:23 -0500
Subject: [PATCH 4/4] Add files via upload
---
script.js | 172 +++++++++++++++++++++++++++---------------------------
1 file changed, 87 insertions(+), 85 deletions(-)
diff --git a/script.js b/script.js
index 7bfd82cc..a33cb11c 100644
--- a/script.js
+++ b/script.js
@@ -1,85 +1,87 @@
-// Write your JavaScript code here!
-
-// {/* /* This block of code shows how to format the HTML once you fetch some planetary JSON!
-function randomizer(max){
- return Math.floor(Math.random() * Math.floor(max));
-}
-
-window.addEventListener("load",function() {
- let form = document.getElementById("launchForm")
- form.addEventListener("submit",function(event){
- fetch("https://handlers.education.launchcode.org/static/planets.json").then( function(response) {
- response.json().then( function(json) {
- let i = randomizer(6);
- const div = document.getElementById("missionTarget");
- div.innerHTML= `
- Mission Destination
-
- Name: ${json[i].name}
- Diameter: ${json[i].diameter}
- Star: ${json[i].star}
- Distance from Earth: ${json[i].distance}
- Number of Moons: ${json[i].moons}
-
- `
- });
- });
-let pilot = document.querySelector("input[name=pilotName]");
-let copilot = document.querySelector("input[name=copilotName]");
-let fuel = document.querySelector("input[name=fuelLevel]");
-let cargo =document.querySelector("input[name=cargoMass]");
-
- if (pilot.value === "" || copilot.value === "" || fuel.value === "" || cargo.value === ""){
- window.alert("All Fields are Required!");
- event.preventDefault();
- }else if(isNaN(fuel.value)||isNaN(cargo.value)){
- window.alert("Please Enter a Number for Cargo and Fuel Levels!");
- event.preventDefault();
- }else if(isNaN(pilot.value) === false ||isNaN(copilot.value) === false){
- window.alert("Please Enter a Valid Name for the Pilot and Copilot");
- event.preventDefault();
- }
- });
- form.addEventListener("submit",function(event){
- let pilot = document.querySelector("input[name=pilotName]");
- let copilot = document.querySelector("input[name=copilotName]");
- let fuel = document.querySelector("input[name=fuelLevel]");
- let cargo =document.querySelector("input[name=cargoMass]");
-
- if (fuel.value < 10000 && fuel.value > 0){
- launchStatus.innerHTML = "Shuttle not ready for launch"
- faultyItems.style.visibility = 'visible';
- launchStatus.style.color = 'red';
- faultyItems.innerHTML= `
-
- Pilot: ${pilot.value} Ready
- Co-pilot: ${copilot.value} Ready
- Fuel is too low for launch
- Cargo mass low enough for launch
-
-
-`;
-event.preventDefault();
-} else if (cargo.value > 10000){
- launchStatus.innerHTML = "Shuttle not ready for launch"
- faultyItems.style.visibility = 'visible';
- launchStatus.style.color = 'red';
- faultyItems.innerHTML= `
-
- Pilot: ${pilot.value} Ready
- Co-pilot: ${copilot.value} Ready
- Fuel high enough for launch
- Cargo mass too high for launch
-
-
-`;
-event.preventDefault();
- }
- if( fuel.value > 10000 && cargo.value < 10000 ) {
- launchStatus.innerHTML = "Shuttle is ready for launch";
- launchStatus.style.color = "green";
- faultyItems.style.visibility ='hidden';
- event.preventDefault();
- }
- });
- });
+// Write your JavaScript code here!
+
+// {/* /* This block of code shows how to format the HTML once you fetch some planetary JSON!
+function randomizer(max){
+ return Math.floor(Math.random() * Math.floor(max));
+}
+
+window.addEventListener("load",function() {
+ let form = document.getElementById("launchForm")
+ form.addEventListener("submit",function(event){
+ fetch("https://handlers.education.launchcode.org/static/planets.json").then( function(response) {
+ response.json().then( function(json) {
+ let i = randomizer(6);
+ const div = document.getElementById("missionTarget");
+ div.innerHTML= `
+ Mission Destination
+
+ Name: ${json[i].name}
+ Diameter: ${json[i].diameter}
+ Star: ${json[i].star}
+ Distance from Earth: ${json[i].distance}
+ Number of Moons: ${json[i].moons}
+
+ `
+ });
+ });
+let pilot = document.querySelector("input[name=pilotName]");
+let copilot = document.querySelector("input[name=copilotName]");
+let fuel = document.querySelector("input[name=fuelLevel]");
+let cargo =document.querySelector("input[name=cargoMass]");
+
+ if (pilot.value === "" || copilot.value === "" || fuel.value === "" || cargo.value === ""){
+ window.alert("All Fields are Required!");
+ event.preventDefault();
+ }else if(isNaN(fuel.value)||isNaN(cargo.value)){
+ window.alert("Please Enter a Number for Cargo and Fuel Levels!");
+ event.preventDefault();
+ }else if(isNaN(pilot.value) === false ||isNaN(copilot.value) === false){
+ window.alert("Please Enter a Valid Name for the Pilot and Copilot");
+ event.preventDefault();
+ }
+ });
+ form.addEventListener("submit",function(event){
+ let pilot = document.querySelector("input[name=pilotName]");
+ let copilot = document.querySelector("input[name=copilotName]");
+ let fuel = document.querySelector("input[name=fuelLevel]");
+ let cargo =document.querySelector("input[name=cargoMass]");
+
+ if (fuel.value < 10000 && fuel.value > 0){
+ launchStatus.innerHTML = "Shuttle not ready for launch"
+ faultyItems.style.visibility = 'visible';
+ launchStatus.style.color = 'red';
+ faultyItems.innerHTML= `
+
+ Pilot: ${pilot.value} Ready
+ Co-pilot: ${copilot.value} Ready
+ Fuel is too low for launch
+ Cargo mass low enough for launch
+
+
+`;
+event.preventDefault();
+} else if (cargo.value > 10000){
+ launchStatus.innerHTML = "Shuttle not ready for launch"
+ faultyItems.style.visibility = 'visible';
+ launchStatus.style.color = 'red';
+ faultyItems.innerHTML= `
+
+ Pilot: ${pilot.value} Ready
+ Co-pilot: ${copilot.value} Ready
+ Fuel high enough for launch
+ Cargo mass too high for launch
+
+
+`;
+event.preventDefault();
+ }
+ if( fuel.value > 10000 && cargo.value < 10000 ) {
+ launchStatus.innerHTML = "Shuttle is ready for launch";
+ launchStatus.style.color = "green";
+ faultyItems.style.visibility ='hidden';
+ event.preventDefault();
+ }
+ });
+ });
+
+