PStream Title Copier

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

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

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

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==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