css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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.

            
              <head>
  <!-- import google fonts -->
  <link href="https://fonts.googleapis.com/css?family=PT+Serif" rel="stylesheet">
  <!-- importing font awesome icons --> 
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> 
  <!-- import jQuery --> 
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> 
</head>

</body>
  <h1> Wikipedia </h1>
  <img src="https://github.com/chrisjim316/freeCodeCamp-/blob/master/Assets/Images/Wikipedia%20Viewer/Images/2000px-Wikipedia-logo-v2-en1-640x538.png?raw=true" id="wikiLogo">
  <div class="row">
    <form>
      <input id="search" type="search" placeholder="Search on wiki" required>
      <h2 style="display:inline-block;" id="searchButton">Search</h2>
      <h2 style="display:inline-block;"><a href="https://en.wikipedia.org/wiki/Special:Random" target="_blank" id="surpriseMe">Surprise Me</a></h2>
    </form>
  </div>
  <br>
  <div id="response"></div>



<!-- The footer -->
<footer>
  <p>Copyright © Chris Jim 2017. All Rights Reserved</p>
  <p>
    <a href="mailto:chrisjim316@gmail.com"><i class="fa fa-envelope"></i></a>
    <a href="https://www.linkedin.com/in/chris-jim-77b090128/" target="_blank"><i class="fa fa-linkedin"></i></a>
    <a href="https://github.com/chrisjim316" target="_blank"><i class="fa fa-github"></i></a>
    <a href="https://www.quora.com/profile/Chris-Jim-1" target="_blank"><i class="fa fa-quora"></i></a>
    <a href="https://www.freecodecamp.com/chrisjim316" target="_blank"><i class="fa fa-free-code-camp"></i></a>
  </p>
</footer>
</body> 
            
          
!
            
              body, html {
  text-align: center; 
  font-family: 'PT Serif', serif;
  color: black;
}

/* title */
h1 {
  font-size: 6.0em;
}
/* Surprise Me button text */
h2 {
  font-size: 1.5em;
}

#wikiLogo {
  height: auto;
  width: 25%;
  padding-bottom: 15px;
}

#surpriseMe,#searchButton {
  background-color: #e6e6e6;
  padding: 15px;
  margin: 5px;
  border-radius: 40px;
  position: relative;
  cursor: pointer; 
}

footer {
  position: relative;
  right: 0;
  bottom: 0;
  left: 0;
  top: 100%;
  padding: 1rem;
  text-align: center;
  color: black;
}

/* search form element customization */
input {
	outline: none;
}
input[type=search] {
	-webkit-appearance: textfield;
	-webkit-box-sizing: content-box;
	font-family: inherit;
	font-size: 150%;
  color: black;
}
input::-webkit-search-decoration,
input::-webkit-search-cancel-button {
	display: none; 
}
input[type=search] {
	background: #ededed url(https://static.tumblr.com/ftv85bp/MIXmud4tx/search-icon.png) no-repeat 9px center;
	border: solid 1px #ccc;
	padding: 9px 10px 9px 32px;
	width: 300px;
	
	-webkit-border-radius: 10em;
	-moz-border-radius: 10em;
	border-radius: 10em;
	
	-webkit-transition: all .5s;
	-moz-transition: all .5s;
	transition: all .5s;
}
input[type=search]:focus {
	width: 350px;
	background-color: #fff;
	border-color: #66CC75;
	
	-webkit-box-shadow: 0 0 5px rgba(109,207,246,.5);
	-moz-box-shadow: 0 0 5px rgba(109,207,246,.5);
	box-shadow: 0 0 5px rgba(109,207,246,.5);
}
input:-moz-placeholder {
	color: #999;
}
input::-webkit-input-placeholder {
	color: #999;
}

/*mobile screens */
@media (max-width: 800px) and (min-width: 300px) {
  h1 {
    font-size: 3em;
  }
  h2 {
    font-size: 0.8em;
  }
  input[type=search] {
    width: 45%;
  }
  input[type=search]:focus {
    width: 55%;
  }
  #surpriseMe,#searchButton {
    font-size: 150%;
  }
  #wikiLogo {
    height: auto;
    width: 50%;
  }
}

            
          
!
            
              //https://www.mediawiki.org/wiki/API:Search_and_discovery
var wikiAPI = "//en.wikipedia.org/w/api.php";
var search = $('#search');
var response = $('#response');

$(document).ready(function() {
  $("#searchButton").on("click", function () {
    $("response").empty(); //make sure previous results are omitted. 
    $.ajax({
    url: wikiAPI,
    data: { action: 'query', list: 'search', srsearch: search.val(), format: 'json' }, //srsearch searches for all results associated with the keywords     
    dataType: 'jsonp',
    /* generate html for each search result (10 results by default) */
    success: function (data) {
      var html = '';
          html += '  <div class="row row-centered">';
      
      data.query.search.map(function(res) {
        html += '    <div class="col-md-6">';
        html += '      <a href="https://en.wikipedia.org/wiki/' + res.title + '" target="_blank">';
        html += '        <div class="panel panel-default">';
        html += '          <div class="panel-heading">';
        html += '            <h3 class="panel-title"><strong>' + res.title + '</strong></h3>';
        html += '          </div>';
        html += '          <div class="panel-body">';
        html += '            ' + res.snippet;
        html += '          </div>';
        html += '        </div>';
        html += '      </a>';
        html += '    </div>';
      });
      
      html += '  </div>';
      
      response.html(html);
    }
    });//end ajax function
  }); //end searchButton 
}); //end document.ready

/* search the wiki when enter key is pressed. */
search.keypress(function (e) {
  if (e.which == 13) {
    $("#searchButton").click(); 
    return false; //prevent refreshing the page every time enter key is pressed. 
  }
});

/* alternatively if required to update search results constantly as user type new letters/words
search.keyup(function() {
$.ajax({
    url: wikiAPI,
    data: { action: 'query', list: 'search', srsearch: search.val(), format: 'json' },
    dataType: 'jsonp',
    // generate html for each search result (10 results by default) 
    success: function (data) {
      var html = '';
          html += '  <div class="row row-centered">';
      
      data.query.search.map(function(res) {
        html += '    <div class="col-md-6">';
        html += '      <a href="https://en.wikipedia.org/wiki/' + res.title + '" target="_blank">';
        html += '        <div class="panel panel-default">';
        html += '          <div class="panel-heading">';
        html += '            <h3 class="panel-title"><strong>' + res.title + '</strong></h3>';
        html += '          </div>';
        html += '          <div class="panel-body">';
        html += '            ' + res.snippet;
        html += '          </div>';
        html += '        </div>';
        html += '      </a>';
        html += '    </div>';
      });
      
      html += '  </div>';
      
      response.html(html);
    }
    });//end ajax function
  }); //end searchButton
*/
  
            
          
!
999px
🕑 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.
Loading ..................

Console