PStream Title Copier

Click the title to copy it to clipboard, works for movies and episodes, enjoy

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         PStream Title Copier
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Click the title to copy it to clipboard, works for movies and episodes, enjoy
// @author       You
// @match        https://pstream.mov/*
// @match        https://www.pstream.mov/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    document.addEventListener('click', function(e) {
        // 1. Look for the container div with class "flex gap-3"
        const targetDiv = e.target.closest('div.flex.gap-3');

        if (targetDiv) {
            // 2. verify it contains the specific spans to avoid clicking other random flex divs
            const epNum = targetDiv.querySelector('.text-white.font-medium');
            const epTitle = targetDiv.querySelector('.text-type-secondary.font-medium');

            if (epNum && epTitle) {
                // 3. Construct the text
                const fullText = `${epNum.innerText} ${epTitle.innerText}`;

                // 4. Copy to clipboard
                navigator.clipboard.writeText(fullText).then(() => {
                    // Visual feedback: Flash green
                    const originalColor = targetDiv.style.color;
                    targetDiv.style.transition = "color 0.2s";
                    epNum.style.color = "#4ade80"; // Green
                    epTitle.style.color = "#4ade80"; // Green

                    // Reset color after 500ms
                    setTimeout(() => {
                       epNum.style.color = "";
                       epTitle.style.color = "";
                    }, 500);

                    console.log('Copied to clipboard:', fullText);
                }).catch(err => {
                    console.error('Failed to copy: ', err);
                });
            }
        }
    });
})();
// --- MOVIE TITLE HANDLER ---
// Targets the <p> tag that usually tries to "Copy Link"
document.addEventListener('click', function(e) {
    const movieTitle = e.target.closest('p.cursor-copy.hover\\:scale-105');

    if (movieTitle) {
        // Stop the website's own script from copying the URL
        e.preventDefault();
        e.stopImmediatePropagation();

        const textToCopy = movieTitle.innerText.trim();

        navigator.clipboard.writeText(textToCopy).then(() => {
            // Visual feedback: brief flash
            const originalColor = movieTitle.style.color;
            movieTitle.style.color = "#4ade80"; // Green

            // Change the hover title temporarily
            const originalTooltip = movieTitle.getAttribute('title');
            movieTitle.setAttribute('title', 'Copied Title!');

            setTimeout(() => {
                movieTitle.style.color = originalColor;
                movieTitle.setAttribute('title', originalTooltip);
            }, 800);

            console.log('Intercepted! Copied title instead of link:', textToCopy);
        });
    }
}, true); // The "true" here helps us catch the click before the site does