Last active
September 21, 2022 18:41
-
-
Save therealFoxster/982a91aeea4c053fb6a22d42f86274db to your computer and use it in GitHub Desktop.
UserScript to filter public repositories by default on github.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name GitHub Filter Public Repositories | |
// @version 1.0.0 | |
// @description Show public repositories by default | |
// @author Foxster | |
// @match *://github.com/* | |
// @compatible safari | |
// @grant GM.xmlHttpRequest | |
// @run-at document-start | |
// ==/UserScript== | |
let previousURL = ""; | |
const observer = new MutationObserver(function(mutations) { | |
if (location.href !== previousURL) { | |
let url = new URL(location.href); | |
// If in "Repositories" tab and doesn't have "type" parameter | |
if (url.searchParams.get("tab") == "repositories" && !url.searchParams.get("type") && !location.href.includes("&type=")) { | |
location.href += "&type=public"; | |
} | |
previousURL = location.href; | |
} | |
}); | |
observer.observe(document, { subtree: true, childList: true }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment