Skip to content

Commit

Permalink
Prime fixed TMDB title card
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamlinerm committed Nov 25, 2024
1 parent c7037ec commit 69aeedf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
1 change: 1 addition & 0 deletions firefox/popup/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,7 @@ <h2>Changelog</h2>
<div class="line flex">
<h2>1.1.53</h2>
<ul>
<li>Prime fixed TMDB title card on chrome.</li>
<li>TMDB ratings added media_type to query, like movie e.g., because shows with same name but different
type</li>
</ul>
Expand Down
15 changes: 7 additions & 8 deletions firefox/skipper.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO
else if (isPrimeVideo)
AllTitleCardsTypes = [
document.querySelectorAll("li:not(.imdb) article[data-card-title]:not([data-card-entity-type='EVENT']):not([data-card-title='Live-TV'])"),
document.querySelectorAll("li:not(.imdb) article[data-testid*='-card']"),
document.querySelectorAll("article[data-testid*='-card']:not(.imdb):not(:has(a#rating))"),
];
// on disney there are multiple images for the same title so only use the first one
let lastTitle = "";
Expand All @@ -422,16 +422,14 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO
if (isNetflix || isDisney || isHotstar || isHBO) card.classList.add("imdb");
else if (isPrimeVideo) {
if (type == 0) card?.closest("li")?.classList.add("imdb");
else if (type == 1) card?.parentElement?.classList.add("imdb");
else if (type == 1) card?.classList.add("imdb");
}
let title;
if (isNetflix) {
title = card?.parentElement?.getAttribute("aria-label")?.split(" (")[0];
if (url.includes("genre/83")) media_type = "tv";
else if (url.includes("genre/34399")) media_type = "movie";
}
// S2: E3 remove this part
else if (isDisney) {
} else if (isDisney) {
title = card?.getAttribute("aria-label")?.replace(" Disney+ Original", "")?.replace(" STAR Original", "");
// no section Extras on disney shows
if (url.includes("entity")) {
Expand Down Expand Up @@ -475,8 +473,6 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO
.replace(/ \d+ minutes remaining/g, "");
}
} else if (isHotstar) title = card?.getAttribute("alt")?.replace(/(S\d+\sE\d+)/g, "");
// amazon
// remove everything after - in the title
else if (isPrimeVideo) {
function fixTitle(title) {
return (
Expand Down Expand Up @@ -547,6 +543,7 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO
}
const vote_count = data?.vote_count || 100;
// right: 1.5vw;
div.id = "rating";
div.style =
"position: absolute;bottom: 0;color: black;text-decoration: none;background:" +
getColorForRating(data?.score, vote_count < 50) +
Expand Down Expand Up @@ -580,7 +577,9 @@ if (isPrimeVideo || isNetflix || isDisney || isHotstar || isCrunchyroll || isHBO
} else if (isHotstar) card.parentElement.appendChild(div);
else if (isPrimeVideo) {
if (card.getAttribute("data-card-title")) card.firstChild.firstChild.appendChild(div);
else card.appendChild(div);
else if (card.querySelector('div[data-testid="title-metadata-main"]')) {
card.querySelector('div[data-testid="title-metadata-main"]').appendChild(div);
} else card.appendChild(div);
}
}
function OnFullScreenChange() {
Expand Down

0 comments on commit 69aeedf

Please sign in to comment.