PTP2CL

Ajoute un lien CinéLounge avant le lien IMDb sur PTP

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name        PTP2CL
// @namespace   https://www.cinelounge.org/
// @description Ajoute un lien CinéLounge avant le lien IMDb sur PTP
// @author      tadanobu
// @match       https://passthepopcorn.me/torrents.php*
// @version     1.2
// @grant       none
// @require     http://code.jquery.com/jquery-3.3.1.min.js
// @icon        https://www.cinelounge.org/images/logoi.png
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    // --- CAS 1 : SUR LA FICHE DU FILM (Détails) ---
    var $detailImdb = $('#imdb-title-link');
    if ($detailImdb.length > 0) {
        var detailHref = $detailImdb.attr('href');
        // On capture uniquement les chiffres après 'tt'
        var detailMatch = detailHref.match(/tt(\d+)/);

        if (detailMatch) {
            var imdbId = detailMatch[1]; // Uniquement les chiffres (ex: 1654829)
            var clUrl = 'https://www.cinelounge.org/imdb2cl/' + imdbId;

            // 1. Ajout dans le titre H2
            $('.page__title').prepend(
                '<a href="' + clUrl + '" target="_blank" style="vertical-align: middle; margin-right: 12px;">' +
                '<img src="https://www.cinelounge.org/images/logoi.png" style="width: 28px; border-radius: 4px;" title="Voir sur CinéLounge" />' +
                '</a>'
            );

            // 2. Ajout dans le tableau des Ratings
            var $imdbTdIcon = $detailImdb.closest('td');
            if ($imdbTdIcon.length > 0) {
                // Création de la cellule Icône CL
                var $clTdIcon = $('<td colspan="1" style="width: 95px;">' +
                                  '<center><a target="_blank" href="' + clUrl + '">' +
                                  '<img src="https://www.cinelounge.org/images/logoi.png" style="height:56px;width:56px;" title="CinéLounge">' +
                                  '</a></center></td>');

                // Création de la cellule Texte CL (vide ou "CL" pour l'alignement)
                var $clTdText = $('<td style="width: 80px;">' +
                                  '<a href="' + clUrl + '" target="_blank" style="font-weight: bold; font-size: 14px;">CinéLounge</a>' +
                                  '</td>');

                // Insertion avant IMDb
                $imdbTdIcon.before($clTdIcon);
                $clTdIcon.after($clTdText);
            }
        }
    }

    // --- CAS 2 : SUR LES LISTES DE FILMS (Browse / Search) ---
    $('div.basic-movie-list__movie__rating-container a[href*="imdb.com/title/tt"]').each(function() {
        var $imdbLink = $(this);
        var listHref = $imdbLink.attr('href');
        var listMatch = listHref.match(/tt(\d+)/);

        if (listMatch) {
            var listImdbId = listMatch[1]; // Uniquement les chiffres
            var listClUrl = 'https://www.cinelounge.org/imdb2cl/' + listImdbId;
            var $imdbContainer = $imdbLink.closest('.basic-movie-list__movie__rating-container');

            // On vérifie qu'on n'a pas déjà ajouté le bouton (évite les doublons)
            if ($imdbContainer.length > 0 && !$imdbContainer.prev().hasClass('cl-container')) {
                var $clContainer = $('<div class="basic-movie-list__movie__rating-container cl-container"></div>');
                var $clLink = $('<a href="' + listClUrl + '" target="_blank" style="font-weight: bold;">' +
                                '<img src="https://www.cinelounge.org/images/logoi.png" ' +
                                'style="width: 14px; vertical-align: middle; margin-right: 4px;" ' +
                                'title="Fiche CinéLounge" />CL</a>');

                $clContainer.append($clLink);
                $imdbContainer.before($clContainer);
            }
        }
    });

})();