Skip to content

Instantly share code, notes, and snippets.

@swissmanu
Created April 27, 2015 11:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save swissmanu/cdd0a5991dc177855544 to your computer and use it in GitHub Desktop.
Save swissmanu/cdd0a5991dc177855544 to your computer and use it in GitHub Desktop.
Greasemonkey: Show Pull Requests I am involved in on top in Atlassian Stash
// ==UserScript==
// @name Stash: Order PR's
// @namespace me.alabor
// @include https://mystash/stash/projects/PROJECT/repos/REPOSITORY/pull-requests
// @include https://mystash/stash/projects/PROJECT/repos/REPOSITORY/pull-requests?state=open
// @version 1
// @grant none
// @require http://code.jquery.com/jquery-1.11.2.min.js
// ==/UserScript==
var pullRequestTable = $('table.pull-requests-table tbody')
, itsMe = $('header#header #current-user').attr('data-username');
$('tr', pullRequestTable).each(function() {
var row = this
, author = $('td.author [data-username="' + itsMe + '"]', row).length > 0
, reviewer = $('td.reviewers [data-username="' + itsMe + '"]', row).length > 0;
if(author || reviewer) {
$(row).detach().prependTo(pullRequestTable);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment