Skip to content

Instantly share code, notes, and snippets.

@dracos
Last active Dec 15, 2015
Embed
What would you like to do?
This basic GM script adds a "Pull requests only" tickbox to your dashboard issue pages on GitHub; clicking it hides non-PR issues. It doesn't work over pagination (without a refresh) or other things like that.
// ==UserScript==
// @name GitHub Assigned Issues Pull Requests tickbox
// @namespace github-assigned-issues-pull-requests
// @version 1.0
// @description Show only pull requests on the Assigned Issues dashboard page (e.g. https://github.com/dashboard/issues/assigned or the similar org page)
// @match *://github.com/dashboard/issues/*
// @match *://github.com/organizations/*/dashboard/issues/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @author Matthew Somerville >> https://github.com/dracos
// ==/UserScript==
$('.issues-list-options').append('<div class="button-group"><label><input type="checkbox" id="pull_requests_only" value="1"> Pull requests only</label></div>');
$('#pull_requests_only').change(function(){
var lis = $('.mini-icon-issue-opened').add('.mini-icon-issue-closed').closest('li'),
count = $('.filter-item.selected span.count');
if ($(this).prop("checked")) {
lis.hide();
var c = count.text();
count.data('c', c);
count.text(c-lis.length);
} else {
lis.show();
count.text(count.data('c'));
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment