Skip to content

Commit

Permalink
Update: Enhanced loading times (#192)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoangsonww committed May 23, 2024
1 parent b31bc02 commit cc1922a
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 47 deletions.
1 change: 1 addition & 0 deletions MovieVerse-Mobile/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
platforms
36 changes: 0 additions & 36 deletions MovieVerse-Mobile/easteregg.txt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ <h2 id="movie-title" class="movie-header"></h2>
❤️
</button>
</div>
<img id="movie-image" alt="Loading TV Series Details..." style="width: 25vw; border-radius: 8px"/>
<img id="movie-image" alt="Loading TV Series Details..." style="width: 25vw; border-radius: 8px" title="Click to view full-size image" />
<h3>Your Rating:</h3>
<div class="rating" title="Click on a star to rate this movie!">
<span class="star" data-value="1" title="Oops, sorry to hear that this movie is disappointing to you">&#9733;</span>
Expand Down Expand Up @@ -787,9 +787,9 @@ <h3>Add a Comment for This TV Series</h3>
document.getElementById('movie-image').addEventListener('click', function() {
let imageUrl = this.src.replace('w780', 'w1280');
const modalHtml = `<div id="image-modal" style="z-index: 10002; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.8); display: flex; justify-content: center; align-items: center;">
<img src="${imageUrl}" style="max-width: 80%; max-height: 80%; border-radius: 10px;">
<span style="position: absolute; top: 10px; right: 25px; font-size: 40px; cursor: pointer" id="removeBtn" onclick="document.getElementById('image-modal').remove();">&times;</span>
</div>`;
<img src="${imageUrl}" style="max-width: 80%; max-height: 80%; border-radius: 10px;" alt="TV Series Poster" />
<span style="position: absolute; top: 10px; right: 25px; font-size: 40px; cursor: pointer" id="removeBtn" onclick="document.getElementById('image-modal').remove();">&times;</span>
</div>`;
document.body.insertAdjacentHTML('beforeend', modalHtml);

document.getElementById('image-modal').addEventListener('click', function(event) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -753,8 +753,7 @@ async function fetchMovieRatings(imdbId, tmdbMovieData) {
imdbRating = 'N/A';
}

const rtRatingObj = data.Ratings.find(rating => rating.Source === "Rotten Tomatoes");
let rtRating = rtRatingObj ? rtRatingObj.Value : 'N/A';
let rtRating = 'N/A';

let metascore = data.Metascore ? `${data.Metascore}/100` : 'N/A';
let awards = data.Awards;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,10 @@ function showMovies(movies, mainElement) {
words[8] = '...';
title = words.slice(0, 9).join(' ');
}
let overview = movie.overview;
if (overview === '') {
overview = 'No overview available.';
}
movieEl.innerHTML = `
${movieImage}
<div class="movie-info" style="display: flex; justify-content: space-between; align-items: start; cursor: pointer;">
Expand All @@ -354,7 +358,7 @@ function showMovies(movies, mainElement) {
</div>
<div class="overview" style="cursor: pointer;">
<h4>Overview: </h4>
${movie.overview}
${overview}
</div>`;
movieEl.addEventListener('click', () => {
localStorage.setItem('selectedMovieId', movie.id);
Expand Down
6 changes: 5 additions & 1 deletion MovieVerse-Mobile/www/MovieVerse-Frontend/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -733,9 +733,13 @@ function showMovies(items, container, category) {
title = words.slice(0, 9).join(' ');
}

const overview = item.overview || 'No overview available.';
let overview = item.overview || 'No overview available.';
const biography = item.biography || 'Click to view the details of this person.';

if (overview === '') {
overview = 'No overview available.';
}

const { id, profile_path, poster_path } = item;
const imagePath = profile_path || poster_path ? IMGPATH + (profile_path || poster_path) : null;

Expand Down
2 changes: 1 addition & 1 deletion MovieVerse-Mobile/www/MovieVerse-Frontend/js/tv-details.js
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ async function populateTvSeriesDetails(tvSeries, imdbRating) {
let imageUrl = this.src.replace('w780', 'w1280');
const modalHtml = `
<div id="image-modal" style="z-index: 100022222; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.8); display: flex; justify-content: center; align-items: center;">
<img src="${imageUrl}" style="max-width: 80%; max-height: 80%; border-radius: 10px; cursor: default;" onclick="event.stopPropagation();">
<img src="${imageUrl}" style="max-width: 80%; max-height: 80%; border-radius: 10px; cursor: default;" onclick="event.stopPropagation();" alt="Media Image"/>
<span style="position: absolute; top: 10px; right: 25px; font-size: 40px; cursor: pointer" id="removeBtn">&times;</span>
</div>
`;
Expand Down
6 changes: 4 additions & 2 deletions MovieVerse-Mobile/www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" media="print" onload="this.media='all';">
<noscript><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"></noscript>

<!-- Poppins Fonts -->
<link rel="preload" href="https://movie-verse.com/fonts/Poppins-Light.ttf" as="font" type="font/ttf" crossorigin="anonymous">
<link rel="preload" href="https://movie-verse.com/fonts/Poppins-Regular.ttf" as="font" type="font/ttf" crossorigin="anonymous">
<link rel="preload" href="https://movie-verse.com/fonts/Poppins-SemiBold.ttf" as="font" type="font/ttf" crossorigin="anonymous">
Expand Down Expand Up @@ -625,7 +626,7 @@ <h1 id="my-heading" style="margin-bottom: -25px" class="notranslate">
</button>
<form id="form">
<div class="search-container">
<input type="text" id="search" placeholder="Search For Films, Actors..." style="width: 250px; margin-right: 5px" class="search" title="Search for movies, actors, TV series, and more!" />
<input type="text" id="search" placeholder="Search For Films, Actors..." style="width: 250px; margin-right: 5px" class="search" title="Search for movies, actors, TV series, and more!" required />
<button type="button" id="button-search" onclick="handleSearch()">Search</button>
</div>
<div id="search-results" class="search-results"></div>
Expand Down Expand Up @@ -1568,6 +1569,7 @@ <h2 id="other" style="cursor: pointer">Timeless Classics: Trending Classic Movie
searchInput.addEventListener('blur', clearSelection);
});
</script>

</body>

</html>
</html>
4 changes: 4 additions & 0 deletions MovieVerse-Mobile/www/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,10 @@ function showMovies(movies, mainElement) {
const voteAvg = vote_count === 0 ? "Unrated" : vote_average.toFixed(1);
const ratingClass = vote_count === 0 ? "unrated" : getClassByRate(vote_average);

if (overview === "") {
overview = "No overview available.";
}

movieEl.innerHTML = `
${movieImage}
<div class="movie-info" style="display: flex; justify-content: space-between; align-items: start; cursor: pointer;">
Expand Down

0 comments on commit cc1922a

Please sign in to comment.