cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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

Looking for quick-add? Try the external resource search, it's quicker and gives you access to the most recent version of thousands of libraries. ☝️

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

Looking for quick-add? Try the external resource search, it's quicker and gives you access to the most recent version of thousands of libraries. ☝️

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>
<header>
 <meta name="viewport" content="width=device-width">
 <link rel="stylesheet" type="text/css" href="stylesheet.css">
 <link href="https://fonts.googleapis.com/css?family=Homemade+Apple|Mr+Dafoe|Nothing+You+Could+Do|Reenie+Beanie|Rock+Salt|Walter+Turncoat" rel="stylesheet"> 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</header>


<body>
<div id="explanation"> <h2> Note: </h2> <p id="textexplanation"> Wikipedia is a river of information that is gathered by a diversity of human beings. The styling is designed to emphasize this diversity.</p></div>
<div class="searcharea">
<h1> Search Wikipedia! </h1>
  <div class="wrapper">
  <input class="searchfield" id="searchbox" type="text" placeholder="Type something here..."></input>
  <button class="searchbutton"> <p id="search"> Search </p> </button>
  <button class="randomsearch"><a href="https://en.wikipedia.org/wiki/Special:Random"> <p id="random"> Random </p> </a> </button>
  </div>
</div>

<ul id ="results">
</ul>

</body>

<script src="wikipediaviewer.js"></script>

</html>
            
          
!
            
              body {
	background-color: black;
	padding-left: 1em;
	padding-right: 1em;
	padding-top: 2em;
    font-size: 100%;
}

ul {
	padding-left: 0;
}

a {
	text-decoration: none;
}

li {
	padding: 10px;
}

button {
	border-radius: 5px;
	background: none;
	padding: 6px;
	border: 1px;
}

.randomsearch {
  background-color: gold;
  font-size: 22px;
}

#random {
  margin: 5px;
}

//Removes the complete html styling from the buttons.
input, button, submit { border:none; } 

.wrapper {
  white-space: nowrap;
}

.searchfield {
	padding: 10px;
	border: 10px;
	border-style: solid;
	background-color: Ivory;
	border-color: LightPink;
	border-radius: 5px;
	-ms-transform: skewX(20deg); /* IE 9 */
    -webkit-transform: skewX(20deg); /* Safari */
    transform: skewX(20deg); /* Standard syntax */
}

.searcharea {
	margin-left: auto;
	margin-right: auto;
}

.buttonsdiv {
	display: inline-block;
}

.searchbutton {
	background-color: silver;
}

h1 {
	font-family: 'Nothing You Could Do', cursive;
  color: white;
  font-size: 1.667em;
}

h2 {
  color: darkred;
  margin: 0 10px 0 -10px;
  text-align: center;
font-family: 'Mr Dafoe', cursive;
font-size: 1.25em;
}

h3 {
	color: white;
	font-family: 'Rock Salt', cursive;
}

p {
	color: white;
	font-family: 'Homemade Apple', cursive;
	font-size: 0.67em;
}
p#search {
  font-family: 'Walter Turncoat', cursive;
  
  color: white;
}
p#random {
	font-family: 'Reenie Beanie', cursive;
  color: white;
}

#explanation {
  background-color: Beige;
  padding: 10px;
  padding-top: 0;
  margin-top: 20px;
  -ms-transform: rotate(-10deg); /* IE 9 */
    -webkit-transform: rotate(-10deg); /* Safari */
    transform: rotate(-10deg); /* Standard syntax */
}

#textexplanation {
  color: darkblue;
  line-height: 1.5em;
  text-decoration: underline;
} 

@media screen and (min-width: 700px) {
  
  h1 {
	   font-size: 2.5em;
  }
  
  h2 {
	  font-size: 1.875em;
  }
  
  h3 {
	  
  }
  
  p {
	  font-size: 1em;
  }
  
  body {
	padding-left: 20%;
	padding-right: 20%;
	padding-top: 30px;
  }
  .searcharea {
	 padding-left: 20%;
	padding-right: 20%;
  }
   #explanation {
	       margin-right: -135px;
   }
}
@media screen and (min-width: 500px) {
 #explanation {
	  float: right;
	  width: 30%;
  }
}
            
          
!
            
              //https://www.mediawiki.org/wiki/API:Search
  var keyword;
 var randRGB;
var i;

$(document).ready(function(){

       $("#search").click(function(){
         $("ul").empty();
        keyword = $("#searchbox").val();
         $.getJSON( "https://en.wikipedia.org/w/api.php?action=opensearch&search=" + keyword + "&callback=?", function( data ) {
  console.log(data);
           if (typeof data[3][1] !== "undefined") {
             for (i = 0; i<10; i++) {
             randomBGRGB();
             randomFontRGB();
             $("#results").append("<li style=" + backgroundRGB + "> <a href="+data[3][i]+"><h3 style=" + fontRGB + ">"+data[1][i]+"</h3></a><p style=" + fontRGB + ">"+data[2][i]+"</p><li>"); 
           }   
         
           }
             else {
               $("#results").append("<li><h3> No search results.. Search again!</h3></li>");
             }      
		});  
	});
});

 function randomBGRGB() {
              var randNum30 = Math.floor((Math.random() * 30) + 1);
              var randNum3 = Math.floor((Math.random() * 3) + 1); // gives a random number from 1 till 3.
              
               if (randNum3 == 1) {
                 backGroundRGB = "background-color:rgb(" + (225 + randNum30) + ",250,250)";
               }
               else if (randNum3 == 2) {
                 backgroundRGB = "background-color:rgb(250," + (225 + randNum30) + ",250)";
               }
               else if (randNum3 == 3) {
                 backgroundRGB = "background-color:rgb(250,250," + (225 + randNum30) + ")";
               
               }
 }

function randomFontRGB() {
              var randNum30 = Math.floor((Math.random() * 100) + 1);
              var randNum3 = Math.floor((Math.random() * 3) + 1); // gives a random number from 1 till 3.
              
               if (randNum3 == 1) {
                 fontRGB = "color:rgb(" + (randNum30) + ",000,000)";
               }
               else if (randNum3 == 2) {
                 fontRGB = "color:rgb(000," + (randNum30) + ",000)";
               }
               else if (randNum3 == 3) {
                 fontRGB = "color:rgb(000,000," + (randNum30) + ")";
               
               }
 }

//@todo random fonts and background color per result.
//@todo responsive maken
//@todo random button


            
          
!
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