Skip to content

Instantly share code, notes, and snippets.

@pjohnmeyer
Created January 26, 2019 16:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pjohnmeyer/0071a27ad6b127030dcf1cd2eecba30b to your computer and use it in GitHub Desktop.
Save pjohnmeyer/0071a27ad6b127030dcf1cd2eecba30b to your computer and use it in GitHub Desktop.
GitHub PR List Bookmarklet
javascript:(function()%7Bconst%20inlineApprovalCount%20%3D%20()%20%3D%3E%20%7Belems%20%3D%20document.getElementsByClassName('muted-link')%3Bre%20%3D%20%2F(%5Cd)%20review%20approval%2F%3Bfor%20(i%20%3D%200%3B%20i%20%3C%20elems.length%3B%20i%2B%2B)%20%7Belem%20%3D%20elems.item(i)%3Bstr%20%3D%20elem.getAttribute('aria-label')%20%7C%7C%20''%3Brere%20%3D%20str.match(re)%3Bif%20(rere)%20%7Belem.innerHTML%20%2B%3D%20%60%20%3Cstrong%3E(%24%7Brere%5B1%5D%7D)%3C%2Fstrong%3E%60%3B%7D%7D%7D%3BinlineApprovalCount()%7D)()
const inlineApprovalCount = () => {
elems = document.getElementsByClassName('muted-link');
re = /(\d) review approval/;
for (i = 0; i < elems.length; i++) {
elem = elems.item(i);
str = elem.getAttribute('aria-label') || '';
rere = str.match(re);
if (rere) {
elem.innerHTML += ` <strong>(${rere[1]})</strong>`;
}
}
};
inlineApprovalCount();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment