Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Air Quality Index Calculator #823

Merged
merged 14 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
20 changes: 20 additions & 0 deletions Calculators/AQI-Level-Calculator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# <p align="center">AQI Level Calculator</p>

## Description :-

Calculates the level of the air quality using AQI index.

## Tech Stacks :-

- HTML
- CSS
- JavaScript

## Screenshots :-

![Screenshot of the WebPage](assets/Screenshot.png)

In the main website


![Screenshot of the Main Website](assets/Screenshot2.png)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions Calculators/AQI-Level-Calculator/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AQI Level Calculator</title>
<link rel="icon" href="./assets/favicon.png">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<h1>Air Quality Index(AQI) level Calculator</h1>
<br><br>
<label for="aqi-idx" id="input-label">Enter AQI of your region : </label>
<input type="number" id="input-id" min="1" max="500" step="any" oninput="validity.valid||(value='');" onchange="validateBaseInput(this)" placeholder="Enter AQI" required>
<br><br>
<button onclick="calculateAQI()">Calculate Level</button>
<p id="result"></p>
</div>
<script src="script.js"></script>
</body>
</html>
30 changes: 30 additions & 0 deletions Calculators/AQI-Level-Calculator/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
function calculateAQI() {

var aqiIndex = document.getElementById("input-id").value;
var resultElement = document.getElementById("result");

if (aqiIndex <= 0 || aqiIndex > 500) {
alert("Invalid input \nEnter AQI index from 1 to 500!");
resultElement.innerHTML = "";
resultElement.style.backgroundColor = "";
} else if (aqiIndex >= 1 && aqiIndex <= 50) {
resultElement.innerHTML = `AQI: ${aqiIndex} - Good air quality`;
resultElement.style.backgroundColor = "green";
} else if (aqiIndex >= 51 && aqiIndex <= 100) {
resultElement.innerHTML = `AQI: ${aqiIndex} - Moderate air quality`;
resultElement.style.backgroundColor = "yellow";
resultElement.style.color = "black";
} else if (aqiIndex >= 101 && aqiIndex <= 150) {
resultElement.innerHTML = `AQI: ${aqiIndex} - Unhealthy for sensitive groups`;
resultElement.style.backgroundColor = "orange";
} else if (aqiIndex >= 151 && aqiIndex <= 200) {
resultElement.innerHTML = `AQI: ${aqiIndex} - Unhealthy`;
resultElement.style.backgroundColor = "red";
} else if (aqiIndex >= 201 && aqiIndex <= 300) {
resultElement.innerHTML = `AQI: ${aqiIndex} - Very unhealthy`;
resultElement.style.backgroundColor = "purple";
} else if (aqiIndex >= 301 && aqiIndex <= 500) {
resultElement.innerHTML = `AQI: ${aqiIndex} - Hazardous`;
resultElement.style.backgroundColor = "maroon";
}
}
73 changes: 73 additions & 0 deletions Calculators/AQI-Level-Calculator/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}

html {
height: 100%;
margin: 0;
background-image: linear-gradient(to right, #72ff5f, #d3ef34, #f1543c);
}

body {
display: flex;
height: 100vh;
margin: 0;
background-image: url('./assets/background.png');
background-size: contain;
background-position: center;
background-repeat: no-repeat;
justify-content: center;
align-items: center;
}

.container {
background-color: rgba(222, 133, 123, 0.5);
padding: 20px;
border-radius: 8px;
color: rgb(10, 10, 10);
text-align: center;
max-width: 35%;
height: 48%;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

#input-label {
font-size: 18px;
font-weight: 500;
color: #000000;
}

#input-id {
width: 100px;
border: none;
border-radius: 10px;
padding: 10px;
margin-bottom: 20px;
}

button {
cursor: pointer;
border: none;
border-radius: 10px;
padding: 10px;
background-image: linear-gradient(to right, #72ff5f, #d3ef34, #de361c);
font-weight: bold;
box-shadow: 0 4px 6px rgba(12, 162, 27, 0.3);
transition: box-shadow 0.3s;
}

button:hover {
box-shadow: 0 6px 8px rgba(176, 39, 29, 0.4);
}

#result {
padding: 12px;
margin-top: 25px;
border-radius: 8px;
color: white;
text-align: center;
justify-content: center;
font-weight: bold;
}
14 changes: 14 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,20 @@ <h3>Calculates the antilog of the any given number taken over any base.</h3>
</div>
</div>
</div>
<div class="box">
<div class="content">
<h2>AQI Level Calculator</h2>
<h3>Calculates the level of the air quality using AQI index as input.</h3>
<div class="card-footer">
<a href="./Calculators/AQI-Level-Calculator/index.html" target="_blank">
<button>Try Now</button>
</a>
<a href="https://github.com/Rakesh9100/CalcDiverse/tree/main/Calculators/AQI-Level-Calculator" title="Source Code" target="_blank">
<img src="./assets/images/github.png" alt="Source Code"></img>
</a>
</div>
</div>
</div>
<div class="box">
<div class="content">
<h2>Arithmetic Progression Calculator</h2>
Expand Down