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='mainBody'>
    <div class='row'>
      <div class='col-xs-12'>
        <div id="titleDiv">
          <span><h1 class='text-center'>MOVIE4U</h1></span>
        </div>
        
        <div class="row selectionRow">
          
          <div class="col-xs-12 col-md-3">
            <p class='text-center'>Top movies from the year...</p>
            <p class='text-center'>
              <select id='birthYear'>
              </select>
            </p>
          </div>
          
          <div class="col-xs-12 col-md-3">
            <p class="text-center">Type in the name of a movie</p>
            <p class="text-center">
              <input id="inputMovieName" type="text" placeholder="Movie Name" />
              <input id="submitMovieName" type="submit" />
          </div>
          
          <div class="col-xs-12 col-md-3">
            <p class="text-center">Type in the name of an actor</p>
            <p class="text-center">
              <input id="inputActorName" type="text" placeholder="Actor's Name" />
              <input id="submitActorName" type="submit" />
          </div>
          
          <div class="col-xs-12 col-md-3">
            <p class="text-center">Get the trailers</p>
            <p class="text-center">
              <input id="inputTrailerName" type="text" placeholder="Find my movie" />
              <input id="submitTrailerName" type="submit" />
          </div>
            
        </div>
        <section class='movies'>
          <div class="moviesInside">
          </div>
        </section>
      </div>
    </div>
    <p id='endorsement'>This product uses the TMDb API but is not endorsed or certified by TMDb</p>
  </div>
</div>
              
            
!

CSS

              
                body {
  background: #282537;
  background-image: -webkit-radial-gradient(top, circle cover, #3c3b52 0%, #252233 80%);
  background-image: -moz-radial-gradient(top, circle cover, #3c3b52 0%, #252233 80%);
  background-image: -o-radial-gradient(top, circle cover, #3c3b52 0%, #252233 80%);
  background-image: radial-gradient(top, circle cover, #3c3b52 0%, #252233 80%);
}

.mainBody {
  padding-top: 10px;
}

.titleDiv {
  text-align: center;
}

h1 {
  text-decoration: none;
  color: #FFF;
  font-weight: 400;
}

#birthYear {
  margin-bottom: 20px;
}

.selectionRow {
  border: 2px solid red;
  padding: 3em;
  margin-bottom: 2em;
  color: #FFF;
}

#birthYear {
  color: #000;
}

.eachMovie h1 {
  text-align: center;
}

.eachMovie {
  border-top: 1px solid black;
  margin-bottom: 2em;
  color: #FFF;
  text-align: justify;
  padding: 10px;
}

.eachMovie > div h1 {
  margin-bottom: 50px;
}

#endorsement {
  text-align: right;
}

input[type="select"] {
  color: #ff0000;
  outline: none;
}
input[type="text"] {
  color: #ff0000;
  outline: 1px solid #ff0000;
}

input[type="submit"] {
  background-color: #ff0000;
  border: none;
  border-radius: 10px;
  outline: none;
}

.selectionRow > div:nth-child(3), .selectionRow > div:nth-child(4) {
  display: none;
}
              
            
!

JS

              
                //USE USER'S LOCATION FOR SHOWTIMES BY PROXIMITY

//Create dropdown menu from 2016 to 2000
for (i = 2016; i >= 2000; i--) {
  $('#birthYear').append('<option>' + i + '</option>');
}

// THE MOVIE DATABASE API
// Discover movies from 2016, ranked by popularity descending in English

function getMovieByYear() {

  $('#birthYear').on('click', function() {
    var year = '&year=' + $("#birthYear :selected").text();
    console.log(year);
    var endPoint = 'https://api.themoviedb.org/3/';
    var discover = 'discover/movie?';
    var search = 'search/movie;'
    var apiKey = 'api_key=eaa6c99bdd160a89bc0a44998ead7bca';
    var language = '&language=en-US';
    var sortPopularity = '&sort_by=popularity.desc';
    var includeAdult = '&include_adult=true';
    var includeVideo = '&include_video=true';
    var page = '&page=1';
    //var requestToken = '0337f4d939c161a00ee702526512817c228f5fce';
    var url = endPoint + discover + apiKey + language + sortPopularity + includeAdult + includeVideo + page + year;
    //FULL URL IS...
    //var url = 'https://api.themoviedb.org/3/discover/movie?api_key=eaa6c99bdd160a89bc0a44998ead7bca&language=en-US&sort_by=popularity.desc&include_adult=true&include_video=true&page=1&primary_release_year=2016&year=2016';

    $.getJSON(url, function(movie) {
      // LOOP OUT THE MOVIE'S ORIGINAL TITLES AND DESCRIPTION
      // APPEND THEM TO THE 'LIST' LIST

      // EMPTY LIST BEFORE APPENDING ITEMS
      $('.moviesInside').empty();

      for (var i = 0; i < movie.results.length; i++) {
        //  ORIGINAL TITLES
        var original_title = movie.results[i].original_title;
        // MOVIE DESCRIPTION
        var overview = movie.results[i].overview;
        // IMAGE POSTER AT WIDTH = 500
        // https://image.tmdb.org/t/p/w500/kqjL17yufvn9OVLyXYpvtyrFfak.jpg
        var poster = movie.results[i].poster_path;
        var releaseDate = movie.results[i].release_date;
        var vote_average = movie.results[i].vote_average;
        var id = movie.results[i].id;

        $('.moviesInside').append('<div class="row eachMovie"><div class="col-md-6 col-xs-12"><h1>' + original_title + '</h1>' + '<h4>' + overview + '</h4>' + '<br /> <br /> <h4 id="releaseDate">Release Date: ' + releaseDate + '</h4>' + '<h4 id="vote_average">Average vote: ' + vote_average + '</h4></div>' + '<div class="col-md-6 col-xs-12"><p><img class="img img-responsive" src=' + 'https://image.tmdb.org/t/p/w300' + poster + ' /></p></div></div>');

      }
    });
  });
}

function getMovieByName() {

  $('#submitMovieName').on('change', function() {

    var endpoint = "https://api.themoviedb.org/3/search/movie?";
    var apiKey = "api_key=eaa6c99bdd160a89bc0a44998ead7bca";
    var language = '&language=en-US';
    var query = "&query=" + $('#inputMovieName').val();
    var url = endpoint + apiKey + language + query;
    console.log(query);

    $.getJSON(url, function(movie) {
      // LOOP OUT THE MOVIE'S ORIGINAL TITLES AND DESCRIPTION
      // APPEND THEM TO THE 'LIST' LIST

      // EMPTY LIST BEFORE APPENDING ITEMS
      $('.moviesInside').empty();

      for (var i = 0; i < movie.results.length; i++) {
        //  ORIGINAL TITLES
        var original_title = movie.results[i].original_title;
        // MOVIE DESCRIPTION
        var overview = movie.results[i].overview;
        // IMAGE POSTER AT WIDTH = 500
        // https://image.tmdb.org/t/p/w500/kqjL17yufvn9OVLyXYpvtyrFfak.jpg
        var poster = movie.results[i].poster_path;
        var releaseDate = movie.results[i].release_date;
        var vote_average = movie.results[i].vote_average;

        //$('.moviesInside').empty();
        $('.moviesInside').text('<div class="row eachMovie"><div class="col-md-6 col-xs-12"><h6>' + original_title + '</h6>' + '<h4>' + overview + '</h4>' + '<br /> <br /> <h4 id="releaseDate">Release Date: ' + releaseDate + '</h4>' + '<h4 id="vote_average">Average vote: ' + vote_average + '</h4></div>' + '<div class="col-md-6 col-xs-12"><p><img class="img img-responsive" src=' + 'https://image.tmdb.org/t/p/w200' + poster + ' /></p></div></div>');

        $('.movies').css('border-radius', '5px');
      }
    });
  });
}

function getMovieByActor() {

  $('#submitActorName').on('click', function() {

    var endpoint = "https://api.themoviedb.org/3/search/person?";
    var apiKey = "api_key=eaa6c99bdd160a89bc0a44998ead7bca";
    var language = '&language=en-US';
    var query = "&query=" + $('#inputActorName').val();
    console.log(query);
    var url = endpoint + apiKey + language + query;

    $.getJSON(url, function(movie) {
      // LOOP OUT THE MOVIE'S ORIGINAL TITLES AND DESCRIPTION
      // APPEND THEM TO THE 'LIST' LIST

      // EMPTY LIST BEFORE APPENDING ITEMS
      $('.moviesInside').empty();

      for (var i = 0; i < movie.results.length; i++) {
        //  ORIGINAL TITLES
        var original_title = movie.results[i].known_for[i].original_title;
        // MOVIE DESCRIPTION
        var overview = movie.results[i].known_for[i].overview;
        // IMAGE POSTER AT WIDTH = 500
        // https://image.tmdb.org/t/p/w500/kqjL17yufvn9OVLyXYpvtyrFfak.jpg
        var poster = movie.results[i].known_for[i].poster_path;
        var releaseDate = movie.results[i].known_for[i].release_date;
        var vote_average = movie.results[i].known_for[i].vote_average;

        //$('.moviesInside').empty();
        $('.moviesInside').append('<div class="row eachMovie"><div class="col-md-6 col-xs-12"><h1>' + original_title + '</h1>' + '<p>' + overview + '</p>' + '<br /> <br /> <h4 id="releaseDate">Release Date: ' + releaseDate + '</h4>' + '<h4 id="vote_average">Average vote: ' + vote_average + '</h4></div>' + '<div class="col-md-6 col-xs-12"><p><img class="img img-responsive" src=' + 'https://image.tmdb.org/t/p/w300' + poster + ' /></p></div></div>');

        $('.movies').css('border-radius', '5px');
      }
    });
  });
}




      $(document).ready(function() {
        getMovieByYear();
        getMovieByName();
        getMovieByActor();
      });
              
            
!
999px

Console