Skip to content

Instantly share code, notes, and snippets.

@rodolfo42
Last active April 9, 2020 02:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rodolfo42/b7de1bbbc1f47e36d7c9de13ab09a3be to your computer and use it in GitHub Desktop.
Save rodolfo42/b7de1bbbc1f47e36d7c9de13ab09a3be to your computer and use it in GitHub Desktop.
Bookmarklet to organize status checks in bors
function appendRow(el, test, status, link) {
var testName = document.createElement("div");
var statusCell = document.createElement("div");
statusCell.innerText = status;
var order = (status == "Succeeded" ? 10 : 5);
testName.style = "flex-basis: 50%; flex-grow: 2; padding-bottom: 5px; margin-bottom: 5px; border-bottom: 1px dashed #666; order: " + order + ";";
statusCell.style = "flex-grow: 1; text-align: right; padding-bottom: 5px; margin-bottom: 5px; border-bottom: 1px dashed #666; order: " + order + ";";
if (link) {
var a = document.createElement("a");
a.innerText = test;
a.href = link;
testName.appendChild(a);
} else {
testName.innerText = test;
}
el.appendChild(testName);
el.appendChild(statusCell);
}
let p = document.getElementsByTagName('p')[3]
p.className = "status-list";
let data = Array.prototype.slice.call(p.getElementsByTagName('a'))
.concat(Array.prototype.slice.call(p.getElementsByTagName('span')))
.map(function (x) {
var row = x.innerText.split('(');
row.link = x.href;
return row;
});
p.innerHTML = "";
p.style = "display: flex; width: 80%; align-items: center; flex-wrap: wrap;";
data.forEach(function (x) { appendRow(p, x[0], x[1].split(')')[0], x.link)});
javascript:(function()%7Bfunction%20appendRow(el%2C%20test%2C%20status%2C%20link)%20%7B%0A%20%20%20%20var%20testName%20%3D%20document.createElement(%22div%22)%3B%0A%20%20%20%20var%20statusCell%20%3D%20document.createElement(%22div%22)%3B%0A%20%20%20%20statusCell.innerText%20%3D%20status%3B%0A%20%20%20%20var%20order%20%3D%20(status%20%3D%3D%20%22Succeeded%22%20%3F%2010%20%3A%205)%3B%0A%20%20%20%20testName.style%20%3D%20%22flex-basis%3A%2050%25%3B%20flex-grow%3A%202%3B%20padding-bottom%3A%205px%3B%20margin-bottom%3A%205px%3B%20border-bottom%3A%201px%20dashed%20%23666%3B%20order%3A%20%22%20%2B%20order%20%2B%20%22%3B%22%3B%0A%20%20%20%20statusCell.style%20%3D%20%22flex-grow%3A%201%3B%20text-align%3A%20right%3B%20padding-bottom%3A%205px%3B%20margin-bottom%3A%205px%3B%20border-bottom%3A%201px%20dashed%20%23666%3B%20order%3A%20%22%20%2B%20order%20%2B%20%22%3B%22%3B%0A%20%20%20%20if%20(link)%20%7B%0A%20%20%20%20var%20a%20%3D%20document.createElement(%22a%22)%3B%0A%20%20%20%20a.innerText%20%3D%20test%3B%0A%20%20%20%20a.href%20%3D%20link%3B%0A%20%20%20%20testName.appendChild(a)%3B%0A%20%20%20%20%7D%20else%20%7B%0A%20%20%20%20testName.innerText%20%3D%20test%3B%0A%20%20%20%20%7D%0A%20%20%20%20el.appendChild(testName)%3B%0A%20%20%20%20el.appendChild(statusCell)%3B%0A%7D%0A%0Alet%20p%20%3D%20document.getElementsByTagName('p')%5B3%5D%0Ap.className%20%3D%20%22status-list%22%3B%0Alet%20data%20%3D%20Array.prototype.slice.call(p.getElementsByTagName('a'))%0A.concat(Array.prototype.slice.call(p.getElementsByTagName('span')))%0A.map(function%20(x)%20%7B%0A%20%20%20%20var%20row%20%3D%20x.innerText.split('(')%3B%0A%20%20%20%20row.link%20%3D%20x.href%3B%0A%20%20%20%20return%20row%3B%0A%7D)%3B%0Ap.innerHTML%20%3D%20%22%22%3B%0Ap.style%20%3D%20%22display%3A%20flex%3B%20width%3A%2080%25%3B%20align-items%3A%20center%3B%20flex-wrap%3A%20wrap%3B%22%3B%0A%0Adata.forEach(function%20(x)%20%7B%20appendRow(p%2C%20x%5B0%5D%2C%20x%5B1%5D.split(')')%5B0%5D%2C%20x.link)%7D)%3B%7D)()%3B
@rodolfo42
Copy link
Author

rodolfo42 commented Apr 7, 2020

1- Copy the contents of the organize-status-bors line above
2- Right-click Bookmarks tab in your browser, Add page
3- Paste the contents as the URL, choose a name
4- click on it when in a bors batch details page

@rodolfo42
Copy link
Author

Screen Shot 2020-04-08 at 23 38 52

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment