PornOne Upload Date

Adds the EXACT upload date for videos. Not just the useless "XX days/months ago".

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

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.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name         PornOne Upload Date
// @namespace    http://tampermonkey.net/
// @version      1.5
// @description  Adds the EXACT upload date for videos. Not just the useless "XX days/months ago".
// @author       nereids
// @match        https://pornone.com/*
// @grant        none
// @icon         https://icons.duckduckgo.com/ip3/pornone.com.ico
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // Function to extract uploadDate from JSON-LD script
    function getUploadDateFromJSON() {
        const scripts = document.querySelectorAll('script[type="application/ld+json"]');
        for (let script of scripts) {
            try {
                const data = JSON.parse(script.textContent.trim());
                if (data['@type'] === 'VideoObject' && data.uploadDate) {
                    return data.uploadDate;
                }
            } catch (e) {
                console.log('Failed to parse JSON-LD script:', e);
            }
        }
        return null;
    }

    // Function to add the date
    function addUploadDate() {
        const uploadDateStr = getUploadDateFromJSON();
        if (!uploadDateStr) {
            console.log('Upload date not found in JSON-LD');
            return;
        }

        // Parse the ISO date string
        const uploadDate = new Date(uploadDateStr);
        if (isNaN(uploadDate.getTime())) {
            console.log('Invalid upload date format:', uploadDateStr);
            return;
        }

        // Format as YYYY-MM-DD
        const formattedDate = uploadDate.toISOString().split('T')[0];

        // Find the exact span with the views text
        const targetElement = document.querySelector('span.text-left.mx-4.md\\:ml-0.md\\:my-2.font-medium.md\\:text-f15.text-warm-grey');
        if (!targetElement) {
            console.log('Views span element not found');
            return;
        }

        // Avoid adding multiple times
        if (targetElement.querySelector('.pornone-upload-date')) {
            return;
        }

        // Create the date span
        const dateSpan = document.createElement('span');
        dateSpan.className = 'pornone-upload-date';
        dateSpan.textContent = ` = ${formattedDate}`;

        // Match the exact Tailwind-style color
        dateSpan.style.setProperty('--tw-text-opacity', '1');
        dateSpan.style.color = 'rgba(136,136,136,var(--tw-text-opacity))';
        dateSpan.style.display = 'inline';

        // Append directly to the span
        targetElement.appendChild(dateSpan);

        console.log('Upload date added:', formattedDate);
    }

    // Run on load
    function runOnLoad() {
        if (document.readyState === 'loading') {
            document.addEventListener('DOMContentLoaded', addUploadDate);
        } else {
            addUploadDate();
        }
    }

    runOnLoad();

    // Observe for dynamic content changes (in case the element loads later)
    const observer = new MutationObserver(function(mutations) {
        let shouldRun = false;
        mutations.forEach(mutation => {
            if (mutation.addedNodes.length > 0) {
                shouldRun = true;
            }
        });
        if (shouldRun) {
            setTimeout(addUploadDate, 500);
        }
    });

    if (document.body) {
        observer.observe(document.body, { childList: true, subtree: true });
    }
})();