Last active
August 20, 2019 11:52
-
-
Save tomasv/68e6cb8940404ef0bd03b532766bb445 to your computer and use it in GitHub Desktop.
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 Github quick approve | |
// @version 5 | |
// @grant none | |
// @match https://github.com/* | |
// @downloadURL https://gist.github.com/tomasv/68e6cb8940404ef0bd03b532766bb445/raw/github_quick_approve.user.js | |
// @updateURL https://gist.github.com/tomasv/68e6cb8940404ef0bd03b532766bb445/raw/github_quick_approve.user.js | |
// ==/UserScript== | |
let addButton = () => { | |
if (document.getElementById('approve-button')) { | |
return | |
} | |
let button = document.createElement('button') | |
button.id = '#approve-button' | |
button.className = 'diffbar-item btn btn-sm btn-primary' | |
button.textContent = '👍🏻' | |
button.style = 'margin-left: 5px' | |
button.addEventListener('click', () => { | |
let reviewScope = document.getElementById('submit-review') | |
reviewScope.querySelector('[value=approve]').click() | |
reviewScope.querySelector('form').submit() | |
}) | |
document.getElementsByClassName('pr-review-tools')[0].appendChild(button) | |
} | |
window.addEventListener('DOMContentLoaded', addButton) | |
window.addEventListener('pjax:success', addButton) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment