Pen Settings

HTML

CSS

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

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="container">
  <div class="row">
    <div class="input-field col s6">
      <!-- //Search Box -->
      <input id="searchTxt" type="text" class="validate">
      <label for="Найти">Search</label>

    </div>
    <div class="input-field col s6">
      <!-- //Search Button -->
      <a class="waves-effect waves-light btn" id="searchBtn">
        <i class="fa fa-search" aria-hidden="true"></i> Search
      </a>
    </div>
    <ul class="collection" id="results">
    </ul>
  </div>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Open+Sans');

* {
  padding: 0;
  margin: 0;
}

body {
  font-family: 'Open Sans', sans-serif;
  font-size: 16px;
}

/*
	------------------------------
	Changes to the Materialize CSS
	------------------------------
*/

.container {
  width: 80%;
  margin: 0 auto;
  padding: 15px;
}

.collection-item {
  height: 200px;
  overflow: hidden;
}

.collection {
  width: 60%;
}

.collection .collection-item {
  padding: 10px;
}

.btn {
  background: #f44336;
}

.btn:hover {
  background: #ff8a80;
}

input[type=text]:not(.browser-default):focus:not([readonly]) {
  border-bottom: 1px solid #f44336;
  box-shadow: 0 2px 0 0 #f44336;
}

/*
	----------
	Custom CSS
	----------
*/

#results {
  display: none;
}

/*Video thumbnail
w - 320
h - 180
*/
.image-container {
  float: left;
  position: relative;
  width: 320px;
  height: 190px;
}

/*Video thumbnail*/
.image {
  position: absolute;
}

.video-info-container {
  height: 190px;
  /*
	width of the image + 10px
	320 + 10
	*/
  margin-left: 330px;
  font-size: 14px;
}

/*Video Title*/
.title {
  font-size: 22px;
}

              
            
!

JS

              
                $(document).ready(function() {
  (function() {
    // Variables
    const $searchTxt = $("#searchTxt");
    const $results = $("#results");
    const $searchBtn = $("#searchBtn");
    const moonURL = "http://moonwalk.cc/api/videos.json?";
    const $collection = $(".collection");

    //$results.fadeIn(3000);

    // Search button event listener
    $searchBtn.on("click", function() {
      let query = $searchTxt.val();

      //check if query len is more than 3 chars
      if (query.length > 3) {
        // when the search button is clicked,
        // take the search text box value and call the handleSearch()
        // passing in the query

        $results.fadeIn(5000);

        handleSearch(query);
      } else {
        $searchTxt.focus();
      }
    });

    function handleSearch(query) {
      // jQuery GET request
      // hitting the Youtube URL
      // sending the request obj with the query included

      $.get(
        moonURL,
        {
          title: query,
          api_token: "825867abcf9a775a9ef6dba82ce3ce93"
        },
        function(data) {
          //call the handleData function
          handleData(data);
        }
      ); // end of $.get
    } // end of handleSearch()

    // JSON data passed in
    // Take the data and plug into HTML
    function handleData(data) {
      // clearing the items inside
      // when performing second search
      $results.html = "";

      // loop through all the data obj
      data.items.forEach((currentValue, index, array) => {
        // find the
        // [0].id.videoId
        // [0].snippet.title
        // [0].snippet.description
        // [0].snippet.thumbnails.medium.url

        let kinopoisk_id = currentValue.id.kinopoisk_id;
        let channelId = currentValue.snippet.channelId;
        let title_ru = currentValue.snippet.title_ru;
        let title_en = currentValue.snippet.title_en;
        let year = currentValue.snippet.year;
        //get only the date
        //ignore the time
        //call the generateHTML passing in the required info
        generateHTML(
          kinopoisk_id,
          title_ru,
          title_en,
          year
        );
      }); // end of for each
    } // end of handleData()

    function generateHTML(
          kinopoisk_id,
          title_ru,
          title_en,
          year
    ) {
      let HTML_TEMPLATE =
        '<li class="collection-item">' +
        '<a href="' +
        kinopoisk_id +
        '">' +
        "</a>" +
        '<div class="video-info-container">' +
        '<ul class="video-info">' +
        '<li class="title"><a href="' +
         +
        '">' +
        title_ru +
        "</a></li>" +
        '<li class="creator"><a href="' +
         +
        '">' +
        title_en +
        "</a></li>" +
        '<li class="upload-date">' +
        year +
        "</li>" +
        "</ul>" +
        "</div>" +
        "</li>";

      // add the built HTML template to the results div
      $results.append(HTML_TEMPLATE);
    } // end of generateHTML
  })(); // end function
}); // end of doc ready

              
            
!
999px

Console