Last active
April 26, 2022 16:24
-
-
Save asottile-sentry/1dae91bee419cfd0a70a98ad8c5bd0c9 to your computer and use it in GitHub Desktop.
This file contains 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 fails-first | |
// @namespace https://asottile.dev | |
// @version 0.1 | |
// @description put failed statuses first | |
// @author asottile | |
// @match https://github.com/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=github.com | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
new MutationObserver((_, observer) => { | |
const lst = document.querySelector('.merge-status-list.js-updatable-content-preserve-scroll-position'); | |
if (!lst) { | |
return; | |
} | |
let fails = []; | |
let pending = []; | |
let skipped = []; | |
for (let child of lst.querySelectorAll('.merge-status-item')) { | |
if (child.querySelector('.octicon-skip')) { | |
child.parentNode.removeChild(child); | |
skipped.push(child); | |
} else if (child.querySelector('.octicon-x')) { | |
child.parentNode.removeChild(child); | |
fails.push(child); | |
} else if (child.querySelector('.anim-rotate, .octicon-dot-fill')) { | |
child.parentNode.removeChild(child); | |
pending.push(child); | |
} | |
} | |
lst.prepend(...fails, ...pending, ...skipped); | |
observer.takeRecords(); // prevent recursing infinitely | |
}).observe(document.documentElement, {childList: true, subtree: true}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
to use this:
[raw]
above and you'll be prompted to install