cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

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.

            
              <div class="container-fluid">
  <div class="row" id="topOfPage">
  </div>
  <div class="row text-center">
    <div class="col-md-12 text-center" id="topButtons">
      <button id="randomArticle" class="btn btn-primary">
        Random Wikipedia Article
      </button>
    </div>
  </div>
  <div class="row text-center search">
    <div class="col-md-3">
    </div>
    <div class="col-md-6">
      <input class="form-control" type="text" placeholder="Type text and press enter to search" id="searchBar">
    </div>
    <div class="col-md-3">
    </div>
  </div>
  <div class="row col-md-3"></div>
  <div class="row col-md-6 text-center" id="searchResults">
  </div>
  <div class="row col-md-3"></div>
</div>
            
          
!
            
              .text-center {
  text-align: center;
}

.search {
  padding-bottom: 50px;
}

#topOfPage {
  padding-top: 50px;
}

#topButtons {
  padding-bottom: 50px;
}

a {
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}
            
          
!
            
              $("#randomArticle").on("click", function() {
  window.open('https://en.wikipedia.org/wiki/Special:Random')
});

window.onkeyup = searchFor;

var searching;
var api = 'https://en.wikipedia.org/w/api.php?format=json&action=query&generator=search&gsrnamespace=0&gsrlimit=10&prop=pageimages|extracts&pilimit=max&exintro&explaintext&exsentences=1&exlimit=max&gsrsearch=';
var cb = '&callback=JSON_CALLBACK';
var pageHTML = 'https://en.wikipedia.org/?curid=';

function searchFor(enterPress) {
  if (enterPress.keyCode == 13) {
    var http = api + document.getElementById('searchBar').value + cb;
    $.ajax({
      async: false,
      url: http,
      dataType: "JSONP",
      success: function(data) {
        var finalResults = $.map(data.query.pages, function(data2) {
          return data2;
        });
        var resultsHTML = "";
        for (i = 0; i < finalResults.length; i++) {
          resultsHTML += "<a href=\"" + pageHTML + finalResults[i].pageid + "\" target=\"_blank\"><div><h3>" + finalResults[i].title + "</h3>" + "<p>" + finalResults[i].extract + "</p></div></a>";
        }
        document.getElementById("searchResults").innerHTML = resultsHTML;
      }
    });
  }
}
            
          
!
999px
Loading ..................

Console