Skip to content

Instantly share code, notes, and snippets.

@akgold
Last active August 29, 2015 14:27
Show Gist options
  • Save akgold/d9ea2c8d853f8ee4ef0c to your computer and use it in GitHub Desktop.
Save akgold/d9ea2c8d853f8ee4ef0c to your computer and use it in GitHub Desktop.
Star Wars Quote Generator
<head>
<title> Alex's Star Wars Quote Generator</title>
</head>
<body>
<div>
<h1 class = text-center>Star Wars Quotes </h1>
<button class = "center-block" id = "change-quote">This quote has disappointed me for the last time.</button>
</div>
<div class = "row" >
<div class = "center-block quote" >
<p class = "toShow"></p>
</div>
</div>
</body>
function getRandQuote() {
var quotes = ["Never tell me the odds!",
"Well, you said you wanted to be around when I made a mistake." ,
"You do have your moments. Not many, but you have them.",
"I know.",
"Ben! I can be a Jedi. Ben, tell him I’m ready! I’m not afraid! You will be.",
"Now, witness the power of this fully operational battle station.",
"&#133;Scoundrel. I like that.",
"I have a bad feeling about this.",
"Hmm! Adventure. Hmmpf! Excitement. A Jedi craves not these things.",
"Who’s the more foolish; the fool, or the fool who follows him?",
"That&#133; is why you fail.",
"It’s worse.",
"That’s no moon.",
"Sorry about the mess.",
"Ready are you? What know you of ready? For eight hundred years have I trained Jedi. My own counsel will I keep on who is to be trained. A Jedi must have the deepest commitment, the most serious mind. This one, a long time have I watched. All his life has he looked away&#133; to the future, to the horizon. Never his mind on where he was. &#133;Hmm? On what he was doing.",
"If they follow standard Imperial procedure, they’ll dump their garbage before they go to light-speed. Then we just&#133; float away&#133;With the rest of the garbage.",
"Laugh it up, fuzzball!",
"I never doubted you! Wonderful!",
"You will never find a more wretched hive of scum and villainy&#133;We must be cautious.",
"Would somebody get this big walking carpet out of my way?!",
"So what I told you was true&#133; from a certain point of view.&#133;A certain point of view?!",
"Your weapon&#133; you will not need it.",
"Luke! We’re gonna have company!","&#133;I think I just blasted it.",
"That’s impossible.",
"Search your feelings.",
"I’ll never join you.",
"He certainly has courage. Yeah, but what good is that if he gets himself killed?",
"&#133;You’ve failed, your highness.I am a Jedi, as my father was before me&#133;So be it, Jedi.",
"Only at the end do you realize the power of the Dark Side.",
"It’s not impossible. I used to bullseye womp rats in my T-16 back home, they’re not much bigger than two meters.",
"Awww! But I was going into Tosche Station to pick up some power converters!!!",
"IT’S A TRAP.",
"But how could they be jamming us if they don’t know&#133; that we’re&#133; coming?",
"Strike me down, and I will become more powerful than you could possibly imagine.",
"STAY ON TARGET."];
return "&ldquo;"+quotes[Math.floor(Math.random() * (quotes.length))]+"&rdquo;";
}
//jQuery to show a quote on open
$(document).ready($('.toShow').html(getRandQuote()));
//Jquery to change quote on click
$('#change-quote').click(function getQuote() {
var $toShow = $('.toShow');
var newQ = getRandQuote()
//make sure we're not putting the same quote back up again
if ($toShow.html() != newQ) {
$toShow.html(newQ);
} else {
getQuote();
}
});
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
@import url(http://fonts.googleapis.com/css?family=News+Cycle:400,700);
h1{
color: rgb(75, 213, 238);
font-size: 300%;
}
body{
width: 100%;
height: 100%;
background: #000;
margin: 0;
font: 700 1.25em "News Cycle", sans-serif;
}
#change-quote{
color: #ff6;
background-color: rgb(0,0,0);
vertical-align: center;
margin-top: 50px;
font-size: 1.5em;
curson: pointer;
}
.quote{
margin: 50px ;
background: rgb(155,155,155);
font-size: 400%
}
p{
text-align: center;
}
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment