Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

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.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

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 id="background" class="container">
  <img id="imgTarget" class="img-fluid"/>
  <div id="posBox"><div class="row justify-content-around">
    <div id="lcol" class="col-xs-12">
      <div class="col-xs-12 col-xs-offset-5">
        <button type="button" id="quothMore" class="btn btn-secondary">Quoth More!</button><p id="tweetBtn"></p></div>
    <div id="rcol" class="col-xs-12 col-md-6 col-lg-4">
    <div id="quoteBox">Welcome to JP's superduper advanced quote machine! Click the button for a new quote, and marvel at how each quote pulls a new image! Until the Google search API stops working because of my free account.</div>
  </div> <!-- posbox -->
              #background {
  position: relative;
  padding: 1rem;
  min-height: 400px;
  background-color: #DDD;
#imgTarget {
  z-index: 1;
#lcol {
#posBox {
#rcol {
#quoteBox {
  border: 1px solid white;
#tweetBox {
              var testMode=0; // testMode=1 causes a placeholder image to be used instead of the google custom search
var twitterURL="";
function getImgURL(auth,tmode) {
  if (tmode) {
    return 'https://ptpimg.me/6mgw4w.jpg';
  } else {
  return 'https://www.googleapis.com/customsearch/v1?q='+(encodeURIComponent(auth))+'&num=1&imgType=face&safe=high&searchType=image&fields=items(link,snippet)&cx=016785142417644725210:ecuzg4lxswe&key=AIzaSyC2ntpD3H9RQuRcD2SyrN4GX38kI1IMcDI';

$(document).ready(function() {
  var auth="";
  $('#quothMore').on("click", function() {
            success: function(json){
              var html="";
              var elips="";
              var longer=0;
              var twitMSG=(encodeURIComponent($(json[0].content).text()).slice(0,(Math.min(json[0].content.length),161)));
              console.log("twitMSGlen= "+twitMSG.length);
              if (twitMSG.length>=161) {
                twitMSG += "...";
              //var twitMSG=$(encodeURIComponent(json[0].content.slice(0,(Math.min(json[0].content.length),139)))).text();
              auth = json[0].title;
              html += "<div class='quotes'>";
              html += json[0].content + "<p class='authorName'>-- " + auth + "</p>";
              twitterURL = 'https://twitter.com/intent/tweet?hashtags=freecodecamp&text='+twitMSG;
              html += "</div>";
              $("#tweetBtn").html('<a href="'+twitterURL+'" target="_blank"><i class="fa fa-twitter-square fa-3x"></i></a> ');
              console.log("auth variable set to: "+auth);
              var myURL = getImgURL(auth,testMode);
              console.log('myURL: '+myURL);
              if (!testMode) {
                      success: function(json2) {
                        // console.log(JSON.stringify(json2.items));
                        var snippet = json2.items[0].snippet;
                        var imgURL = json2.items[0].link;
                        console.log('Found URL to set as image: '+imgURL);
                        // console.log('snippet for image text: '+snippet);
              } else {
                console.log('Default URL to set as image: '+myURL);
            cache: false
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.