generator: Updated socials & style changes
Added on click to generated password text box if empty generate password. Added link to my website Added favicon
This commit is contained in:
parent
c01a74485f
commit
966e7efe5d
@ -1,10 +1,25 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Password Generator | Nathan Woodburn</title>
|
||||
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/all.min.css'>
|
||||
<link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Montserrat&display=swap'><link rel="stylesheet" href="./style.css">
|
||||
<meta charset="UTF-8">
|
||||
<title>Password Generator | Nathan.Woodburn/</title>
|
||||
<meta name="theme-color" content="#97009a">
|
||||
<meta name="description" content="G'day, this is my personal website. You can find out who I am or check out some of my projects.">
|
||||
<meta name="twitter:title" content="Nathan.Woodburn/">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:image" content="https://nathan.woodburn.au/assets/img/profile.jpg">
|
||||
<meta name="twitter:image" content="https://nathan.woodburn.au/assets/img/profile.jpg">
|
||||
<meta name="twitter:description" content="G'day, this is my personal website. You can find out who I am or check some of my projects.">
|
||||
<meta name="twitter:card" content="summary">
|
||||
<link rel="apple-touch-icon" type="image/png" sizes="180x180" href="../assets/img/NJW%20Icon%20180.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="../assets/img/NJW%20Icon%2016.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="../assets/img/NJW%20Icon%2032.png">
|
||||
<link rel="icon" type="image/png" sizes="180x180" href="../assets/img/NJW%20Icon%20180.png">
|
||||
<link rel="icon" type="image/png" sizes="192x192" href="../assets/img/NJW%20Icon%20192.png">
|
||||
<link rel="icon" type="image/png" sizes="512x512" href="../assets/img/NJW%20Icon%20512.png">
|
||||
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/all.min.css'>
|
||||
<link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Montserrat&display=swap'>
|
||||
<link rel="stylesheet" href="./style.css">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
@ -15,7 +30,7 @@
|
||||
<div class="result__title field-title">Generated Password</div>
|
||||
<div class="result__info right">click to copy</div>
|
||||
<div class="result__info left">copied</div>
|
||||
<div class="result__viewbox" id="result">CLICK GENERATE</div>
|
||||
<div class="result__viewbox" id="result"><button class="textgenerate" id="textgenerate">GENERATE PASSWORD</button></div>
|
||||
<button id="copy-btn" style="--x: 0; --y: 0"><i class="far fa-copy"></i></button>
|
||||
</div>
|
||||
<div class="length range__slider" data-min="4" data-max="32">
|
||||
@ -44,7 +59,7 @@
|
||||
</div>
|
||||
|
||||
<button class="btn generate" id="generate">Generate Password</button>
|
||||
<!-- <a href="/"><p style="text-align:center">Home</p></a> -->
|
||||
<a href="https://nathan.woodburn.au/" target="_blank">Nathan.Woodburn/</a>
|
||||
</div>
|
||||
<!-- partial -->
|
||||
<script src="./script.js"></script>
|
||||
|
@ -81,6 +81,7 @@ const symbolEl = document.getElementById("symbol");
|
||||
|
||||
// Button to generate the password
|
||||
const generateBtn = document.getElementById("generate");
|
||||
const generateBtntxt = document.getElementById("textgenerate");
|
||||
// Button to copy the text
|
||||
const copyBtn = document.getElementById("copy-btn");
|
||||
// Result viewbox container
|
||||
@ -126,7 +127,7 @@ window.addEventListener("resize", e => {
|
||||
copyBtn.addEventListener("click", () => {
|
||||
const textarea = document.createElement("textarea");
|
||||
const password = resultEl.innerText;
|
||||
if (!password || password == "CLICK GENERATE") {
|
||||
if (!password || password == "generateBtntxt") {
|
||||
return;
|
||||
}
|
||||
textarea.value = password;
|
||||
@ -156,6 +157,21 @@ generateBtn.addEventListener("click", () => {
|
||||
copiedInfo.style.opacity = "0";
|
||||
});
|
||||
|
||||
// When Generate is clicked Password id generated.
|
||||
generateBtntxt.addEventListener("click", () => {
|
||||
const length = +lengthEl.value;
|
||||
const hasLower = lowercaseEl.checked;
|
||||
const hasUpper = uppercaseEl.checked;
|
||||
const hasNumber = numberEl.checked;
|
||||
const hasSymbol = symbolEl.checked;
|
||||
generatedPassword = true;
|
||||
resultEl.innerText = generatePassword(length, hasLower, hasUpper, hasNumber, hasSymbol);
|
||||
copyInfo.style.transform = "translateY(0%)";
|
||||
copyInfo.style.opacity = "0.75";
|
||||
copiedInfo.style.transform = "translateY(200%)";
|
||||
copiedInfo.style.opacity = "0";
|
||||
});
|
||||
|
||||
// Function responsible to generate password and then returning it.
|
||||
function generatePassword(length, lower, upper, number, symbol) {
|
||||
let generatedPassword = "";
|
||||
|
@ -33,6 +33,7 @@ button {
|
||||
margin: 10px -5px;
|
||||
margin-bottom: 30px;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.result {
|
||||
@ -309,3 +310,8 @@ a:hover {
|
||||
transform: rotate(10deg);
|
||||
}
|
||||
}
|
||||
button.textgenerate {
|
||||
color: white;
|
||||
background-color: transparent;
|
||||
font-size: larger;
|
||||
}
|
Loading…
Reference in New Issue
Block a user