JavaScript preprocessors can help make authoring JavaScript easier and more convenient. For instance, CoffeeScript can help prevent easy-to-make mistakes and offer a cleaner syntax and Babel can bring ECMAScript 6 features to browsers that only support ECMAScript 5.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
HTML Settings
Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.
<div class="container">
<div class="title">
<h1>Random Quote Generator</h1>
</div>
<div class="quote-box">
<blockquote id="quote-text">The type of man who will be intimidated by me is exactly the type of man I have no interest in.</blockquote>
<p id="quote-source">-Chimamanda Ngozi Adichie</p>
<div class="quote-buttons">
<a class="twitter-share-button" href="https://twitter.com/intent/tweet?text=The type of man who will be intimidated by me is exactly the type of man I have no interest in. -Chimamanda Ngozi Adichie" target="_blank"><i class="fa fa-2x fa-twitter" data-toggle="tooltip" data-placement="bottom" title="Tweet this quote" aria-hidden="true"></i></a>
<button type="button" onClick="getQuote();" class="btn btn-primary" id="new-quote">New Quote</button>
</div>
</div>
</div>
<div class="container">
<footer>
<p class="credits"> Designed and coded by <a href="http://www.katelynlemay.com" target="_blank">Katelyn Lemay</a></p>
</footer>
</div>
body {
width: 100%;
height: 100%;
background-color: #e74c3c;
color: #ecf0f1;
font-family: 'Open Sans', sans-serif;
}
h1 {
font-family: 'Montserrat', sans-serif;
font-size: 4rem;
}
#footer, a {
color: #ecf0f1;
text-decoration: underline;
}
#footer, a:hover {
color: #2c3e50;
}
.title {
text-align: center;
margin: 2rem auto 3rem;
}
.quote-box {
background-color: #ecf0f1;
color: #2c3e50;
margin: auto;
padding: 2rem;
max-width: 50rem;
}
#quote-text {
font-size: 2rem;
}
#quote-source {
font-size: 1.5rem;
}
.quote-buttons {
margin-top: 2.5rem;
text-align: center;
}
.fa-2x {
vertical-align: middle;
color: #3498db;
margin-right: 1rem;
}
.fa-2x:hover {
color: #2c3e50;
}
.btn-primary {
background-color: #3498db;
border: #3498db;
}
.btn-primary:hover {
background-color: #2c3e50;
border: #2c3e50;
}
.credits {
margin: 1rem auto;
text-align: center;
}
@media only screen and (max-width: 990px) {
h1 {
font-size: 3rem;
}
#quote-text {
font-size: 1.75rem;
}
#quote-source {
font-size: 1.5rem;
}
}
@media only screen and (max-width: 768px) {
h1 {
font-size: 2rem;
}
#quote-text {
text-align: center;
font-size: 1.5rem;
}
#quote-source {
margin-top: 1rem;
text-align: center;
font-size: 1.25rem;
}
.quote-buttons {
text-align: center;
margin-top: 2rem;
}
}
@media only screen and (max-width: 441px) {
h1 {
font-size: 1.5rem;
}
.title {
margin-bottom: 2rem;
}
#quote-text {
font-size: 1.5rem;
}
}
@media only screen and (max-width: 398px) {
#quote-text {
font-size: 1.25rem;
}
#quote-source {
font-size: 1rem;
}
}
}
$(document).ready(function() {
$(function () {
$('[data-toggle="tooltip"]').tooltip()
});
});
//store quotes in array
var quotes = [
{content: "A feminist is any woman who tells the truth about her life.", source: "-Virginia Woolf"},
{content: "There is no such thing as a single-issue struggle because we do not live single-issue lives.", source: "-Audre Lorde"},
{content: "Injustice anywhere is a threat to justice everywhere.", source: "-Martin Luther King, Jr."},
{content: "The type of man who will be intimidated by me is exactly the type of man I have no interest in.", source: "-Chimamanda Ngozi Adichie"},
{content: "Prejudices... are most difficult to eradicate from the heart whose soil has never been loosened or fertilised by education", source: "-Charlotte Brontë"},
{content: "Until we get equality in education, we won't have an equal society.", source: "-Sonia Sotomayor"},
{content: "Women belong in all places where decisions are being made.", source: "-Ruth Bader Ginsburg"},
{content: "A people without the knowledge of their past history, origin and culture is like a tree without roots.", source: "-Marcus Garvey"},
{content: "To deny people their human rights is to challenge their very humanity.", source: "-Nelson Mandela"},
{content: "A political struggle that does not have women at the heart of it, above it, below it, and within it is no struggle at all.", source: "-Arundhati Roy"},
{content: "Freedom is never granted; it is won. Justice is never given; it is exacted.", source: "-A. Philip Randolph"},
{content: "There may be times when we are powerless to prevent injustice, but there must never be a time when we fail to protest.", source: "-Elie Wiesel"},
{content: "When someone shows you who they are, believe them the first time.", source: "-Maya Angelou"},
{content: "We have to talk about liberating minds as well as liberating society.", source: "-Angela Davis"},
{content: "If we aren’t intersectional, some of us, the most vulnerable, are going to fall through the cracks.", source: "-Kimberle Williams Crenshaw"},
{content: "If you are neutral in situations of injustice, you have chosen the side of the oppressor.", source: "-Desmond Tutu"},
{content: "The oppression of women knows no ethnic nor racial boundaries... but that does not mean it is identical within those boundaries", source: "-Audre Lorde"},
]
function getQuote() {
//generate random number within array length
var randomNumber = Math.floor(Math.random() * quotes.length + 1);
//use random number to get quote and source, append to paragraph
var quoteContent = quotes[randomNumber].content;
var quoteSource = quotes[randomNumber].source;
document.getElementById("quote-text").innerHTML = quoteContent;
document.getElementById("quote-source").innerHTML = quoteSource;
// send to Tweet button
$(".twitter-share-button").attr("href", 'https://twitter.com/intent/tweet?text=' + quoteContent + " " + quoteSource);
};
Also see: Tab Triggers