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 24, 2024
1 parent 475349f commit f94f594
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions MovieVerse-Frontend/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,7 @@ function showMovies(items, container, category) {

let title = item.title || item.name || "N/A";
const words = title.split(' ');

if (words.length >= 9) {
words[8] = '...';
title = words.slice(0, 9).join(' ');
Expand Down Expand Up @@ -767,10 +768,14 @@ function showMovies(items, container, category) {
movieContentHTML += `</div>`;

if (isPerson) {
movieContentHTML += `<div class="overview" style="cursor: pointer;"><h4>Details: </h4>${biography}</div>`;
const roleOverview = item.known_for_department === 'Directing' ? 'Director Overview' : 'Actor Overview';
movieContentHTML += `<div class="overview" style="cursor: pointer;"><h4>${roleOverview}: </h4>${biography}</div>`;
}
else if (isTvSeries) {
movieContentHTML += `<div class="overview" style="cursor: pointer;"><h4>TV Series Overview: </h4>${overview}</div>`;
}
else {
movieContentHTML += `<div class="overview" style="cursor: pointer;"><h4>Overview: </h4>${overview}</div>`;
movieContentHTML += `<div class="overview" style="cursor: pointer;"><h4>Movie Overview: </h4>${overview}</div>`;
}

movieEl.innerHTML = movieContentHTML;
Expand Down Expand Up @@ -798,7 +803,6 @@ function showMovies(items, container, category) {
}

localStorage.setItem('directorVisits', JSON.stringify(directorVisits));

localStorage.setItem('selectedDirectorId', id);
window.location.href = 'director-details.html?' + id;
}
Expand All @@ -819,7 +823,6 @@ function showMovies(items, container, category) {
}

localStorage.setItem('actorVisits', JSON.stringify(actorVisits));

localStorage.setItem('selectedActorId', id);
window.location.href = 'actor-details.html?' + id;
}
Expand Down Expand Up @@ -906,4 +909,4 @@ function updateBrowserURL(title) {

function createNameSlug(title) {
return title.toLowerCase().replace(/ /g, '-').replace(/[^\w-]/g, '');
}
}

0 comments on commit f94f594

Please sign in to comment.