Gitlab submodule compare

Clicking on submodule link opens comparison in new tab

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

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 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         Gitlab submodule compare
// @namespace    http://tampermonkey.net/
// @version      0.2.0
// @description  Clicking on submodule link opens comparison in new tab
// @author       Cáno
// @match        https://git.getprintbox.com/*
// @grant        none
// @require      https://code.jquery.com/jquery-3.2.1.min.js
// ==/UserScript==

(function() {
    'use strict';
    //return;
    setInterval(function() {
        $('.file-title-name > .commit-sha').each(function() {
            var parent = $(this);
            var n = parent.closest('.diff-file').find('.line_content.parallel:not(.old) > span').html();
            var o = parent.closest('.diff-file').find('.line_content.parallel.old > span').html();
            var a = parent.prev().find('a');
            if (a.attr('done') !== 'true') {
                a.attr('href', a.attr('href') + '/compare/' + o + '...' + n);
            }
            a.attr('done', true);
        });
    }, 1600);
})();