Skip to content

Instantly share code, notes, and snippets.

@cm85
Last active June 28, 2017 10:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cm85/a6b0ff3e263489dc02b71816ebcd9978 to your computer and use it in GitHub Desktop.
Save cm85/a6b0ff3e263489dc02b71816ebcd9978 to your computer and use it in GitHub Desktop.
Forgiveness Assist Quote
<main class="prompt">
<p>Get Your Federal Student Loan Monthly Payment Forgiven Today!</p>
<p>Call (800) 757-5001 To Get Your New Monthly Payment In Just Minutes</p>
<p>Or Go To forgivenessassist.com For More Information</p>
</main>
var $lines = $('.prompt p');
$lines.hide();
var lineContents = new Array();
var terminal = function() {
var skip = 0;
typeLine = function(idx) {
idx == null && (idx = 0);
var element = $lines.eq(idx);
var content = lineContents[idx];
if(typeof content == "undefined") {
$('.skip').hide();
return;
}
var charIdx = 0;
var typeChar = function() {
var rand = Math.round(Math.random() * 150) + 25;
setTimeout(function() {
var char = content[charIdx++];
element.append(char);
if(typeof char !== "undefined")
typeChar();
else {
element.append('<br/><span class="output">' + element.text().slice(9, -1) + '</span>');
element.removeClass('active');
typeLine(++idx);
}
}, skip ? 0 : rand);
}
content = ' $$$ ➜ "' + content + '"';
element.append(' ').addClass('active');
typeChar();
}
$lines.each(function(i) {
lineContents[i] = $(this).text();
$(this).text('').show();
});
typeLine();
}
terminal();
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
body {
background-color: black;
color: #55ff55;
font-family: monospace;
}
.output {
color: red;
}
.active:after {
content: '_';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment