Skip to content

Commit

Permalink
Final: Enhance app functionalities (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoangsonww committed Sep 8, 2024
1 parent 84ecc3c commit d12635d
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 5 deletions.
5 changes: 4 additions & 1 deletion MovieVerse-Frontend/js/actor-details.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,10 @@ async function populateActorDetails(actor, credits) {

const movieTitle = document.createElement('p');
movieTitle.classList.add('movie-title');
movieTitle.textContent = movie.title;
const movieTitleWords = movie.title.split(' ');
const truncatedMovieTitle = movieTitleWords.length > 5 ? movieTitleWords.slice(0, 5).join(' ') + ' ...' : movie.title;
movieTitle.textContent = truncatedMovieTitle;

movieDetails.appendChild(movieTitle);

movieItem.appendChild(movieDetails);
Expand Down
6 changes: 5 additions & 1 deletion MovieVerse-Frontend/js/company-details.js
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,11 @@ function displayCompanyMovies(movies) {

const movieTitle = document.createElement('p');
movieTitle.classList.add('movie-title');
movieTitle.textContent = movie.title;
const movieTitleWords = movie.title.split(' ');
const truncatedMovieTitle = movieTitleWords.length > 5 ? movieTitleWords.slice(0, 5).join(' ') + ' ...' : movie.title;

movieTitle.textContent = truncatedMovieTitle;

movieDetails.appendChild(movieTitle);

movieItem.appendChild(movieDetails);
Expand Down
6 changes: 5 additions & 1 deletion MovieVerse-Frontend/js/director-details.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,11 @@ async function populateDirectorDetails(director, credits) {

const movieTitle = document.createElement('p');
movieTitle.classList.add('movie-title');
movieTitle.textContent = movie.title;
const movieTitleWords = movie.title.split(' ');
const truncatedMovieTitle = movieTitleWords.length > 5 ? movieTitleWords.slice(0, 5).join(' ') + ' ...' : movie.title;

movieTitle.textContent = truncatedMovieTitle;

movieDetails.appendChild(movieTitle);

movieItem.appendChild(movieDetails);
Expand Down
5 changes: 4 additions & 1 deletion MovieVerse-Frontend/js/movie-details.js
Original file line number Diff line number Diff line change
Expand Up @@ -1287,7 +1287,10 @@ async function populateMovieDetails(movie, imdbRating, rtRating, metascore, awar

const similarMovieTitle = document.createElement('p');
similarMovieTitle.classList.add('actor-name');
similarMovieTitle.textContent = similarMovie.title;
const titleWords = similarMovie.title.split(' ');
const truncatedTitle = titleWords.length > 5 ? titleWords.slice(0, 5).join(' ') + ' ...' : similarMovie.title;
similarMovieTitle.textContent = truncatedTitle;

similarMovieDetails.appendChild(similarMovieTitle);

similarMovieItem.appendChild(similarMovieDetails);
Expand Down
5 changes: 4 additions & 1 deletion MovieVerse-Frontend/js/tv-details.js
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,10 @@ async function populateTvSeriesDetails(tvSeries, imdbRating, rated) {

const similarTvName = document.createElement('p');
similarTvName.classList.add('similar-tv-name');
similarTvName.textContent = similarTv.name;
const tvNameWords = similarTv.name.split(' ');
const truncatedTvName = tvNameWords.length > 5 ? tvNameWords.slice(0, 5).join(' ') + ' ...' : similarTv.name;
similarTvName.textContent = truncatedTvName;

similarTvDetails.appendChild(similarTvName);

similarTvItem.appendChild(similarTvDetails);
Expand Down

0 comments on commit d12635d

Please sign in to comment.