A Pen by giannis panagiotopoulos on CodePen.
Created
February 11, 2016 12:15
-
-
Save anonymous/eaead38fcf86a4ab10a9 to your computer and use it in GitHub Desktop.
quote machine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>Get your daily quote!</title> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css"> | |
</head> | |
<body> | |
<div class="container"> | |
<div class="row row-content"> | |
<div class="col-xs-12"> | |
<h3>Random Quote Machine</h3> | |
</div> | |
<div class="col-xs-12 col-sm-9"> | |
<form class="form-horizontal"> | |
<div class="form-group"> | |
<div class="checkbox col-sm-10"> | |
<p>Click on the "Get Quote" button to display a random quote</p> | |
<p>You can also share the quote by clicking the "Tweeter" button</p> | |
</div> | |
</div> | |
<div class="form-group"> | |
<label for="feedback" class="col-sm-2 control-label">Your Quote</label> | |
<div class="col-sm-10 "> | |
<div class="form-control" id="quoteContainer"></div> | |
</div> | |
</div> | |
<div class="form-group"> | |
<div class="col-sm-offset-2 col-sm-10"> | |
<button id="quoteButton" class="btn btn-success">Get Quote</button> | |
<a id="myTwitter" class="btn btn-info" href="#" target="_blank"><i class="fa fa-twitter"></i> Tweeter</a> | |
</div> | |
</div> | |
</form> | |
</div> | |
</div> | |
</div> | |
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function(){ | |
var Quotation=new Array() | |
Quotation[0] = "Be yourself; everyone else is already taken - Oscar Wilde"; | |
Quotation[1] = "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe. - Albert Einstein"; | |
Quotation[2] = "So many books, so little time. - Frank Zappa"; | |
Quotation[3] = "Be the change that you wish to see in the world. - Mahatma Gandhi"; | |
Quotation[4] = "If you tell the truth, you don't have to remember anything. - Mark Twain"; | |
Quotation[5] = "Without music, life would be a mistake. - Friedrich Nietzsche"; | |
Quotation[6] = "Life is what happens to you while you're busy making other plans. - Allen Saunders"; | |
Quotation[7] = "I have not failed. I've just found 10,000 ways that won't work. - Thomas A. Edison"; | |
Quotation[8] = "It is never too late to be what you might have been. - George Eliot"; | |
Quotation[9] = "Everything you can imagine is real. - Pablo Picasso"; | |
$('#quoteButton').click(function(evt){ | |
evt.preventDefault(); | |
var Q = Quotation.length; | |
var whichQuotation=Math.round(Math.random()*(Q-1)); | |
var quoteContainer = $('#quoteContainer'); | |
var tLink = document.getElementById('myTwitter'); | |
quoteContainer.html(''); | |
quoteContainer.append(Quotation[whichQuotation]); | |
var tUrl = 'https://twitter.com/intent/tweet?text=' + Quotation[whichQuotation]; | |
tLink.setAttribute('href', tUrl); | |
// console.log(tUrl); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.14/angular.min.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.form-control { | |
height: 50px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" /> | |
<link href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.2.3/animate.min.css" rel="stylesheet" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment