Thisvid Copy Link Button

Adds copy link buttons to video thumbnails on thisvid.com

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         Thisvid Copy Link Button
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Adds copy link buttons to video thumbnails on thisvid.com
// @license      MIT
// @author       You
// @match        https://*.thisvid.com/*
// @grant        GM_addStyle
// ==/UserScript==

(function() {
    'use strict';

    // Add CSS
    GM_addStyle(`
        .thumbs-items .info,
        .thumbs-items .percent {
            display: none !important;
        }

        .thumb {
            position: relative !important;
        }

        .copy-link-btn {
            position: absolute !important;
            top: 5px !important;
            right: 5px !important;
            background: rgba(0,0,0,0.7) !important;
            color: white !important;
            border: none !important;
            border-radius: 3px !important;
            padding: 2px 6px !important;
            font-size: 12px !important;
            cursor: pointer !important;
            z-index: 1000 !important;
            display: none !important;
        }

        .thumb:hover .copy-link-btn {
            display: block !important;
        }

        .copy-link-btn:hover {
            background: rgba(0,0,0,0.9) !important;
        }

        .copy-link-btn.copied {
            background: #4CAF50 !important;
        }
    `);

    // Function to add copy buttons
    function addCopyButtons() {
        const thumbs = document.querySelectorAll('.thumbs-items a');
        
        thumbs.forEach(thumb => {
            // Only add button if it doesn't already exist
            if (!thumb.querySelector('.copy-link-btn')) {
                const copyBtn = document.createElement('button');
                copyBtn.className = 'copy-link-btn';
                copyBtn.textContent = '📋';
                copyBtn.title = 'Copy link';
                
                copyBtn.addEventListener('click', async (e) => {
                    e.preventDefault();
                    e.stopPropagation();
                    
                    try {
                        await navigator.clipboard.writeText(thumb.href);
                        copyBtn.textContent = '✓';
                        copyBtn.classList.add('copied');
                        
                        setTimeout(() => {
                            copyBtn.textContent = '📋';
                            copyBtn.classList.remove('copied');
                        }, 1000);
                    } catch (err) {
                        console.error('Failed to copy:', err);
                    }
                });

                // Add button to the thumbnail container
                const thumbContainer = thumb.querySelector('.thumb');
                if (thumbContainer) {
                    thumbContainer.appendChild(copyBtn);
                }
            }
        });
    }

    // Initial setup
    addCopyButtons();

    // Watch for dynamic content changes
    const observer = new MutationObserver((mutations) => {
        mutations.forEach((mutation) => {
            if (mutation.addedNodes.length) {
                addCopyButtons();
            }
        });
    });

    // Start observing the document for added nodes
    observer.observe(document.body, {
        childList: true,
        subtree: true
    });

})();