<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="keywords" content="HTML,CSS, Bootstrap, JavaScript, jQuery">
<meta name="author" content="Zia">
<meta name="Random Quote Machine Application" content="Random Quote Machine with HTML, CSS, Bootstrap, and jQuery. I a user click on a button it shows a new random quote. The user can also share out a quote by simply clicking a button on social media.">
<title>Random Quote Machine Application</title>
</head>
<body>
<div class="container vertical-center">
<div class="col-md-10 offset-md-1 mb-2">
<h1>Top 100 quotes of all time.</h1>
<blockquote class="quote-card green-card">
<p id="quote">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Doloremque at, architecto culpa sint veniam temporibus!!
</p>
<cite>
<span id="author"></span>
</cite>
</blockquote>
<a id="twitter" class="btn btn-lg btn-social btn-twitter"> <i class="fa fa-twitter"></i>Tweet Quote</a>
<button class="btn btn-success pull-right" id="randomQuote">New Quote</button>
</div>
</div>
</body>
</html>
@charset "UTF-8";
@import url(https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,200italic);
@import url(https://fonts.googleapis.com/css?family=Romanesco);
@import url(https://fonts.googleapis.com/css?family=Lobster);
@import url(https://fonts.googleapis.com/css?family=Pacifico);
@import url(https://fonts.googleapis.com/css?family=IM+Fell+DW+Pica+SC);
@import url(//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css);
@charset "UTF-8";
@import url(https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,200italic);
body {
background-image: url(https://raw.githubusercontent.com/ziaongit/Random-Quote-Machine-Application/master/resources/images/background.jpg);
background-size: cover;
background-repeat: no-repeat;
display: table;
font-family: 'Source Sans Pro', sans-serif;
font-weight: 300;
margin: 0;
padding: 0;
height: 100%;
width: 100%;
}
h1{
font-family: 'Lobster', cursive;
text-shadow: 2px 2px #00970b;
text-align: center;
color: #ffffff;
padding-bottom: 10px;
}
.vertical-center {
min-height: 100%;
min-height: 100vh;
display: flex;
align-items: center;
}
.text-center {
text-align: center;
}
.quote-card {
background: #fff;
color: #222222;
padding: 20px;
padding-left: 50px;
box-sizing: border-box;
box-shadow: 0 2px 4px rgba(34, 34, 34, 0.12);
position: relative;
overflow: hidden;
min-height: 120px;
}
.quote-card p {
font-family: 'Pacifico', cursive;
font-size: 200%;
line-height: 1.5;
margin: 0;
max-width: 80%;
}
.quote-card cite {
font-family: 'Romanesco', cursive;
font-size: 190%;
margin-top: 10px;
display: block;
max-width: 80%;
}
#author {
z-index: 300;
position: relative;
}
.quote-card:before {
font-family: Georgia, serif;
content: "“";
position: absolute;
top: 10px;
left: 10px;
font-size: 5em;
color: rgba(238, 238, 238, 0.8);
font-weight: normal;
}
.quote-card:after {
font-family: Georgia, serif;
content: "”";
position: absolute;
bottom: -110px;
line-height: 100px;
right: -32px;
font-size: 25em;
color: rgba(238, 238, 238, 0.8);
font-weight: normal;
}
@media (max-width: 640px) {
.quote-card:after {
font-size: 22em;
right: -25px;
}
.quote-card p {
font-size: 150%;
}
.quote-card cite {
font-size: 100%;
}
#author {
text-shadow: -2px 2px #ff2881;
}
#twitter {
width: 100%;
margin-bottom: 5px;
text-align: center;
}
.btn-success {
width: 100%;
}
}
.quote-card.blue-card {
background: #0078FF;
color: #ffffff;
box-shadow: 0 1px 2px rgba(34, 34, 34, 0.12), 0 2px 4px rgba(34, 34, 34, 0.24);
}
.quote-card.blue-card:before, .quote-card.blue-card:after {
color: #5FAAFF;
}
.quote-card.green-card {
background: #00970B;
color: #ffffff;
box-shadow: 0 1px 2px rgba(34, 34, 34, 0.12), 0 2px 4px rgba(34, 34, 34, 0.24);
}
.quote-card.green-card:before, .quote-card.green-card:after {
color:#59E063 ;
}
.quote-card.red-card {
background: #F61E32;
color: #ffffff;
box-shadow: 0 1px 2px rgba(34, 34, 34, 0.12), 0 2px 4px rgba(34, 34, 34, 0.24);
}
.quote-card.red-card:before, .quote-card.red-card:after {
color:#F65665 ;
}
.quote-card.yellow-card {
background: #F9A825;
color: #222222;
box-shadow: 0 1px 2px rgba(34, 34, 34, 0.12), 0 2px 4px rgba(34, 34, 34, 0.24);
}
.quote-card.yellow-card:before, .quote-card.yellow-card:after {
color: #FBC02D;
}
.btn {
display: inline-block;
padding: 9px 12px;
padding-top: 7px;
margin-bottom: 0;
font-size: 14px;
line-height: 20px;
color: #5e5e5e;
text-align: center;
vertical-align: middle;
cursor: pointer;
background-color: #d1dade;
-webkit-border-radius: 3px;
-webkit-border-radius: 3px;
-webkit-border-radius: 3px;
background-image: none !important;
border: none;
text-shadow: none;
box-shadow: none;
transition: all 0.12s linear 0s !important;
font: 14px/20px "Helvetica Neue",Helvetica,Arial,sans-serif;
}
.btn-cons {
margin-right: 5px;
min-width: 120px;
margin-bottom: 8px;
}
.btn-success {
font-family: Georgia, serif;
color: #fff;
background-color: #00970b;
border-color: #59e063;
}
.btn-info {
color: #fff;
background-color: #5bc0de;
border-color: #46b8da;
}
.btn-link, .btn-link:active, .btn-link[disabled], fieldset[disabled] .btn-link {
background-color: transparent;
-webkit-box-shadow: none;
box-shadow: none;
}
.btn-link, .btn-link:hover, .btn-link:focus, .btn-link:active {
border-color: transparent;
}
.btn-link {
color: #5e5e5e;
background-color: transparent;
border: none;
}
#twitter {
color: #fff;
background-color: #2ba9e1;
border-color: rgba(0,0,0,0.2);
}
#twitter:hover,#twitter:focus,#twitter:active{
color:#fff;
background-color:#1c92c7;
border-color:rgba(0,0,0,0.2)
}
.btn-social.btn-lg :first-child {
line-height: 38px;
}
.btn-twitter{color:#fff;background-color:#2ba9e1;border-color:rgba(0,0,0,0.2)}.btn-twitter:hover,.btn-twitter:focus,.btn-twitter:active,.btn-twitter.active,.open .dropdown-toggle.btn-twitter{color:#fff;background-color:#1c92c7;border-color:rgba(0,0,0,0.2)}
.btn-twitter:active,.btn-twitter.active,.open .dropdown-toggle.btn-twitter{background-image:none}
.btn-twitter.disabled,.btn-twitter[disabled],fieldset[disabled] .btn-twitter,.btn-twitter.disabled:hover,.btn-twitter[disabled]:hover,fieldset[disabled] .btn-twitter:hover,.btn-twitter.disabled:focus,.btn-twitter[disabled]:focus,fieldset[disabled] .btn-twitter:focus,.btn-twitter.disabled:active,.btn-twitter[disabled]:active,fieldset[disabled] .btn-twitter:active,.btn-twitter.disabled.active,.btn-twitter[disabled].active,fieldset[disabled] .btn-twitter.active{background-color:#2ba9e1;border-color:rgba(0,0,0,0.2)}
.btn-social{position:relative;padding-left:44px;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.btn-social :first-child{position:absolute;left:0;top:0;bottom:0;width:32px;line-height:34px;font-size:1.6em;text-align:center;border-right:1px solid rgba(0,0,0,0.2)}
.btn-social.btn-lg{padding-left:61px}.btn-social.btn-lg :first-child{line-height:45px;width:45px;font-size:1.8em}
.btn-social.btn-sm{padding-left:38px}.btn-social.btn-sm :first-child{line-height:28px;width:28px;font-size:1.4em}
.btn-social.btn-xs{padding-left:30px}.btn-social.btn-xs :first-child{line-height:20px;width:20px;font-size:1.2em}
.btn-social-icon{position:relative;padding-left:44px;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;height:34px;width:34px;padding-left:0;padding-right:0}.btn-social-icon :first-child{position:absolute;left:0;top:0;bottom:0;width:32px;line-height:34px;font-size:1.6em;text-align:center;border-right:1px solid rgba(0,0,0,0.2)}
.btn-social-icon.btn-lg{padding-left:61px}.btn-social-icon.btn-lg :first-child{line-height:45px;width:45px;font-size:1.8em}
.btn-social-icon.btn-sm{padding-left:38px}.btn-social-icon.btn-sm :first-child{line-height:28px;width:28px;font-size:1.4em}
.btn-social-icon.btn-xs{padding-left:30px}.btn-social-icon.btn-xs :first-child{line-height:20px;width:20px;font-size:1.2em}
.btn-social-icon :first-child{border:none;text-align:center;width:100% !important}
.btn-social-icon.btn-lg{height:45px;width:45px;padding-left:0;padding-right:0}
.btn-social-icon.btn-sm{height:30px;width:30px;padding-left:0;padding-right:0}
.btn-social-icon.btn-xs{height:22px;width:22px;padding-left:0;padding-right:0}
var randomQuote;
var currentIndex;
var quoteText;
var quoteAuthor;
$(document).ready(function() {
getRandomQuote();
$('#randomQuote').click(getRandomQuote);
$('#twitter').click(shareTweet);
function getRandomQuote(){
$.getJSON("https://talaikis.com/api/quotes/", function(data) {
generateQuote(data);
});
}
function generateQuote(quotes) {
do {
var QuotesIndex = Math.floor(Math.random() * quotes.length);
}while(currentIndex === QuotesIndex)
randomQuote = quotes[QuotesIndex];
quoteText = randomQuote.quote;
quoteAuthor = randomQuote.author;
currentIndex = QuotesIndex;
$('#quote').html(randomQuote.quote);
$('#author').html('- '+randomQuote.author);
}
function shareTweet() {
if(quoteText.length > 100) {
quoteText = quoteText.substr(0, 100).match(/(^.+)\s/)[1]+ '...';
}
window.open('https://twitter.com/intent/tweet?text='+quoteText+' - '+quoteAuthor);
}
});