XVideos Upload Date

Displays the upload date 'cause that's a pretty basic thing that a video website should have.

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey 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 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.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

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         XVideos Upload Date
// @namespace    http://tampermonkey.net/
// @version      1.3
// @description  Displays the upload date 'cause that's a pretty basic thing that a video website should have.
// @author       nereids
// @match        https://www.xvideos.com/video*
// @grant        none
// @license      MIT
// @author       nereids
// @icon         https://icons.duckduckgo.com/ip3/xvideos.com.ico
// ==/UserScript==

(function() {
    'use strict';

    // Function to extract uploadDate from JSON-LD
    function getUploadDate() {
        const scripts = document.querySelectorAll('script[type="application/ld+json"]');
        for (const script of scripts) {
            try {
                const json = JSON.parse(script.textContent);
                if (json.uploadDate) {
                    // Format the date to a readable string, e.g., "October 9, 2025"
                    return new Date(json.uploadDate).toLocaleDateString('en-US', {
                        year: 'numeric',
                        month: 'long',
                        day: 'numeric'
                    });
                }
            } catch (e) {
                console.error('Error parsing JSON-LD:', e);
            }
        }
        return 'Unknown';
    }

    // Get the upload date
    const uploadDate = getUploadDate();

    // Find the duration element: <span class="duration">1 h 31 min</span>
    const durationElement = document.querySelector('span.duration');

    if (durationElement) {
        // Create a new span element for the upload date
        const dateSpan = document.createElement('span');
        dateSpan.textContent = `${uploadDate}`;
        dateSpan.className = 'duration'; // Reuse the same class for identical styling

        // Apply inline styles to ensure consistency (in case class is overridden)
        const style = {
            display: 'inline-block',
            fontSize: '15px',
            lineHeight: '22px',
            height: '22px',
            padding: '0 6px',
            background: '#de2600',
            borderRadius: '3px',
            color: '#FFFFFF',
            fontWeight: '700',
            margin: '5px 0 0 4px',
            verticalAlign: 'top'
        };

        Object.assign(dateSpan.style, style);

        // Insert the date span right after the duration element
        durationElement.parentNode.insertBefore(dateSpan, durationElement.nextSibling);
    } else {
        console.warn('Duration element not found. Selector may need adjustment.');
    }
})();