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.

            
              <body class="bg-light-gray">
  <div>
    <section class="mt6  tc  pa5-ns ph5-ns">
      <h1 class=""><a href =         "https://en.wikipedia.org/wiki/Special:Random " target = "_blank" class="link f2-ns f4 lh-copy gray bg-animate hover-bg-light-blue tc-ns tl nowrap"> Click Here for a Random Article</a></h1>
      <p class="lh-copy measure-ns">
        <div class="tl pa4-l">
          <form class="bg-dark-blue-ns mw7-ns tc center pa4-ns br2-ns ba-ns b--black-10" id = "searchForm">
            <fieldset class="cf bn ma0 pa0">
              <legend class="pa0 f5 f4-ns mb3 light-gray-ns nowrap">Or Search Wikipedia for Keywords:</legend>
              <div class="cf">
                <input class="fl f6 f5-l input-reset bn black-80 bg-white fl pa3 lh-solid w-100 w-75-m w-80-l br2-ns br--left-ns" placeholder="Search here" type="text" name="Search" value="" id="Search">
                <button class="buttons fl f6 f5-l button-reset pv3 tc bn bg-animate bg-black-70 hover-bg-black white pointer w-100 w-25-m w-20-l br2-ns br--right-ns" id="SearchBtn" type="submit">Search</button>
              </div>
            </fieldset>
            <div id="wikiResults">
            </div>
          </form>
        </div>
      </p>
    </section>

  </div>
            
          
!
            
              
.buttons{
  -webkit-touch-callout: none; /* iOS Safari */
  -webkit-user-select: none;   /* Chrome/Safari/Opera */
  -khtml-user-select: none;    /* Konqueror */
  -moz-user-select: none;      /* Firefox */
  -ms-user-select: none;       /* Internet Explorer/Edge */
  user-select: none;           /* Non-prefixed version, currently
                                  not supported by any browser */
}
            
          
!
            
              const url = 'https://en.wikipedia.org/w/api.php?';
const wikiPageURL = 'https://en.wikipedia.org/?curid=';
//$wgCrossSiteAJAXdomains = array( '*' );
$("#SearchBtn").click(function() {
  $.ajax({
    url: url,

    data: {
      action: 'query',
      prop: 'pageimages|extracts',
      generator: 'search',
      redirects: '1',
      piprop: 'original|name',
      pilimit: '10',
      exsentences: '1',
      exlimit: '10',
      exintro: '1',
      gsrnamespace: '',
      gsrlimit: '10',
      gsroffset: '0',
      gsrwhat: 'text',
      gsrprop: 'snippet|titlesnippet',
      gsrsearch: $('#Search').val(),
      format: 'json',
      origin: '*'
    },
    dataType: 'json'
  }).done(function(response) {
    let pages = response.query.pages; // server response
    var items = [];
    items.push("<main class='mw6 center'>");
    $.each(pages, function(key, val) {
      if (typeof(val.thumbnail) != 'undefined')
      {
        
    items.push("<article><a class='link dt w-100 bb b--black-10 pb2 mt2 dim blue' href="+wikiPageURL+val.pageid+" target='_blank'><div class='dtc w3'><img src="+val.thumbnail.original+" class='db w4 h-auto'/></div><div class='dtc v-top pl2'><h1 class='f6 f5-ns fw6 lh-title black mv0'>"+val.title+"</h1><h2 class='f6 fw4 mt2 mb0 black-60'>"+val.extract+"</h2></div></a></article>"
      );
    }
  });
    items.push("</main>");
    $("#wikiResults").html(items.join(""));
  });
});
$("#searchForm").submit(function() {
 $("#SearchBtn").click();
    return false;
});

            
          
!
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