Commits2PR

Add the commits to PR textarea.

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.

(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.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name         Commits2PR
// @namespace    https://git.oschina.net/
// @version      1.0
// @description  Add the commits to PR textarea.
// @author       Ruter
// @match        http://git.oschina.net/*
// @match        http://gitee.com/*
// @match        https://git.oschina.net/*
// @match        https://gitee.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    var btn2Pr = '<div class="btn-group"><button type="button" title="Add commits to PR textarea" tabindex="-1" data-hotkey="Ctrl+Alt+P" data-toggle="button" class="add2pr"><span class="fa fa-arrow-down"></span></button></div>';
    $(".md-editor > .md-header.btn-toolbar").append(btn2Pr);
    
    function add2Pr () {
        var commits = [];
        $(".row_title").each(function(){
            commits.push($(this).text());
        });
        $("textarea.md-input").first().val(commits.join('\n\n'));
    }
    
    $(".add2pr").click(add2Pr);
})();