您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
Disable the merge pull request button when fixup! commits exist in the current PR and haven't been squashed yet
当前为
// ==UserScript== // @name GitHub Disable Merge When Fixup! Commits Exist // @namespace http://tampermonkey.net/ // @version 0.1.3 // @description Disable the merge pull request button when fixup! commits exist in the current PR and haven't been squashed yet // @author Drew Budwin // @match http*://github.com/* // @require https://code.jquery.com/jquery-2.2.1.js // @require http://greasyfork.icu/scripts/6250-waitforkeyelements/code/waitForKeyElements.js?version=23756 // @grant none // ==/UserScript== waitForKeyElements (".merge-message", disableMergeButton); function disableMergeButton() { var mergeButton = findButtonByClass(); if (mergeButton !== null && doesPRContainFixupCommits()) { mergeButton.innerHTML = "Are there fixup! commits?"; mergeButton.disabled = true; } else { console.log("ERROR: Can't locate active merge button on page with text \"" + mergeButtonText + "\"!"); } } function findButtonByClass() { var buttons = document.getElementsByClassName('btn btn-primary js-merge-branch-action'); if (buttons.length == 1) { return buttons[0]; } return null; } function doesPRContainFixupCommits() { var position = document.documentElement.innerHTML.indexOf('fixup!'); return position !== -1 ? true : false; }