Jira history diff

Highliht diff in Jira issue history.

Verze ze dne 14. 05. 2024. Zobrazit nejnovější verzi.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         Jira history diff
// @version      2024-05-14
// @description  Highliht diff in Jira issue history.
// @author       vctls
// @match        https://*.atlassian.net/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=atlassian.net
// @grant        none
// @require      https://cdn.jsdelivr.net/gh/google/diff-match-patch@62f2e689f498f9c92dbc588c58750addec9b1654/javascript/diff_match_patch_uncompressed.js
// @license      MIT
// @namespace https://greasyfork.org/users/299396
// ==/UserScript==

(function() {
    'use strict';

    const handleMessage = () => {
        document
            .querySelectorAll('[data-testid="issue-history.ui.history-items.generic-history-item.history-item"] > div:last-child > div:last-child')
            .forEach((element) => {
            if (element.innerText.length < 100) return;

            const left = element.querySelector("div:first-child");
            const right = element.querySelector("div:last-child");

            if (!left || !right) return;

            element.style.display = "block";
            const dmp = new diff_match_patch();
            const diff = dmp.diff_main(left.innerText, right.innerText);
            dmp.diff_cleanupSemantic(diff);

            element.innerHTML = dmp.diff_prettyHtml(diff);
        });
    };

    const delayedHandler = () => {
        setTimeout(() => handleMessage(), 10);
    };

    (new MutationObserver(delayedHandler)).observe(document, {childList: true, subtree: true});

})();