<commit_before>// Initialize Firebase
var config = {
    apiKey: "<KEY>",
    authDomain: "movieq-d9325.firebaseapp.com",
    databaseURL: "https://movieq-d9325.firebaseio.com",
    storageBucket: "movieq-d9325.appspot.com",
    messagingSenderId: "139642987985"
};
firebase.initializeApp(config);

//API variables (base URL, image, and ApiKey) for fight room.
var baseUrl = "https://api.themoviedb.org/3/";
var imageUrl = "https://image.tmdb.org/t/p/w300"
var movieApiKey = "api_key=9f7c638352a37a88f16032189ac08772";
var and = "&";

// Example of api request // https://api.themoviedb.org/3/movie/550?api_key=9f7c638352a37a88f16032189ac08772 // Gets movie fight club
$.ajax({
    url: 'https://api.themoviedb.org/3/movie/550',
    type: 'GET',
    data: 'api_key=9f7c638352a37a88f16032189ac08772', // or $('#myform').serializeArray()
    success: function (data) { /*console.log(data);*/ } 
});

//So in this one we're getting all the favorite movies.
$.ajax({
    url: baseUrl + 'discover/movie',
    type: 'GET',
    data: 'sort_by=popularity.desc&' + movieApiKey, // or $('#myform').serializeArray()
    success: function (data) {
        // console.log(data); 
        //FUNCTION 
        processPopularMovies(data);
    }
});

//Process JSON for list of popular movies.........
function processPopularMovies(data) {
    // Returns 20 popular movies
    var movies = data.results;
    for (i = 0; i < movies.length; i++) {
        // console.log(movies[i]);
        // Make panel then add to grid
        $('#movieList').append(makePanel(movies[i]));
    }
}
 
function makePanel(movie) {
    // Take information here and convert into an html object
    var trimmedString = movie.overview.substring(0, 140);
    if (trimmedString.length < movie.overview.length) trimmedString += "...";
    $('#movieList').text = '';
    var panel = '<div class="col-sm-4">' +
        '<div class="panel panel-success">' +
        ' <div class="panel-heading">' + movie.title + '</div>' +
        '<div class="panel-body">' +
        '<img src="' + imageUrl + movie.poster_path + '" class="img-responsive" style="width:100%" alt="Image"></div>' +
        '<div class="panel-footer">' + trimmedString + '</div>' +
        '</div></div>';
    console.log(baseUrl + "movie?" + movie.poster_path + and + movieApiKey);
    return panel;
}


/*ALL MY SEARCH CODE. At this point, Most of these could be combined with the popular movie functions, 
but I wrote them separately just in case they need to be different*/

//SEARCH BAR RESULTS

var prefix = document.getElementById("prefix");
var thePrefix = prefix.value.toLowerCase();
var thePrefixPlus = thePrefix.replace(/ /, '+');
prefix.addEventListener();

//get Search results
//https://api.themoviedb.org/3/search/movie?api_key=9f7c638352a37a88f16032189ac08772&query=la+la+land
$.ajax({
    url: baseUrl + 'search/movie?', 
    type: 'GET',
    data: movieApiKey + and + 'query=' + thePrefixPlus, // or $('#myform').serializeArray()
    success: function (data) {
        processSearchMovies(data);
    }
});

function processSearchMovies(data) {
    var movies = data.results;
    for (i = 0; i < movies.length; i++) {
        $('#searchResultList').append(makeSearchPanel(movies[i]));
    }
}

function makeSearchPanel(movie) {
    var trimmedString = movie.overview.substring(0, 140);
    if (trimmedString.length < movie.overview.length) trimmedString += "...";
    $('#searchResultList').text = '';
    var panel = '<div class="col-sm-4">' +
        '<div class="panel panel-success">' +
        ' <div class="panel-heading">' + movie.title + '</div>' +
        '<div class="panel-body">' +
        '<img src="' + imageUrl + movie.poster_path + '" class="img-responsive" style="width:100%" alt="Image"></div>' +
        '<div class="panel-footer">' + trimmedString + '</div>' +
        '</div></div>';
    console.log(baseUrl + "movie?" + movie.poster_path + and + movieApiKey);
    return panel;
}
<commit_msg>Update SearchResults.html<commit_after><!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <title>Welcome to Firebase Hosting</title>
  <link rel=stylesheet type="text/css" href="css/main.css">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
</head>

<body>

  <div class="jumbotron">
    <div class="container text-center">
      <h1>MovieQ</h1>
      <p>Mission, Vision & Values</p>
    </div>
  </div>

  <nav class="navbar navbar-inverse">
    <div class="container-fluid">
      <div class="navbar-header">
        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>                        
      </button>
        <a class="navbar-brand" href="#">Logo</a>
      </div>
      <div class="collapse navbar-collapse" id="myNavbar">
        <ul class="nav navbar-nav">
          <li class="active"><a href="#">Home</a></li>
          <li><a href="#">Products</a></li>
          <li><a href="#">Deals</a></li>
          <li><a href="#">Stores</a></li>
          <li><a href="#">Contact</a></li>
          <li><a href="#"><input style="color: #000000" placeholder = "Search..." id='prefix'></a></li>
        </ul>

        <ul class="nav navbar-nav navbar-right">
          <li><a href="#"><span class="glyphicon glyphicon-user"></span> Your Account</a></li>
          <li><a href="#"><span class="glyphicon glyphicon-shopping-cart"></span> Cart</a></li>
        </ul>
      </div>
    </div>
  </nav>

  
   <div id=searchResultList class="container">
  </div><br>


  <br><br>

  <footer class="container-fluid text-center">
    <p>Online Store Copyright</p>
    <form class="form-inline">Get deals:
      <input type="email" class="form-control" size="50" placeholder="Email Address">
      <button type="button" class="btn btn-danger">Sign Up</button>
    </form>
  </footer>
  <script src="https://www.gstatic.com/firebasejs/3.6.7/firebase.js"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  <script src="js/main.js"></script>

</body>

</html>

{'fraction_non_alphanumeric': 0.19128908742820677, 'fraction_numerical': 0.028876834716017867, 'mean_word_length': 3.2415426251691475, 'pattern_counts': {'":': 0, '<': 131, '<?xml version=': 0, '>': 127, 'https://': 10, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5417047', 'n_tokens_mistral': 2233, 'n_tokens_neox': 2067, 'n_words': 424}