diff --git a/assets/spaceships/blueprint.png b/assets/spaceships/blueprint.png new file mode 100644 index 0000000..9ca147a Binary files /dev/null and b/assets/spaceships/blueprint.png differ diff --git a/assets/spaceships/hangar.png b/assets/spaceships/hangar.png new file mode 100644 index 0000000..3db513b Binary files /dev/null and b/assets/spaceships/hangar.png differ diff --git a/css/global.css b/css/global.css index a867acc..67a2b03 100644 --- a/css/global.css +++ b/css/global.css @@ -36,7 +36,7 @@ select { color: var(--text-color); } -.block-content{ +#block-content{ margin: 0; padding: 0; width: 100%; diff --git a/css/ships.css b/css/ships.css new file mode 100644 index 0000000..a2fa651 --- /dev/null +++ b/css/ships.css @@ -0,0 +1,85 @@ +* { + box-sizing: border-box; +} +@font-face { + font-family: M42; + src: url("/assets/fonts/Pixellari.ttf"); +} +.block-ships{ + display:flex; + flex-direction: column; + color: white; + font-size:large; + text-align: center; + padding-top: 100px; + max-width: 1000px; + position: relative; + margin: auto; +} +button{ + color: white; + font-family: 'M42'; + background-color: black; + font-size:x-small; + box-shadow: 3px 2px white; + border: 4px solid white; + border-radius: 10px; + padding: 10px; + padding-left: 15px; + padding-right: 15px; +} +button:hover{ + background-color:aqua ; + transition: 1s; +} + + +.my-modal{ + font-size:small; +} +body{ + background-image: url("/assets/spaceships/hangar.png"); + background-size: cover; +} + +.ships-list { + display: none; +} + +/* Next & previous buttons */ +.prev, .next { + cursor: pointer; + position: absolute; + top: 50%; + width: auto; + margin-top: -22px; + padding: 16px; + color: white; + font-weight: bold; + font-size: 18px; + transition: 0.6s ease; + border-radius: 0 3px 3px 0; + user-select: none; +} + +/* Position the "next button" to the right */ +.next { + right: 0; + border-radius: 3px 0 0 3px; +} + +/* On hover, add a black background color with a little bit see-through */ +.prev:hover, .next:hover { + background-color: rgba(0,0,0,0.8); +} + +/* Fading animation */ +.fade { + animation-name: fade; + animation-duration: 1.5s; +} + +@keyframes fade { + from {opacity: .4} + to {opacity: 1} +} \ No newline at end of file diff --git a/html/template.html b/html/template.html index c4b1588..6a3c791 100644 --- a/html/template.html +++ b/html/template.html @@ -7,5 +7,5 @@
Name : ${ship.registration.name}
`); + $(".infos").append(`Faction : ${ship.registration.factionSymbol}
`); + $(".infos").append(`Role : ${ship.registration.role}
`); + } + }) + modal.show(); + }); + temp_engine.add_event(".nav", "click", (e) => { + const id_ship = $(e.target).attr("data-symbol"); + ships.forEach(ship =>{ + if(ship.symbol==id_ship) + { + $(".infos").html(""); + $(".infos").append(`Current system : ${ship.nav.systemSymbol}
`); + $(".infos").append(`Current waypoint : ${ship.nav.waypointSymbol}
`); + $(".infos").append(`Current status : ${ship.nav.status}
`); + $(".infos").append(`Flight mode : ${ship.nav.flightMode}
`); + } + }) + modal.show(); + }); + temp_engine.add_event(".crew", "click", (e) => { + const id_ship = $(e.target).attr("data-symbol"); + ships.forEach(ship =>{ + if(ship.symbol==id_ship) + { + $(".infos").html(""); + $(".infos").append(`Current member : ${ship.crew.current}
`); + $(".infos").append(`Capacity : ${ship.crew.capacity}
`); + $(".infos").append(`required member : ${ship.crew.required}
`); + $(".infos").append(`Moral : ${ship.crew.morale}
`); + } + }) + modal.show(); + }); + temp_engine.add_event(".frame", "click", (e) => { + const id_ship = $(e.target).attr("data-symbol"); + ships.forEach(ship =>{ + if(ship.symbol==id_ship) + { + $(".infos").html(""); + $(".infos").append(`Name : ${ship.frame.name}
`); + $(".infos").append(`Description : ${ship.frame.description}
`); + $(".infos").append(`Fuel capacity : ${ship.frame.fuelCapacity}
`); + $(".infos").append(`Condition : ${ship.frame.condition}
`); + $(".infos").append(`Power : ${ship.frame.requirements.power}
`); + $(".infos").append(`Crew : ${ship.frame.requirements.crew}
`); + + } + }) + modal.show(); + }); + temp_engine.add_event(".react", "click", (e) => { + const id_ship = $(e.target).attr("data-symbol"); + ships.forEach(ship =>{ + if(ship.symbol==id_ship) + { + $(".infos").html(""); + $(".infos").append(`Name : ${ship.reactor.name}
`); + $(".infos").append(`Description : ${ship.reactor.description}
`); + $(".infos").append(`Condition : ${ship.reactor.condition}
`); + $(".infos").append(`Power : ${ship.reactor.powerOutput}
`); + $(".infos").append(`Crew : ${ship.reactor.requirements.crew}
`); + } + }) + modal.show(); + }); + temp_engine.add_event(".engine", "click", (e) => { + const id_ship = $(e.target).attr("data-symbol"); + ships.forEach(ship =>{ + if(ship.symbol==id_ship) + { + $(".infos").html(""); + $(".infos").append(`Name : ${ship.engine.name}
`); + $(".infos").append(`Description : ${ship.engine.description}
`); + $(".infos").append(`Condition : ${ship.engine.condition}
`); + $(".infos").append(`Speed : ${ship.engine.speed}
`); + $(".infos").append(`Crew : ${ship.engine.requirements.crew}
`); + $(".infos").append(`Power : ${ship.engine.requirements.power}
`); + } + }) + modal.show(); + }); + temp_engine.add_event(".fuel", "click", (e) => { + const id_ship = $(e.target).attr("data-symbol"); + ships.forEach(ship =>{ + if(ship.symbol==id_ship) + { + $(".infos").html(""); + $(".infos").append(`current fuel : ${ship.fuel.current}
`); + $(".infos").append(`Description : ${ship.fuel.capacity}
`); + $(".infos").append(`Condition : ${ship.fuel.consumed.amount}
`); + $(".infos").append(`Speed : ${ship.fuel.consumed.timestamp}
`); + } + }) + modal.show(); + }); + $(".ships-list").on("click", (e) => { + const id_ship = $(e.target).attr("data-id"); + ships.forEach(ship =>{ + if(ship.symbol==id_ship) + { + } + }) + + }); + }); + + temp_engine.add_event(".btn-close", "click", () => { + modal.close(); + }); + function plusSlides(n) { + showSlides(slideIndex += n); + } + + temp_engine.add_event(".prev", "click", () => { + plusSlides(-1); + }); + temp_engine.add_event(".next", "click", () => { + plusSlides(1); + }); + + function showSlides(n) { + let i; + let slides = document.getElementsByClassName("ships-list"); + if (n > slides.length) {slideIndex = 1} + if (n < 1) {slideIndex = slides.length} + for (i = 0; i < slides.length; i++) { + slides[i].style.display = "none"; + } + slides[slideIndex-1].style.display = "block"; + } + + }); + + temp_engine.render("templates/ships/ships.html"); + +}; \ No newline at end of file