Last active
July 24, 2023 09:41
-
-
Save skjnldsv/d9244cf50d148d4e38319fe497f7b68c to your computer and use it in GitHub Desktop.
Nextcloud drone status check sort
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 Nextcloud drone status check sort | |
// @namespace http://drone.nextcloud.com/ | |
// @version 0.3 | |
// @description Put Nextcloud drone failed jobs on top of the list | |
// @author MorrisJobke & Skjnldsv | |
// @match https://drone.nextcloud.com/nextcloud/* | |
// @icon https://github.githubassets.com/favicons/favicon.svg | |
// @grant none | |
// @updateURL https://gist.github.com/skjnldsv/d9244cf50d148d4e38319fe497f7b68c/raw/nextcloud-drone-status-sort.user.js | |
// @downloadURL https://gist.github.com/skjnldsv/d9244cf50d148d4e38319fe497f7b68c/raw/nextcloud-drone-status-sort.user.js | |
// ==/UserScript== | |
let init = function (delay) { | |
var container = document.querySelector('.stages') | |
if(!container) { | |
delay = delay * 2; | |
if(delay === 0) { | |
delay = 15; | |
} | |
if(delay > 500) { | |
return; | |
} | |
setTimeout(function() {init(delay)}, delay); | |
} else { | |
var children = Array.prototype.slice.call(container.querySelectorAll('.stage-container'), 0) | |
while (container.firstChild) { | |
container.removeChild(container.firstChild); | |
} | |
container.append(...children.sort((a, b) => { | |
return a.querySelector('.status').classList.contains('status-success') - b.querySelector('.status').classList.contains('status-success') | |
})) | |
} | |
}; | |
init(0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment