Greasy Fork is available in English.

PTP2CL

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

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==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);
            }
        }
    });

})();