Skip to content

Instantly share code, notes, and snippets.

@janpio
Created December 9, 2023 10:10
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 janpio/e404efbbc9f55d14eda3e660ab1b7bb4 to your computer and use it in GitHub Desktop.
Save janpio/e404efbbc9f55d14eda3e660ab1b7bb4 to your computer and use it in GitHub Desktop.
GitHub Open project fields by project name
// ==UserScript==
// @name Automatically expand Projects sidebar
// @namespace http://github.com/
// @version 2023-12-09
// @description Clicks the "+x more" link in the project sections of the issue sidebar
// @author @fregante & @janpio
// @match https://github.com/**/issues/*
// @match https://github.com/**/pull/*
// @run-at document-end
// @icon https://www.google.com/s2/favicons?sz=64&domain=github.com
// @grant none
// ==/UserScript==
const projectNamesToExpand = [
"🧬 ORM Team"
]
function open() {
// Find all unopened sidebar project widgets
for (const button of document.querySelectorAll('collapsible-sidebar-widget:not([open]) [aria-label^="See more fields"]')) {
// Only open ones for projects in projectNamesToExpand
if(projectNamesToExpand.includes(button.previousElementSibling.getElementsByClassName('ml-1')[0].innerText)) {
button.dispatchEvent(new MouseEvent('mousedown'))
}
}
}
open();
document.addEventListener('turbo:render', open);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment