Skip to content

Instantly share code, notes, and snippets.

@hashbrowncipher
Created November 5, 2014 19:23
Show Gist options
  • Save hashbrowncipher/62afd5f82b23af208c35 to your computer and use it in GitHub Desktop.
Save hashbrowncipher/62afd5f82b23af208c35 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name JIRA Issue Change Notifier
// @include https://jira.example.com/browse/*
// ==/UserScript==
var checkInterval = 5000;
var issueKey = JIRA.Issue.getIssueKey();
var updatedDate = new Date(jQuery('span#updated-date time')[0].dateTime).getTime()
var isIssueUpdated = function() {
jQuery.ajax({
dataType: 'json',
url: "/rest/api/2/search?jql=updated > " + updatedDate + " and issue=" + issueKey + "&maxResults=0",
success: function(data) {
if ( data.total != 0) {
jQuery('.aui-page-header').css('background-color', 'red');
} else {
setTimeout(isIssueUpdated, checkInterval)
}
},
error: function() {
setTimeout(isIssueUpdated, checkInterval)
},
timeout: 10000,
});
}
isIssueUpdated();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment