Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for sorting GitHub checks #130

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion github-sort-content.user.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ==UserScript==
// @name GitHub Sort Content
// @version 3.1.1
// @version 3.2.0
// @description A userscript that makes some lists & markdown tables sortable
// @license MIT
// @author Rob Garrison
Expand Down Expand Up @@ -407,6 +407,33 @@
".ghsc-gazer-header"
]
}
},
// github.com/(:user|:org)/:repo/pull/:pr
"pull-request-checks": {
check: el => el.matches(".merge-status-list"),
sort: el => {
removeSelection();
tinysort(
$$("div.merge-status-item"),
// first by status
{
order: 'asc',
selector: 'path',
attr: 'd'
},
// then by check name
{
order: 'asc',
natural: true,
selector: `strong.text-emphasized`
}
)
},
css: {
unsorted: [
".merge-status-list"
]
}
}
};

Expand Down Expand Up @@ -521,6 +548,13 @@
setDirection($$(".ghsc-header-cell", grid), el, dir);
}

/**
*
* @param {*} header The element containing the header
* @param {*} list The element containing the list
* @param {*} opts Options passed to tinysort. See <a href="http://tinysort.sjeiti.com/">TinySort</a> for details.
* Multiple selectors have to be passed using a single selector with an appropriate query, e.g. <code>{ selector: "a[id], a.f4" }</code>
*/
function initSortList(header, list, opts = {}) {
if (list) {
removeSelection();
Expand Down