Github Pull Request From Link

Make pull request original branch linkable

Verze ze dne 30. 08. 2014. 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         Github Pull Request From Link
// @namespace    https://github.com/jerone/UserScripts/
// @description  Make pull request original branch linkable
// @author       jerone
// @copyright    2014+, jerone (http://jeroenvanwarmerdam.nl)
// @license      GNU GPLv3
// @homepage     https://github.com/jerone/UserScripts/tree/master/Github_Pull_Request_From
// @homepageURL  https://github.com/jerone/UserScripts/tree/master/Github_Pull_Request_From
// @include      *://github.com/*/*/pull/*
// @version      10
// @grant        none
// @contribution Changes based on Firefox extension https://github.com/diegocr/GitHubExtIns by https://github.com/diegocr
// ==/UserScript==
(function(){
    var targetTreeSpan = document.querySelectorAll('span.commit-ref.current-branch.css-truncate.js-selectable-text.expandable')[1],
        branchTree = targetTreeSpan.textContent.trim().split(':'),
        userTree = branchTree.shift(),
        urlTree = [
            '//github.com',
            userTree,
            document.querySelector('.js-current-repository').textContent,
            'tree',
            branchTree.join(':')
        ].join('/'),
        targetTreeA = document.createElement('a');
    targetTreeA.setAttribute('href', urlTree);
    targetTreeA.innerHTML = targetTreeSpan.innerHTML;
    targetTreeSpan.innerHTML = '';
    targetTreeSpan.appendChild(targetTreeA);
})();