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

add show hide password #428

Closed
wants to merge 2 commits into from
Closed
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
30 changes: 30 additions & 0 deletions ShowHidePassword/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
rel="stylesheet"
href="https://use.fontawesome.com/releases/v5.15.4/css/all.css"
integrity="sha384-DyZ88mC6Up2uqS4h/KRgHuoeGwBcD4Ng9SiP4dIRy0EXTlnuz47vAwmeGwVChigm"
crossorigin="anonymous"
/>
<title>Show Hide Password</title>
<link rel="stylesheet" href="./style.css" />
</head>
<body>
<div class="inputBox">
<input id="password" type="password" placeholder="Enter your password" />
<div id="toggle">
<i
id="icon"
class="fas fa-eye-slash fa-2x"
onclick="showHide();"
style="padding: 5px"
></i>
</div>
</div>

<script src="./script.js"></script>
</body>
</html>
15 changes: 15 additions & 0 deletions ShowHidePassword/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const password = document.getElementById("password");
const toggle = document.getElementById("toggle");
const icon = document.getElementById("icon");
function showHide() {
if (password.type === "password") {
password.setAttribute("type", "text");
toggle.classList.remove("hide");
icon.classList.remove("fa-eye-slash");
icon.classList.add("fa-eye");
} else {
password.setAttribute("type", "password");
toggle.classList.add("hide");
icon.classList.add("fa-eye-slash");
}
}
50 changes: 50 additions & 0 deletions ShowHidePassword/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
* {
margin: 0;
padding: 0;
}
body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: #f8f8f8;
}
.inputBox {
position: relative;
width: 400px;
height: 60px;
}
.inputBox input {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
font-size: 25px;
padding: 15px;
outline: none;
border: none;
border-radius: 8px;
background: transparent;
box-sizing: border-box;
box-shadow: -4px -4px 10px rgba(255, 255, 255, 1),
inset 4px 4px 10px rgba(0, 0, 0, 0.05),
inset -4px -4px 10px rgba(255, 255, 255, 1),
4px 4px 10px rgba(0, 0, 0, 0.05);
}
.inputBox input::placeholder {
color: rgb(146, 140, 140);
}
#toggle {
position: absolute;
top: 10px;
right: 10px;
width: 45px;
height: 30px;
background-size: cover;
padding: 5px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
}
47 changes: 47 additions & 0 deletions TextAnalyzer/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
let textareaEl = document.querySelector("#text");
let text = null;
let data = {
words: 0,
sentences: 0,
uppercaes: 0,
lowercase: 0,
spaces: 0,
digits: 0,
vowels: 0,
consonants: 0,
};

const findLength = (item) => (item == null ? 0 : item.length);

const setText = () => {
text = textareaEl.value;
if (text != null) {
data.sentences = findLength(text.match(/\056/g));
data.words = findLength(text.match(/[a-zA-Z]+/g));
data.spaces = findLength(text.match(/\s/g));
data.uppercaes = findLength(text.match(/[A-Z]/g));
data.lowercase = findLength(text.match(/[a-z]/g));
data.digits = findLength(text.match(/\d/g));
data.vowels = findLength(text.match(/[aeiou]/gi));
data.consonants = findLength(text.match(/[bcdfghjklmnpqrstvwxyz]/gi));
}
localStorage.setItem("data", JSON.stringify(data));

window.location = "info.html";
};

const getData = () => {
return JSON.parse(localStorage.getItem("data"));
};

const showData = () => {
let data = getData();
let htmlContent = "";
for (item in data) {
htmlContent += `<div class="box">
<h2>${data[item]}</h2>
<p>${item}</p>
</div>`;
}
document.querySelector(".info-wrapper").innerHTML = htmlContent;
};
22 changes: 22 additions & 0 deletions TextAnalyzer/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>Text</title>
<link rel="stylesheet" href="./style.css" />
</head>
<body>
<div class="text-wrapper">
<textarea
id="text"
spellcheck="false"
placeholder="Enter your text here...."
></textarea>
<button onclick="setText()" class="btn">Generate Info</button>
</div>

<!-- textInfo.js -->
<script src="./app.js"></script>
</body>
</html>
22 changes: 22 additions & 0 deletions TextAnalyzer/info.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>Text Info</title>

<!-- style.css -->
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div class="info-wrapper"></div>

<script src="app.js"></script>

<script>
window.onload = () => {
showData();
};
</script>
</body>
</html>
109 changes: 109 additions & 0 deletions TextAnalyzer/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}

body,
html {
width: 100%;
height: 100%;
}

body {
font-family: "Roboto", sans-serif;
}

.info-wrapper {
width: 100%;
height: 100%;
padding: 40px;
display: grid;
grid-template-columns: repeat(4, 1fr);
grid-gap: 2rem;
}

.text-wrapper {
width: 100%;
height: 100%;
padding: 50px;
}

textarea {
background: rgb(255, 174, 174);
color: rgb(0, 0, 0);
width: 100%;
height: 90%;
padding: 20px;
font-size: 1.5rem;
border-radius: 4px;
margin-bottom: 10px;
resize: none;
border: none;
}

button {
border: none;
color: #fff;
background-color: #000;
padding: 15px 40px;
border-radius: 4px;
cursor: pointer;
}

button:hover {
border: 1px solid #000;
background: rgb(255, 174, 174);
color: #000;
}

textarea:focus {
outline: none;
}

.box {
border: 2px solid #000;
border-radius: 10px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
min-height: 200px;
}

.box h2 {
font-size: 4rem;
font-weight: 100;
color: #000000;
}

.box:hover h2,
.box:hover,
.box:hover p {
background-color: #000;
color: #fff;
scale: 2;
}

.box p {
font-size: 20px;
background-color: #fff;
color: #283618;
padding: 5px 20px;
border-radius: 27px;
}

@media screen and (max-width: 768px) {
.info-wrapper {
grid-template-columns: repeat(2, 1fr);
gap: 40px;
}
}

@media screen and (max-width: 576px) {
.info-wrapper {
grid-template-columns: repeat(1, 1fr);
gap: 40px;
}
}