SoundCloud Release Date

Replaces "... years ago" with exact upload date on SoundCloud

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         SoundCloud Release Date
// @namespace    http://tampermonkey.net/
// @version      1.2
// @author       Agent102
// @description  Replaces "... years ago" with exact upload date on SoundCloud
// @match        https://soundcloud.com/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function () {
    'use strict';

    function updateDates() {
        const timeElements = document.querySelectorAll(
            'time:not([data-date-fixed])'
        );

        timeElements.forEach(timeEl => {
            const visibleSpan = timeEl.querySelector('span[aria-hidden="true"]');

            if (!visibleSpan) return;

            const title = timeEl.getAttribute('title');
            if (!title) return;

            let realDate = null;

            // Вариант:
            // "Posted on 8 December 2021"
            const postedMatch = title.match(/Posted on (.+)/);

            if (postedMatch) {
                realDate = postedMatch[1];
            } else {
                // Вариант:
                // "4 February 2026"
                realDate = title;
            }

            if (!realDate) return;

            visibleSpan.textContent = realDate;

            // Помечаем как обработанный
            timeEl.setAttribute('data-date-fixed', '1');
        });
    }

    updateDates();

    let timeout;

    const observer = new MutationObserver(() => {
        clearTimeout(timeout);

        timeout = setTimeout(() => {
            updateDates();
        }, 300);
    });

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