Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions bug-beatles/Password_generator/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,4 +196,14 @@ function generatePassword(){

}

copyBtn.addEventListener('click', () => {
passwordDisplay.select();
document.execCommand("copy");
copyMsg.innerText = "Copied!";
// Clear the copied message after 2 seconds
setTimeout(() => {
copyMsg.innerText = "";
}, 2000);
});

generateButton.addEventListener('click', generatePassword);
Binary file added bug-beatles/weather_app-main/assets/mit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bug-beatles/weather_app-main/assets/mt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bug-beatles/weather_app-main/assets/sr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bug-beatles/weather_app-main/assets/ss.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions bug-beatles/weather_app-main/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,27 @@ <h1>Weather App</h1>
<p>Clouds</p>
<p data-cloudiness></p>
</div>
<div class="parameter">
<img src="./assets/sr.png">
<p>Sunrise</p>
<p data-sunrise></p>
</div>
<div class="parameter">
<img src="./assets/ss.png">
<p>Sunset</p>
<p data-sunset></p>
</div>
<div class="parameter">
<img src="./assets/mit.png">
<p>Minimum Temperature</p>
<p data-min-temp></p>
</div>
<div class="parameter">
<img src="./assets/mt.png">
<p>Maximum Temperature</p>
<p data-max-temp></p>
</div>


</div>

Expand Down
14 changes: 11 additions & 3 deletions bug-beatles/weather_app-main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ async function fetchUserWeatherInfo(coordinates) {
}

function renderWeatherInfo(weatherInfo) {
//fistly, we have to fethc the elements

// Fetching HTML elements
const cityName = document.querySelector("[data-cityName]");
const countryIcon = document.querySelector("[data-countryIcon]");
const desc = document.querySelector("[data-weatherDesc]");
Expand All @@ -98,10 +97,14 @@ function renderWeatherInfo(weatherInfo) {
const windspeed = document.querySelector("[data-windspeed]");
const humidity = document.querySelector("[data-humidity]");
const cloudiness = document.querySelector("[data-cloudiness]");
const sunrise = document.querySelector("[data-sunrise]");
const sunset = document.querySelector("[data-sunset]");
const minTemp = document.querySelector("[data-min-temp]");
const maxTemp = document.querySelector("[data-max-temp]");

console.log(weatherInfo);

//fetch values from weatherINfo object and put it UI elements
// Rendering weather data
cityName.innerText = weatherInfo?.name;
countryIcon.src = `https://flagcdn.com/144x108/${weatherInfo?.sys?.country.toLowerCase()}.png`;
desc.innerText = weatherInfo?.weather?.[0]?.description;
Expand All @@ -110,8 +113,13 @@ function renderWeatherInfo(weatherInfo) {
windspeed.innerText = `${weatherInfo?.wind?.speed} m/s`;
humidity.innerText = `${weatherInfo?.main?.humidity}%`;
cloudiness.innerText = `${weatherInfo?.clouds?.all}%`;
sunrise.innerText = new Date(weatherInfo?.sys?.sunrise * 1000).toLocaleTimeString();
sunset.innerText = new Date(weatherInfo?.sys?.sunset * 1000).toLocaleTimeString();
minTemp.innerText = `${weatherInfo?.main?.temp_min} °C`;
maxTemp.innerText = `${weatherInfo?.main?.temp_max} °C`;
}


function getLocation() {
if(navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
Expand Down