cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

            
              <form ng-app="wikipediaFeed" ng-controller="WikiController" onsubmit="return false;">
  <div ng-class="searchPosition">
  <h1>
  <span class='blue'>W</span><span class='red'>i</span><span class='yellow'>k</span><span class='blue'>i</span><span class='green'>p</span><span class='red'>e</span><span class='blue'>d</span><span class='yellow'>i</span><span class='green'>a</span>
</h1>
  <input type='text' ng-model="searchText" placeholder="type search criteria here" />
  <p>
    <button ng-click="search()">Search</button>
    <a class='button' href='http://en.wikipedia.org/wiki/Special:Random' target='_blank'>I'm feeling  random</a>
  </p>
    
  </div>
  <ul class="resultlist">
    <li ng-repeat="r in results">
      <a ng-href="http://en.wikipedia.org/?curid={{ r.pageid }}" target="_blank"><b>{{ r.title }}</b><p>{{ r.extract }}</p></a>
    </li>
  </ul>
  
</form>
            
          
!
            
              html, body {
  width: 100%;
  height: 100%;
  border: 0;
  margin: 0;
  padding: 0;
  font-size: 16px;
}

div {
  transition: top 1s;
}
h1 {
  font-size: 4em;
  margin: 0.25em;
  transition: font-size 1s, margin 1s;
}
p {
  transition: margin 1s;
}
.in-middle {
  position: absolute;
  top: 25%;
  left: 50%;
  transform:translate(-50%);
  text-align: center;
}
.at-top {
  position: absolute;
  top: 0;
  left: 50%;
  transform:translate(-50%);
  text-align: center;
}


.blue {
  color: #4285F4;
}
.red {
  color: #ea4335;
}
.yellow {
  color: #fbbc05;
}
.green {
  color: #34A853;
}

button, .button {
  border: 1px outset #d3d3d3;
  padding: 0.4em;
  background: #e3e3e3;
  font-size: 1em;
  text-decoration: none;
  color: #222;
  display: inline-block;
  font-family: Arial;
  transition: padding 1s, font-size 1s;
}

input[type=text] {
  width: 100%;
  font-size: 1.2em;
  line-height: 1.5;
  border-radius: 4px;
  border: 1px solid #4285F4;
  transition: font-size 1s, line-height 1s;
}

::-webkit-input-placeholder{
  padding-left: 0.5em;
}

:-moz-placeholder {
  padding-left: 0.5em;
}

::-moz-placeholder {
  padding-left: 0.5em;
}
:-ms-input-placeholder {  
   padding-left: 0.5em;  
}

.at-top > h1 {
  font-size: 2em;
  margin: 0.1em;
}
.at-top > input[type=text] {
  font-size: 0.8em;
  line-height: 1.2;
}
.at-top button, 
.at-top .button {
  font-size: 0.75em;
  padding: 0.2em 0.3em;
}
.at-top > p {
  margin: 0.1em 0;
}
.resultlist {
  transition: height 1s, opacity 1s;
  margin: 6em 0.5em 1em;
  list-style-type: none;
  padding: 0;
}
.resultlist > li {
  padding: 0.1em 0.5em 0.15em;
  text-align: left;
}
.resultlist a {
  text-decoration: none;
  color: #222;
}
.resultlist li:hover {
  background: #ffd;
  border-left: 0.15em solid #34A853;
  padding-left: 0.35em;
  cursor: pointer;
}
.resultlist b {
  color: blue;
}
.resultlist p {
  margin: 0.1em 0;
  font-size: 0.9em;
}
            
          
!
            
              (function() {
  var app = angular.module("wikipediaFeed", []);

  app.controller("WikiController", ["$http", "$scope", function($http, $scope) {
    $scope.searchText = "";
    $scope.searchPosition = "in-middle";
    $scope.results = [];
    $scope.search = function() {
      var url = [
        "https://en.wikipedia.org/w/api.php",
        "?action=query&format=json&prop=images%7Cextracts&generator=search&imlimit=20&exsentences=-1&exlimit=20&exintro=1&explaintext=1&gsrnamespace=0&gsrlimit=10&gsrsearch=",
        $scope.searchText,
        "&callback=JSON_CALLBACK"
      ].join("");

      $http.jsonp(url).then(function(resp) {
        if (resp.status !== 200) {
          console.error(resp.statusText);
          return;
        }
        $scope.searchPosition = "at-top";
        $scope.results = [];
        for (var a in resp.data.query.pages) {
          $scope.results.push(resp.data.query.pages[a]);
        }
        
        console.log($scope.results);
      }, function(err) {
        console.error(err);
      });
    };

  }]);
})();
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console