Skip to content

Instantly share code, notes, and snippets.

@giorrrgio
Last active November 10, 2016 13:10
Show Gist options
  • Save giorrrgio/49ec472d6b343810de063066b64f8697 to your computer and use it in GitHub Desktop.
Save giorrrgio/49ec472d6b343810de063066b64f8697 to your computer and use it in GitHub Desktop.
Greasemonkey notify completed checks on a pr
// ==UserScript==
// @name PR Checks ready
// @namespace AdEspresso
// @version 1
// @grant none
// @include /^https://github.com/adespresso/adespresso/pull/\d+/
// @require https://code.jquery.com/jquery-latest.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @require https://raw.githubusercontent.com/ttsvetko/HTML5-Desktop-Notifications/master/dist/Notification.min.js
// ==/UserScript==
var found = false;
function alertReady() {
if (!found) {
window.Notification.requestPermission();
var text = $('h1.gh-header-title .js-issue-title').text().trim();
var n = new Notification( 'PR ' + text + ' is Ready, all checks passed',{icon: $("[name=icon]").val() });
}
}
(function () {
if ($('.completeness-indicator-success').length === 0) {
waitForKeyElements('.mergeability-details .completeness-indicator-success', alertReady);
found = false;
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment