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.
<html lang="en">
<body id="myDIV">
<div class="container-fluid">
<table>
<tr>
<!--<div class = "title row text-center">-->
<th><h1>Random Quote Machine</h1></th>
<!--</div>-->
</tr>
</table>
<div class = "jumbotron jumbo row text-center quote">
<h2>Click the button for a quote.</h2>
</div>
<div class="row text-center">
<button id = "getRandomQuote" class = "btn btn-primary">
Get Quote
</button>
</div>
<div class = "row text-center">
<div id="container" class = "col-xs-12 tweet">
</div>
</div>
</body>
</html>
#myDIV {
background-color: #ffbf00;
-webkit-animation: mymove 20s infinite;
animation: mymove 20s infinite;
}
@-webkit-keyframes mymove {
40% {background-color: #cc0000;}
30% {background-color: #990033;}
30% {background-color: #ffbf00;}
}
@keyframes mymove {
40% {background-color: #cc0000;}
30% {background-color: #990033;}
30% {background-color: #ffbf00;}
}
@keyframes fadein
{
0%{opacity: 0}
100%{opacity:1}
}
q {
quotes: "“" "”" "‘" "’";
}
q:before {
content: open-quote;
}
q:after {
content: close-quote;
}
h1 {
font-size: calc(0.5rem + 5.5vmin);
}
h2, h3 {
opacity: 0;
animation-name: fadein;
animation-duration: 2s;
animation-timing-function: ease;
animation-fill-mode:forwards;
font-size: calc(0.5rem + 3.5vmin);
}
.title {
height: 200px;
vertical-align: middle;
}
.jumbo {
height: 300px;
vertical-align: middle;
background-color: rgba(255,255,255,.80);
}
table {
table-layout: auto;
width: 100%;
}
tr {
border: none;
text-align: center;
}
th {
border: none;
text-align: center;
padding: 50px;
}
window.twttr = (function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0],
t = window.twttr || {};
if (d.getElementById(id)) return t;
js = d.createElement(s);
js.id = id;
js.src = "https://platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js, fjs);
t._e = [];
t.ready = function(f) {
t._e.push(f);
};
return t;
}(document, "script", "twitter-wjs"));
$(document).ready(function() {
$("#getRandomQuote").on("click", function(){
var array = [
{
"wiseQuote": "I think I am, therefore I am. I think.",
"whoSaidIt": "George Carlin"
},
{
"wiseQuote": "People who see life as anything more than pure entertainment are missing the point.",
"whoSaidIt": "George Carlin"
},
{
"wiseQuote": "A learning experience is one of those things that say, You know that thing you just did? Don't do that.",
"whoSaidIt": "Douglas Adams"
},
{
"wiseQuote": "We are stuck with technology when what we really want is just stuff that works.",
"whoSaidIt": "Douglas Adams"
},
{
"wiseQuote": "Women who seek to be equal with men lack ambition.",
"whoSaidIt": "Timothy Leary"
},
{
"wiseQuote": "Think for yourself and question authority.",
"whoSaidIt": "Timothy Leary"
},
{
"wiseQuote": "Each religion has got their own way of making you feel like a victim.",
"whoSaidIt": "Timothy Leary"
},
{
"wiseQuote": "You're only as young as the last time you changed your mind.",
"whoSaidIt": "Timothy Leary"
},
{
"wiseQuote": "Why not?",
"whoSaidIt": "Timothy Leary"
},
{
"wiseQuote": "You must do the thing you think you cannot do.",
"whoSaidIt": "Eleanor Roosevelt"
},
{
"wiseQuote": "Where knowledge is a duty, ignorance is a crime.",
"whoSaidIt": "Thomas Paine"
},
{
"wiseQuote": "It is from the Bible that man has learned cruelty, rape, and murder; for the belief of a cruel God makes a cruel man.",
"whoSaidIt": "Thomas Paine"
},
{
"wiseQuote": "Reason obeys itself; and Ignorance submits to whatever is dictated to it.",
"whoSaidIt": "Thomas Paine"
},
{
"wiseQuote": "My whole religion is this: Do every duty, and expect no reward for it, either here or hereafter.",
"whoSaidIt": "Bertrand Russell"
},
{
"wiseQuote": "Sex alleviates tension. Love causes it.",
"whoSaidIt": "Woody Allen"
},
{
"wiseQuote": "I don't believe in an afterlife, although I am bringing a change of underwear.",
"whoSaidIt": "Woody Allen"
},
{
"wiseQuote": "I don't work out. If God had wanted us to bend over, he would have put diamonds on the floor.",
"whoSaidIt": "Joan Rivers"
},
{
"wiseQuote": "A man can sleep around, no questions asked, but if a woman makes nineteen or twenty mistakes she's a tramp.",
"whoSaidIt": "Joan Rivers"
}
];
function shuffle(array) {
var m = array.length, t, i;
// While there remain elements to shuffle…
while (m) {
// Pick a remaining element…
i = Math.floor(Math.random() * m--);
// And swap it with the current element.
t = array[m];
array[m] = array[i];
array[i] = t;
}
return array;
};
var array2 = shuffle(array);
var printOut = "<div class=\"row text-center quote\"><h2><q>" + array2[0].wiseQuote + "</q></h2></div>";
printOut += "<footer><cite><h3>" + " -" + array2[0].whoSaidIt + "</h3></cite></footer>";
printOut += "<div class=\"row text-center\"></div> <a href=\"https://twitter.com/intent/tweet?text=" + "%22" + encodeURIComponent(array2[0].wiseQuote) + "%22";
printOut += " -" + array2[0].whoSaidIt + "\" class=\"twitter-share-button\" data-size=\"large\"></a>";
$(".quote").html(printOut);
twttr.widgets.load($(".quote"));
});
});
Also see: Tab Triggers