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.

            
              <!--FONT FAMILY LINKS -->
<!--<link href='https://fonts.googleapis.com/css?family=Sacramento' rel='stylesheet' type='text/css'>font-family: 'Sacramento', cursive;-->
<link href='https://fonts.googleapis.com/css?family=Cabin' rel='stylesheet' type='text/css'><!--font-family: 'Cabin', sans-serif;-->
<link href='https://fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'><!--font-family: 'Montserrat', sans-serif;-->
<link href='https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300' rel='stylesheet' type='text/css'><!--font-family: 'Open Sans Condensed', sans-serif;--->
<link href='https://fonts.googleapis.com/css?family=Dancing+Script' rel='stylesheet' type='text/css'><!--font-family: 'Dancing Script', cursive;-->

<!--HEADER -->
<div class="container">
  <h1 class="title">Wikipedia Viewer</h1>
  <p class="sub-title">This is a wikipedia viewer, you just have to type what you want to search and it will bring you some wikipedia links.</p>  
</div>


<!--CONTENT -->
<div class="container">
  <div class="col-lg-3">
  </div>
  <div class="col-lg-6">
    <input id="search" type="text" placeholder=" Search..." autocomplete="off" required>
    <button class="icon btn glyphicon glyphicon-search" title="Search" action="/submit" id="go"></button>
    <a class="icon btn" href="https://en.wikipedia.org/wiki/Special:Random" target="_blank"><button class="btn glyphicon glyphicon-random" title="click to go a random Wikipedia page" action="/submit" id="go"></button></a>
  </div>
  <div class="col-lg-3">
  </div>
  
</div>
<div>
  <h3 class="text-center" id="answer"></h3>
</div>

<!--SHOW RESULTS -->
<div class="container">
  <div  id="dta" >
  </div>
</div>

<!--FOOTER-->
<div id="navcontainer" class="container navbar-fixed-bottom col-md-12">
  <div> 
    <h4 class="owners_page blok" float="right">Wikipedia viewer project,<strong style="font-family: 'Dancing Script', cursive;"> Designed by </strong><strong ><a href="https://codepen.io/Danielcv_93/" >Daniel Cartín</a></strong></h4>   
    <div class="bottom-bar blok">
      <a href="https://twitter.com/danielcv_93">
        <img title="Twitter" alt="Twitter" src="https://socialmediawidgets.files.wordpress.com/2014/03/01_twitter1.png" width="35" height="35" />
      </a>
      <a href="https://cr.linkedin.com/in/daniel-cartin-a53aa1121">
        <img title="LinkedIn" alt="LinkedIn" src="https://socialmediawidgets.files.wordpress.com/2014/03/07_linkedin1.png" width="35" height="35" />
      </a>
      <a href="https://www.facebook.com/daniel.cartin93">
        <img title="Facebook" alt="Facebook" src="https://socialmediawidgets.files.wordpress.com/2014/03/02_facebook1.png" width="35" height="35" />
      </a>
      <a href="https://www.pinterest.com/danielcv93/">
        <img title="Pinterest" alt="Pinterest" src="https://socialmediawidgets.files.wordpress.com/2014/03/13_pinterest1.png" width="35" height="35" />
      </a>
    </div>
  </div>
</div>


            
          
!
            
              //BODY
body{
background: #333333;
 height: 100%;
 color: #fff;
}

//TITLE 
.title{
  font-family: 'Montserrat', sans-serif;
  font-size: 50px;
  text-align:center;
  /*padding-top:25%;*/
  text-shadow: 3px 3px 6px #000000;
}

//SUB-TITLE
.sub-title{
  font-family: 'Open Sans Condensed', sans-serif;
  font-size: 25px;
  text-align:center;
}

//PLACEHOLDER
input[type=text] {
 /* background-color: #000;*/
  color: #0489B1;
  width: 350px;
  height:40px;
  font-size:19px;
  text-align:center;
  border-radius:3px;
  border-color:#0489B1;
}

//BUTTONS
.icon{
  color:#000!important;
}

//RESULTS
.result{
  padding:4px;
  float:center; 
  color:black !important;  
}
.title-result{
  font-size: 20px;
  padding: 5px;
  background-color:#fff ;
  color:#000 !important;
  border-radius: 3px;
  text-align: left;
}

.extract-result{
  font-size:14px;
  color:black !important;
}

//FOOTER
.bottom-bar {
  float: right;
  padding: 10px;
}

.bottom-nvb {
  background-color: #202020;
  color: #ffffff;
  width: auto;
  border-radius: 50%;
}
#navcontainer {
  background-color: #202020;
  width: auto;
  height: auto;
}
.blok{
  display: inline-block;
}
            
          
!
            
              $(document).ready(function(){

  
//on clik search button   
 function goSearch(){
    $("#dta").text('');
   
			var search = $(":text").val(),extract,Plink;
      var url="https://en.wikipedia.org/w/api.php?action=query&generator=search&gsrlimit=10&format=json&callback=JSON_CALLBACK&prop=extracts&prop=extracts&exintro&exsentences=3&exlimit=max&gsrsearch=" +search+ "&callback=?";
   
   
   if(search.length!==0&&search!==" "&&search!=="  "&&search!=="   "&&search!=="    "&&search!=="     "&&search!=="      "&&search!=="              "&&search!=="        "&&search!=="          "&&search!=="            "&&search!=="             "&&search!=="            "&&search!=="             "&&search!=="         "&&search!=="                   "&&search!=="                "&&search!=="                        "&&search!=="  "&&search!=="  "                     &&search!=="               "&&search!=="  "&&search!=="  "&&search!=="       "&&search!=="           "){
    
    $("#answer").text('These are the wikipedia results for '+"\""+search+"\" :");
      $("body").css('background-color', "#333333");
   
  
//Get JSON from wikipedia
		 $.getJSON(url, function(json) {
  	//$("#dta").html(JSON.stringify(json));   /*Show json*/
         
       for(var prop in json.query.pages){
         
         var Pageid=json.query.pages[prop].pageid,
             title=json.query.pages[prop].title,
             extract= json.query.pages[prop].extract;
      
//Show on HTML div #dta
         $("#dta").append(
           '<a href='+'http://en.wikipedia.org/?curid='+Pageid+' target="_blank">'+
           "<div>"+
           "</div>"+
           '<div class="result">'+
           '<strong>'+'<div class="title-result">'+title+'<br/>'+'</strong>'+
           '<div class="extract-result">'+extract+'<br/>'+
           '</div>'+
           '</div>'+
           '</a>'
         );    
       }
     });
   } else{
     $("body").css('background-color', "#440000");
    $("#answer").text('Type a word to search');
   //$(".title").css('padding-top', "25%");
   }
 };
 
  
  //Clic go to search   
      $("#go").click( function (y){
        goSearch()
      });
  //Press Intro to search   
  $(document).keypress(function(e){
    if(e.which == 13) {
      goSearch();
    }});
  
}); 

/*  https://en.wikipedia.org/w/api.php?format=json&action=query&generator=search&gsrnamespace=0&gsrlimit=11&prop=pageimages|extracts&pilimit=max&exintro&explaintext&exsentences=1&exlimit=max&gsrsearch=" +search+ "&callback=?*/
            
          
!
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