Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

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


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Auto Save

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


<link rel="stylesheet" href="" />
    <script src=""></script>
    <div id="container">
      <h2><a href="" target="_blank" class="random">A random article</a></h2>
      <h3>Click and Start Typing</h3>
      <form><input id="sbox" type="text" name="search" autocomplete="off" class="ui resize-input"><a class="resize-close"><i class="fa fa-times" aria-hidden="true"></i></a></form>

      <footer>Coded by Oscar Salvatierra for a freeCodeCamp challenge</footer>
      <!--div id="output"></div>
    </div For testing json output results-->


                html{ height: 100%;}
body {
  background-color: #f4fbfc;
  min-height: 100%;
  display: grid;
  grid-template-rows: 1fr auto;

footer {
  position: inherit;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 1rem;
  background-color: #efefef;
  text-align: center;
  font-size: 0.8em;
  margin-bottom: 0%;
#container {
  width: 100%;
  text-align: center; 

#sbox {
    border-color: #38bac1;
    border-style: solid;
    height: 36px;
    width: 38px;
    -webkit-border-radius: 5px;
    -moz-border-radius: 5px;
    border-radius: 23px;
    border-width: 5px;
    outline : none;
    z-index: 10

.resize-close {
    margin-left: -24px; 
    cursor: pointer;

  color: #2fb5c6;
#tcontainer {
    border-color: #38bac1;
    border-style: solid;
    margin: 0 auto;
    height: 100%;
    width: 80%;
    -webkit-border-radius: 5px;
    -moz-border-radius: 5px;
    border-radius: 23px;
    border-width: 5px;
    transition:all .3s;
    cursor: pointer;
    outline : none;
    padding: 11px 35px 10px 35px;
    text-align: left;
  margin-bottom: 20px;
opacity:0;  /* make things invisible upon start */
 -webkit-animation:fadeIn ease-in 1;  /* call our keyframe named fadeIn, use animattion ease-in and repeat it only 1 time */
 -moz-animation:fadeIn ease-in 1;
 animation:fadeIn ease-in 1;
 -webkit-animation-fill-mode:forwards;  /* this makes sure that after animation is done we remain at the last keyframe value (opacity: 1)*/

@-webkit-keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@-moz-keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }


                //setup 'before' functions for countdown on keyup
    var typingTimer; //timer identifier
    var doneTypingInterval = 500;  //time in ms

     //on keyup, start the countdown
      var value = $('.ui').val;
        if (value) {
        typingTimer = setTimeout(doneTyping, doneTypingInterval);

 //user is "finished typing," do something
    function doneTyping () {

function httprequest (){
// function to capture input and add to Wiki URL  
function add() {
  var up = document.getElementById('sbox').value;
  var tempurl = "";
  var urlsearchT = "*&generator=search&gsrsearch=" + up + "&prop=extracts&gsrnamespace=0&gsrlimit=10&gsroffset=0&gsrwhat=text&exintro&explaintext&exsentences=1&exlimit=max";  
           if (up !== null) {
            return urlsearchT;
          } else if (up == ""){
            return tempurl;
var request = new XMLHttpRequest();
var method = 'GET';
var async = true;

// the request, add(), async);
request.onreadystatechange = function() {
    if (request.readyState == 4 && request.status == 200) {
      var data = JSON.parse(request.responseText);      
      var header = document.querySelector('header');

//populate function pull data variable above
request.onload = function() {  
  function populate() { 
    header.innerHTML = ""; 
//getobj, the variable used twice
var getobj = Object.entries(data['query']["pages"]);

    //gets the Title and text
    var title = [];    
    for (var i=0;i<getobj.length;i++){
    var output = Object.values(getobj[i][1]);
    var link = "";
    title.push(Object.values("<div id='tcontainer'><p><a href='" + link + output[2] + "'target='_blank'>" + output[2]+"</a></br>" + output[4] + "</p></div>"));
    var re = title.toString().replace(/,/g,"");
   var mytitle = document.createElement('h1');
    mytitle.innerHTML = re;

//resize variables and jquery actions
var inputW = '200px';
var inputWreturn = '38px';

    width: inputW}, 400);
   width: inputWreturn}, 400);
  doneTyping ();