Created
April 27, 2015 11:20
-
-
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
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
// ==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