Skip to content

Instantly share code, notes, and snippets.

@lamchau
Last active August 29, 2015 14:06
Show Gist options
  • Save lamchau/6d07b50d83eccb50f0cd to your computer and use it in GitHub Desktop.
Save lamchau/6d07b50d83eccb50f0cd to your computer and use it in GitHub Desktop.
Commit comment deletion bookmarklet for Pull Requests on GitHub. Written to clean up spammy build-bot. Minify for use with http://closure-compiler.appspot.com/home
(function() {
var author = "displayName";
var clickElement = function(element) {
if (!!!element) {
return;
}
var event = document.createEvent("HTMLEvents");
event.initEvent("click", true, true);
event.eventName = "click";
element.dispatchEvent(event);
};
var fn = window.confirm;
window.confirm = function() {
return true;
};
Array.prototype.forEach.call(document
.querySelectorAll("div[class='timeline-comment-header commit']"),
function(element) {
if (element.querySelector("strong > a[href='/" + author + "']")) {
clickElement(element.querySelector("[data-method='delete']"));
}
});
window.confirm = fn;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment