Skip to content

Instantly share code, notes, and snippets.

@kennyp
Created August 15, 2013 02:09
Show Gist options
  • Save kennyp/6237628 to your computer and use it in GitHub Desktop.
Save kennyp/6237628 to your computer and use it in GitHub Desktop.
LGTM button for pull requests.
// ==UserScript==
// @name LGTM Button
// @namespace lgtm.github.com
// @description Add a LGTM button to pull requests.
// @include https://github.com/Skookum/*/pull/*
// @version 1
// ==/UserScript==
var lgtmButton = document.createElement('button'),
buttonCont = document.querySelector('button[name="comment_and_close"]').parentNode,
commentBtn = buttonCont.querySelector('button:last-child');
lgtmButton.innerHTML = "LGTM";
lgtmButton.setAttribute('class', 'button primary');
lgtmButton.onclick = function (e) {
buttonCont.parentNode.querySelector('textarea:last-of-type').innerHTML = "LGTM";
window.location.reload();
};
buttonCont.appendChild(lgtmButton);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment