Last active
March 7, 2023 12:39
-
-
Save dscho/536ffb491d964dd444f0eb6d91f87266 to your computer and use it in GitHub Desktop.
Assorted helpful tweaks for git.git
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Assorted helpful tweaks for git.git | |
// @version 0.5 | |
// @description Helps maintain git.git PRs | |
// @match https://github.com/git/git/* | |
// @source https://gist.github.com/dscho/536ffb491d964dd444f0eb6d91f87266 | |
// @updateURL https://gist.github.com/dscho/536ffb491d964dd444f0eb6d91f87266/raw/git.git-helper.user.js | |
// @downloadURL https://gist.github.com/dscho/536ffb491d964dd444f0eb6d91f87266/raw/git.git-helper.user.js | |
// @run-at document-end | |
// @connect api.github.com | |
// ==/UserScript== | |
(() => { | |
// hide merge button | |
const clearMergeButton = () => { | |
['merge', 'squash', 'rebase'].map((mode) => { | |
for (const e of document.querySelectorAll(`.btn-group-${mode}`)) { | |
e.style.display = 'none'; | |
} | |
}); | |
for (const e of document.querySelectorAll('.js-merge-method-menu-button')) { | |
e.style.display = 'none'; | |
} | |
}; | |
clearMergeButton(); | |
new MutationObserver((events, observer) => { | |
events.forEach((event) => { | |
if (event.addedNodes) { | |
clearMergeButton(); | |
} | |
}) | |
}).observe(document, { attributes: true, childList: true, subtree: true }); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment