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 class="container-fluid">
  <div class="row">

    <!-- Left Sidebar a.k.a Control Panel -->
    <div id="controlPanel" class="col-sm-4 controlPanel">
      <div class="page-header">
        <h1>Wikipedia Viewer</h1>
      </div>

      <!-- Search Bar -->
      <div class=" text-center">
        <form>
          <input type="text" class="search" id="searchText" placeholder="Start typing to search">
          <button type="button" class="button" id="searchButton"><i class="fa fa-search"></i></button>
          <button type="button" class="button randomArticle" id="randomArticle" value="Random Aritcle"><i class="fa fa-random"></i></button>
        </form>
        <!-- <input type="button" class="button" id="nearby" value="Nearby"> -->
      </div>
      <div class="page pageHide" id="pageId0">
        <a id="linkId0" target="wikiframe">
          <h5 id="titleId0"></h5>
          <p id="snippetId0"></p>
        </a>
      </div>
      <div class="page pageHide" id="pageId1">
        <a id="linkId1" target="wikiframe">
          <h5 id="titleId1"></h5>
          <p id="snippetId1"></p>
        </a>
      </div>
      <div class="page pageHide" id="pageId2">
        <a id="linkId2" target="wikiframe">
          <h5 id="titleId2"></h5>
          <p id="snippetId2"></p>
        </a>
      </div>
      <div class="page pageHide" id="pageId3">
        <a id="linkId3" target="wikiframe">
          <h5 id="titleId3"></h5>
          <p id="snippetId3"></p>
        </a>
      </div>
      <div class="page pageHide" id="pageId4">
        <a id="linkId4" target="wikiframe">
          <h5 id="titleId4"></h5>
          <p id="snippetId4"></p>
        </a>
      </div>
      <!-- End Left Sidebar a.k.a Control Panel -->
    </div>

    <!-- iframe showing Wiki results -->
    <div class="col-sm-8">
      <iframe id="iframe" class= "wikiframe" name="wikiframe" src="https://www.gadgetsmagazine.com.ph/wp-content/uploads/bfi_thumb/1058px-Wikipedia-logo-v2-en-l3prci9f0kbtbajen6yy62hfcjloopbslgwez616y0.png"></iframe>
    </div>

  </div>
</div>
            
          
!
            
              body {
  background-color: #f9f9f9;
  
}

.controlPanel {
  margin-bottom: 60px;
  margin-top: 60px;
}

.wikiframe {
  position: relative;
  margin-top: -52px;
  width: 100%;
  border: 0;
}

/*Search Bar*/
form {
  width: 100%;
  margin-bottom: 5px;
}

.search {
  padding: 8px 5%;
  width: 65%;
  background: #f0f0f0;
  border: 0px solid #3d3a3a;
}

.search:focus {
  background-color: #ffffff;
  border: 0px solid #3d3a3a;
  outline: none;
}

.button {
  position: relative;
  padding: 6px 5%;
  left: -8px;
  border: 2px solid #3d3a3a;
  background-color: #3d3a3a;
  color: #fafafa;
}

.randomArticle {
  left: -11px;
  padding: 6px 5%;
  margin-bottom: 10px;
  position: relative;
}

.button:hover {
  background-color: #fafafa;
  color: #3d3a3a;
  cursor:pointer;
}

.pageHide {
  display: none;
}

.page {
  background-color: white;
  border: 1px solid #3d3a3a;
  margin: 2px;
}

.page:hover {
  background-color: #fafafa;
  color: #3d3a3a;
  -webkit-transition: background-color 1s, color 1s;
}

h5 {
  font-weight: bold;
  padding: 8px 0px 0px 8px;
}

p:hover {
  background-color: #fafafa;
  color: grey;
  -webkit-transition: background-color 1s, color 1s;
}

p {
  font-size: 0.75em;
  color: grey;
  padding: 0px 0px 0px 8px;
}

a {
  color: #3d3a3a;
}

a:hover {
  text-decoration: none;
  background-color: #fafafa;
  color: #3d3a3a;
  transition: background-color 1s, color 1s;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-track {
  -webkit-box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.3);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb {
  border-radius: 10px;
  -webkit-box-shadow: inset 0 0 6px rgb(6, 69, 173);
}

            
          
!
            
              // Make iframe the correct height
$(document).ready(function() {
  var windowHeight = $(window).height() + 45 + "px";
  document.getElementById("iframe").setAttribute("height", windowHeight);
  document
    .getElementById("iframe")
    .setAttribute("src", "https://en.m.wikipedia.org/");
});

// Change iframe for random article selection
$("#randomArticle").click(function() {
  document
    .getElementById("iframe")
    .setAttribute(
      "src",
      "https://en.m.wikipedia.org/wiki/Special:Random/#/random"
    );
});

// Search via search button
$("#searchButton").click(function() {
  searchWikipedia();
});


function searchWikipedia() {
  $.getJSON(
    "https://en.m.wikipedia.org/w/api.php?callback=?",
    {
      srsearch: document.getElementById("searchText").value,
      srprop: "title",
      srprop: "snippet",
      prop: "links",
      action: "query",
      list: "search",
      format: "json"
    },
    function(data) {
      var parsed = data;

      for (i = 0; i < 5; i++) {
        var linkId = "linkId" + i;
        var titleId = "titleId" + i;
        var snippetId = "snippetId" + i;

        var a = document.getElementById(linkId);
        a.href =
          "https://en.m.wikipedia.org/wiki/" + parsed.query.search[i].title;
        document.getElementById(titleId).innerHTML =
          parsed.query.search[i].title;
        document.getElementById(snippetId).innerHTML =
          parsed.query.search[i].snippet;

        $(".page").removeClass("pageHide");
      }
    }
  );
}

            
          
!
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.

Console