Skip to content

Instantly share code, notes, and snippets.

@reece
Created January 10, 2023 00:28
Show Gist options
  • Save reece/14e2a155126b285d94a4b38aa964aa30 to your computer and use it in GitHub Desktop.
Save reece/14e2a155126b285d94a4b38aa964aa30 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name GitHub Pull: All open review requests button
// @namespace Violentmonkey Scripts
// @match https://github.com/pulls*
// @grant MIT
// @version 1.0
// @author Reece Hart <reecehart@gmail.com>
// @description Add button to show previously reviewed pull requests that are still open
// @require https://code.jquery.com/jquery-3.6.1.slim.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// ==/UserScript==
function updateNavBar () {
console.log("Adding All open review requests button")
a = document.querySelector("a[title='Pull Requests requesting your review']")
b = a.cloneNode(true)
b.setAttribute("title", "All open review requests")
b.innerHTML = "Open review requests"
b.setAttribute("data-selected-links", b.getAttribute("data-selected-links").replace("review-requested", "reviewed-by"))
b.setAttribute("href", b.getAttribute("href").replace("review-requested", "reviewed-by"))
b.classList.remove("selected")
b.removeAttribute("aria-current")
a.after(b)
}
waitForKeyElements("a[title='Pull Requests requesting your review']", updateNavBar);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment