Skip to content

Commit

Permalink
Add icon to IMDb link, resolves #18
Browse files Browse the repository at this point in the history
  • Loading branch information
Verner Jan committed Nov 9, 2022
1 parent 9d01214 commit 932aab2
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions csfd-compare.js
Original file line number Diff line number Diff line change
Expand Up @@ -2294,6 +2294,25 @@ async function onHomepage() {
this.stars = this.getStars();
}

/**
* For some reason, IMDb button to link current film does not have icon. This function adds it.
*
* @returns {Promise<void>}
*/
async addImdbIcon() {
const $image = $('<img>', {
// src: 'https://cdn4.iconfinder.com/data/icons/logos-and-brands/512/171_Imdb_logo_logos-512.png',
src: 'https://images.squarespace-cdn.com/content/v1/57c984f1cd0f68cf4beeb2cf/1472911999963-KH5AM2AU675ZGJUJEGQV/imdb+logo.png',
alt: 'IMDB',
title: 'IMDB',
style: 'width: 26px; height: 26px; mix-blend-mode: darken;',
class: 'imdb-icon',
});
const $imdbI = $('a.button-big.button-imdb i');
$imdbI.css({ 'opacity': '1', 'background-color': '#f5c518' });
$imdbI.append($image);
}

/**
* Iterate through .icon-control icons and if empty, clone the existing one.
* When clicking on the cloned icon, it will trigger the click on the original icon.
Expand Down Expand Up @@ -2430,6 +2449,8 @@ async function onHomepage() {
// =================================
// GLOBAL
// =================================
csfd.addImdbIcon();

if (settings.clickableHeaderBoxes) { csfd.clickableHeaderBoxes(); }
if (settings.showControlPanelOnHover) { csfd.openControlPanelOnHover(); }

Expand Down

0 comments on commit 932aab2

Please sign in to comment.