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.
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link href='https://fonts.googleapis.com/css?family=Kumar One' rel='stylesheet'>
<link href='https://fonts.googleapis.com/css?family=Playball' rel='stylesheet'>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css"/>
</head>
<h1 class="text-center"></h1>
<div class="container">
<div class="jumbotron">
<!--h1 class="text-center">Random Quotes</h1-->
<div class="row">
<div class="col-xs-2 col-sm-2 col-md-2 col-lg-2 text-center"></div>
<div class="col-xs-8 col-sm-8 col-md-8 col-lg-8 text-center">
<div class="text-center head" >Collection of the most favorite quotes</div>
<div class="well" style="background-color: powderblue;">
<div class="text-center message">
The quote
</div>
<input type="text" name="hiddenMessage" id="hiddenMessage">
<div class="text-right author">
Author
</div>
</div>
<button type="button" onclick="pageRedirectTwitter()" id="twitter" class="btn-primary btn-lg"><i class="fa fa-twitter"></i></button>
<button type="button" onclick="pageRedirectGitHub()" class="btn-primary btn-lg"><i class="fa fa-github"></i></button>
<button type="button" class="btn-primary btn-lg" id="newQuote">New Quote</button>
</div>
<div class="col-xs-2 col-sm-2 col-md-2 col-lg-2 text-center"></div>
</div>
</div>
</div>
body {
/*background-color: #002b3b;*/
background-image: url("https://www.transparenttextures.com/patterns/strange-bullseyes.png");
/* This is mostly intended for prototyping; please download the pattern and re-host for production environments. Thank you! */
}
.head {
font-family: 'Kumar One';
font-size: 22px;
}
.well {
background-color: powderblue;
}
.message {
font-family: 'Playball';
font-size: 20px;
}
.author {
font: italic bold 12px/30px Georgia, serif;
}
var temp;
$(document).ready(function(){
$("#newQuote").on("click", function(){
//jsonp will remove any cors issue. cross origin resource sharing.
$.getJSON("https://api.forismatic.com/api/1.0/?method=getQuote&format=jsonp&lang=en&jsonp=?", function(json){
//get the value and format them
var quote = "";
var hiddenQuote = "";
hiddenQuote += json.quoteText;
//hiddenQuote += '<input type="text" id="hiddenMessage" value="' +json.quoteText+ '">';
quote += '<strong>“</strong> ' +json.quoteText+ ' <strong>”</strong>';
$(".message").html(quote);
$("#hiddenMessage").val(hiddenQuote);
//$(".message").html(hiddenQuote);
var auth = "";
auth += '- ' +json.quoteAuthor;
$(".author").html(auth);
});
});
});
var temp = document.getElementById('hiddenMessage').value;
//alert(temp);
//alert(document.getElementById('hiddenMessage').value);
function pageRedirectTwitter() {
window.open('https://twitter.com/intent/tweet?text=' +temp)
}
function pageRedirectGitHub() {
window.open('https://github.com/kreuel?tab=stars', 'blank')
}
//get individual value and save it on .message and .author
//$(".message").html(JSON.stringify(json));
//$(".message").text(json.quoteText);
//$(".author").text(json.quoteAuthor);
/*
json.forEach(function(val){
var keys = Object.keys(val);
html += "<div class = 'result'>";
keys.forEach(function(key){
html += "<strong>" + key + "</strong>: " +val[key] + "<br>";
});
html += "</div><br>";
});
$(".message").html(html);
*/
Also see: Tab Triggers