SmartPass

Size
3,841 Kb
Views
12,144

How do I make an smartpass?

What is a smartpass? How do you make a smartpass? This script and codes were developed by Julien Dargelos on 29 November 2022, Tuesday.

SmartPass Previews

SmartPass - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>SmartPass</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <form id="form"> <input id="input" type="password"/> <input id="submit" type="submit"> <span id="confirm">Hello!</span>
</form>
<p> The correct password is <span class="correct">password</span><br> Also try something <span class="wrong">wrong</span>
</p> <script src="js/index.js"></script>
</body>
</html>

SmartPass - Script Codes CSS Codes

form { margin: 80px 0 0 0; position: relative; text-align: center;
}
#input { width: 200px; height: 20px; opacity: 0;
}
#submit {display:none;}
#confirm { height: 18px; top: 0; opacity: 0; position: relative; display: block; font-family: Helvetica, Arial, sans-serif; font-size: 18px; color: rgb(0,255,90); transition: 0.2s;
}
#confirm.correct { opacity: 1; top: -37px; transition: 0.3s 0.3s;
}
p { top: 0; left: 50%; width: 220px; margin: 150px 0 0 -130px; padding: 20px; border: 2px solid rgb(190,190,190); border-radius: 4px; position: absolute; font-family: Helvetica, Arial, sans-serif; font-size: 14px; text-align: center; color: rgb(120,120,120);
}
p span { margin: 5px 0 5px 2px; padding: 3px 5px; border: 1px dashed rgb(120,120,120); border-radius: 3px; display: inline-block; font-size: 12px; color: #fff;
}
p span.wrong { border-color: rgb(255,0,0); color: rgb(255,0,0);
}
p span.correct { border-color: rgb(0,255,90); color: rgb(0,255,90);
}
.smartpass { border-bottom: 2px solid rgb(190,190,190); overflow: hidden; font-size: 0; text-align: center; display: inline-block; -webkit-transition: 0.2s; -moz-transition: 0.2s; transition: 0.2s;
}
.smartpass.wrong,
.smartpass.focus.wrong { border-bottom-color: red;
}
.smartpass.correct { padding-top: 20px; margin-top: -20px; border-bottom-color: rgb(0,255,90);
}
.smartpass.focus { border-bottom-color:rgb(120,120,120);
}
.smartpass .smartpass-cursor { background: rgb(190,190,190); width: 2px; height: 70%; top: -75%; left: 0; margin: -2px 0 0 0; opacity: 0; position: relative; display: block; -webkit-transition: 0.1s; -moz-transition: 0.1s; transition: 0.1s;
}
.smartpass.focus .smartpass-cursor { opacity: 1; -webkit-animation:smartpass-cursor 1s infinite; -moz-animation:smartpass-cursor 1s infinite; animation:smartpass-cursor 1s infinite;
}
.smartpass.focus.typing .smartpass-cursor { -webkit-animation:none; -moz-animation:none; animation:none;
}
.smartpass .smartpass-cursor.hit { background:rgb(120,120,120); -webkit-transition:left 0.1s; -moz-transition:left 0.1s; transition:left 0.1s;
}
.smartpass.focus.wrong .smartpass-cursor { opacity: 0; -webkit-animation:none; -moz-animation:none; animation:none;
}
.smartpass input { opacity: 0;
}
.smartpass .smartpass-dot { background: rgb(190,190,190); width: 6px; height: 6px; top: -31px; margin: 0 2px 100% 2px; border-radius: 6px; vertical-align: top; position: relative; display: inline-block; -webkit-animation: smartpass-dot 0.4s 1; -moz-animation: smartpass-dot 0.4s 1; animation: smartpass-dot 0.4s 1;
}
.smartpass .smartpass-dot.out { width: 0; height: 0; margin: 3px 0 100% 0; -webkit-transition: 0.1s; -moz-transition: 0.1s; transition: 0.1s;
}
.smartpass.wrong .smartpass-dot { -webkit-animation: smartpass-dot-wrong 0.5s 1; -moz-animation: smartpass-dot-wrong 0.5s 1; animation: smartpass-dot-wrong 0.5s 1;
}
.smartpass.correct .smartpass-dot { opacity: 0; -webkit-animation: smartpass-dot-correct 0.5s 1; -webkit-transition: none; -moz-transition: none; transition: none;
}
@-webkit-keyframes smartpass-cursor { 0% {opacity: 1;} 50% {opacity: 0;} 100% {opacity: 1;}
}
@-moz-keyframes smartpass-cursor { 0% {opacity: 1;} 50% {opacity: 0;} 100% {opacity: 1;}
}
@keyframes smartpass-cursor { 0% {opacity: 1;} 50% {opacity: 0;} 100% {opacity: 1;}
}
@-webkit-keyframes smartpass-dot { 0% {background:rgb(190,190,190);width:0;margin-top:5%;} 25% {width:6px;} 50% {background:rgb(120,120,120);margin-top:-1%;} 100% {background:rgb(190,190,190);margin-top:0;}
}
@-moz-keyframes smartpass-dot { 0% {background:rgb(190,190,190);width:0;margin-top:5%;} 25% {width:6px;} 50% {background:rgb(120,120,120);margin-top:-1%;} 100% {background:rgb(190,190,190);margin-top:0;}
}
@keyframes smartpass-dot { 0% {background:rgb(190,190,190);width:0;margin-top:5%;} 25% {width:6px;} 50% {background:rgb(120,120,120);margin-top:-1%;} 100% {background:rgb(190,190,190);margin-top:0;}
}
@-webkit-keyframes smartpass-dot-wrong { 0% {background: rgb(190,190,190);left: 0;} 15% {background: rgb(255,0,0);left: -7px;} 30% {left: 7px;} 45% {left: -7px} 60% {left: 0px;} 65% {top: -31px;} 100% {background: rgb(255,0,0);top:0;}
}
@-moz-keyframes smartpass-dot-wrong { 0% {background: rgb(190,190,190);left: 0;} 15% {background: rgb(255,0,0);left: -7px;} 30% {left: 7px;} 45% {left: -7px} 60% {left: 0px;} 65% {top: -31px;} 100% {background: rgb(255,0,0);top:0;}
}
@keyframes smartpass-dot-wrong { 0% {background: rgb(190,190,190);left: 0;} 15% {background: rgb(255,0,0);left: -7px;} 30% {left: 7px;} 45% {left: -7px} 60% {left: 0px;} 65% {top: -31px;} 100% {background: rgb(255,0,0);top:0;}
}
@-webkit-keyframes smartpass-dot-correct { 0% {background: rgb(190,190,190);top: -31px;opacity: 1;} 25% {background: rgb(0,255,90);top: -31px;opacity: 1;} 100% {top: -50px}
}

SmartPass - Script Codes JS Codes

var SmartPass=function(input) { if(input instanceof Node) { if(input.tagName=='INPUT' && input.type=='password') { var self=this; this.input=input; this.element=document.createElement('div'); this.element.style.width=this.input.offsetWidth+'px'; this.element.style.height=this.input.offsetHeight+'px'; this.cursor=document.createElement('div'); this.cursor.className='smartpass-cursor'; this.element.className='smartpass'; this.dots=[]; this.cursorDelta=0; this.typingInterval=200; this.typingTimeout=null; this.typing=function() {	this.cursor.className+=' hit'; setTimeout(function() {	self.cursor.className=self.cursor.className.replace(/\bhit\b/g,''); },this.typingInterval/2);	if(this.typingTimeout!==null) clearTimeout(this.typingTimeout); this.element.className+=' typing';	this.typingTimeout=setTimeout(function() {	self.element.className=self.element.className.replace(/\btyping\b/g,''); },this.typingInterval); }; this.appendDots=function(n) { if (typeof n!='number') n=1; for(var i=0; i<n; i++) { var dot=document.createElement('div'); dot.className='smartpass-dot'; this.dots.push(dot); this.element.appendChild(dot); } }; this.removeDots=function(n,animation) { if(typeof n!='number') n=1; if(n>this.dots.length) n=this.dots.length; var remove=function(dot) {	setTimeout(function(){dot.parentNode.removeChild(dot);},100); }; if(animation!==false) { for(var i=this.dots.length-n; i<this.dots.length; i++) { this.dots[i].className+=' out'; remove(this.dots[i]); } } else {	for(var i=this.dots.length-n; i<this.dots.length; i++) { this.dots[i].parentNode.removeChild(this.dots[i]); } } this.dots.splice(this.dots.length-n,n); }; this.updateDots=function(animation) { var n=this.input.value.length-this.dots.length; if(n>0) this.appendDots(n); else if(n<0) this.removeDots(-n,animation); }; this.updateCursor=function(delta) {	if(typeof delta=='number') this.cursorDelta+=-this.cursorDelta>=this.dots.length && delta<0 ? 0 : delta; if(this.cursorDelta>0) this.cursorDelta=0;	var left=this.element.offsetWidth/2-1; if(this.dots.length>0) {	var dotStyle=getComputedStyle(this.dots[0]);	var dotWidth=6; dotWidth+=parseInt(dotStyle.getPropertyValue('margin-right')); dotWidth+=parseInt(dotStyle.getPropertyValue('margin-left'));	left+=(this.dots.length+this.cursorDelta*2)*dotWidth/2; } if(left>this.element.offsetWidth-2) left=this.element.offsetWidth-2; else if(left<0) left=0; this.cursor.style.left=left+'px'; }; this.confirm=function(check) {	this.element.className=this.element.className.replace(/\b(correct|wrong)\b/g,''); setTimeout(function(){self.element.className+=check ? ' correct' : ' wrong';},1); if(check) this.input.blur(); else {	setTimeout(function() {	self.input.value='';	self.updateDots(false); self.updateCursor();	self.element.className=self.element.className.replace(/\bwrong\b/g,''); },500); } }; this.reset=function() {	this.input.value=''; this.updateDots(); this.updateCursor();	this.element.className='smartpass'; setTimeout(function(){self.input.focus();},300); }; this.input.addEventListener('keydown',function(event) {	self.typing(); setTimeout(function() {	self.updateDots();	self.updateCursor(event.keyCode==39 ? 1 : (event.keyCode==37 ? -1 : 0)); }); }); this.input.addEventListener('focus',function() {	self.updateDots(); self.updateCursor();	self.element.className+=' focus'; }); this.input.addEventListener('blur',function() {	self.element.className=self.element.className.replace(/\bfocus\b/g,''); }); this.input.parentNode.insertBefore(this.element,this.input); this.input.parentNode.removeChild(this.input); this.element.appendChild(this.input); this.element.appendChild(this.cursor); this.updateDots(); this.updateCursor(); setTimeout(function(){self.input.focus();},300); } }
};
var smartPass=new SmartPass(document.getElementById('input'));
document.getElementById('form').onsubmit=function() {	if(document.getElementById('input').value=='password') {	smartPass.confirm(true); document.getElementById('confirm').className='correct'; setTimeout(function(){document.getElementById('confirm').className='';},1800); setTimeout(function(){smartPass.reset();},2000) } else {	smartPass.confirm(false); document.getElementById('confirm').className=''; } return false;
};
SmartPass - Script Codes
SmartPass - Script Codes
Home Page Home
Developer Julien Dargelos
Username juliendargelos
Uploaded November 29, 2022
Rating 4.5
Size 3,841 Kb
Views 12,144
Do you need developer help for SmartPass?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Julien Dargelos (juliendargelos) Script Codes
Create amazing captions with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!