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.

            
              <section id="search_wrapper" class="container">
<div class="wrapper">
  <fieldset class="search_box">
    <form>
      <h1 id="main">Search Wikipedia!</h1>

      <p><label for="search_field">Enter your search:</label>
        <input type="text" id="search_field" /></p>
      <p>
        <button id="search">Search!</button>
        <button id="random"><a href="http://en.wikipedia.org/wiki/Special:Random">Random Page!</a></button>
      </p>
      
    </form>
  </fieldset>
</div>
</section>
<section id="results_wrapper" class="container">
<div class="wrapper">
  <h2>Search results for <span id="search_text"></span></h2>
  <hr />
  <div id="results"></div>
</div>
</section>
            
          
!
            
              @import "bourbon";

// _base.scss
 
/********
VARIABLES
********/

// Typography
$base-font-family: $helvetica;
$heading-font-family: $base-font-family;

// Font Sizes
$base-font-size: 1em;

// Line height
$base-line-height: 1.5;
$heading-line-height: 1.2;

// Other Sizes
$base-border-radius: 3px;
$base-spacing: $base-line-height * 1em;
$small-spacing: $base-spacing / 2;
$base-z-index: 0;

// Colors
$blue: #477dca;
$dark-gray: #333;
$medium-gray: #999;
$light-gray: #ddd;

// Font Colors
$base-font-color: $dark-gray;
$action-color: $blue;

// Border
$base-border-color: $light-gray;
$base-border: 1px solid $base-border-color;

// Background Colors
$base-background-color: #fff;
$secondary-background-color: tint($base-border-color, 75%);

// Forms
$form-box-shadow: inset 0 1px 3px rgba(#000, 0.06);
$form-box-shadow-focus: $form-box-shadow, 0 0 5px adjust-color($action-color, $lightness: -5%, $alpha: -0.3);

// Animations
$base-duration: 150ms;
$base-timing: ease;

/************
GRID SETTINGS
*************/

// IMPORT NEAT HELPERS -----------------------------------------

/****************
FUNCTIONS/PRIVATE
*****************/
// Not function for Libsass compatibility
// https://github.com/sass/libsass/issues/368
@function is-not($value) {
  @return if($value, false, true);
}

// Checks if a number is even
@function is-even($int) {
  @return $int % 2 == 0;
}

// Checks if an element belongs to a list or not
@function belongs-to($tested-item, $list) {
  @return is-not(not-belongs-to($tested-item, $list));
}

@function not-belongs-to($tested-item, $list) {
  @return is-not(index($list, $tested-item));
}

// Contains display value
@function contains-display-value($query) {
  @return belongs-to(table, $query)
       or belongs-to(block, $query)
       or belongs-to(inline-block, $query)
       or belongs-to(inline, $query);
}

// Parses the first argument of span-columns()
@function container-span($span: $span) {
  @if length($span) == 3 {
    $container-columns: nth($span, 3);
    @return $container-columns;
  } @else if length($span) == 2 {
    $container-columns: nth($span, 2);
    @return $container-columns;
  }

  @return $grid-columns;
}

@function container-shift($shift: $shift) {
  $parent-columns: $grid-columns !default !global;

  @if length($shift) == 3 {
    $container-columns: nth($shift, 3);
    @return $container-columns;
  } @else if length($shift) == 2 {
    $container-columns: nth($shift, 2);
    @return $container-columns;
  }

  @return $parent-columns;
}

// Generates a striped background
@function gradient-stops($grid-columns, $color: $visual-grid-color) {
  $transparent: transparent;

  $column-width: flex-grid(1, $grid-columns);
  $gutter-width: flex-gutter($grid-columns);
  $column-offset: $column-width;

  $values: ($transparent 0, $color 0);

  @for $i from 1 to $grid-columns*2 {
    @if is-even($i) {
      $values: append($values, $transparent $column-offset, comma);
      $values: append($values, $color $column-offset, comma);
      $column-offset: $column-offset + $column-width;
    } @else {
      $values: append($values, $color $column-offset, comma);
      $values: append($values, $transparent $column-offset, comma);
      $column-offset: $column-offset + $gutter-width;
    }
  }

  @return $values;
}

// Layout direction
@function get-direction($layout, $default) {
  $direction: null;

  @if to-upper-case($layout) == "LTR" or to-upper-case($layout) == "RTL" {
    $direction: direction-from-layout($layout);
  } @else {
    $direction: direction-from-layout($default);
  }

  @return $direction;
}

@function direction-from-layout($layout) {
  $direction: null;

  @if to-upper-case($layout) == "LTR" {
    $direction: right;
  } @else {
    $direction: left;
  }

  @return $direction;
}

@function get-opposite-direction($direction) {
  $opposite-direction: left;

  @if $direction == "left" {
    $opposite-direction: right;
  }

  @return $opposite-direction;
}

/***********************
FUNCTIONS/NEW-BREAKPOINT
************************/
@charset "UTF-8";

@function new-breakpoint($query: $feature $value $columns, $total-columns: $grid-columns) {
  @if length($query) == 1 {
    $query: $default-feature nth($query, 1) $total-columns;
  } @else if is-even(length($query)) {
    $query: append($query, $total-columns);
  }

  @if is-not(belongs-to($query, $visual-grid-breakpoints)) {
    $visual-grid-breakpoints: append($visual-grid-breakpoints, $query, comma) !global;
  }

  @return $query;
}
/************
SETTINGS/GRID
*************/

@charset "UTF-8";

/// Sets the relative width of a single grid column. The unit used should be the same one used to define `$gutter`. To learn more about `modular-scale()` see [Bourbon docs](http://bourbon.io/docs/#modular-scale). Set with a `!global` flag.
///
/// @type Number (Unit)

$column: modular-scale(3, 1em, $golden) !default;

/// Sets the relative width of a single grid gutter. The unit used should be the same one used to define `$column`. To learn more about `modular-scale()` see [Bourbon docs](http://bourbon.io/docs/#modular-scale). Set with the `!global` flag.
///
/// @type Number (Unit)

$gutter: modular-scale(1, 1em, $golden) !default;

/// Sets the total number of columns in the grid. Its value can be overridden inside a media query using the `media()` mixin. Set with the `!global` flag.
///
/// @type Number (Unitless)

$grid-columns: 12 !default;

/// Sets the max-width property of the element that includes `outer-container()`. Set with the `!global` flag.
///
/// @type Number (Unit)
///
$max-width: 1200px !default;

/// When set to true, it sets the box-sizing property of all elements to `border-box`. Set with a `!global` flag.
///
/// @type Bool
///
/// @example css - CSS Output
///   html {
///     box-sizing: border-box; }
///
///   *, *::after, *::before {
///     box-sizing: inherit;
///   }

$border-box-sizing: true !default;

/// Sets the default [media feature](http://www.w3.org/TR/css3-mediaqueries/#media) that `media()` and `new-breakpoint()` revert to when only a breakpoint value is passed. Set with a `!global` flag.
///
/// @type String

$default-feature: min-width; // Default @media feature for the breakpoint() mixin

///Sets the default layout direction of the grid. Can be `LTR` or `RTL`. Set with a `!global` flag.
///
///@type String

$default-layout-direction: LTR !default;

/*******************
SETTINGS VISUAL GRID
********************/

@charset "UTF-8";

/// Displays the visual grid when set to true. The overlaid grid may be few pixels off depending on the browser's rendering engine and pixel rounding algorithm. Set with the `!global` flag.
///
/// @type Bool

$visual-grid: false !default;

/// Sets the visual grid color. Set with `!global` flag.
///
/// @type Color

$visual-grid-color: #eee !default;

/// Sets the `z-index` property of the visual grid. Can be `back` (behind content) or `front` (in front of content). Set with `!global` flag.
///
/// @type String

$visual-grid-index: back !default;

/// Sets the opacity property of the visual grid. Set with `!global` flag.
///
/// @type Number (unitless)

$visual-grid-opacity: 0.6 !default;

$visual-grid-breakpoints: () !default;

/************************
SETTINGS DISABLE-WARNINGS
*************************/

@charset "UTF-8";

/// Disable all deprecation warnings. Defaults to `false`. Set with a `!global` flag.
///
/// @type Bool

$disable-warnings: false !default;

@mixin -neat-warn($message) {
  @if $disable-warnings == false {
    @warn "#{$message}";
  }
}

// RETURN TO GRID-SETTINGS

// Neat Overrides
// $column: 90px;
// $gutter: 30px;
// $grid-columns: 12;
// $max-width: 1200px;

// Neat Breakpoints
$medium-screen: 600px;
$large-screen: 900px;

$medium-screen-up: new-breakpoint(min-width $medium-screen 4);
$large-screen-up: new-breakpoint(min-width $large-screen 8);

/************
BOURBON NEAT
*************/

@import "neat";

/******
BUTTONS
******/

#{$all-buttons} {
  appearance: none;
  background-color: $action-color;
  border: 0;
  border-radius: $base-border-radius;
  color: #fff;
  cursor: pointer;
  display: inline-block;
  font-family: $base-font-family;
  font-size: $base-font-size;
  -webkit-font-smoothing: antialiased;
  font-weight: 600;
  line-height: 1;
  padding: $small-spacing $base-spacing;
  text-decoration: none;
  transition: background-color $base-duration $base-timing;
  user-select: none;
  vertical-align: middle;
  white-space: nowrap;

  &:hover,
  &:focus {
    background-color: shade($action-color, 20%);
    color: #fff;
  }

  &:disabled {
    cursor: not-allowed;
    opacity: 0.5;

    &:hover {
      background-color: $action-color;
    }
  }
  a {
    color:white;
  }
}

/****
FORMS
****/

fieldset {
  background-color: $secondary-background-color;
  border: $base-border;
  margin: 0 0 $small-spacing;
  padding: $base-spacing;
}

input,
label,
select {
  display: block;
  font-family: $base-font-family;
  font-size: $base-font-size;
}

label {
  font-weight: 600;
  margin-bottom: $small-spacing / 2;

  &.required::after {
    content: "*";
  }

  abbr {
    display: none;
  }
}

#{$all-text-inputs},
select[multiple=multiple] {
  background-color: $base-background-color;
  border: $base-border;
  border-radius: $base-border-radius;
  box-shadow: $form-box-shadow;
  box-sizing: border-box;
  font-family: $base-font-family;
  font-size: $base-font-size;
  margin-bottom: $small-spacing;
  padding: $base-spacing / 3;
  transition: border-color $base-duration $base-timing;
  width: 100%;

  &:hover {
    border-color: shade($base-border-color, 20%);
  }

  &:focus {
    border-color: $action-color;
    box-shadow: $form-box-shadow-focus;
    outline: none;
  }

  &:disabled {
    background-color: shade($base-background-color, 5%);
    cursor: not-allowed;

    &:hover {
      border: $base-border;
    }
  }
}

textarea {
  resize: vertical;
}

input[type="search"] {
  appearance: none;
}

input[type="checkbox"],
input[type="radio"] {
  display: inline;
  margin-right: $small-spacing / 2;

  + label {
    display: inline-block;
  }
}

input[type="file"] {
  margin-bottom: $small-spacing;
  width: 100%;
}

select {
  margin-bottom: $base-spacing;
  max-width: 100%;
  width: auto;
}

/*****
LISTS
*****/

ul,
ol {
  list-style-type: none;
  margin: 0 0 0 1em;
  padding: 0;
}
ol.default {
  list-style: decimal;
}
ul.default {
  list-style: disc;
}

dl {
  margin-bottom: $small-spacing;

  dt {
    font-weight: 600;
    margin-top: $small-spacing;
  }

  dd {
    margin: 0 0 0 1em;
  }
}

/******
TABLES
******/

table {
  border-collapse: collapse;
  margin: $small-spacing 0;
  table-layout: fixed;
  width: 100%;
}

th {
  border-bottom: 1px solid shade($base-border-color, 25%);
  font-weight: 600;
  padding: $small-spacing 0;
  text-align: left;
}

td {
  border-bottom: $base-border;
  padding: $small-spacing 0;
}

tr,
td,
th {
  vertical-align: middle;
}

/**********
TYPOGRAPHY
**********/

body {
  color: $base-font-color;
  font-family: $base-font-family;
  font-size: $base-font-size;
  line-height: $base-line-height;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: $heading-font-family;
  font-size: $base-font-size;
  line-height: $heading-line-height;
  margin: 0 0 $small-spacing;
  font-weight:bold;
}
h1 {
  font-size:$base-font-size * 2;
}
h2 {
  font-size:$base-font-size * 1.5;
}
h3 {
  font-size:$base-font-size * 1.3;
}
h4 {
  font-size:$base-font-size * 1.2;
}
h5 {
  font-size:$base-font-size * 1.1;
}

p {
  margin: 0 0 $small-spacing;
}

a {
  color: $action-color;
  text-decoration: none;
  transition: color $base-duration $base-timing;
}

hr {
  border-bottom: $base-border;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  margin: $base-spacing 0;
}

img,
picture {
  margin: 0;
  max-width: 100%;
}

em {
  font-style:italic;
}

//////////////////////////////
// Comments
.comment {
  $base-border-radius: 3px !default;
  $base-spacing: 1.5em !default;
  $action-color: #477DCA !default;
  $dark-gray: #333 !default;
  $base-font-color: $dark-gray !default;
  $comment-gutter: 1.4em;
  $comment-image-padding: 0.7em;
  $comment-image-width: 4em;
  $comment-color: $base-font-color;
  $comment-background: lighten($action-color, 15%);
  $comment-detail-color: transparentize($comment-color, 0.5);
  $comment-image-vert-alignment: top;

  border-bottom: 1px solid transparentize($comment-color, 0.9);
  display: table;
  margin-bottom: $base-spacing;
  padding-bottom: 1em;
  width: 100%;

  .comment-image,
  .comment-content {
    display: table-cell;
    vertical-align: $comment-image-vert-alignment;
  }

  .comment-image {
    padding-right: $comment-gutter;

    > img {
      background: $comment-background;
      border-radius: $base-border-radius;
      display: block;
      height: auto;
      max-width: none;
      padding: $comment-image-padding;
      width: $comment-image-width;
    }

    .comment-reverse-order & {
      padding-right: 0;
      padding-left: 10px;
    }
  }

  .comment-content {
    width: 100%;

    h1 {
      font-size: 1em;
      margin: 0 0 0.5em 0;
    }

    p {
      line-height: 1.5em;
      margin-bottom: 0.5em;
    }

    p.comment-detail {
      color: $comment-detail-color;
      font-size: 0.9em;
      font-style: italic;
    }
  }
}



///////////////////////////////

.wrapper {
  @include outer-container;
  padding:1em;
}
#results_wrapper {
  display:none;
}
            
          
!
            
              $(document).ready(function() {
  $(function(){
    $("#search").on("click", function(e){
      e.preventDefault();
      console.log("Start");
      var searchInput = document.getElementById('search_field').value
      $.ajax({
        dataType: "jsonp",
        url: "https://en.wikipedia.org/w/api.php?format=json&action=query&generator=search&gsrnamespace=0&gsrlimit=10&prop=pageimages|extracts&pilimit=max&exintro&explaintext&exsentences=1&exlimit=max&gsrsearch=" + searchInput + "&callback=JSON_CALLBACK",
        success: function(res) {
          $("#search_wrapper").hide();
          $("#search_text").html(searchInput);
          var output = '';
          $.each(res.query.pages, function() {
            if(this.thumbnail){
              var image = this.thumbnail.source;
            } else {
              var image = "https://raw.githubusercontent.com/thoughtbot/refills/master/source/images/placeholder_logo_1.png";
            }
            output += '<div class="comment">\
                        <div class="comment-image">\
                          <img src=' + image + '>\
                      </div>\
                      <div class="comment-content">\
                        <h1>' + this.title + '</h1>\
                        <p>' + this.extract + '</p>\
                        <p class="comment-detail"><a href="https://en.wikipedia.org/?curid=' + this.pageid + '" target="_blank">Read wikipedia article</a>\
                      </div>\
                    </div>\
                    </div>';
            $("#results").html(output);
            $("#results_wrapper").show();
          });
        }
      });
    });
  });
});
            
          
!
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