Skip to content

Instantly share code, notes, and snippets.

@janpio
Created December 9, 2023 10:10
Show Gist options
  • 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