Last active
August 29, 2015 14:06
-
-
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
This file contains hidden or 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
(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