PTP2CL

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

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==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);
            }
        }
    });

})();