您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Confirmation before common mistakes when merging Pull Requests in github
- // ==UserScript==
- // @name GitHubFlow PR merge idiot-proofing
- // @namespace https://gist.github.com/raveren/f08ba2673a92c582692e1a233621762f
- // @version 0.3
- // @author raveren
- // @description Confirmation before common mistakes when merging Pull Requests in github
- // @match https://github.com/*/pull/*
- // ==/UserScript==
- (function() {
- document.querySelector('.js-merge-branch-action').addEventListener('click', function(e){
- if ( document.querySelector('#commits_tab_counter').innerHTML.trim()!='1'
- && !confirm('More than one commit, you still wanna merge?')) {
- e.preventDefault();
- e.stopPropagation();
- return false;
- }
- if ( document.querySelector('.text-pending') && !confirm('Build not complete yet, you still wanna merge?')) {
- e.preventDefault();
- e.stopPropagation();
- return false;
- }
- });
- })();