您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds four Buttons To each Commit in a GitHub pull request for selecting comment templates.
当前为
// ==UserScript== // @name GitHub-Maintainer-Buttons // @namespace https://pruetz.net/userscript/github/maintainer-buttons // @include https://github.com/*/pull/* // @version 1 // @grant none // @description Adds four Buttons To each Commit in a GitHub pull request for selecting comment templates. // ==/UserScript== var commit_id = function (element) { return $(element).contents()[0].data; }; var new_comment_field = $('#new_comment_field'); var fill_and_focus_comment = function(text) { new_comment_field.val(text); new_comment_field.focus(); }; var provide_feedback = function(commit_id) { fill_and_focus_comment("FEEDBACK (" + commit_id + ")\n\n* [ ] "); }; var request_review = function(commit_id) { fill_and_focus_comment("REVIEW (" + commit_id + ")\n\n[Cruise]() (" + commit_id + ")"); }; var say_its_ok = function(commit_id) { fill_and_focus_comment("OK (" + commit_id + ")"); }; var say_it_looks_good = function(commit_id) { fill_and_focus_comment("LGTM (" + commit_id + ")"); }; var add_button = function(dom_sibling, title, icon, click_handler) { // octicon class in conjunction with dark user stlye utterly destroys button style $("<button class='btn btn-sm octicon-" + icon + "' style='font: 16px/1 octicons; margin-left: 1px; margin-right: 1px;' title='" + title + "'></button>"). appendTo($(dom_sibling.parentNode)).click(click_handler); }; var add_maintainer_buttons = function () { var commit_id_elements = $('.commit-id'); $.each(commit_id_elements, function(index, dom_element) { add_button(dom_element, "Feedback", "comment", function() { provide_feedback(commit_id(dom_element)); }); add_button(dom_element, "Review", "eye", function() { request_review(commit_id(dom_element)); }); add_button(dom_element, "Ok", "check", function() { say_its_ok(commit_id(dom_element)); }); add_button(dom_element, "Seems fine", "thumbsup", function() { say_it_looks_good(commit_id(dom_element)); }); }); }; add_maintainer_buttons();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址