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.
<!--
Functionality: Opens with a quote, press a button to generate a new quote, press a button to tweet quote
Look: two buttons inside a box in the center of the screen
Best twitter resource: https://dev.twitter.com/web/tweet-button/parameters#button
-->
<div id="background">
<div class="container" id="mainbox">
<div class="text-center" id="pagetitle">
<h1>Terry Tate Quote Machine</h1>
</div>
<div class="jumbotron">
<div id="quotetext">
<p class="lead text-center" id="thequote" style="font-weight: bold" onload="replaceQuote"></p>
<p class="text-center">-<em>Terry Tate</em></p>
</div>
<div class="text-center" id="buttonrow">
<button onclick="replaceQuote()" class="btn btn-default btn-lg" type="submit">Get More Pain</button>
</div>
<div class="text-center" id="socialbuttons" style="padding:5px">
<button class="btn btn-primary"><a href="https://twitter.com/intent/tweet?text=" target="_blank" class=" twitter-share-button" id="share" style="color:white"><span class="fa fa-twitter"></span> Tweet</a></button>
</div>
</div>
</div>
</div>
#mainbox {
padding-top: 50px;
padding-left: 25px;
padding-right: 25px
}
var quoteArr = [
{
num: 1,
quote:
"You must be out of your mind, son! You can't cut the cheese, where ever you please! That's just nasty!"
},
{ num: 2, quote: "Break was over 15 minutes ago, Mitch!" },
{
num: 3,
quote:
"That ain't your cake, Phillip, that's Simone's cake. You eat someone else's cake again, and I will get you a slice of Terry's very special pain cake. And you won't want seconds o' that."
},
{ num: 4, quote: "You kill the joe, you make some mo'! You know that baby!" },
{
num: 5,
quote:
"Whooo! You can't walk away from a K-22 paper jam! You must be out of your mind, son! This is my world, Donnie, you just work here baby!"
},
{
num: 6,
quote: "This ain't your home, so don't use the speakerphone, Roger! Whooo!"
}
];
function getRandomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min)) + min;
}
var first = getRandomInt(0, 6);
document.addEventListener("DOMContentLoaded", function() {
document.getElementById("thequote").innerHTML = quoteArr[first]["quote"];
document.querySelector("#share").setAttribute("href","https://twitter.com/intent/tweet?text="+quoteArr[last]['quote']);
});
var last = first;
var next = getRandomInt(0, 6);
function replaceQuote() {
last = next;
document.getElementById("thequote").innerHTML = quoteArr[last]["quote"];
while (next === last) {
next = getRandomInt(0, 6);
}
document.querySelector("#share").setAttribute("href","https://twitter.com/intent/tweet?text="+quoteArr[last]['quote']);
}
Also see: Tab Triggers