diff --git a/Thumbs.db b/Thumbs.db new file mode 100644 index 00000000..8d5ecee0 Binary files /dev/null and b/Thumbs.db differ diff --git a/index.html b/index.html index e69de29b..b18dd337 100644 --- a/index.html +++ b/index.html @@ -0,0 +1,90 @@ + + + + + + + + Fortune Teller - learn your future + + + + + + + + +
+

Fortune Teller

+

Learn about your future

+
+ + +
+

Where will you live in 10 years?

+
+
+

After all, you're the one deciding your fate. I will let you choose the continent:

+ +
+ +
+ +

+

+

+ +
+ + +
+

Words to live by

+
+
+
+

Discover your inspiring life motto

+ +
+ +
+ + +
+

Your future pet

+
+
+
+

Will there be a French bulldog in your life? :)

+ +
+ + +
+

Lottery numbers

+
+
+

Quick answer to the most important question

+
Your lucky numbers are:
+
+ +
+ + + + + \ No newline at end of file diff --git a/main.js b/main.js index e69de29b..3489e1df 100644 --- a/main.js +++ b/main.js @@ -0,0 +1,183 @@ +// Lottery numbers start +function lotteryNumbers(range, outputCount) { + let helpArray = []; + for (let i = 1; i <= range; i++) { + helpArray.push(i); + } + + let resultNums = []; + + for (let i = 1; i <= outputCount; i++) { + const random = Math.floor(Math.random() * (range - i)); + resultNums.push(helpArray[random]); + helpArray[random] = helpArray[range - i]; + } + document.getElementById("luckynumbers").innerHTML = resultNums.join(" - "); + } + // Lottery numbers end + + // 10 years live start + var europeCities = [ + "Sevilla, Spain", + "Nordkjosbotn, Norway", + "Zalaegerszeg, Hungary", + ]; + var northAmericaCities = [ + "Delta Junction, Alaska, US", + "Guadalajara, Mexico", + "Denver, Colorado, US", + ]; + var southAmericaCities = [ + "Stanley, Falkland Islands", + "Parauapebas, Brasil", + "Arequipa, Peru", + ]; + var africaCities = [ + "Maseru, Lesotho", + "Port Elizabeth, RSA", + "Ouargla, Algeria", + ]; + var asiaCities = [ + "Verkhoyansk, Russia", + "Surabaya, Indonesia", + "Chongqing, China", + ]; + var australiaCities = [ + "Oodnadatta, Australia", + "Suva, Fiji", + "Canberra, Australia", + ]; + + async function getCity() { + var selectedContinent = document.getElementById("continents").value; + if (selectedContinent === "europe") { + city = europeCities[Math.floor(Math.random() * europeCities.length)]; + } else if (selectedContinent === "north-america") { + city = + northAmericaCities[Math.floor(Math.random() * northAmericaCities.length)]; + } else if (selectedContinent === "south-america") { + city = + southAmericaCities[Math.floor(Math.random() * southAmericaCities.length)]; + } else if (selectedContinent === "africa") { + city = africaCities[Math.floor(Math.random() * africaCities.length)]; + } else if (selectedContinent === "asia") { + city = asiaCities[Math.floor(Math.random() * asiaCities.length)]; + } else if (selectedContinent === "australia") { + city = australiaCities[Math.floor(Math.random() * australiaCities.length)]; + } + + document.getElementById("city").innerHTML = "You will live in " + city; + + if (city === "Sevilla, Spain") { + cityID = "2510911"; + } else if (city === "Nordkjosbotn, Norway") { + cityID = "3133897"; + } else if (city === "Zalaegerszeg, Hungary") { + cityID = "3042638"; + } else if (city === "Delta Junction, Alaska, US") { + cityID = "5860524"; + } else if (city === "Guadalajara, Mexico") { + cityID = "4005539"; + } else if (city === "Denver, Colorado, US") { + cityID = "5419384"; + } else if (city === "Stanley, Falkland Islands") { + cityID = "3426691"; + } else if (city === "Parauapebas, Brasil") { + cityID = "6317872"; + } else if (city === "Arequipa, Peru") { + cityID = "3947322"; + } else if (city === "Maseru, Lesotho") { + cityID = "932506"; + } else if (city === "Port Elizabeth, RSA") { + cityID = "964420"; + } else if (city === "Ouargla, Algeria") { + cityID = "2485801"; + } else if (city === "Verkhoyansk, Russia") { + cityID = "2013465"; + } else if (city === "Surabaya, Indonesia") { + cityID = "1625822"; + } else if (city === "Chongqing, China") { + cityID = "1814906"; + } else if (city === "Oodnadatta, Australia") { + cityID = "2064144"; + } else if (city === "Suva, Fiji") { + cityID = "2198148"; + } else if (city === "Canberra, Australia") { + cityID = "2172517"; + } + const key = "7295d5982610c427647a9f6429ff9564"; + const response = await fetch( + "https://api.openweathermap.org/data/2.5/weather?id=" + + cityID + + "&appid=" + + key + ); + const data = await response.json(); + if (response.ok) { + // Update DOM elements + getTemperature(data); + } else { + document.getElementById("city").innerHTML = "An error occured."; + } + } + + function getTemperature(d) { + var celcius = Math.round(parseFloat(d.main.temp) - 273.15); + document.getElementById("temperature").innerHTML = + "Today, the temperature in this city is: " + celcius + "°"; + if (celcius <= 12) { + opinionText = "Well, I don't envy you. This place so cold!"; + } else if (celcius >= 27) { + opinionText = "I hope you you don't get sunburned easily..."; + } else { + opinionText = "The weather is pretty nice!"; + } + + document.getElementById("opinion").innerHTML = opinionText; + } + // 10 years live end + + // words to live by start + async function getQuote() { + const response = await fetch("https://api.quotable.io/random?tags=life"); + const data = await response.json(); + if (response.ok) { + document.getElementById("quote").innerHTML = data.content; + document.getElementById("cite").innerHTML = data.author; + } else { + quote.textContent = "An error occured"; + } + } + // words to live by end + + // future dog start + async function getDog() { + fetch("https://dog.ceo/api/breeds/image/random") + .then((response) => { + if (response.ok) { + return response.json(); + } else { + document.getElementsByClassName("dogInfo").innerHTML = + "An error occured."; + } + }) + .then((data) => { + const imageurl = data.message; + document.getElementById( + "randomImageContainer" + ).innerHTML = `dog image`; + let bits = data.message.split("/"); + bits = bits[bits.length - 2].split("-").map((word) => { + return word.charAt(0).toUpperCase() + word.slice(1); + }); + if (bits[1] === undefined) { + document.getElementById("dogInfo").innerHTML = + "Your future doggo is " + bits[0]; + } else { + document.getElementById("dogInfo").innerHTML = + "Your future doggo is " + bits[1] + " " + bits[0]; + } + }); + } + // future dog end + \ No newline at end of file diff --git a/stars.jpg b/stars.jpg new file mode 100644 index 00000000..e60cb07a Binary files /dev/null and b/stars.jpg differ diff --git a/style.css b/style.css index e69de29b..d0b75ab6 100644 --- a/style.css +++ b/style.css @@ -0,0 +1,161 @@ +@media only screen and (max-width: 1800px) { + #main { + width: 40%; + } + .container-up, .container { + width: 40%; + } + } + + @media only screen and (max-width: 768px) { + #main { + width: 65%; + } + .container-up, .container { + width: 65%; + } + } + + @media only screen and (max-width: 425px) { + #main { + width:85%; + } + .container-up, .container { + width: 85%; + } + } + + body { + background-image: linear-gradient(to top, #fff2c3, #fdfbe3); + } + .color1 { + background-color: #ef959c; + } + .color2 { + background-color: #cbb3bf; + } + .color3 { + background-color: #95adb6; + } + .color4 { + background-color: #7285b3; + } + #main { + border-radius: 15px; + box-shadow: 8px 8px 25px -12px rgba(43, 43, 169, 1); + margin: 20px auto; + padding: 1px; + background-image: url(./stars.jpg); + background-size: cover; + color: white; + } + .container-up { + border-radius: 15px 15px 0px 0px; + box-shadow: 8px 8px 25px -12px rgba(43, 43, 169, 1); + margin: 20px auto 0px auto; + padding: 1px; + color: white; + } + .container { + background-color: white; + border-color: white; + border-radius: 0px 0px 15px 15px; + box-shadow: 8px 8px 25px -12px rgba(43, 43, 169, 1); + margin: 0px auto 20px auto; + padding: 1px; + } + h1, + h2, + h3 { + font-family: "Crimson Pro", serif; + text-align: center; + } + h5 { + font-family: "Nunito", sans-serif; + text-align: center; + } + p { + text-align: center; + font-family: "Nunito", sans-serif; + } + /* words to live by start */ + cite { + font-family: "Nunito", sans-serif; + font-style: italic; + } + /* words to live by end */ + button { + border: none; + opacity: 70%; + color: white; + border-radius: 1.5rem; + padding: 0.7rem; + margin: 7px; + font-family: "Nunito", sans-serif; + font-size: 16px; + } + button.color1:hover { + border: 2px solid #ef959c; + background-color: white; + color: #ef959c; + border-radius: 1.5rem; + padding: 0.7rem; + margin: 5px; + cursor: pointer; + } + button.color2:hover { + border: 2px solid #cbb3bf; + background-color: white; + color: #cbb3bf; + border-radius: 1.5rem; + padding: 0.7rem; + margin: 5px; + cursor: pointer; + } + button.color3:hover { + border: 2px solid #95adb6; + background-color: white; + color: #95adb6; + border-radius: 1.5rem; + padding: 0.7rem; + margin: 5px; + cursor: pointer; + } + button.color4:hover { + border: 2px solid #7285b3; + background-color: white; + color: #7285b3; + border-radius: 1.5rem; + padding: 0.7rem; + margin: 5px; + cursor: pointer; + } + .card-footer { + margin: 10px; + text-align: center; + } + #luckynumbers { + text-align: center; + font-family: "Nunito", sans-serif; + } + /* live in 10 years start */ + .continentselect { + margin: 10px; + text-align: center; + } + select { + font-family: "Nunito", sans-serif; + font-size: 16px; + text-align: center; + border: none; + } + /* live in 10 years end */ + #randomImageContainer { + width: 95%; + border-radius: 15px; + margin: 5px auto; + } + #randomImageContainer img { + width: 100%; + } + \ No newline at end of file