GitLab - show absolute timestamps

Replaces relative GitLab timestamps with their full title

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 or Violentmonkey 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.

(У мене вже є менеджер скриптів, дайте мені встановити його!)

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.

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

// ==UserScript==
// @name         GitLab - show absolute timestamps
// @namespace    https://gitlab.com/
// @version      1.0
// @description  Replaces relative GitLab timestamps with their full title
// @match        https://gitlab.com/*
// @grant        none
// @license      CC0-1.0
// ==/UserScript==
(function () {
    'use strict';

    function replaceTimes(root = document) {
        root.querySelectorAll('time[title]').forEach(time => {
            const title = time.getAttribute('title');

            if (title && time.textContent !== title) {
                time.textContent = title;
            }
        });
    }

    // Elementy obecne przy załadowaniu strony
    replaceTimes();

    // Elementy dodawane dynamicznie przez GitLaba
    const observer = new MutationObserver(mutations => {
        for (const mutation of mutations) {
            for (const node of mutation.addedNodes) {
                if (node.nodeType !== Node.ELEMENT_NODE) {
                    continue;
                }

                if (node.matches && node.matches('time[title]')) {
                    node.textContent = node.getAttribute('title');
                }

                replaceTimes(node);
            }
        }
    });

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