My Merge Requests Gitlab

Show Link to opened Merge Requests

Fra 02.06.2018. Se den seneste versjonen.

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.

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         My Merge Requests Gitlab
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  Show Link to opened Merge Requests
// @author       hannsen
// @match        https://git04.quodata.de/*
// @require      https://code.jquery.com/jquery-3.1.1.min.js
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    var $merge_button = $($(".user-counter:eq( 1 )").prop('outerHTML'));
    var new_href = $merge_button.children().attr('href').replace('assignee_id','state=opened&author_id');
    $merge_button.children().attr('href',new_href);
    $merge_button.find('span').toggleClass('gitlab-own-merge-requests merge-requests-count issues-count')
        .removeClass('hidden');
    $($merge_button.prop('outerHTML')).insertBefore( ".user-counter:eq( 2 )" );

    $.ajax({
        url: new_href,
    })
        .done(function( data ) {
        var open_mr = $(data).find('a#state-opened > span.badge').html();
        $('.gitlab-own-merge-requests').html( open_mr );
    });

    // when comparing images, choose swipe method
    // var $swipeButton = $('.hidden-xs.btn.btn-default').clone();
    // $swipeButton.removeAttr('href').click(function(){$('li.swipe').click();});
    // $swipeButton.text('Swipe');
    // $swipeButton.insertAfter('.hidden-xs.btn.btn-default');

})();